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

Commit b664954e authored by Anthony Lee's avatar Anthony Lee
Browse files

Clear account using TelecomManager not CallsManager.

TelecomManager is the right way to handle this since this
code could run as the second user.  It gets the system Telecom
service and calls a method on it to do its work.

Bug: 17689845
Change-Id: I2895e2f386e5bb97f6de67140c4f2dc4c4403b15
parent d9f5438b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.telecom.TelecomManager;

import java.lang.String;

@@ -61,9 +62,9 @@ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver {
     * @param packageName The name of the removed package.
     */
    private void handlePackageRemoved(Context context, String packageName) {
        final CallsManager callsManager = CallsManager.getInstance();
        if (callsManager != null) {
            callsManager.getPhoneAccountRegistrar().clearAccounts(packageName);
        final TelecomManager telecomManager = TelecomManager.from(context);
        if (telecomManager != null) {
            telecomManager.clearAccountsForPackage(packageName);
        }
    }
}