Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d53dd29 authored by Bryce Lee's avatar Bryce Lee
Browse files

Broadcast when a phone account is unregistered.

The action was previously added but not wired up.

Bug: 25331205
Change-Id: If7b8910928a579c7f86a3bd42f725d4d16dec973
parent 6afefa40
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ public class TelecomServiceImpl {
                        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 @@ public class TelecomServiceImpl {
                            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;