Merge "Convert existing flags to new system." into sc-v2-dev
This commit is contained in:
@@ -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 ==========================
|
||||
|
||||
@@ -18,40 +18,12 @@
|
||||
<resources>
|
||||
<bool name="are_flags_overrideable">false</bool>
|
||||
|
||||
<bool name="flag_notification_pipeline2">true</bool>
|
||||
<bool name="flag_notification_pipeline2_rendering">false</bool>
|
||||
<bool name="flag_notif_updates">true</bool>
|
||||
|
||||
<bool name="flag_monet">true</bool>
|
||||
|
||||
<!-- People Tile flag -->
|
||||
<bool name="flag_conversations">false</bool>
|
||||
|
||||
<!-- The new animations to/from lockscreen and AOD! -->
|
||||
<bool name="flag_lockscreen_animations">true</bool>
|
||||
|
||||
<!-- The new swipe to unlock animation, which shows the app/launcher behind the keyguard during
|
||||
the swipe. -->
|
||||
<bool name="flag_new_unlock_swipe_animation">true</bool>
|
||||
|
||||
<!-- The shared-element transition between lockscreen smartspace and launcher smartspace. -->
|
||||
<bool name="flag_smartspace_shared_element_transition">false</bool>
|
||||
|
||||
<bool name="flag_pm_lite">true</bool>
|
||||
|
||||
<bool name="flag_charging_ripple">false</bool>
|
||||
|
||||
<bool name="flag_ongoing_call_status_bar_chip">true</bool>
|
||||
|
||||
<bool name="flag_ongoing_call_in_immersive">true</bool>
|
||||
|
||||
<bool name="flag_ongoing_call_in_immersive_chip_tap">true</bool>
|
||||
|
||||
<bool name="flag_smartspace">false</bool>
|
||||
|
||||
<bool name="flag_smartspace_deduping">true</bool>
|
||||
|
||||
<bool name="flag_combined_status_bar_signal_icons">false</bool>
|
||||
|
||||
<bool name="flag_new_user_switcher">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ExpandableView> 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;
|
||||
|
||||
@@ -5311,10 +5311,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);
|
||||
@@ -5326,8 +5326,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();
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user