diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java index 52f883b5fbb7e..50c2e75c3a018 100644 --- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java +++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java @@ -52,7 +52,7 @@ public final class Telecom extends BaseCommand { (new Telecom()).run(args); } - + private static final String CALLING_PACKAGE = Telecom.class.getPackageName(); private static final String COMMAND_SET_PHONE_ACCOUNT_ENABLED = "set-phone-account-enabled"; private static final String COMMAND_SET_PHONE_ACCOUNT_DISABLED = "set-phone-account-disabled"; private static final String COMMAND_REGISTER_PHONE_ACCOUNT = "register-phone-account"; @@ -286,7 +286,7 @@ public final class Telecom extends BaseCommand { final String label = nextArgRequired(); PhoneAccount account = PhoneAccount.builder(handle, label) .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER).build(); - mTelecomService.registerPhoneAccount(account); + mTelecomService.registerPhoneAccount(account, CALLING_PACKAGE); System.out.println("Success - " + handle + " registered."); } @@ -316,7 +316,7 @@ public final class Telecom extends BaseCommand { .addSupportedUriScheme(PhoneAccount.SCHEME_TEL) .addSupportedUriScheme(PhoneAccount.SCHEME_VOICEMAIL) .build(); - mTelecomService.registerPhoneAccount(account); + mTelecomService.registerPhoneAccount(account, CALLING_PACKAGE); System.out.println("Success - " + handle + " registered."); } @@ -358,7 +358,7 @@ public final class Telecom extends BaseCommand { private void runUnregisterPhoneAccount() throws RemoteException { final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs(); - mTelecomService.unregisterPhoneAccount(handle); + mTelecomService.unregisterPhoneAccount(handle, CALLING_PACKAGE); System.out.println("Success - " + handle + " unregistered."); } @@ -395,11 +395,11 @@ public final class Telecom extends BaseCommand { } private void runGetDefaultDialer() throws RemoteException { - System.out.println(mTelecomService.getDefaultDialerPackage()); + System.out.println(mTelecomService.getDefaultDialerPackage(CALLING_PACKAGE)); } private void runGetSystemDialer() throws RemoteException { - System.out.println(mTelecomService.getSystemDialerPackage()); + System.out.println(mTelecomService.getSystemDialerPackage(CALLING_PACKAGE)); } private void runWaitOnHandler() throws RemoteException { diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index e560f34cfcd8a..f5edc8fe9d76b 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1202,7 +1202,7 @@ public class TelecomManager { if (service != null) { try { return service.getSimCallManager( - SubscriptionManager.getDefaultSubscriptionId()); + SubscriptionManager.getDefaultSubscriptionId(), mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#getSimCallManager"); } @@ -1224,7 +1224,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.getSimCallManager(subscriptionId); + return service.getSimCallManager(subscriptionId, mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#getSimCallManager"); } @@ -1248,7 +1248,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.getSimCallManagerForUser(userId); + return service.getSimCallManagerForUser(userId, mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#getSimCallManagerForUser"); } @@ -1499,7 +1499,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - service.registerPhoneAccount(account); + service.registerPhoneAccount(account, mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#registerPhoneAccount", e); } @@ -1515,7 +1515,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - service.unregisterPhoneAccount(accountHandle); + service.unregisterPhoneAccount(accountHandle, mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#unregisterPhoneAccount", e); } @@ -1596,7 +1596,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.getDefaultDialerPackage(); + return service.getDefaultDialerPackage(mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "RemoteException attempting to get the default dialer package name.", e); } @@ -1670,7 +1670,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - return service.getSystemDialerPackage(); + return service.getSystemDialerPackage(mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "RemoteException attempting to get the system dialer package name.", e); } @@ -2075,7 +2075,8 @@ public class TelecomManager { "acceptHandover for API > O-MR1"); return; } - service.addNewIncomingCall(phoneAccount, extras == null ? new Bundle() : extras); + service.addNewIncomingCall(phoneAccount, extras == null ? new Bundle() : extras, + mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "RemoteException adding a new incoming call: " + phoneAccount, e); } @@ -2117,7 +2118,8 @@ public class TelecomManager { if (service != null) { try { service.addNewIncomingConference( - phoneAccount, extras == null ? new Bundle() : extras); + phoneAccount, extras == null ? new Bundle() : extras, + mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "RemoteException adding a new incoming conference: " + phoneAccount, e); } @@ -2414,7 +2416,7 @@ public class TelecomManager { Intent result = null; if (service != null) { try { - result = service.createManageBlockedNumbersIntent(); + result = service.createManageBlockedNumbersIntent(mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#createManageBlockedNumbersIntent", e); } @@ -2571,7 +2573,7 @@ public class TelecomManager { ITelecomService service = getTelecomService(); if (service != null) { try { - service.acceptHandover(srcAddr, videoState, destAcct); + service.acceptHandover(srcAddr, videoState, destAcct, mContext.getPackageName()); } catch (RemoteException e) { Log.e(TAG, "RemoteException acceptHandover: " + e); } diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 985f6bc7131ba..ed4a058e66b90 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -100,22 +100,22 @@ interface ITelecomService { /** * @see TelecomServiceImpl#getSimCallManager */ - PhoneAccountHandle getSimCallManager(int subId); + PhoneAccountHandle getSimCallManager(int subId, String callingPackage); /** * @see TelecomServiceImpl#getSimCallManagerForUser */ - PhoneAccountHandle getSimCallManagerForUser(int userId); + PhoneAccountHandle getSimCallManagerForUser(int userId, String callingPackage); /** * @see TelecomServiceImpl#registerPhoneAccount */ - void registerPhoneAccount(in PhoneAccount metadata); + void registerPhoneAccount(in PhoneAccount metadata, String callingPackage); /** * @see TelecomServiceImpl#unregisterPhoneAccount */ - void unregisterPhoneAccount(in PhoneAccountHandle account); + void unregisterPhoneAccount(in PhoneAccountHandle account, String callingPackage); /** * @see TelecomServiceImpl#clearAccounts @@ -148,7 +148,7 @@ interface ITelecomService { /** * @see TelecomServiceImpl#getDefaultDialerPackage */ - String getDefaultDialerPackage(); + String getDefaultDialerPackage(String callingPackage); /** * @see TelecomServiceImpl#getDefaultDialerPackage @@ -158,7 +158,7 @@ interface ITelecomService { /** * @see TelecomServiceImpl#getSystemDialerPackage */ - String getSystemDialerPackage(); + String getSystemDialerPackage(String callingPackage); /** * @see TelecomServiceImpl#dumpCallAnalytics @@ -256,12 +256,15 @@ interface ITelecomService { /** * @see TelecomServiceImpl#addNewIncomingCall */ - void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras); + void addNewIncomingCall(in PhoneAccountHandle phoneAccount, in Bundle extras, + String callingPackage); /** * @see TelecomServiceImpl#addNewIncomingConference */ - void addNewIncomingConference(in PhoneAccountHandle phoneAccount, in Bundle extras); + void addNewIncomingConference(in PhoneAccountHandle phoneAccount, in Bundle extras, + String callingPackage); + /** * @see TelecomServiceImpl#addNewUnknownCall @@ -297,7 +300,7 @@ interface ITelecomService { /** * @see TelecomServiceImpl#createManageBlockedNumbersIntent **/ - Intent createManageBlockedNumbersIntent(); + Intent createManageBlockedNumbersIntent(String callingPackage); /** * @see TelecomServiceImpl#createLaunchEmergencyDialerIntent @@ -324,7 +327,8 @@ interface ITelecomService { /** * @see TelecomServiceImpl#acceptHandover */ - void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct); + void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct, + String callingPackage); /** * @see TelecomServiceImpl#setTestEmergencyPhoneAccountPackageNameFilter