diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-29 16:16:50 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-29 16:21:00 -0700 |
commit | f1a349bda3b6cb400692159d72a41ea89b0e6128 (patch) | |
tree | 58d298736942da581bc659bbda16bc825aaebbc2 | |
parent | 5686780404a41901d226cc7ba506c1c0ba284713 (diff) | |
download | frameworks_base-f1a349bda3b6cb400692159d72a41ea89b0e6128.zip frameworks_base-f1a349bda3b6cb400692159d72a41ea89b0e6128.tar.gz frameworks_base-f1a349bda3b6cb400692159d72a41ea89b0e6128.tar.bz2 |
Add default dialer checks to Telecom/Telephony
Check for the default dialer or the modify phone state permission
for various TelecomManager/TelephonyManager methods.
Make sure to check the user-selected default rather than the
hardcoded package name.
Exercise this code in TestDialerActivity.
Bug: 20304458
Change-Id: Ic04cd8f2ba98e1d54c39549ae89d3e11cd5cdafb
3 files changed, 13 insertions, 11 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 8d6bda8..1431eb8 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -921,7 +921,7 @@ public class TelecomManager { public void silenceRinger() { try { if (isServiceConnected()) { - getTelecomService().silenceRinger(); + getTelecomService().silenceRinger(mContext.getOpPackageName()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#silenceRinger", e); @@ -1029,7 +1029,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.handlePinMmi(dialString); + return service.handlePinMmi(dialString, mContext.getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#handlePinMmi", e); } @@ -1053,7 +1053,8 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.handlePinMmiForPhoneAccount(accountHandle, dialString); + return service.handlePinMmiForPhoneAccount(accountHandle, dialString, + mContext.getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#handlePinMmi", e); } @@ -1071,7 +1072,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null && accountHandle != null) { try { - return service.getAdnUriForPhoneAccount(accountHandle); + return service.getAdnUriForPhoneAccount(accountHandle, mContext.getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#getAdnUriForPhoneAccount", e); } @@ -1089,7 +1090,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - service.cancelMissedCallsNotification(); + service.cancelMissedCallsNotification(mContext.getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#cancelMissedCallsNotification", e); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 49f2aad..bc76f06 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -154,7 +154,7 @@ interface ITelecomService { /** * @see TelecomServiceImpl#silenceRinger */ - void silenceRinger(); + void silenceRinger(String callingPackage); /** * @see TelecomServiceImpl#isInCall @@ -184,22 +184,23 @@ interface ITelecomService { /** * @see TelecomServiceImpl#cancelMissedCallsNotification */ - void cancelMissedCallsNotification(); + void cancelMissedCallsNotification(String callingPackage); /** * @see TelecomServiceImpl#handleMmi */ - boolean handlePinMmi(String dialString); + boolean handlePinMmi(String dialString, String callingPackage); /** * @see TelecomServiceImpl#handleMmi */ - boolean handlePinMmiForPhoneAccount(in PhoneAccountHandle accountHandle, String dialString); + boolean handlePinMmiForPhoneAccount(in PhoneAccountHandle accountHandle, String dialString, + String callingPackage); /** * @see TelecomServiceImpl#getAdnUriForPhoneAccount */ - Uri getAdnUriForPhoneAccount(in PhoneAccountHandle accountHandle); + Uri getAdnUriForPhoneAccount(in PhoneAccountHandle accountHandle, String callingPackage); /** * @see TelecomServiceImpl#isTtySupported diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ee7f0ea..d674b31 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3703,7 +3703,7 @@ public class TelephonyManager { @SystemApi public void silenceRinger() { try { - getTelecomService().silenceRinger(); + getTelecomService().silenceRinger(mContext.getOpPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#silenceRinger", e); } |