cleanupOrphanPA's feature framework (2/2)*

Bug: 210134615
Test: Unit + manual
Change-Id: Ic350e4e45c0d1597c6f61e3e3e717b3a2c1bb099
This commit is contained in:
Thomas Stuart
2022-01-18 21:43:57 +00:00
parent dfc3a6ba76
commit c8460d8e21
2 changed files with 15 additions and 0 deletions

View File

@@ -71,6 +71,8 @@ public final class Telecom extends BaseCommand {
private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer"; private static final String COMMAND_GET_DEFAULT_DIALER = "get-default-dialer";
private static final String COMMAND_STOP_BLOCK_SUPPRESSION = "stop-block-suppression"; private static final String COMMAND_STOP_BLOCK_SUPPRESSION = "stop-block-suppression";
private static final String COMMAND_CLEANUP_STUCK_CALLS = "cleanup-stuck-calls"; private static final String COMMAND_CLEANUP_STUCK_CALLS = "cleanup-stuck-calls";
private static final String COMMAND_CLEANUP_ORPHAN_PHONE_ACCOUNTS =
"cleanup-orphan-phone-accounts";
private static final String COMMAND_RESET_CAR_MODE = "reset-car-mode"; private static final String COMMAND_RESET_CAR_MODE = "reset-car-mode";
/** /**
@@ -125,6 +127,9 @@ public final class Telecom extends BaseCommand {
+ " provider after a call to emergency services.\n" + " provider after a call to emergency services.\n"
+ "usage: telecom cleanup-stuck-calls: Clear any disconnected calls that have" + "usage: telecom cleanup-stuck-calls: Clear any disconnected calls that have"
+ " gotten wedged in Telecom.\n" + " gotten wedged in Telecom.\n"
+ "usage: telecom cleanup-orphan-phone-accounts: remove any phone accounts that"
+ " no longer have a valid UserHandle or accounts that no longer belongs to an"
+ " installed package.\n"
+ "usage: telecom set-emer-phone-account-filter <PACKAGE>\n" + "usage: telecom set-emer-phone-account-filter <PACKAGE>\n"
+ "\n" + "\n"
+ "telecom set-phone-account-enabled: Enables the given phone account, if it has" + "telecom set-phone-account-enabled: Enables the given phone account, if it has"
@@ -227,6 +232,9 @@ public final class Telecom extends BaseCommand {
case COMMAND_CLEANUP_STUCK_CALLS: case COMMAND_CLEANUP_STUCK_CALLS:
runCleanupStuckCalls(); runCleanupStuckCalls();
break; break;
case COMMAND_CLEANUP_ORPHAN_PHONE_ACCOUNTS:
runCleanupOrphanPhoneAccounts();
break;
case COMMAND_RESET_CAR_MODE: case COMMAND_RESET_CAR_MODE:
runResetCarMode(); runResetCarMode();
break; break;
@@ -362,6 +370,11 @@ public final class Telecom extends BaseCommand {
mTelecomService.cleanupStuckCalls(); mTelecomService.cleanupStuckCalls();
} }
private void runCleanupOrphanPhoneAccounts() throws RemoteException {
System.out.println("Success - cleaned up " + mTelecomService.cleanupOrphanPhoneAccounts()
+ " phone accounts.");
}
private void runResetCarMode() throws RemoteException { private void runResetCarMode() throws RemoteException {
mTelecomService.resetCarMode(); mTelecomService.resetCarMode();
} }

View File

@@ -342,6 +342,8 @@ interface ITelecomService {
void cleanupStuckCalls(); void cleanupStuckCalls();
int cleanupOrphanPhoneAccounts();
void resetCarMode(); void resetCarMode();
void setTestDefaultCallRedirectionApp(String packageName); void setTestDefaultCallRedirectionApp(String packageName);