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
diff --git a/src/com/android/server/telecom/PhoneAccountBroadcastReceiver.java b/src/com/android/server/telecom/PhoneAccountBroadcastReceiver.java
index 74f63cd..9634eda 100644
--- a/src/com/android/server/telecom/PhoneAccountBroadcastReceiver.java
+++ b/src/com/android/server/telecom/PhoneAccountBroadcastReceiver.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.telecom.TelecomManager;
import java.lang.String;
@@ -61,9 +62,9 @@
* @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);
}
}
}