Loading services/core/java/com/android/server/notification/NotificationManagerService.java +19 −16 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ public class NotificationManagerService extends SystemService { private boolean mNotificationEffectsEnabledForAutomotive; private DeviceConfig.OnPropertiesChangedListener mDeviceConfigChangedListener; protected NotificationAttentionHelper mAttentionHelper; private boolean mFlagRefactorAttentionHelper; private int mWarnRemoteViewsSizeBytes; private int mStripRemoteViewsSizeBytes; Loading Loading @@ -1189,7 +1190,7 @@ public class NotificationManagerService extends SystemService { @Override public void onSetDisabled(int status) { synchronized (mNotificationLock) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateDisableNotificationEffectsLocked(status); } else { mDisableNotificationEffects = Loading Loading @@ -1335,7 +1336,7 @@ public class NotificationManagerService extends SystemService { public void clearEffects() { synchronized (mNotificationLock) { if (DBG) Slog.d(TAG, "clearEffects"); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearAttentionEffects(); } else { clearSoundLocked(); Loading Loading @@ -1564,7 +1565,7 @@ public class NotificationManagerService extends SystemService { int changedFlags = data.getFlags() ^ flags; if ((changedFlags & FLAG_SUPPRESS_NOTIFICATION) != 0) { // Suppress notification flag changed, clear any effects if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearEffectsLocked(key); } else { clearEffectsLocked(key); Loading Loading @@ -1913,7 +1914,7 @@ public class NotificationManagerService extends SystemService { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { if (action.equals(Intent.ACTION_SCREEN_ON)) { // Keep track of screen on/off state, but do not turn off the notification light // until user passes through the lock screen or views the notification. Loading Loading @@ -2029,7 +2030,7 @@ public class NotificationManagerService extends SystemService { ContentResolver resolver = getContext().getContentResolver(); resolver.registerContentObserver(NOTIFICATION_BADGING_URI, false, this, UserHandle.USER_ALL); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this, UserHandle.USER_ALL); } Loading Loading @@ -2059,7 +2060,7 @@ public class NotificationManagerService extends SystemService { public void update(Uri uri) { ContentResolver resolver = getContext().getContentResolver(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) { boolean pulseEnabled = Settings.System.getIntForUser(resolver, Settings.System.NOTIFICATION_LIGHT_PULSE, 0, UserHandle.USER_CURRENT) Loading Loading @@ -2560,7 +2561,9 @@ public class NotificationManagerService extends SystemService { mToastRateLimiter = toastRateLimiter; if (Flags.refactorAttentionHelper()) { //Cache aconfig flag value mFlagRefactorAttentionHelper = Flags.refactorAttentionHelper(); if (mFlagRefactorAttentionHelper) { mAttentionHelper = new NotificationAttentionHelper(getContext(), lightsManager, mAccessibilityManager, mPackageManagerClient, userManager, usageStats, mNotificationManagerPrivate, mZenModeHelper, flagResolver); Loading @@ -2570,7 +2573,7 @@ public class NotificationManagerService extends SystemService { // If this is called within a test, make sure to unregister the intent receivers by // calling onDestroy() IntentFilter filter = new IntentFilter(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); Loading Loading @@ -2898,7 +2901,7 @@ public class NotificationManagerService extends SystemService { } registerNotificationPreferencesPullers(); new LockPatternUtils(getContext()).registerStrongAuthTracker(mStrongAuthTracker); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.onSystemReady(); } } else if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { Loading Loading @@ -6571,7 +6574,7 @@ public class NotificationManagerService extends SystemService { pw.println(" mMaxPackageEnqueueRate=" + mMaxPackageEnqueueRate); pw.println(" hideSilentStatusBar=" + mPreferencesHelper.shouldHideSilentStatusIcons()); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.dump(pw, " ", filter); } } Loading Loading @@ -7872,7 +7875,7 @@ public class NotificationManagerService extends SystemService { boolean wasPosted = removeFromNotificationListsLocked(r); cancelNotificationLocked(r, false, REASON_SNOOZED, wasPosted, null, SystemClock.elapsedRealtime()); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading Loading @@ -8012,7 +8015,7 @@ public class NotificationManagerService extends SystemService { cancelGroupChildrenLocked(r, mCallingUid, mCallingPid, listenerName, mSendDelete, childrenFlagChecker, mReason, mCancellationElapsedTimeMs); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading Loading @@ -8309,7 +8312,7 @@ public class NotificationManagerService extends SystemService { int buzzBeepBlinkLoggingCode = 0; if (!r.isHidden()) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { buzzBeepBlinkLoggingCode = mAttentionHelper.buzzBeepBlinkLocked(r, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(r.getUserId()), Loading Loading @@ -9296,7 +9299,7 @@ public class NotificationManagerService extends SystemService { || interruptiveChanged; if (interceptBefore && !record.isIntercepted() && record.isNewEnoughForAlerting(System.currentTimeMillis())) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.buzzBeepBlinkLocked(record, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(record.getUserId()), mListenerHints)); Loading Loading @@ -9676,7 +9679,7 @@ public class NotificationManagerService extends SystemService { }); } if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearEffectsLocked(canceledKey); } else { // sound Loading Loading @@ -10040,7 +10043,7 @@ public class NotificationManagerService extends SystemService { cancellationElapsedTimeMs); } } if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +19 −16 Original line number Diff line number Diff line Loading @@ -706,6 +706,7 @@ public class NotificationManagerService extends SystemService { private boolean mNotificationEffectsEnabledForAutomotive; private DeviceConfig.OnPropertiesChangedListener mDeviceConfigChangedListener; protected NotificationAttentionHelper mAttentionHelper; private boolean mFlagRefactorAttentionHelper; private int mWarnRemoteViewsSizeBytes; private int mStripRemoteViewsSizeBytes; Loading Loading @@ -1189,7 +1190,7 @@ public class NotificationManagerService extends SystemService { @Override public void onSetDisabled(int status) { synchronized (mNotificationLock) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateDisableNotificationEffectsLocked(status); } else { mDisableNotificationEffects = Loading Loading @@ -1335,7 +1336,7 @@ public class NotificationManagerService extends SystemService { public void clearEffects() { synchronized (mNotificationLock) { if (DBG) Slog.d(TAG, "clearEffects"); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearAttentionEffects(); } else { clearSoundLocked(); Loading Loading @@ -1564,7 +1565,7 @@ public class NotificationManagerService extends SystemService { int changedFlags = data.getFlags() ^ flags; if ((changedFlags & FLAG_SUPPRESS_NOTIFICATION) != 0) { // Suppress notification flag changed, clear any effects if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearEffectsLocked(key); } else { clearEffectsLocked(key); Loading Loading @@ -1913,7 +1914,7 @@ public class NotificationManagerService extends SystemService { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { if (action.equals(Intent.ACTION_SCREEN_ON)) { // Keep track of screen on/off state, but do not turn off the notification light // until user passes through the lock screen or views the notification. Loading Loading @@ -2029,7 +2030,7 @@ public class NotificationManagerService extends SystemService { ContentResolver resolver = getContext().getContentResolver(); resolver.registerContentObserver(NOTIFICATION_BADGING_URI, false, this, UserHandle.USER_ALL); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this, UserHandle.USER_ALL); } Loading Loading @@ -2059,7 +2060,7 @@ public class NotificationManagerService extends SystemService { public void update(Uri uri) { ContentResolver resolver = getContext().getContentResolver(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) { boolean pulseEnabled = Settings.System.getIntForUser(resolver, Settings.System.NOTIFICATION_LIGHT_PULSE, 0, UserHandle.USER_CURRENT) Loading Loading @@ -2560,7 +2561,9 @@ public class NotificationManagerService extends SystemService { mToastRateLimiter = toastRateLimiter; if (Flags.refactorAttentionHelper()) { //Cache aconfig flag value mFlagRefactorAttentionHelper = Flags.refactorAttentionHelper(); if (mFlagRefactorAttentionHelper) { mAttentionHelper = new NotificationAttentionHelper(getContext(), lightsManager, mAccessibilityManager, mPackageManagerClient, userManager, usageStats, mNotificationManagerPrivate, mZenModeHelper, flagResolver); Loading @@ -2570,7 +2573,7 @@ public class NotificationManagerService extends SystemService { // If this is called within a test, make sure to unregister the intent receivers by // calling onDestroy() IntentFilter filter = new IntentFilter(); if (!Flags.refactorAttentionHelper()) { if (!mFlagRefactorAttentionHelper) { filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); Loading Loading @@ -2898,7 +2901,7 @@ public class NotificationManagerService extends SystemService { } registerNotificationPreferencesPullers(); new LockPatternUtils(getContext()).registerStrongAuthTracker(mStrongAuthTracker); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.onSystemReady(); } } else if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { Loading Loading @@ -6571,7 +6574,7 @@ public class NotificationManagerService extends SystemService { pw.println(" mMaxPackageEnqueueRate=" + mMaxPackageEnqueueRate); pw.println(" hideSilentStatusBar=" + mPreferencesHelper.shouldHideSilentStatusIcons()); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.dump(pw, " ", filter); } } Loading Loading @@ -7872,7 +7875,7 @@ public class NotificationManagerService extends SystemService { boolean wasPosted = removeFromNotificationListsLocked(r); cancelNotificationLocked(r, false, REASON_SNOOZED, wasPosted, null, SystemClock.elapsedRealtime()); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading Loading @@ -8012,7 +8015,7 @@ public class NotificationManagerService extends SystemService { cancelGroupChildrenLocked(r, mCallingUid, mCallingPid, listenerName, mSendDelete, childrenFlagChecker, mReason, mCancellationElapsedTimeMs); if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading Loading @@ -8309,7 +8312,7 @@ public class NotificationManagerService extends SystemService { int buzzBeepBlinkLoggingCode = 0; if (!r.isHidden()) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { buzzBeepBlinkLoggingCode = mAttentionHelper.buzzBeepBlinkLocked(r, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(r.getUserId()), Loading Loading @@ -9296,7 +9299,7 @@ public class NotificationManagerService extends SystemService { || interruptiveChanged; if (interceptBefore && !record.isIntercepted() && record.isNewEnoughForAlerting(System.currentTimeMillis())) { if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.buzzBeepBlinkLocked(record, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(record.getUserId()), mListenerHints)); Loading Loading @@ -9676,7 +9679,7 @@ public class NotificationManagerService extends SystemService { }); } if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.clearEffectsLocked(canceledKey); } else { // sound Loading Loading @@ -10040,7 +10043,7 @@ public class NotificationManagerService extends SystemService { cancellationElapsedTimeMs); } } if (Flags.refactorAttentionHelper()) { if (mFlagRefactorAttentionHelper) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); Loading