log callingPackage for all public TelecomManager API's (2/2)

To help facilitate better tracing calls into Telecom,
callingPackages are now logged out for all public
TelecomManger API's

bug: 178636244
Test: 9 unit tests updated
Change-Id: I30e37b5d05fdae5e97c400ad1496ac1b7473f811
This commit is contained in:
Thomas Stuart
2022-01-27 21:16:11 +00:00
parent b41b25ff73
commit bc724ef4d1
3 changed files with 33 additions and 27 deletions

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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