Loading AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ </intent-filter> </receiver> <receiver android:name=".components.PhoneAccountBroadcastReceiver" <receiver android:name=".components.AppUninstallBroadcastReceiver" android:process="system"> <intent-filter> <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> Loading src/com/android/server/telecom/components/PhoneAccountBroadcastReceiver.java→src/com/android/server/telecom/components/AppUninstallBroadcastReceiver.java +25 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,12 @@ package com.android.server.telecom.components; import com.android.server.telecom.PhoneAccountRegistrar; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.UserHandle; import android.provider.Settings; import android.telecom.TelecomManager; import java.lang.String; Loading @@ -30,14 +33,20 @@ import java.lang.String; * Captures {@code android.intent.action.ACTION_PACKAGE_FULLY_REMOVED} intents and triggers the * removal of associated {@link android.telecom.PhoneAccount}s via the * {@link com.android.telecom.PhoneAccountRegistrar}. * * Note: This class listens for the {@code PACKAGE_FULLY_REMOVED} intent rather than * {@code PACKAGE_REMOVED} as {@code PACKAGE_REMOVED} is triggered on re-installation of the same * package, where {@code PACKAGE_FULLY_REMOVED} is triggered only when an application is completely * uninstalled. This is desirable as we do not wish to un-register all * uninstalled. * * This is desirable as we do not wish to un-register all * {@link android.telecom.PhoneAccount}s associated with a package being re-installed to ensure * the enabled state of the accounts is retained. * * When default call screening application is removed, set * {@link Settings.Secure.CALL_SCREENING_DEFAULT_APPLICATION} as null into provider. */ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { public class AppUninstallBroadcastReceiver extends BroadcastReceiver { /** * Receives the intents the class is configured to received. * Loading @@ -54,6 +63,7 @@ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { String packageName = uri.getSchemeSpecificPart(); handlePackageRemoved(context, packageName); handleUninstallOfCallScreeningService(context, packageName); } } Loading @@ -69,4 +79,17 @@ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { telecomManager.clearAccountsForPackage(packageName); } } private void handleUninstallOfCallScreeningService(Context context, String packageName) { String defaultCallScreeningApp = Settings.Secure .getStringForUser(context.getContentResolver(), Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT, UserHandle.USER_CURRENT); ComponentName componentName = ComponentName.unflattenFromString(defaultCallScreeningApp); if (componentName != null && componentName.getPackageName().equals(packageName)) { Settings.Secure.putStringForUser(context.getContentResolver(), Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT, null, UserHandle.USER_CURRENT); } } } Loading
AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ </intent-filter> </receiver> <receiver android:name=".components.PhoneAccountBroadcastReceiver" <receiver android:name=".components.AppUninstallBroadcastReceiver" android:process="system"> <intent-filter> <action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" /> Loading
src/com/android/server/telecom/components/PhoneAccountBroadcastReceiver.java→src/com/android/server/telecom/components/AppUninstallBroadcastReceiver.java +25 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,12 @@ package com.android.server.telecom.components; import com.android.server.telecom.PhoneAccountRegistrar; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.UserHandle; import android.provider.Settings; import android.telecom.TelecomManager; import java.lang.String; Loading @@ -30,14 +33,20 @@ import java.lang.String; * Captures {@code android.intent.action.ACTION_PACKAGE_FULLY_REMOVED} intents and triggers the * removal of associated {@link android.telecom.PhoneAccount}s via the * {@link com.android.telecom.PhoneAccountRegistrar}. * * Note: This class listens for the {@code PACKAGE_FULLY_REMOVED} intent rather than * {@code PACKAGE_REMOVED} as {@code PACKAGE_REMOVED} is triggered on re-installation of the same * package, where {@code PACKAGE_FULLY_REMOVED} is triggered only when an application is completely * uninstalled. This is desirable as we do not wish to un-register all * uninstalled. * * This is desirable as we do not wish to un-register all * {@link android.telecom.PhoneAccount}s associated with a package being re-installed to ensure * the enabled state of the accounts is retained. * * When default call screening application is removed, set * {@link Settings.Secure.CALL_SCREENING_DEFAULT_APPLICATION} as null into provider. */ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { public class AppUninstallBroadcastReceiver extends BroadcastReceiver { /** * Receives the intents the class is configured to received. * Loading @@ -54,6 +63,7 @@ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { String packageName = uri.getSchemeSpecificPart(); handlePackageRemoved(context, packageName); handleUninstallOfCallScreeningService(context, packageName); } } Loading @@ -69,4 +79,17 @@ public class PhoneAccountBroadcastReceiver extends BroadcastReceiver { telecomManager.clearAccountsForPackage(packageName); } } private void handleUninstallOfCallScreeningService(Context context, String packageName) { String defaultCallScreeningApp = Settings.Secure .getStringForUser(context.getContentResolver(), Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT, UserHandle.USER_CURRENT); ComponentName componentName = ComponentName.unflattenFromString(defaultCallScreeningApp); if (componentName != null && componentName.getPackageName().equals(packageName)) { Settings.Secure.putStringForUser(context.getContentResolver(), Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT, null, UserHandle.USER_CURRENT); } } }