Loading src/com/android/settings/notification/NotificationBackend.java +25 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_CACHED; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER; import static android.os.UserHandle.USER_SYSTEM; import android.app.INotificationManager; import android.app.NotificationChannel; Loading @@ -44,6 +45,7 @@ import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.ConversationChannelWrapper; import android.service.notification.NotificationListenerFilter; import android.text.format.DateUtils; Loading Loading @@ -112,6 +114,15 @@ public class NotificationBackend { void recordCanBeBlocked(Context context, PackageManager pm, RoleManager rm, PackageInfo app, AppRow row) { if (Settings.Secure.getIntForUser(context.getContentResolver(), Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 0, USER_SYSTEM) != 0) { try { row.systemApp = row.lockedImportance = sINM.isPermissionFixed(app.packageName, row.userId); } catch (RemoteException e) { Log.w(TAG, "Error calling NMS", e); } } else { row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app); List<String> roles = rm.getHeldRolesFromController(app.packageName); if (roles.contains(RoleManager.ROLE_DIALER) Loading @@ -122,6 +133,7 @@ public class NotificationBackend { com.android.internal.R.array.config_nonBlockableNotificationPackages); markAppRowWithBlockables(nonBlockablePkgs, row, app.packageName); } } @VisibleForTesting static void markAppRowWithBlockables(String[] nonBlockablePkgs, AppRow row, String packageName) { Loading Loading @@ -653,6 +665,11 @@ public class NotificationBackend { return false; } @VisibleForTesting void setNm(INotificationManager inm) { sINM = inm; } /** * NotificationsSentState contains how often an app sends notifications and how recently it sent * one. Loading src/com/android/settings/notification/app/BlockPreferenceController.java +2 −3 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class BlockPreferenceController extends NotificationPreferenceController } bar.setDisabledByAdmin(mAdmin); if (mChannel != null && !isChannelBlockable()) { if (mChannel != null && (!isChannelBlockable() || !isChannelConfigurable(mChannel))) { bar.setSwitchBarEnabled(false); } Loading @@ -88,8 +88,7 @@ public class BlockPreferenceController extends NotificationPreferenceController bar.setSwitchBarEnabled(false); } if (mChannel == null && mAppRow.systemApp && (!mAppRow.banned || mAppRow.lockedImportance)) { if (mChannel == null && !isAppBlockable()) { bar.setSwitchBarEnabled(false); } Loading src/com/android/settings/notification/app/ConversationPriorityPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -62,9 +62,9 @@ public class ConversationPriorityPreferenceController extends NotificationPrefer public void updateState(Preference preference) { if (mAppRow != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); ConversationPriorityPreference pref = (ConversationPriorityPreference) preference; pref.setConfigurable(!mChannel.isImportanceLockedByOEM()); pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setOriginalImportance(mChannel.getOriginalImportance()); pref.setPriorityConversation(mChannel.isImportantConversation()); Loading src/com/android/settings/notification/app/HighImportancePreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public class HighImportancePreferenceController extends NotificationPreferenceCo @Override public void updateState(Preference preference) { if (mAppRow != null && mChannel != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference; pref.setChecked(mChannel.getImportance() >= IMPORTANCE_HIGH); Loading src/com/android/settings/notification/app/ImportancePreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,9 +66,9 @@ public class ImportancePreferenceController extends NotificationPreferenceContro @Override public void updateState(Preference preference) { if (mAppRow!= null && mChannel != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); ImportancePreference pref = (ImportancePreference) preference; pref.setConfigurable(!mChannel.isImportanceLockedByOEM()); pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading
src/com/android/settings/notification/NotificationBackend.java +25 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_CACHED; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER; import static android.os.UserHandle.USER_SYSTEM; import android.app.INotificationManager; import android.app.NotificationChannel; Loading @@ -44,6 +45,7 @@ import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.ConversationChannelWrapper; import android.service.notification.NotificationListenerFilter; import android.text.format.DateUtils; Loading Loading @@ -112,6 +114,15 @@ public class NotificationBackend { void recordCanBeBlocked(Context context, PackageManager pm, RoleManager rm, PackageInfo app, AppRow row) { if (Settings.Secure.getIntForUser(context.getContentResolver(), Settings.Secure.NOTIFICATION_PERMISSION_ENABLED, 0, USER_SYSTEM) != 0) { try { row.systemApp = row.lockedImportance = sINM.isPermissionFixed(app.packageName, row.userId); } catch (RemoteException e) { Log.w(TAG, "Error calling NMS", e); } } else { row.systemApp = Utils.isSystemPackage(context.getResources(), pm, app); List<String> roles = rm.getHeldRolesFromController(app.packageName); if (roles.contains(RoleManager.ROLE_DIALER) Loading @@ -122,6 +133,7 @@ public class NotificationBackend { com.android.internal.R.array.config_nonBlockableNotificationPackages); markAppRowWithBlockables(nonBlockablePkgs, row, app.packageName); } } @VisibleForTesting static void markAppRowWithBlockables(String[] nonBlockablePkgs, AppRow row, String packageName) { Loading Loading @@ -653,6 +665,11 @@ public class NotificationBackend { return false; } @VisibleForTesting void setNm(INotificationManager inm) { sINM = inm; } /** * NotificationsSentState contains how often an app sends notifications and how recently it sent * one. Loading
src/com/android/settings/notification/app/BlockPreferenceController.java +2 −3 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class BlockPreferenceController extends NotificationPreferenceController } bar.setDisabledByAdmin(mAdmin); if (mChannel != null && !isChannelBlockable()) { if (mChannel != null && (!isChannelBlockable() || !isChannelConfigurable(mChannel))) { bar.setSwitchBarEnabled(false); } Loading @@ -88,8 +88,7 @@ public class BlockPreferenceController extends NotificationPreferenceController bar.setSwitchBarEnabled(false); } if (mChannel == null && mAppRow.systemApp && (!mAppRow.banned || mAppRow.lockedImportance)) { if (mChannel == null && !isAppBlockable()) { bar.setSwitchBarEnabled(false); } Loading
src/com/android/settings/notification/app/ConversationPriorityPreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -62,9 +62,9 @@ public class ConversationPriorityPreferenceController extends NotificationPrefer public void updateState(Preference preference) { if (mAppRow != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); ConversationPriorityPreference pref = (ConversationPriorityPreference) preference; pref.setConfigurable(!mChannel.isImportanceLockedByOEM()); pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setOriginalImportance(mChannel.getOriginalImportance()); pref.setPriorityConversation(mChannel.isImportantConversation()); Loading
src/com/android/settings/notification/app/HighImportancePreferenceController.java +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public class HighImportancePreferenceController extends NotificationPreferenceCo @Override public void updateState(Preference preference) { if (mAppRow != null && mChannel != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); RestrictedSwitchPreference pref = (RestrictedSwitchPreference) preference; pref.setChecked(mChannel.getImportance() >= IMPORTANCE_HIGH); Loading
src/com/android/settings/notification/app/ImportancePreferenceController.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,9 +66,9 @@ public class ImportancePreferenceController extends NotificationPreferenceContro @Override public void updateState(Preference preference) { if (mAppRow!= null && mChannel != null) { preference.setEnabled(mAdmin == null && !mChannel.isImportanceLockedByOEM()); preference.setEnabled(mAdmin == null && isChannelConfigurable(mChannel)); ImportancePreference pref = (ImportancePreference) preference; pref.setConfigurable(!mChannel.isImportanceLockedByOEM()); pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), Loading