diff --git a/packages/SystemUI/plugin/src/com/android/systemui/flags/Flags.java b/packages/SystemUI/plugin/src/com/android/systemui/flags/Flags.java
index 17b13a235805a..3761d42ae98c7 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/flags/Flags.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/flags/Flags.java
@@ -23,14 +23,75 @@ import java.util.Map;
/**
* List of {@link Flag} objects for use in SystemUI.
*
- * Flag Ids are integers. They must be unique.
+ * Flag Ids are integers.
+ * Ids must be unique. This is enforced in a unit test.
+ * Ids need not be sequential. Flags can "claim" a chunk of ids for flags in related featurs with
+ * a comment. This is purely for organizational purposes.
*
* On public release builds, flags will always return their default value. There is no way to
* change their value on release builds.
+ *
+ * See {@link FeatureFlagManager} for instructions on flipping the flags via adb.
*/
public class Flags {
- public static final BooleanFlag THE_FIRST_FLAG = new BooleanFlag(1, false);
+ public static final BooleanFlag TEAMFOOD = new BooleanFlag(1, false);
+ /***************************************/
+ // 100 - notification
+ public static final BooleanFlag NEW_NOTIFICATION_PIPELINE =
+ new BooleanFlag(100, true);
+
+ public static final BooleanFlag NEW_NOTIFICATION_PIPELINE_RENDERING =
+ new BooleanFlag(101, false);
+
+ public static final BooleanFlag NOTIFICATION_UPDATES =
+ new BooleanFlag(102, true);
+
+
+ /***************************************/
+ // 200 - keyguard/lockscreen
+ public static final BooleanFlag KEYGUARD_LAYOUT =
+ new BooleanFlag(200, true);
+
+ public static final BooleanFlag LOCKSCREEN_ANIMATIONS =
+ new BooleanFlag(201, true);
+
+ public static final BooleanFlag NEW_UNLOCK_SWIPE_ANIMATION =
+ new BooleanFlag(202, true);
+
+ /***************************************/
+ // 300 - power menu
+ public static final BooleanFlag POWER_MENU_LITE =
+ new BooleanFlag(300, true);
+
+ /***************************************/
+ // 400 - smartspace
+ public static final BooleanFlag SMARTSPACE_DEDUPING =
+ new BooleanFlag(400, true);
+
+ public static final BooleanFlag SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED =
+ new BooleanFlag(401, false);
+
+ /***************************************/
+ // 500 - quick settings
+ public static final BooleanFlag NEW_USER_SWITCHER =
+ new BooleanFlag(500, true);
+
+ /***************************************/
+ // 600- status bar
+ public static final BooleanFlag COMBINED_STATUS_BAR_SIGNAL_ICONS =
+ new BooleanFlag(501, false);
+
+ /***************************************/
+ // 700 - dialer/calls
+ public static final BooleanFlag ONGOING_CALL_STATUS_BAR_CHIP =
+ new BooleanFlag(600, true);
+
+ public static final BooleanFlag ONGOING_CALL_IN_IMMERSIVE =
+ new BooleanFlag(601, true);
+
+ public static final BooleanFlag ONGOING_CALL_IN_IMMERSIVE_CHIP_TAP =
+ new BooleanFlag(602, true);
// Pay no attention to the reflection behind the curtain.
// ========================== Curtain ==========================
diff --git a/packages/SystemUI/res/values/flags.xml b/packages/SystemUI/res/values/flags.xml
index 6758387661758..c598097cd5aff 100644
--- a/packages/SystemUI/res/values/flags.xml
+++ b/packages/SystemUI/res/values/flags.xml
@@ -18,40 +18,12 @@
false
- true
- false
- true
-
true
false
-
- true
-
-
- true
-
-
- false
-
- true
-
false
- true
-
- true
-
- true
-
false
-
- true
-
- false
-
- true
diff --git a/packages/SystemUI/src/com/android/systemui/flags/FeatureFlags.java b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlags.java
index 105e7f514dc40..947a39a32365d 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/FeatureFlags.java
+++ b/packages/SystemUI/src/com/android/systemui/flags/FeatureFlags.java
@@ -33,7 +33,7 @@ import javax.inject.Inject;
/**
* Class to manage simple DeviceConfig-based feature flags.
*
- * See {@link FeatureFlagReader} for instructions on defining and flipping flags.
+ * See {@link Flags} for instructions on defining new flags.
*/
@SysUISingleton
public class FeatureFlags {
@@ -87,67 +87,70 @@ public class FeatureFlags {
}
public boolean isNewNotifPipelineEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_notification_pipeline2);
+ return isEnabled(Flags.NEW_NOTIFICATION_PIPELINE);
}
public boolean isNewNotifPipelineRenderingEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_notification_pipeline2_rendering);
+ return isEnabled(Flags.NEW_NOTIFICATION_PIPELINE_RENDERING);
}
/** */
public boolean useNewLockscreenAnimations() {
- return mFlagReader.isEnabled(R.bool.flag_lockscreen_animations);
+ return isEnabled(Flags.LOCKSCREEN_ANIMATIONS);
}
public boolean isPeopleTileEnabled() {
+ // TODO(b/202860494): different resource overlays have different values.
return mFlagReader.isEnabled(R.bool.flag_conversations);
}
public boolean isMonetEnabled() {
+ // TODO(b/202860494): used in wallpaper picker. Always true, maybe delete.
return mFlagReader.isEnabled(R.bool.flag_monet);
}
public boolean isPMLiteEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_pm_lite);
+ return isEnabled(Flags.POWER_MENU_LITE);
}
public boolean isChargingRippleEnabled() {
+ // TODO(b/202860494): different resource overlays have different values.
return mFlagReader.isEnabled(R.bool.flag_charging_ripple);
}
public boolean isOngoingCallStatusBarChipEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_ongoing_call_status_bar_chip);
+ return isEnabled(Flags.ONGOING_CALL_STATUS_BAR_CHIP);
}
public boolean isOngoingCallInImmersiveEnabled() {
- return isOngoingCallStatusBarChipEnabled()
- && mFlagReader.isEnabled(R.bool.flag_ongoing_call_in_immersive);
+ return isOngoingCallStatusBarChipEnabled() && isEnabled(Flags.ONGOING_CALL_IN_IMMERSIVE);
}
public boolean isOngoingCallInImmersiveChipTapEnabled() {
return isOngoingCallInImmersiveEnabled()
- && mFlagReader.isEnabled(R.bool.flag_ongoing_call_in_immersive_chip_tap);
+ && isEnabled(Flags.ONGOING_CALL_IN_IMMERSIVE_CHIP_TAP);
}
public boolean isSmartspaceEnabled() {
+ // TODO(b/202860494): different resource overlays have different values.
return mFlagReader.isEnabled(R.bool.flag_smartspace);
}
public boolean isSmartspaceDedupingEnabled() {
- return isSmartspaceEnabled() && mFlagReader.isEnabled(R.bool.flag_smartspace_deduping);
+ return isSmartspaceEnabled() && isEnabled(Flags.SMARTSPACE_DEDUPING);
}
public boolean isNewKeyguardSwipeAnimationEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_new_unlock_swipe_animation);
+ return isEnabled(Flags.NEW_UNLOCK_SWIPE_ANIMATION);
}
public boolean isSmartSpaceSharedElementTransitionEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_smartspace_shared_element_transition);
+ return isEnabled(Flags.SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED);
}
/** Whether or not to use the provider model behavior for the status bar icons */
public boolean isCombinedStatusBarSignalIconsEnabled() {
- return mFlagReader.isEnabled(R.bool.flag_combined_status_bar_signal_icons);
+ return isEnabled(Flags.COMBINED_STATUS_BAR_SIGNAL_ICONS);
}
/** System setting for provider model behavior */
@@ -159,7 +162,7 @@ public class FeatureFlags {
* Use the new version of the user switcher
*/
public boolean useNewUserSwitcher() {
- return mFlagReader.isEnabled(R.bool.flag_new_user_switcher);
+ return isEnabled(Flags.NEW_USER_SWITCHER);
}
/** static method for the system setting */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
index c3dc7001f5e87..d59318e45e7e4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java
@@ -41,8 +41,11 @@ import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.animation.Interpolators;
+import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.statusbar.AlphaOptimizedImageView;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -306,7 +309,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
final int showDismissSetting = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_NEW_NOTIF_DISMISS, -1);
final boolean newFlowHideShelf = showDismissSetting == -1
- ? mContext.getResources().getBoolean(R.bool.flag_notif_updates)
+ ? Dependency.get(FeatureFlags.class).isEnabled(Flags.NOTIFICATION_UPDATES)
: showDismissSetting == 1;
if (newFlowHideShelf) {
return;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
index 594afceab63a7..faf0fdfa0c8de 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManager.java
@@ -21,6 +21,8 @@ import android.util.MathUtils;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
+import com.android.systemui.flags.FeatureFlags;
+import com.android.systemui.flags.Flags;
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -41,6 +43,7 @@ public class NotificationRoundnessManager {
private final ExpandableView[] mTmpFirstInSectionViews;
private final ExpandableView[] mTmpLastInSectionViews;
private final KeyguardBypassController mBypassController;
+ private final FeatureFlags mFeatureFlags;
private boolean mExpanded;
private HashSet mAnimatedChildren;
private Runnable mRoundingChangedCallback;
@@ -55,7 +58,9 @@ public class NotificationRoundnessManager {
@Inject
NotificationRoundnessManager(
KeyguardBypassController keyguardBypassController,
- NotificationSectionsFeatureManager sectionsFeatureManager) {
+ NotificationSectionsFeatureManager sectionsFeatureManager,
+ FeatureFlags featureFlags) {
+ mFeatureFlags = featureFlags;
int numberOfSections = sectionsFeatureManager.getNumberOfBuckets();
mFirstInSectionViews = new ExpandableView[numberOfSections];
mLastInSectionViews = new ExpandableView[numberOfSections];
@@ -122,9 +127,8 @@ public class NotificationRoundnessManager {
void setViewsAffectedBySwipe(
ExpandableView viewBefore,
ExpandableView viewSwiped,
- ExpandableView viewAfter,
- boolean cornerAnimationsEnabled) {
- if (!cornerAnimationsEnabled) {
+ ExpandableView viewAfter) {
+ if (!mFeatureFlags.isEnabled(Flags.NOTIFICATION_UPDATES)) {
return;
}
final boolean animate = true;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 278f09b45b4c2..77c9f635e3c51 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -5312,10 +5312,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
}
mController.getNoticationRoundessManager()
- .setViewsAffectedBySwipe((ExpandableView) viewBefore,
+ .setViewsAffectedBySwipe(
+ (ExpandableView) viewBefore,
(ExpandableView) viewSwiped,
- (ExpandableView) viewAfter,
- getResources().getBoolean(R.bool.flag_notif_updates));
+ (ExpandableView) viewAfter);
updateFirstAndLastBackgroundViews();
requestDisallowInterceptTouchEvent(true);
@@ -5327,8 +5327,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
void onSwipeEnd() {
updateFirstAndLastBackgroundViews();
mController.getNoticationRoundessManager()
- .setViewsAffectedBySwipe(null, null, null,
- getResources().getBoolean(R.bool.flag_notif_updates));
+ .setViewsAffectedBySwipe(null, null, null);
// Round bottom corners for notification right before shelf.
mShelf.updateAppearance();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
index 0772c03d10d02..73560be1d265a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationRoundnessManagerTest.java
@@ -32,6 +32,7 @@ import androidx.test.filters.SmallTest;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
+import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.statusbar.notification.NotificationSectionsFeatureManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
@@ -61,6 +62,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
private ExpandableNotificationRow mSecond;
@Mock
private KeyguardBypassController mBypassController;
+ @Mock
+ private FeatureFlags mFeatureFlags;
private float mSmallRadiusRatio;
@Before
@@ -71,7 +74,8 @@ public class NotificationRoundnessManagerTest extends SysuiTestCase {
/ resources.getDimension(R.dimen.notification_corner_radius);
mRoundnessManager = new NotificationRoundnessManager(
mBypassController,
- new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext));
+ new NotificationSectionsFeatureManager(new DeviceConfigProxy(), mContext),
+ mFeatureFlags);
allowTestableLooperAsMainThread();
NotificationTestHelper testHelper = new NotificationTestHelper(
mContext,