diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-03-13 16:20:52 -0700 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2016-03-15 14:25:36 -0700 |
commit | 60d449f45f52c22d7f7e669760457b717352f8de (patch) | |
tree | 69afb2476817f4093d16d6598c8d7b047f2341b2 /src/com | |
parent | aae1559613cc24ad1d960b550c15af9f61675f38 (diff) |
Updating settings to use system blocked numbers ui
+ After the user has migrated to the framework number blocking
solution, the 'Call blocking' setting needs to take them to the
system ui. The branching logic to determine which UI to open is added
in this CL.
Bug: 26664600
Change-Id: I2574f0665d3f0d3d92230e0210c69d1d10b60228
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/dialer/compat/FilteredNumberCompat.java | 19 | ||||
-rw-r--r-- | src/com/android/dialer/settings/DialerSettingsActivity.java | 6 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/com/android/dialer/compat/FilteredNumberCompat.java b/src/com/android/dialer/compat/FilteredNumberCompat.java index c74ff9d1d..232504796 100644 --- a/src/com/android/dialer/compat/FilteredNumberCompat.java +++ b/src/com/android/dialer/compat/FilteredNumberCompat.java @@ -22,12 +22,16 @@ import android.app.FragmentManager; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; import android.net.Uri; import android.preference.PreferenceManager; import android.support.annotation.Nullable; +import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import com.android.contacts.common.compat.CompatUtils; +import com.android.contacts.common.compat.TelecomManagerUtil; import com.android.contacts.common.testing.NeededForTesting; import com.android.dialer.DialerApplication; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; @@ -37,6 +41,7 @@ import com.android.dialer.database.FilteredNumberContract.FilteredNumberTypes; import com.android.dialer.filterednumber.BlockNumberDialogFragment; import com.android.dialer.filterednumber.BlockNumberDialogFragment.Callback; import com.android.dialer.filterednumber.BlockedNumbersMigrator; +import com.android.dialer.filterednumber.BlockedNumbersSettingsActivity; import com.android.dialer.filterednumber.MigrateBlockedNumbersDialogFragment; import java.util.ArrayList; @@ -268,4 +273,18 @@ public class FilteredNumberCompat { private static boolean shouldShowMigrationDialog(boolean isBlocking) { return isBlocking && canUseNewFiltering() && !hasMigratedToNewBlocking(); } + + /** + * Creates the {@link Intent} which opens the blocked numbers management interface. + * + * @param context The {@link Context}. + * @return The intent. + */ + public static Intent createManageBlockedNumbersIntent(Context context) { + if (canUseNewFiltering() && hasMigratedToNewBlocking()) { + return TelecomManagerUtil.createManageBlockedNumbersIntent( + (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE)); + } + return new Intent(context, BlockedNumbersSettingsActivity.class); + } } diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index a18715760..bbcbd49fc 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -18,7 +18,6 @@ package com.android.dialer.settings; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.os.Build; import android.os.Bundle; import android.os.UserManager; import android.preference.PreferenceManager; @@ -29,12 +28,11 @@ import android.view.MenuItem; import android.widget.Toast; import com.android.contacts.common.compat.CompatUtils; -import com.android.contacts.common.compat.SdkVersionOverride; import com.android.contacts.common.compat.TelephonyManagerCompat; import com.android.dialer.R; +import com.android.dialer.compat.FilteredNumberCompat; import com.android.dialer.compat.SettingsCompat; import com.android.dialer.compat.UserManagerCompat; -import com.android.dialer.filterednumber.BlockedNumbersSettingsActivity; import java.util.List; @@ -99,7 +97,7 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { if (isPrimaryUser) { Header blockedCallsHeader = new Header(); blockedCallsHeader.titleRes = R.string.manage_blocked_numbers_label; - blockedCallsHeader.intent = new Intent(this, BlockedNumbersSettingsActivity.class); + blockedCallsHeader.intent = FilteredNumberCompat.createManageBlockedNumbersIntent(this); target.add(blockedCallsHeader); if (TelephonyManagerCompat.isTtyModeSupported(telephonyManager) |