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

Commit 453744d1 authored by Lyn Han's avatar Lyn Han
Browse files

Enable flag to hide half-swipe shelf

Bug: 171817112
Test: visual - shelf that shows on notif half-swipe gone by default
Test: gradle - first, build with sysuiTestDebug variant and SystemUITests config. Then run

adb shell am instrument -w -e class com.android.systemui.statusbar.notification.row.NotificationMenuRowTest com.android.systemui.tests

Change-Id: I1b359e73d2ce9cff7cdbf367ce7002e5710d5946
parent 6544279f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
            mMenuContainer = new FrameLayout(mContext);
        }
        final boolean newFlowHideShelf = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.SHOW_NEW_NOTIF_DISMISS, 0) == 1;
                Settings.Global.SHOW_NEW_NOTIF_DISMISS, 1 /* on by default */) == 1;
        if (newFlowHideShelf) {
            return;
        }
+3 −3
Original line number Diff line number Diff line
@@ -834,9 +834,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        if (!mShouldDrawNotificationBackground) {
            return;
        }
        final boolean clearUndershelf = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.SHOW_NEW_NOTIF_DISMISS, 0 /* show background by default */) == 1;
        if (clearUndershelf) {
        final boolean newFlowHideShelf = Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.SHOW_NEW_NOTIF_DISMISS, 1 /* on by default */) == 1;
        if (newFlowHideShelf) {
            mBackgroundPaint.setColor(Color.TRANSPARENT);
            invalidate();
            return;
+17 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package com.android.systemui.statusbar.notification.row;

import static android.provider.Settings.Secure.SHOW_NOTIFICATION_SNOOZE;
import static android.provider.Settings.Global.SHOW_NEW_NOTIF_DISMISS;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -96,6 +97,7 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
    @Test
    public void testNoAppOpsInSlowSwipe() {
        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, 0);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

        NotificationMenuRow row = new NotificationMenuRow(mContext, mPeopleNotificationIdentifier);
        row.createMenu(mRow, null);
@@ -108,6 +110,7 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
    @Test
    public void testNoSnoozeInSlowSwipe() {
        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, 0);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

        NotificationMenuRow row = new NotificationMenuRow(mContext, mPeopleNotificationIdentifier);
        row.createMenu(mRow, null);
@@ -120,6 +123,7 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
    @Test
    public void testSnoozeInSlowSwipe() {
        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, 1);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

        NotificationMenuRow row = new NotificationMenuRow(mContext, mPeopleNotificationIdentifier);
        row.createMenu(mRow, null);
@@ -129,6 +133,19 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
        assertEquals(2, container.getChildCount());
    }

    @Test
    public void testSlowSwipe_newDismiss() {
        Settings.Secure.putInt(mContext.getContentResolver(), SHOW_NOTIFICATION_SNOOZE, 1);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 1);

        NotificationMenuRow row = new NotificationMenuRow(mContext, mPeopleNotificationIdentifier);
        row.createMenu(mRow, null);

        ViewGroup container = (ViewGroup) row.getMenuView();
        // Clear menu
        assertEquals(0, container.getChildCount());
    }

    @Test
    public void testIsSnappedAndOnSameSide() {
        NotificationMenuRow row = Mockito.spy(