Loading services/core/java/com/android/server/notification/ConditionProviders.java +21 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.notification; import android.annotation.NonNull; import android.app.INotificationManager; import android.app.NotificationManager; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -161,6 +163,25 @@ public class ConditionProviders extends ManagedServices { } } @Override public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (removingPackage) { INotificationManager inm = NotificationManager.getService(); if (pkgList != null && (pkgList.length > 0)) { for (String pkgName : pkgList) { try { inm.removeAutomaticZenRules(pkgName); inm.setNotificationPolicyAccessGranted(pkgName, false); } catch (Exception e) { Slog.e(TAG, "Failed to clean up rules for " + pkgName, e); } } } } super.onPackagesChanged(removingPackage, pkgList); } public ManagedServiceInfo checkServiceToken(IConditionProvider provider) { synchronized(mMutex) { return checkServiceTokenLocked(provider); Loading services/core/java/com/android/server/notification/ManagedServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -217,8 +217,8 @@ abstract public class ManagedServices { return mEnabledServicesPackageNames.contains(pkg); } public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged queryReplace=" + queryReplace public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged removingPackage=" + removingPackage + " pkgList=" + (pkgList == null ? null : Arrays.asList(pkgList)) + " mEnabledServicesPackageNames=" + mEnabledServicesPackageNames); boolean anyServicesInvolved = false; Loading @@ -234,7 +234,7 @@ abstract public class ManagedServices { if (anyServicesInvolved) { // if we're not replacing a package, clean up orphaned bits if (!queryReplace) { if (removingPackage) { updateSettingsAccordingToInstalledServices(); rebuildRestoredPackages(); } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +10 −10 Original line number Diff line number Diff line Loading @@ -696,9 +696,9 @@ public class NotificationManagerService extends SystemService { int changeUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_ALL); String pkgList[] = null; boolean queryReplace = queryRemove && intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); if (DBG) Slog.i(TAG, "action=" + action + " queryReplace=" + queryReplace); boolean removingPackage = queryRemove && !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); if (DBG) Slog.i(TAG, "action=" + action + " removing=" + removingPackage); if (action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) { pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST); } else if (action.equals(Intent.ACTION_PACKAGES_SUSPENDED)) { Loading Loading @@ -747,10 +747,10 @@ public class NotificationManagerService extends SystemService { } } } mListeners.onPackagesChanged(queryReplace, pkgList); mRankerServices.onPackagesChanged(queryReplace, pkgList); mConditionProviders.onPackagesChanged(queryReplace, pkgList); mRankingHelper.onPackagesChanged(queryReplace, pkgList); mListeners.onPackagesChanged(removingPackage, pkgList); mRankerServices.onPackagesChanged(removingPackage, pkgList); mConditionProviders.onPackagesChanged(removingPackage, pkgList); mRankingHelper.onPackagesChanged(removingPackage, pkgList); } } }; Loading Loading @@ -3894,14 +3894,14 @@ public class NotificationManagerService extends SystemService { } @Override public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged queryReplace=" + queryReplace public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged removingPackage=" + removingPackage + " pkgList=" + (pkgList == null ? null : Arrays.asList(pkgList))); if (mRankerServicePackageName == null) { return; } if (pkgList != null && (pkgList.length > 0)) { if (pkgList != null && (pkgList.length > 0) && !removingPackage) { for (String pkgName : pkgList) { if (mRankerServicePackageName.equals(pkgName)) { registerRanker(); Loading services/core/java/com/android/server/notification/RankingHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -504,8 +504,8 @@ public class RankingHelper implements RankingConfig { return packageBans; } public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (queryReplace || pkgList == null || pkgList.length == 0 public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (!removingPackage || pkgList == null || pkgList.length == 0 || mRestoredWithoutUids.isEmpty()) { return; // nothing to do } Loading services/core/java/com/android/server/notification/ZenModeConditions.java +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public class ZenModeConditions implements ConditionProviders.Callback { mSubscriptions.put(rule.conditionId, rule.component); } } else { rule.condition = null; if (DEBUG) Log.d(TAG, "zmc failed to subscribe"); } } Loading Loading
services/core/java/com/android/server/notification/ConditionProviders.java +21 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.notification; import android.annotation.NonNull; import android.app.INotificationManager; import android.app.NotificationManager; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; Loading Loading @@ -161,6 +163,25 @@ public class ConditionProviders extends ManagedServices { } } @Override public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (removingPackage) { INotificationManager inm = NotificationManager.getService(); if (pkgList != null && (pkgList.length > 0)) { for (String pkgName : pkgList) { try { inm.removeAutomaticZenRules(pkgName); inm.setNotificationPolicyAccessGranted(pkgName, false); } catch (Exception e) { Slog.e(TAG, "Failed to clean up rules for " + pkgName, e); } } } } super.onPackagesChanged(removingPackage, pkgList); } public ManagedServiceInfo checkServiceToken(IConditionProvider provider) { synchronized(mMutex) { return checkServiceTokenLocked(provider); Loading
services/core/java/com/android/server/notification/ManagedServices.java +3 −3 Original line number Diff line number Diff line Loading @@ -217,8 +217,8 @@ abstract public class ManagedServices { return mEnabledServicesPackageNames.contains(pkg); } public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged queryReplace=" + queryReplace public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged removingPackage=" + removingPackage + " pkgList=" + (pkgList == null ? null : Arrays.asList(pkgList)) + " mEnabledServicesPackageNames=" + mEnabledServicesPackageNames); boolean anyServicesInvolved = false; Loading @@ -234,7 +234,7 @@ abstract public class ManagedServices { if (anyServicesInvolved) { // if we're not replacing a package, clean up orphaned bits if (!queryReplace) { if (removingPackage) { updateSettingsAccordingToInstalledServices(); rebuildRestoredPackages(); } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +10 −10 Original line number Diff line number Diff line Loading @@ -696,9 +696,9 @@ public class NotificationManagerService extends SystemService { int changeUserId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_ALL); String pkgList[] = null; boolean queryReplace = queryRemove && intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); if (DBG) Slog.i(TAG, "action=" + action + " queryReplace=" + queryReplace); boolean removingPackage = queryRemove && !intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); if (DBG) Slog.i(TAG, "action=" + action + " removing=" + removingPackage); if (action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) { pkgList = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST); } else if (action.equals(Intent.ACTION_PACKAGES_SUSPENDED)) { Loading Loading @@ -747,10 +747,10 @@ public class NotificationManagerService extends SystemService { } } } mListeners.onPackagesChanged(queryReplace, pkgList); mRankerServices.onPackagesChanged(queryReplace, pkgList); mConditionProviders.onPackagesChanged(queryReplace, pkgList); mRankingHelper.onPackagesChanged(queryReplace, pkgList); mListeners.onPackagesChanged(removingPackage, pkgList); mRankerServices.onPackagesChanged(removingPackage, pkgList); mConditionProviders.onPackagesChanged(removingPackage, pkgList); mRankingHelper.onPackagesChanged(removingPackage, pkgList); } } }; Loading Loading @@ -3894,14 +3894,14 @@ public class NotificationManagerService extends SystemService { } @Override public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged queryReplace=" + queryReplace public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (DEBUG) Slog.d(TAG, "onPackagesChanged removingPackage=" + removingPackage + " pkgList=" + (pkgList == null ? null : Arrays.asList(pkgList))); if (mRankerServicePackageName == null) { return; } if (pkgList != null && (pkgList.length > 0)) { if (pkgList != null && (pkgList.length > 0) && !removingPackage) { for (String pkgName : pkgList) { if (mRankerServicePackageName.equals(pkgName)) { registerRanker(); Loading
services/core/java/com/android/server/notification/RankingHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -504,8 +504,8 @@ public class RankingHelper implements RankingConfig { return packageBans; } public void onPackagesChanged(boolean queryReplace, String[] pkgList) { if (queryReplace || pkgList == null || pkgList.length == 0 public void onPackagesChanged(boolean removingPackage, String[] pkgList) { if (!removingPackage || pkgList == null || pkgList.length == 0 || mRestoredWithoutUids.isEmpty()) { return; // nothing to do } Loading
services/core/java/com/android/server/notification/ZenModeConditions.java +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ public class ZenModeConditions implements ConditionProviders.Callback { mSubscriptions.put(rule.conditionId, rule.component); } } else { rule.condition = null; if (DEBUG) Log.d(TAG, "zmc failed to subscribe"); } } Loading