diff options
author | Yorke Lee <yorkelee@google.com> | 2015-06-03 16:23:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-03 16:24:17 +0000 |
commit | ac2e3886e3f129b0ee94bb514e026fe72951b4a8 (patch) | |
tree | eb5360567c7645d90d4be81c4ddaafb85a1e6875 /telecomm | |
parent | ad94045eb2da1e917404c88becdcbfa7ad9edf87 (diff) | |
parent | db6da486217daa3418944cf93086a3bae549dad2 (diff) | |
download | frameworks_base-ac2e3886e3f129b0ee94bb514e026fe72951b4a8.zip frameworks_base-ac2e3886e3f129b0ee94bb514e026fe72951b4a8.tar.gz frameworks_base-ac2e3886e3f129b0ee94bb514e026fe72951b4a8.tar.bz2 |
Merge "Allow default dialer changes and phone account enable/disable via ADB" into mnc-dev
Diffstat (limited to 'telecomm')
3 files changed, 19 insertions, 51 deletions
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java index d3df151..3d49308 100644 --- a/telecomm/java/android/telecom/DefaultDialerManager.java +++ b/telecomm/java/android/telecom/DefaultDialerManager.java @@ -41,10 +41,13 @@ public class DefaultDialerManager { * The caller of this method needs to have permission to write to secure settings and * manage users on the device. * + * @return {@code true} if the default dialer application was successfully changed, + * {@code false} otherwise. + * * @hide * */ - public static void setDefaultDialerApplication(Context context, String packageName) { - setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser()); + public static boolean setDefaultDialerApplication(Context context, String packageName) { + return setDefaultDialerApplication(context, packageName, ActivityManager.getCurrentUser()); } /** @@ -52,16 +55,20 @@ public class DefaultDialerManager { * The caller of this method needs to have permission to write to secure settings and * manage users on the device. * + * @return {@code true} if the default dialer application was successfully changed, + * {@code false} otherwise. + * * @hide * */ - public static void setDefaultDialerApplication(Context context, String packageName, int user) { + public static boolean setDefaultDialerApplication(Context context, String packageName, + int user) { // Get old package name String oldPackageName = Settings.Secure.getStringForUser(context.getContentResolver(), Settings.Secure.DIALER_DEFAULT_APPLICATION, user); if (packageName != null && oldPackageName != null && packageName.equals(oldPackageName)) { // No change - return; + return false; } // Only make the change if the new package belongs to a valid phone application @@ -71,7 +78,9 @@ public class DefaultDialerManager { // Update the secure setting. Settings.Secure.putStringForUser(context.getContentResolver(), Settings.Secure.DIALER_DEFAULT_APPLICATION, packageName, user); + return true; } + return false; } /** diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 07176b3..3c8cc9a 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -124,33 +124,6 @@ public class TelecomManager { "android.telecom.action.CHANGE_DEFAULT_DIALER"; /** - * Privileged version of {@link #ACTION_CHANGE_DEFAULT_DIALER} that doesn't require - * confirmation from the user via the dialog. - * - * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} - * @hide - */ - public static final String ACTION_CHANGE_DEFAULT_DIALER_PRIVILEGED = - "android.telecom.action.CHANGE_DEFAULT_DIALER_PRIVILEGED"; - - /** - * Activity action: Opens the settings screen where a user can enable and disable which - * {@link PhoneAccount}s are allows to make and receive calls. Because a user must - * explicitly enable an account before the system will use it, an app may want to send the - * user to this setting after registering a {@link PhoneAccount}. - * <p> - * Input: get*Extra field {@link #EXTRA_PHONE_ACCOUNT_DESCRIPTION} contains a string-based - * reference to the {@link PhoneAccountHandle} you want to enable. get*Extra field - * {@link #EXTRA_ENABLE_PHONE_ACCOUNT_VALUE} contains a boolean value indicated whether - * the account should be enabled or disabled. - * <p> - * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} - * @hide - */ - public static final String ACTION_ENABLE_PHONE_ACCOUNT_SETTING = - "android.telecom.action.ENABLE_PHONE_ACCOUNT_SETTING"; - - /** * Extra value used to provide the package name for {@link #ACTION_CHANGE_DEFAULT_DIALER}. */ public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = @@ -186,25 +159,6 @@ public class TelecomManager { "android.telecom.extra.PHONE_ACCOUNT_HANDLE"; /** - * The extra used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING} to specify a phone account - * as a string value. The value is of the form: "A;B" where A is the component name of the - * {@link PhoneAccount} (e.g., - * com.android.phone/com.android.services.telephony.TelephonyConnectionService) and B is the - * {@link PhoneAccount} ID. - * @hide - */ - public static final String EXTRA_PHONE_ACCOUNT_DESCRIPTION = - "android.telecom.extra.PHONE_ACCOUNT_DESCRIPTION"; - - /** - * Boolean extra used to specify a value for enabling and disabling a phone account. - * Used with {@link #ACTION_ENABLE_PHONE_ACCOUNT_SETTING}. - * @hide - */ - public static final String EXTRA_ENABLE_PHONE_ACCOUNT_VALUE = - "android.telecom.extra.ENABLE_PHONE_ACCOUNT_VALUE"; - - /** * Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains * metadata about the call. This {@link Bundle} will be returned to the * {@link ConnectionService}. diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index aa02021..ea6a74a 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -231,5 +231,10 @@ interface ITelecomService { /** * @see TelecomServiceImpl#enablePhoneAccount */ - void enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled); + boolean enablePhoneAccount(in PhoneAccountHandle accountHandle, boolean isEnabled); + + /** + * @see TelecomServiceImpl#setDefaultDialer + */ + boolean setDefaultDialer(in String packageName); } |