Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ package android.app { method public void allowAssistantAdjustment(String); method public void disallowAssistantAdjustment(String); method public android.content.ComponentName getEffectsSuppressor(); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method public boolean matchesCallFilter(android.os.Bundle); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method public void updateNotificationChannel(@NonNull String, int, @NonNull android.app.NotificationChannel); Loading core/java/android/app/NotificationManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -1501,7 +1501,8 @@ public class NotificationManager { } /** @hide */ public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { @TestApi public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String pkg) { INotificationManager service = getService(); try { return service.isNotificationPolicyAccessGrantedForPackage(pkg); Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +9 −0 Original line number Diff line number Diff line Loading @@ -4777,6 +4777,15 @@ public class SettingsProvider extends ContentProvider { currentVersion = 195; } if (currentVersion == 195) { // Version 195: delete obsolete manged services settings getSecureSettingsLocked(userId).deleteSettingLocked( Secure.ENABLED_NOTIFICATION_ASSISTANT); getSecureSettingsLocked(userId).deleteSettingLocked( Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES); currentVersion = 196; } // vXXX: Add new settings above this point. if (currentVersion != newVersion) { Loading services/core/java/com/android/server/notification/ConditionProviders.java +1 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,7 @@ public class ConditionProviders extends ManagedServices { final Config c = new Config(); c.caption = "condition provider"; c.serviceInterface = ConditionProviderService.SERVICE_INTERFACE; c.secureSettingName = Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES; c.secureSettingName = null; c.xmlTag = TAG_ENABLED_DND_APPS; c.secondarySettingName = Settings.Secure.ENABLED_NOTIFICATION_LISTENERS; c.bindPermission = android.Manifest.permission.BIND_CONDITION_PROVIDER_SERVICE; Loading services/core/java/com/android/server/notification/ManagedServices.java +37 −26 Original line number Diff line number Diff line Loading @@ -437,9 +437,15 @@ abstract public class ManagedServices { } } } if (shouldReflectToSettings()) { Settings.Secure.putStringForUser( mContext.getContentResolver(), element, value, userId); loadAllowedComponentsFromSettings(); } for (UserInfo user : mUm.getUsers()) { addApprovedList(value, user.id, mConfig.secureSettingName.equals(element)); } Slog.d(TAG, "Done loading approved values from settings"); rebindServices(false, userId); } } Loading Loading @@ -498,11 +504,14 @@ abstract public class ManagedServices { out.endTag(null, TAG_MANAGED_SERVICES); if (!forBackup && isPrimary) { // Also write values to settings, for observers who haven't migrated yet if (shouldReflectToSettings()) { // Also write values to settings, for observers who haven't // migrated yet Settings.Secure.putStringForUser(mContext.getContentResolver(), getConfig().secureSettingName, allowedItems, approvedUserId); } } } } Loading @@ -515,6 +524,13 @@ abstract public class ManagedServices { out.endTag(null, getConfig().xmlTag); } /** * Returns whether the approved list of services should also be written to the Settings db */ protected boolean shouldReflectToSettings() { return false; } /** * Writes extra xml attributes to {@link #TAG_MANAGED_SERVICES} tag. */ Loading @@ -530,8 +546,20 @@ abstract public class ManagedServices { */ protected void readExtraTag(String tag, TypedXmlPullParser parser) throws IOException {} protected void migrateToXml() { loadAllowedComponentsFromSettings(); protected final void migrateToXml() { for (UserInfo user : mUm.getUsers()) { final ContentResolver cr = mContext.getContentResolver(); addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secureSettingName, user.id), user.id, true); if (!TextUtils.isEmpty(getConfig().secondarySettingName)) { addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secondarySettingName, user.id), user.id, false); } } } void readDefaults(TypedXmlPullParser parser) { Loading Loading @@ -638,23 +666,6 @@ abstract public class ManagedServices { protected abstract String getRequiredPermission(); private void loadAllowedComponentsFromSettings() { for (UserInfo user : mUm.getUsers()) { final ContentResolver cr = mContext.getContentResolver(); addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secureSettingName, user.id), user.id, true); if (!TextUtils.isEmpty(getConfig().secondarySettingName)) { addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secondarySettingName, user.id), user.id, false); } } Slog.d(TAG, "Done loading approved values from settings"); } protected void addApprovedList(String approved, int userId, boolean isPrimary) { addApprovedList(approved, userId, isPrimary, approved); } Loading Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -272,6 +272,7 @@ package android.app { method public void allowAssistantAdjustment(String); method public void disallowAssistantAdjustment(String); method public android.content.ComponentName getEffectsSuppressor(); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method public boolean matchesCallFilter(android.os.Bundle); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method public void updateNotificationChannel(@NonNull String, int, @NonNull android.app.NotificationChannel); Loading
core/java/android/app/NotificationManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -1501,7 +1501,8 @@ public class NotificationManager { } /** @hide */ public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { @TestApi public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String pkg) { INotificationManager service = getService(); try { return service.isNotificationPolicyAccessGrantedForPackage(pkg); Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +9 −0 Original line number Diff line number Diff line Loading @@ -4777,6 +4777,15 @@ public class SettingsProvider extends ContentProvider { currentVersion = 195; } if (currentVersion == 195) { // Version 195: delete obsolete manged services settings getSecureSettingsLocked(userId).deleteSettingLocked( Secure.ENABLED_NOTIFICATION_ASSISTANT); getSecureSettingsLocked(userId).deleteSettingLocked( Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES); currentVersion = 196; } // vXXX: Add new settings above this point. if (currentVersion != newVersion) { Loading
services/core/java/com/android/server/notification/ConditionProviders.java +1 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,7 @@ public class ConditionProviders extends ManagedServices { final Config c = new Config(); c.caption = "condition provider"; c.serviceInterface = ConditionProviderService.SERVICE_INTERFACE; c.secureSettingName = Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES; c.secureSettingName = null; c.xmlTag = TAG_ENABLED_DND_APPS; c.secondarySettingName = Settings.Secure.ENABLED_NOTIFICATION_LISTENERS; c.bindPermission = android.Manifest.permission.BIND_CONDITION_PROVIDER_SERVICE; Loading
services/core/java/com/android/server/notification/ManagedServices.java +37 −26 Original line number Diff line number Diff line Loading @@ -437,9 +437,15 @@ abstract public class ManagedServices { } } } if (shouldReflectToSettings()) { Settings.Secure.putStringForUser( mContext.getContentResolver(), element, value, userId); loadAllowedComponentsFromSettings(); } for (UserInfo user : mUm.getUsers()) { addApprovedList(value, user.id, mConfig.secureSettingName.equals(element)); } Slog.d(TAG, "Done loading approved values from settings"); rebindServices(false, userId); } } Loading Loading @@ -498,11 +504,14 @@ abstract public class ManagedServices { out.endTag(null, TAG_MANAGED_SERVICES); if (!forBackup && isPrimary) { // Also write values to settings, for observers who haven't migrated yet if (shouldReflectToSettings()) { // Also write values to settings, for observers who haven't // migrated yet Settings.Secure.putStringForUser(mContext.getContentResolver(), getConfig().secureSettingName, allowedItems, approvedUserId); } } } } Loading @@ -515,6 +524,13 @@ abstract public class ManagedServices { out.endTag(null, getConfig().xmlTag); } /** * Returns whether the approved list of services should also be written to the Settings db */ protected boolean shouldReflectToSettings() { return false; } /** * Writes extra xml attributes to {@link #TAG_MANAGED_SERVICES} tag. */ Loading @@ -530,8 +546,20 @@ abstract public class ManagedServices { */ protected void readExtraTag(String tag, TypedXmlPullParser parser) throws IOException {} protected void migrateToXml() { loadAllowedComponentsFromSettings(); protected final void migrateToXml() { for (UserInfo user : mUm.getUsers()) { final ContentResolver cr = mContext.getContentResolver(); addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secureSettingName, user.id), user.id, true); if (!TextUtils.isEmpty(getConfig().secondarySettingName)) { addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secondarySettingName, user.id), user.id, false); } } } void readDefaults(TypedXmlPullParser parser) { Loading Loading @@ -638,23 +666,6 @@ abstract public class ManagedServices { protected abstract String getRequiredPermission(); private void loadAllowedComponentsFromSettings() { for (UserInfo user : mUm.getUsers()) { final ContentResolver cr = mContext.getContentResolver(); addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secureSettingName, user.id), user.id, true); if (!TextUtils.isEmpty(getConfig().secondarySettingName)) { addApprovedList(Settings.Secure.getStringForUser( cr, getConfig().secondarySettingName, user.id), user.id, false); } } Slog.d(TAG, "Done loading approved values from settings"); } protected void addApprovedList(String approved, int userId, boolean isPrimary) { addApprovedList(approved, userId, isPrimary, approved); } Loading