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

Commit 82a05b63 authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Notifications: Inline demote item.

Permission revocation as MenuItem, with undo flow.

Separate flag from Guts/back of card implementation.

Still icon-only. Text coming soon.

Bug: 379186372
Test: atest SystemUiTests
Flag: com.android.systemui.permission_helper_inline_ui_rich_ongoing
Change-Id: Iac339601f74c950cffb66a8e64bc75cd23c5ad55
parent 3fe3512c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2033,7 +2033,14 @@ flag {
flag {
  name: "permission_helper_ui_rich_ongoing"
  namespace: "systemui"
  description: "[RONs] Guards inline permission helper for demoting RONs"
  description: "[RONs] Guards inline permission helper for demoting RONs [Guts/card version]"
  bug: "379186372"
}

flag {
  name: "permission_helper_inline_ui_rich_ongoing"
  namespace: "systemui"
  description: "[RONs] Guards inline permission helper for demoting RONs [Inline version]"
  bug: "379186372"
}

+1 −40
Original line number Diff line number Diff line
@@ -96,46 +96,6 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
        row.resetMenu();
    }


    @Test
    public void testNoAppOpsInSlowSwipe() {
        when(mRow.getShowSnooze()).thenReturn(false);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

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

        ViewGroup container = (ViewGroup) row.getMenuView();
        // noti blocking
        assertEquals(1, container.getChildCount());
    }

    @Test
    public void testNoSnoozeInSlowSwipe() {
        when(mRow.getShowSnooze()).thenReturn(false);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

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

        ViewGroup container = (ViewGroup) row.getMenuView();
        // just for noti blocking
        assertEquals(1, container.getChildCount());
    }

    @Test
    public void testSnoozeInSlowSwipe() {
        when(mRow.getShowSnooze()).thenReturn(true);
        Settings.Global.putInt(mContext.getContentResolver(), SHOW_NEW_NOTIF_DISMISS, 0);

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

        ViewGroup container = (ViewGroup) row.getMenuView();
        // one for snooze and one for noti blocking
        assertEquals(2, container.getChildCount());
    }

    @Test
    public void testSlowSwipe_newDismiss() {
        when(mRow.getShowSnooze()).thenReturn(true);
@@ -230,6 +190,7 @@ public class NotificationMenuRowTest extends LeakCheckedTest {
                new NotificationMenuRow(mContext, mPeopleNotificationIdentifier));
        doReturn(30f).when(row).getSnapBackThreshold();
        doReturn(50f).when(row).getDismissThreshold();
        doReturn(70).when(row).getSpaceForMenu();

        when(row.isMenuOnLeft()).thenReturn(true);
        when(row.getTranslation()).thenReturn(40f);
+10 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="960"
    android:viewportHeight="960"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M680,120L680,200L640,200L640,527L560,447L560,200L400,200L400,287L313,200L280,167L280,167L280,120L680,120ZM480,920L440,880L440,640L240,640L240,560L320,480L320,434L56,168L112,112L848,848L790,904L526,640L520,640L520,880L480,920ZM354,560L446,560L402,516L400,514L354,560ZM480,367L480,367L480,367L480,367ZM402,516L402,516L402,516L402,516Z"/>
</vector>
+73 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2017, The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<com.android.systemui.statusbar.notification.row.PromotedPermissionGutsContent
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="2dp"
    android:paddingBottom="2dp"
    android:background="@androidprv:color/materialColorSurfaceContainerHigh"
    android:theme="@style/Theme.SystemUI"
    >

    <RelativeLayout
        android:id="@+id/promoted_guts"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/notification_2025_min_height">

        <ImageView
            android:id="@+id/unpin_icon"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/unpin_icon"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:padding="@dimen/notification_importance_button_padding"
            />

        <TextView
            android:id="@+id/demote_explain"
            android:layout_width="400dp"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@id/unpin_icon"
            android:layout_toLeftOf="@id/undo"
            android:padding="@*android:dimen/notification_content_margin_end"
            android:textColor="@androidprv:color/materialColorOnSurface"
            android:minWidth="@dimen/min_clickable_item_size"
            android:minHeight="@dimen/min_clickable_item_size"
            style="@style/TextAppearance.NotificationInfo.Button" />

        <TextView
            android:id="@+id/undo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/unpin_icon"
            android:layout_alignParentRight="true"
            android:padding="@*android:dimen/notification_content_margin_end"
            android:textColor="@androidprv:color/materialColorOnSurface"
            android:minWidth="@dimen/min_clickable_item_size"
            android:minHeight="@dimen/min_clickable_item_size"
            android:text="@string/snooze_undo"
            style="@style/TextAppearance.NotificationInfo.Button" />
    </RelativeLayout>

</com.android.systemui.statusbar.notification.row.PromotedPermissionGutsContent>
+6 −0
Original line number Diff line number Diff line
@@ -4188,6 +4188,12 @@
        All Quick Settings tiles will reset to the device’s original settings
    </string>


    <!-- Content of the Reset Tiles dialog in QS Edit mode. [CHAR LIMIT=NONE] -->
    <string name="demote_explain_text">
         <xliff:g id="application" example= "Superfast Food Delivery">%1$s</xliff:g> will no longer show Live Updates here. You can change this any time in Settings.
    </string>

    <!-- Template that joins disabled message with the label for the voice over. [CHAR LIMIT=NONE] -->
    <string name="volume_slider_disabled_message_template"><xliff:g example="Notification" id="stream_name">%1$s</xliff:g>, <xliff:g example="Disabled because ring is muted" id="disabled_message">%2$s</xliff:g></string>
</resources>
Loading