diff options
| author | 2022-02-05 15:07:25 +0000 | |
|---|---|---|
| committer | 2022-02-05 15:07:25 +0000 | |
| commit | d0e75eb2c40d13d77a108c0dcee44e92256e3758 (patch) | |
| tree | 12e13bc266b9a6bfa2ceabaefcccda9251f38428 | |
| parent | 4962344aac9475b5dd3e80337d878062efaa1a5d (diff) | |
| parent | 6534424c2fad9d96935839d2dee47e6faad7fcdf (diff) | |
Merge "Fix notification drag and drop flag"
9 files changed, 33 insertions, 20 deletions
| diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 4a0c30ccd798..3d0c08bb5237 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -39,6 +39,8 @@ import android.view.ViewConfiguration;  import android.view.accessibility.AccessibilityEvent;  import com.android.systemui.animation.Interpolators; +import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags;  import com.android.systemui.plugins.FalsingManager;  import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;  import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -82,6 +84,7 @@ public class SwipeHelper implements Gefingerpoken {      private final int mSwipeDirection;      private final VelocityTracker mVelocityTracker;      private final FalsingManager mFalsingManager; +    private final FeatureFlags mFeatureFlags;      private float mInitialTouchPos;      private float mPerpendicularInitialTouchPos; @@ -128,7 +131,8 @@ public class SwipeHelper implements Gefingerpoken {      public SwipeHelper(              int swipeDirection, Callback callback, Resources resources, -            ViewConfiguration viewConfiguration, FalsingManager falsingManager) { +            ViewConfiguration viewConfiguration, FalsingManager falsingManager, +            FeatureFlags featureFlags) {          mCallback = callback;          mHandler = new Handler();          mSwipeDirection = swipeDirection; @@ -146,6 +150,7 @@ public class SwipeHelper implements Gefingerpoken {          mFadeDependingOnAmountSwiped = resources.getBoolean(                  R.bool.config_fadeDependingOnAmountSwiped);          mFalsingManager = falsingManager; +        mFeatureFlags = featureFlags;          mFlingAnimationUtils = new FlingAnimationUtils(resources.getDisplayMetrics(),                  getMaxEscapeAnimDuration() / 1000f);      } @@ -795,7 +800,7 @@ public class SwipeHelper implements Gefingerpoken {      }      private boolean isAvailableToDragAndDrop(View v) { -        if (v.getResources().getBoolean(R.bool.config_notificationToContents)) { +        if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_DRAG_TO_CONTENTS)) {              if (v instanceof ExpandableNotificationRow) {                  ExpandableNotificationRow enr = (ExpandableNotificationRow) v;                  boolean canBubble = enr.getEntry().canBubble(); diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.java b/packages/SystemUI/src/com/android/systemui/flags/Flags.java index 357a68fc6502..e1f8f0718077 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.java +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.java @@ -46,9 +46,6 @@ public class Flags {      public static final BooleanFlag NOTIFICATION_PIPELINE_DEVELOPER_LOGGING =              new BooleanFlag(103, false); -    public static final ResourceBooleanFlag NOTIFICATION_SHADE_DRAG = -            new ResourceBooleanFlag(104, R.bool.config_enableNotificationShadeDrag); -      public static final BooleanFlag NSSL_DEBUG_LINES =              new BooleanFlag(105, false); @@ -58,6 +55,9 @@ public class Flags {      public static final BooleanFlag NEW_PIPELINE_CRASH_ON_CALL_TO_OLD_PIPELINE =              new BooleanFlag(107, false); +    public static final ResourceBooleanFlag NOTIFICATION_DRAG_TO_CONTENTS = +            new ResourceBooleanFlag(108, R.bool.config_notificationToContents); +      /***************************************/      // 200 - keyguard/lockscreen diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java index 2436ffdbeefa..c4beb5bf4d7b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java @@ -27,8 +27,9 @@ import android.view.ViewGroup;  import androidx.annotation.NonNull;  import androidx.annotation.Nullable; -import com.android.systemui.R;  import com.android.systemui.classifier.FalsingCollector; +import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags;  import com.android.systemui.plugins.FalsingManager;  import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;  import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -89,6 +90,7 @@ public class ExpandableNotificationRowController implements NotifViewController      private final OnUserInteractionCallback mOnUserInteractionCallback;      private final FalsingManager mFalsingManager;      private final FalsingCollector mFalsingCollector; +    private final FeatureFlags mFeatureFlags;      private final boolean mAllowLongPress;      private final PeopleNotificationIdentifier mPeopleNotificationIdentifier;      private final Optional<BubblesManager> mBubblesManagerOptional; @@ -119,6 +121,7 @@ public class ExpandableNotificationRowController implements NotifViewController              OnUserInteractionCallback onUserInteractionCallback,              FalsingManager falsingManager,              FalsingCollector falsingCollector, +            FeatureFlags featureFlags,              PeopleNotificationIdentifier peopleNotificationIdentifier,              Optional<BubblesManager> bubblesManagerOptional,              ExpandableNotificationRowDragController dragController) { @@ -145,6 +148,7 @@ public class ExpandableNotificationRowController implements NotifViewController          mOnFeedbackClickListener = mNotificationGutsManager::openGuts;          mAllowLongPress = allowLongPress;          mFalsingCollector = falsingCollector; +        mFeatureFlags = featureFlags;          mPeopleNotificationIdentifier = peopleNotificationIdentifier;          mBubblesManagerOptional = bubblesManagerOptional;          mDragController = dragController; @@ -179,7 +183,7 @@ public class ExpandableNotificationRowController implements NotifViewController          );          mView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);          if (mAllowLongPress) { -            if (mView.getResources().getBoolean(R.bool.config_notificationToContents)) { +            if (mFeatureFlags.isEnabled(Flags.NOTIFICATION_DRAG_TO_CONTENTS)) {                  mView.setDragController(mDragController);              } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java index 1038e76234ae..2d2fbe588728 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelper.java @@ -33,6 +33,7 @@ import com.android.internal.annotations.VisibleForTesting;  import com.android.internal.jank.InteractionJankMonitor;  import com.android.systemui.SwipeHelper;  import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.flags.FeatureFlags;  import com.android.systemui.plugins.FalsingManager;  import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;  import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper; @@ -66,9 +67,10 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc      NotificationSwipeHelper(              Resources resources, ViewConfiguration viewConfiguration, -            FalsingManager falsingManager, int swipeDirection, NotificationCallback callback, +            FalsingManager falsingManager, FeatureFlags featureFlags, +            int swipeDirection, NotificationCallback callback,              NotificationMenuRowPlugin.OnMenuEventListener menuListener) { -        super(swipeDirection, callback, resources, viewConfiguration, falsingManager); +        super(swipeDirection, callback, resources, viewConfiguration, falsingManager, featureFlags);          mMenuListener = menuListener;          mCallback = callback;          mFalsingCheck = () -> resetExposedMenuView(true /* animate */, true /* force */); @@ -508,16 +510,18 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc          private final Resources mResources;          private final ViewConfiguration mViewConfiguration;          private final FalsingManager mFalsingManager; +        private final FeatureFlags mFeatureFlags;          private int mSwipeDirection;          private NotificationCallback mNotificationCallback;          private NotificationMenuRowPlugin.OnMenuEventListener mOnMenuEventListener;          @Inject          Builder(@Main Resources resources, ViewConfiguration viewConfiguration, -                FalsingManager falsingManager) { +                FalsingManager falsingManager, FeatureFlags featureFlags) {              mResources = resources;              mViewConfiguration = viewConfiguration;              mFalsingManager = falsingManager; +            mFeatureFlags = featureFlags;          }          Builder setSwipeDirection(int swipeDirection) { @@ -538,7 +542,7 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc          NotificationSwipeHelper build() {              return new NotificationSwipeHelper(mResources, mViewConfiguration, mFalsingManager, -                    mSwipeDirection, mNotificationCallback, mOnMenuEventListener); +                    mFeatureFlags, mSwipeDirection, mNotificationCallback, mOnMenuEventListener);          }      }  } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 250f2d1a706c..278b4ec5f53a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -806,7 +806,6 @@ public class NotificationPanelViewController extends PanelViewController              QsFrameTranslateController qsFrameTranslateController,              KeyguardUnlockAnimationController keyguardUnlockAnimationController) {          super(view, -                featureFlags,                  falsingManager,                  dozeLog,                  keyguardStateController, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 1f2c0675c588..85e804233ed9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -53,8 +53,6 @@ import com.android.systemui.R;  import com.android.systemui.animation.Interpolators;  import com.android.systemui.classifier.Classifier;  import com.android.systemui.doze.DozeLog; -import com.android.systemui.flags.FeatureFlags; -import com.android.systemui.flags.Flags;  import com.android.systemui.keyguard.KeyguardUnlockAnimationController;  import com.android.systemui.plugins.FalsingManager;  import com.android.systemui.statusbar.NotificationShadeWindowController; @@ -223,7 +221,6 @@ public abstract class PanelViewController {      public PanelViewController(              PanelView view, -            FeatureFlags featureFlags,              FalsingManager falsingManager,              DozeLog dozeLog,              KeyguardStateController keyguardStateController, @@ -292,7 +289,8 @@ public abstract class PanelViewController {          mBounceInterpolator = new BounceInterpolator();          mFalsingManager = falsingManager;          mDozeLog = dozeLog; -        mNotificationsDragEnabled = featureFlags.isEnabled(Flags.NOTIFICATION_SHADE_DRAG); +        mNotificationsDragEnabled = mResources.getBoolean( +                R.bool.config_enableNotificationShadeDrag);          mVibratorHelper = vibratorHelper;          mVibrateOnOpening = mResources.getBoolean(R.bool.config_vibrateOnIconAnimation);          mStatusBarTouchableRegionManager = statusBarTouchableRegionManager; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java index a890414115dd..52189e417017 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationEntryManagerInflationTest.java @@ -48,6 +48,7 @@ import com.android.systemui.SysuiTestCase;  import com.android.systemui.classifier.FalsingCollectorFake;  import com.android.systemui.classifier.FalsingManagerFake;  import com.android.systemui.dump.DumpManager; +import com.android.systemui.flags.FeatureFlags;  import com.android.systemui.media.MediaFeatureFlag;  import com.android.systemui.media.dialog.MediaOutputDialogFactory;  import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -273,6 +274,7 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase {                                  null,                                  new FalsingManagerFake(),                                  new FalsingCollectorFake(), +                                mock(FeatureFlags.class),                                  mPeopleNotificationIdentifier,                                  Optional.of(mock(BubblesManager.class)),                                  mock(ExpandableNotificationRowDragController.class) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java index a0e91fc77148..1305d79e4648 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationSwipeHelperTest.java @@ -42,6 +42,7 @@ import androidx.test.filters.SmallTest;  import com.android.systemui.SwipeHelper;  import com.android.systemui.SysuiTestCase;  import com.android.systemui.classifier.FalsingManagerFake; +import com.android.systemui.flags.FeatureFlags;  import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;  import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;  import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -71,6 +72,7 @@ public class NotificationSwipeHelperTest extends SysuiTestCase {      private Handler mHandler;      private ExpandableNotificationRow mNotificationRow;      private Runnable mFalsingCheck; +    private FeatureFlags mFeatureFlags;      @Rule public MockitoRule mockito = MockitoJUnit.rule(); @@ -78,9 +80,10 @@ public class NotificationSwipeHelperTest extends SysuiTestCase {      public void setUp() throws Exception {          mCallback = mock(NotificationSwipeHelper.NotificationCallback.class);          mListener = mock(NotificationMenuRowPlugin.OnMenuEventListener.class); +        mFeatureFlags = mock(FeatureFlags.class);          mSwipeHelper = spy(new NotificationSwipeHelper(                  mContext.getResources(), ViewConfiguration.get(mContext), -                new FalsingManagerFake(), SwipeHelper.X, mCallback, mListener)); +                new FalsingManagerFake(), mFeatureFlags, SwipeHelper.X, mCallback, mListener));          mView = mock(View.class);          mEvent = mock(MotionEvent.class);          mMenuRow = mock(NotificationMenuRowPlugin.class); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java index dee88dbfe29d..7347565408f5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java @@ -37,7 +37,6 @@ import static org.mockito.Mockito.clearInvocations;  import static org.mockito.Mockito.doAnswer;  import static org.mockito.Mockito.mock;  import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset;  import static org.mockito.Mockito.times;  import static org.mockito.Mockito.verify;  import static org.mockito.Mockito.when; @@ -99,7 +98,6 @@ import com.android.systemui.controls.dagger.ControlsComponent;  import com.android.systemui.doze.DozeLog;  import com.android.systemui.dump.DumpManager;  import com.android.systemui.flags.FeatureFlags; -import com.android.systemui.flags.Flags;  import com.android.systemui.fragments.FragmentHostManager;  import com.android.systemui.fragments.FragmentService;  import com.android.systemui.idle.IdleHostViewController; @@ -394,7 +392,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {          mConfiguration.orientation = ORIENTATION_PORTRAIT;          when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics);          mDisplayMetrics.density = 100; -        when(mFeatureFlags.isEnabled(Flags.NOTIFICATION_SHADE_DRAG)).thenReturn(true); +        when(mResources.getBoolean(R.bool.config_enableNotificationShadeDrag)).thenReturn(true);          when(mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade))                  .thenReturn(NOTIFICATION_SCRIM_TOP_PADDING_IN_SPLIT_SHADE);          when(mResources.getDimensionPixelSize(R.dimen.qs_panel_width)).thenReturn(400); |