Broadcast when a phone account is unregistered.
The action was previously added but not wired up.
Bug: 25331205
Change-Id: If7b8910928a579c7f86a3bd42f725d4d16dec973
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index fc8977b..0d638ad 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -320,7 +320,7 @@
Intent intent = new Intent(TelecomManager.ACTION_PHONE_ACCOUNT_REGISTERED);
intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,
account.getAccountHandle());
- Log.i(this, "Sending phone-account intent as user");
+ Log.i(this, "Sending phone-account unregistered intent as user");
mContext.sendBroadcastAsUser(intent, UserHandle.ALL,
PERMISSION_PROCESS_PHONE_ACCOUNT_REGISTRATION);
} finally {
@@ -341,6 +341,19 @@
accountHandle.getComponentName().getPackageName());
enforceUserHandleMatchesCaller(accountHandle);
mPhoneAccountRegistrar.unregisterPhoneAccount(accountHandle);
+
+ // Broadcast an intent indicating the phone account which was unregistered.
+ long token = Binder.clearCallingIdentity();
+ try {
+ Intent intent =
+ new Intent(TelecomManager.ACTION_PHONE_ACCOUNT_UNREGISTERED);
+ intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);
+ Log.i(this, "Sending phone-account registered intent as user");
+ mContext.sendBroadcastAsUser(intent, UserHandle.ALL,
+ PERMISSION_PROCESS_PHONE_ACCOUNT_REGISTRATION);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
} catch (Exception e) {
Log.e(this, e, "unregisterPhoneAccount %s", accountHandle);
throw e;