Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70831a58 authored by Iavor-Valentin Iftime's avatar Iavor-Valentin Iftime Committed by Android (Google) Code Review
Browse files

Merge "Cache aconfig flag for NAH refactoring" into main

parents 90468ed0 814ac929
Loading
Loading
Loading
Loading
+19 −16
Original line number Diff line number Diff line
@@ -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;
@@ -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 =
@@ -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();
@@ -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);
@@ -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.
@@ -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);
            }
@@ -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)
@@ -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);
@@ -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);
@@ -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) {
@@ -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);
                    }
                }
@@ -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();
@@ -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();
@@ -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()),
@@ -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));
@@ -9676,7 +9679,7 @@ public class NotificationManagerService extends SystemService {
                });
            }
            if (Flags.refactorAttentionHelper()) {
            if (mFlagRefactorAttentionHelper) {
                mAttentionHelper.clearEffectsLocked(canceledKey);
            } else {
                // sound
@@ -10040,7 +10043,7 @@ public class NotificationManagerService extends SystemService {
                            cancellationElapsedTimeMs);
                }
            }
            if (Flags.refactorAttentionHelper()) {
            if (mFlagRefactorAttentionHelper) {
                mAttentionHelper.updateLightsLocked();
            } else {
                updateLightsLocked();