Add telecom test-commands for maintaining role overrides.

This allows for easier testing of role-dependencies for Telecom (since
RoleManager is not yet fully implemented).

Bug: 63966743
Test: Manual
Change-Id: I92fd86411d1312be2255ec0634f059cd8e4bfc26
This commit is contained in:
Tyler Gunn 2018-11-21 15:11:36 -08:00
parent 6e7ff180a5
commit c3430ea05e
2 changed files with 39 additions and 0 deletions

View File

@ -46,6 +46,10 @@ public final class Telecom extends BaseCommand {
private static final String COMMAND_SET_PHONE_ACCOUNT_DISABLED = "set-phone-account-disabled";
private static final String COMMAND_REGISTER_PHONE_ACCOUNT = "register-phone-account";
private static final String COMMAND_REGISTER_SIM_PHONE_ACCOUNT = "register-sim-phone-account";
private static final String COMMAND_SET_TEST_CALL_SCREENING_APP = "set-test-call-screening-app";
private static final String COMMAND_ADD_OR_REMOVE_CALL_COMPANION_APP =
"add-or-remove-call-companion-app";
private static final String COMMAND_SET_TEST_AUTO_MODE_APP = "set-test-auto-mode-app";
private static final String COMMAND_UNREGISTER_PHONE_ACCOUNT = "unregister-phone-account";
private static final String COMMAND_SET_DEFAULT_DIALER = "set-default-dialer";
private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
@ -64,6 +68,9 @@ public final class Telecom extends BaseCommand {
"usage: telecom set-phone-account-enabled <COMPONENT> <ID> <USER_SN>\n" +
"usage: telecom set-phone-account-disabled <COMPONENT> <ID> <USER_SN>\n" +
"usage: telecom register-phone-account <COMPONENT> <ID> <USER_SN> <LABEL>\n" +
"usage: telecom set-test-call-screening-app <PACKAGE>\n" +
"usage: telecom set-test-auto-mode-app <PACKAGE>\n" +
"usage: telecom add-or-remove-call-companion-app <PACKAGE> <1/0>\n" +
"usage: telecom register-sim-phone-account <COMPONENT> <ID> <USER_SN> <LABEL> <ADDRESS>\n" +
"usage: telecom unregister-phone-account <COMPONENT> <ID> <USER_SN>\n" +
"usage: telecom set-default-dialer <PACKAGE>\n" +
@ -113,6 +120,15 @@ public final class Telecom extends BaseCommand {
case COMMAND_REGISTER_PHONE_ACCOUNT:
runRegisterPhoneAccount();
break;
case COMMAND_SET_TEST_CALL_SCREENING_APP:
runSetTestCallScreeningApp();
break;
case COMMAND_ADD_OR_REMOVE_CALL_COMPANION_APP:
runAddOrRemoveCallCompanionApp();
break;
case COMMAND_SET_TEST_AUTO_MODE_APP:
runSetTestAutoModeApp();
break;
case COMMAND_REGISTER_SIM_PHONE_ACCOUNT:
runRegisterSimPhoneAccount();
break;
@ -173,6 +189,23 @@ public final class Telecom extends BaseCommand {
System.out.println("Success - " + handle + " registered.");
}
private void runSetTestCallScreeningApp() throws RemoteException {
final String packageName = nextArg();
mTelecomService.setTestDefaultCallScreeningApp(packageName);
}
private void runAddOrRemoveCallCompanionApp() throws RemoteException {
final String packageName = nextArgRequired();
String isAdded = nextArgRequired();
boolean isAddedBool = "1".equals(isAdded);
mTelecomService.addOrRemoveTestCallCompanionApp(packageName, isAddedBool);
}
private void runSetTestAutoModeApp() throws RemoteException {
final String packageName = nextArg();
mTelecomService.setTestAutoModeApp(packageName);
}
private void runUnregisterPhoneAccount() throws RemoteException {
final PhoneAccountHandle handle = getPhoneAccountHandleFromArgs();
mTelecomService.unregisterPhoneAccount(handle);

View File

@ -304,4 +304,10 @@ interface ITelecomService {
* @see TelecomServiceImpl#handleCallIntent
*/
void handleCallIntent(in Intent intent);
void setTestDefaultCallScreeningApp(String packageName);
void addOrRemoveTestCallCompanionApp(String packageName, boolean isAdded);
void setTestAutoModeApp(String packageName);
}