diff options
| author | 2023-10-19 17:50:51 +0000 | |
|---|---|---|
| committer | 2023-10-19 17:50:51 +0000 | |
| commit | fe27605d632e403c517d10bff73cbb443dfa0dba (patch) | |
| tree | 615b1bac80f1a3b348216b9afd7a77ba6bda48bd | |
| parent | 6212b77ac83ee4553768caabaa4aa80563064f6b (diff) | |
Revert "Use aconfig flag for NAH refactoring"
This reverts commit 6212b77ac83ee4553768caabaa4aa80563064f6b.
Reason for revert: b/306410754
Bug: 306410754
Change-Id: I58a56d16e9cdca589249738dd8fe1d5301c3e97f
4 files changed, 29 insertions, 29 deletions
diff --git a/core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java b/core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java index 77e150239803..b1d22e069d9d 100644 --- a/core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java +++ b/core/java/com/android/internal/config/sysui/SystemUiSystemPropertiesFlags.java @@ -81,6 +81,11 @@ public class SystemUiSystemPropertiesFlags { public static final Flag PROPAGATE_CHANNEL_UPDATES_TO_CONVERSATIONS = releasedFlag( "persist.sysui.notification.propagate_channel_updates_to_conversations"); + // TODO: b/291907312 - remove feature flags + /** Gating the NMS->NotificationAttentionHelper buzzBeepBlink refactor */ + public static final Flag ENABLE_ATTENTION_HELPER_REFACTOR = devFlag( + "persist.debug.sysui.notification.enable_attention_helper_refactor"); + // TODO b/291899544: for released flags, use resource config values /** Value used by polite notif. feature */ public static final Flag NOTIF_COOLDOWN_T1 = devFlag( diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 70d2ed49268c..837b76154363 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -289,6 +289,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.compat.IPlatformCompat; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags; +import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags; import com.android.internal.logging.InstanceId; import com.android.internal.logging.InstanceIdSequence; import com.android.internal.logging.MetricsLogger; @@ -1178,7 +1179,7 @@ public class NotificationManagerService extends SystemService { @Override public void onSetDisabled(int status) { synchronized (mNotificationLock) { - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.updateDisableNotificationEffectsLocked(status); } else { mDisableNotificationEffects = @@ -1324,7 +1325,7 @@ public class NotificationManagerService extends SystemService { public void clearEffects() { synchronized (mNotificationLock) { if (DBG) Slog.d(TAG, "clearEffects"); - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.clearAttentionEffects(); } else { clearSoundLocked(); @@ -1553,7 +1554,8 @@ 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 (mFlagResolver.isEnabled( + NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.clearEffectsLocked(key); } else { clearEffectsLocked(key); @@ -1902,7 +1904,7 @@ public class NotificationManagerService extends SystemService { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (!Flags.refactorAttentionHelper()) { + if (!mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { 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. @@ -2009,7 +2011,7 @@ public class NotificationManagerService extends SystemService { ContentResolver resolver = getContext().getContentResolver(); resolver.registerContentObserver(NOTIFICATION_BADGING_URI, false, this, UserHandle.USER_ALL); - if (!Flags.refactorAttentionHelper()) { + if (!mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this, UserHandle.USER_ALL); } @@ -2035,7 +2037,7 @@ public class NotificationManagerService extends SystemService { public void update(Uri uri) { ContentResolver resolver = getContext().getContentResolver(); - if (!Flags.refactorAttentionHelper()) { + if (!mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) { boolean pulseEnabled = Settings.System.getIntForUser(resolver, Settings.System.NOTIFICATION_LIGHT_PULSE, 0, UserHandle.USER_CURRENT) @@ -2528,7 +2530,7 @@ public class NotificationManagerService extends SystemService { mToastRateLimiter = toastRateLimiter; - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper = new NotificationAttentionHelper(getContext(), lightsManager, mAccessibilityManager, mPackageManagerClient, userManager, usageStats, mNotificationManagerPrivate, mZenModeHelper, flagResolver); @@ -2538,7 +2540,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 (!mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); @@ -2863,7 +2865,7 @@ public class NotificationManagerService extends SystemService { } registerNotificationPreferencesPullers(); new LockPatternUtils(getContext()).registerStrongAuthTracker(mStrongAuthTracker); - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.onSystemReady(); } } else if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { @@ -6460,7 +6462,7 @@ public class NotificationManagerService extends SystemService { pw.println(" mMaxPackageEnqueueRate=" + mMaxPackageEnqueueRate); pw.println(" hideSilentStatusBar=" + mPreferencesHelper.shouldHideSilentStatusIcons()); - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.dump(pw, " ", filter); } } @@ -7726,7 +7728,7 @@ public class NotificationManagerService extends SystemService { boolean wasPosted = removeFromNotificationListsLocked(r); cancelNotificationLocked(r, false, REASON_SNOOZED, wasPosted, null, SystemClock.elapsedRealtime()); - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); @@ -7859,7 +7861,7 @@ public class NotificationManagerService extends SystemService { cancelGroupChildrenLocked(r, mCallingUid, mCallingPid, listenerName, mSendDelete, childrenFlagChecker, mReason, mCancellationElapsedTimeMs); - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); @@ -8156,7 +8158,7 @@ public class NotificationManagerService extends SystemService { int buzzBeepBlinkLoggingCode = 0; if (!r.isHidden()) { - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { buzzBeepBlinkLoggingCode = mAttentionHelper.buzzBeepBlinkLocked(r, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(r.getUserId()), @@ -9143,7 +9145,7 @@ public class NotificationManagerService extends SystemService { || interruptiveChanged; if (interceptBefore && !record.isIntercepted() && record.isNewEnoughForAlerting(System.currentTimeMillis())) { - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.buzzBeepBlinkLocked(record, new NotificationAttentionHelper.Signals( mUserProfiles.isCurrentProfile(record.getUserId()), mListenerHints)); @@ -9523,7 +9525,7 @@ public class NotificationManagerService extends SystemService { }); } - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.clearEffectsLocked(canceledKey); } else { // sound @@ -9887,7 +9889,7 @@ public class NotificationManagerService extends SystemService { cancellationElapsedTimeMs); } } - if (Flags.refactorAttentionHelper()) { + if (mFlagResolver.isEnabled(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR)) { mAttentionHelper.updateLightsLocked(); } else { updateLightsLocked(); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java index cf8548cfe689..9bd938f2e0a7 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java @@ -80,9 +80,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.IAccessibilityManager; import android.view.accessibility.IAccessibilityManagerClient; - import androidx.test.runner.AndroidJUnit4; - import com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags; import com.android.internal.config.sysui.TestableFlagResolver; import com.android.internal.logging.InstanceIdSequence; @@ -95,7 +93,6 @@ import com.android.server.pm.PackageManagerService; import java.util.List; import java.util.Objects; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -193,7 +190,7 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { assertTrue(mAccessibilityManager.isEnabled()); // TODO (b/291907312): remove feature flag - mSetFlagsRule.enableFlags(Flags.FLAG_REFACTOR_ATTENTION_HELPER); + mTestFlagResolver.setFlagOverride(NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR, true); // Disable feature flags by default. Tests should enable as needed. mSetFlagsRule.disableFlags(Flags.FLAG_POLITE_NOTIFICATIONS, Flags.FLAG_EXPIRE_BITMAPS); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 6bf14770abe2..3d4b4a62e5ac 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -84,6 +84,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; +import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.ENABLE_ATTENTION_HELPER_REFACTOR; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.FSI_FORCE_DEMOTE; import static com.android.internal.config.sysui.SystemUiSystemPropertiesFlags.NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; @@ -206,7 +207,6 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.permission.PermissionManager; -import android.platform.test.flag.junit.SetFlagsRule; import android.provider.DeviceConfig; import android.provider.MediaStore; import android.provider.Settings; @@ -325,9 +325,6 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { @Rule public TestRule compatChangeRule = new PlatformCompatChangeRule(); - @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); - private TestableNotificationManagerService mService; private INotificationManager mBinderService; private NotificationManagerInternal mInternalService; @@ -614,8 +611,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { }); // TODO (b/291907312): remove feature flag - mSetFlagsRule.disableFlags(Flags.FLAG_REFACTOR_ATTENTION_HELPER, - Flags.FLAG_POLITE_NOTIFICATIONS); + mTestFlagResolver.setFlagOverride(ENABLE_ATTENTION_HELPER_REFACTOR, false); initNMS(); } @@ -656,7 +652,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { verify(mHistoryManager).onBootPhaseAppsCanStart(); // TODO b/291907312: remove feature flag - if (Flags.refactorAttentionHelper()) { + if (mTestFlagResolver.isEnabled(ENABLE_ATTENTION_HELPER_REFACTOR)) { mService.mAttentionHelper.setAudioManager(mAudioManager); } else { mService.setAudioManager(mAudioManager); @@ -1687,7 +1683,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { @Test public void testEnqueueNotificationWithTag_WritesExpectedLogs_NAHRefactor() throws Exception { // TODO b/291907312: remove feature flag - mSetFlagsRule.enableFlags(Flags.FLAG_REFACTOR_ATTENTION_HELPER); + mTestFlagResolver.setFlagOverride(ENABLE_ATTENTION_HELPER_REFACTOR, true); // Cleanup NMS before re-initializing if (mService != null) { try { @@ -9082,7 +9078,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testOnBubbleMetadataChangedToSuppressNotification_soundStopped_NAHRefactor() throws Exception { // TODO b/291907312: remove feature flag - mSetFlagsRule.enableFlags(Flags.FLAG_REFACTOR_ATTENTION_HELPER); + mTestFlagResolver.setFlagOverride(ENABLE_ATTENTION_HELPER_REFACTOR, true); // Cleanup NMS before re-initializing if (mService != null) { try { |