summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/aconfig/systemui.aconfig9
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java41
-rw-r--r--packages/SystemUI/res/drawable/unpin_icon.xml10
-rw-r--r--packages/SystemUI/res/layout/promoted_permission_guts.xml73
-rw-r--r--packages/SystemUI/res/values/strings.xml6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableOutlineView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java29
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java50
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java173
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java2
13 files changed, 61 insertions, 377 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index 228bff6327eb..4693377654f8 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -2021,14 +2021,7 @@ flag {
flag {
name: "permission_helper_ui_rich_ongoing"
namespace: "systemui"
- 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]"
+ description: "[RONs] Guards inline permission helper for demoting RONs"
bug: "379186372"
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
index 4019c7082b36..ce120c51db6a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationMenuRowTest.java
@@ -101,6 +101,46 @@ 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);
@@ -195,7 +235,6 @@ 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);
diff --git a/packages/SystemUI/res/drawable/unpin_icon.xml b/packages/SystemUI/res/drawable/unpin_icon.xml
deleted file mode 100644
index 4e2e15893884..000000000000
--- a/packages/SystemUI/res/drawable/unpin_icon.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<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>
diff --git a/packages/SystemUI/res/layout/promoted_permission_guts.xml b/packages/SystemUI/res/layout/promoted_permission_guts.xml
deleted file mode 100644
index 50e5ae3c05ed..000000000000
--- a/packages/SystemUI/res/layout/promoted_permission_guts.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?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>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 7ef03aef8530..3fdb98b4e00b 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -4195,12 +4195,6 @@
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>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 70e531853197..256d549dc880 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -2684,58 +2684,30 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
}
/**
- * Whether to allow dismissal with the whole-row translation animation.
- *
- * If true, either animation is permissible.
- * If false, usingRTX behavior is forbidden, only clipping animation should be used.
- *
- * Usually either is OK, except for promoted notifications, where we always need to
- * dismiss with content clipping/partial translation animation instead, so that we
- * can show the demotion options.
- * @return
- */
- private boolean allowDismissUsingRowTranslationX() {
- if (Flags.permissionHelperInlineUiRichOngoing()) {
- return !isPromotedOngoing();
- } else {
- // Don't change behavior unless the flag is on.
- return true;
- }
- }
-
- /**
* Set the dismiss behavior of the view.
*
* @param usingRowTranslationX {@code true} if the view should translate using regular
* translationX, otherwise the contents will be
* translated.
- * @param forceUpdateChildren {@code true} to force initialization, {@code false} if lazy
- * behavior is OK.
*/
@Override
- public void setDismissUsingRowTranslationX(boolean usingRowTranslationX,
- boolean forceUpdateChildren) {
- // Before updating dismiss behavior, make sure this is an allowable configuration for this
- // notification.
- usingRowTranslationX = usingRowTranslationX && allowDismissUsingRowTranslationX();
-
- if (forceUpdateChildren || (usingRowTranslationX != mDismissUsingRowTranslationX)) {
+ public void setDismissUsingRowTranslationX(boolean usingRowTranslationX) {
+ if (usingRowTranslationX != mDismissUsingRowTranslationX) {
// In case we were already transitioning, let's switch over!
float previousTranslation = getTranslation();
if (previousTranslation != 0) {
setTranslation(0);
}
- super.setDismissUsingRowTranslationX(usingRowTranslationX, forceUpdateChildren);
+ super.setDismissUsingRowTranslationX(usingRowTranslationX);
if (previousTranslation != 0) {
setTranslation(previousTranslation);
}
-
if (mChildrenContainer != null) {
List<ExpandableNotificationRow> notificationChildren =
mChildrenContainer.getAttachedChildren();
for (int i = 0; i < notificationChildren.size(); i++) {
ExpandableNotificationRow child = notificationChildren.get(i);
- child.setDismissUsingRowTranslationX(usingRowTranslationX, forceUpdateChildren);
+ child.setDismissUsingRowTranslationX(usingRowTranslationX);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableOutlineView.java
index 6c990df5d05e..80cf818e985f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableOutlineView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableOutlineView.java
@@ -292,8 +292,7 @@ public abstract class ExpandableOutlineView extends ExpandableView {
* translationX, otherwise the contents will be
* translated.
*/
- public void setDismissUsingRowTranslationX(boolean usingRowTranslationX,
- boolean forceUpdateChildren) {
+ public void setDismissUsingRowTranslationX(boolean usingRowTranslationX) {
mDismissUsingRowTranslationX = usingRowTranslationX;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
index f4e01bf718d9..cdb78d99538b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java
@@ -29,7 +29,6 @@ import android.content.pm.ShortcutManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -310,7 +309,6 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
});
View gutsView = item.getGutsView();
-
try {
if (gutsView instanceof NotificationSnooze) {
initializeSnoozeView(row, (NotificationSnooze) gutsView);
@@ -324,8 +322,6 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
(PartialConversationInfo) gutsView);
} else if (gutsView instanceof FeedbackInfo) {
initializeFeedbackInfo(row, (FeedbackInfo) gutsView);
- } else if (gutsView instanceof PromotedPermissionGutsContent) {
- initializeDemoteView(row, (PromotedPermissionGutsContent) gutsView);
}
return true;
} catch (Exception e) {
@@ -355,31 +351,6 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
}
/**
- * Sets up the {@link NotificationSnooze} inside the notification row's guts.
- *
- * @param row view to set up the guts for
- * @param demoteGuts view to set up/bind within {@code row}
- */
- private void initializeDemoteView(
- final ExpandableNotificationRow row,
- PromotedPermissionGutsContent demoteGuts) {
- StatusBarNotification sbn = row.getEntry().getSbn();
- demoteGuts.setStatusBarNotification(sbn);
- demoteGuts.setOnDemoteAction(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- try {
- // TODO(b/391661009): Signal AutomaticPromotionCoordinator here
- mNotificationManager.setCanBePromoted(
- sbn.getPackageName(), sbn.getUid(), false, true);
- } catch (RemoteException e) {
- Log.e(TAG, "Couldn't revoke live update permission", e);
- }
- }
- });
- }
-
- /**
* Sets up the {@link FeedbackInfo} inside the notification row's guts.
*
* @param row view to set up the guts for
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 da8e44af15f3..977936fa34fc 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
@@ -273,7 +273,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
} else if (personNotifType >= PeopleNotificationIdentifier.TYPE_FULL_PERSON) {
mInfoItem = createConversationItem(mContext);
} else if (android.app.Flags.uiRichOngoing()
- && android.app.Flags.apiRichOngoing()
&& Flags.permissionHelperUiRichOngoing()
&& sbn.getNotification().isPromotedOngoing()) {
mInfoItem = createPromotedItem(mContext);
@@ -286,12 +285,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
}
mRightMenuItems.add(mInfoItem);
mRightMenuItems.add(mFeedbackItem);
- if (android.app.Flags.uiRichOngoing() && Flags.permissionHelperInlineUiRichOngoing()
- && entry.isPromotedOngoing()) {
- mRightMenuItems.add(createDemoteItem(mContext));
- }
-
-
mLeftMenuItems.addAll(mRightMenuItems);
populateMenuViews();
@@ -313,19 +306,15 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
} else {
mMenuContainer = new FrameLayout(mContext);
}
-
final int showDismissSetting = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_NEW_NOTIF_DISMISS, /* default = */ 1);
final boolean newFlowHideShelf = showDismissSetting == 1;
-
- // Populate menu items if we are using the new permission helper (U+) or if we are using
- // the very old dismiss setting (SC-).
- // TODO: SHOW_NEW_NOTIF_DISMISS==0 case can likely be removed.
- if (Flags.permissionHelperInlineUiRichOngoing() || !newFlowHideShelf) {
- List<MenuItem> menuItems = mOnLeft ? mLeftMenuItems : mRightMenuItems;
- for (int i = 0; i < menuItems.size(); i++) {
- addMenuView(menuItems.get(i), mMenuContainer);
- }
+ if (newFlowHideShelf) {
+ return;
+ }
+ List<MenuItem> menuItems = mOnLeft ? mLeftMenuItems : mRightMenuItems;
+ for (int i = 0; i < menuItems.size(); i++) {
+ addMenuView(menuItems.get(i), mMenuContainer);
}
}
@@ -689,15 +678,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
return snooze;
}
- static MenuItem createDemoteItem(Context context) {
- PromotedPermissionGutsContent demoteContent =
- (PromotedPermissionGutsContent) LayoutInflater.from(context).inflate(
- R.layout.promoted_permission_guts, null, false);
- MenuItem info = new NotificationMenuItem(context, null, demoteContent,
- R.drawable.unpin_icon);
- return info;
- }
-
static NotificationMenuItem createConversationItem(Context context) {
Resources res = context.getResources();
String infoDescription = res.getString(R.string.notification_menu_gear_description);
@@ -705,7 +685,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
(NotificationConversationInfo) LayoutInflater.from(context).inflate(
R.layout.notification_conversation_info, null, false);
return new NotificationMenuItem(context, infoDescription, infoContent,
- NotificationMenuItem.OMIT_FROM_SWIPE_MENU);
+ R.drawable.ic_settings);
}
static NotificationMenuItem createPromotedItem(Context context) {
@@ -715,7 +695,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
(PromotedNotificationInfo) LayoutInflater.from(context).inflate(
R.layout.promoted_notification_info, null, false);
return new NotificationMenuItem(context, infoDescription, infoContent,
- NotificationMenuItem.OMIT_FROM_SWIPE_MENU);
+ R.drawable.ic_settings);
}
static NotificationMenuItem createPartialConversationItem(Context context) {
@@ -725,7 +705,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
(PartialConversationInfo) LayoutInflater.from(context).inflate(
R.layout.partial_conversation_info, null, false);
return new NotificationMenuItem(context, infoDescription, infoContent,
- NotificationMenuItem.OMIT_FROM_SWIPE_MENU);
+ R.drawable.ic_settings);
}
static NotificationMenuItem createInfoItem(Context context) {
@@ -737,14 +717,14 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
NotificationInfo infoContent = (NotificationInfo) LayoutInflater.from(context).inflate(
layoutId, null, false);
return new NotificationMenuItem(context, infoDescription, infoContent,
- NotificationMenuItem.OMIT_FROM_SWIPE_MENU);
+ R.drawable.ic_settings);
}
static MenuItem createFeedbackItem(Context context) {
FeedbackInfo feedbackContent = (FeedbackInfo) LayoutInflater.from(context).inflate(
R.layout.feedback_info, null, false);
MenuItem info = new NotificationMenuItem(context, null, feedbackContent,
- NotificationMenuItem.OMIT_FROM_SWIPE_MENU);
+ -1 /*don't show in slow swipe menu */);
return info;
}
@@ -781,10 +761,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
@Override
public boolean isWithinSnapMenuThreshold() {
- if (getSpaceForMenu() == 0) {
- // don't snap open if there are no items
- return false;
- }
float translation = getTranslation();
float snapBackThreshold = getSnapBackThreshold();
float targetRight = getDismissThreshold();
@@ -826,10 +802,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
}
public static class NotificationMenuItem implements MenuItem {
-
- // Constant signaling that this MenuItem should not appear in slow swipe.
- public static final int OMIT_FROM_SWIPE_MENU = -1;
-
View mMenuView;
GutsContent mGutsContent;
String mContentDescription;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java
index 769f0b5a4fa4..01ee788f7fd7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java
@@ -80,7 +80,6 @@ public class PromotedNotificationInfo extends NotificationInfo {
assistantFeedbackController, metricsLogger, onCloseClick);
mNotificationManager = iNotificationManager;
-
mPackageDemotionInteractor = packageDemotionInteractor;
bindDemote(entry.getSbn(), pkg);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java
deleted file mode 100644
index 222a1f4d8adf..000000000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedPermissionGutsContent.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-package com.android.systemui.statusbar.notification.row;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.service.notification.StatusBarNotification;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.systemui.res.R;
-
-/**
- * This GutsContent shows an explanatory interstitial telling the user they've just revoked this
- * app's permission to post Promoted/Live notifications.
- * If the guts are dismissed without further action, the revocation is committed.
- * If the user hits undo, the permission is not revoked.
- */
-public class PromotedPermissionGutsContent extends LinearLayout
- implements NotificationGuts.GutsContent, View.OnClickListener {
-
- private static final String TAG = "SnoozyPromotedGuts";
-
- private NotificationGuts mGutsContainer;
- private StatusBarNotification mSbn;
-
- private TextView mUndoButton;
-
- private MetricsLogger mMetricsLogger = new MetricsLogger();
- private OnClickListener mDemoteAction;
-
- public PromotedPermissionGutsContent(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
-
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
- mUndoButton = (TextView) findViewById(R.id.undo);
- mUndoButton.setOnClickListener(this);
- mUndoButton.setContentDescription(
- getContext().getString(R.string.snooze_undo_content_description));
-
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- dispatchConfigurationChanged(getResources().getConfiguration());
- }
-
- /**
- * Update the content description of the snooze view based on the snooze option and whether the
- * snooze options are expanded or not.
- * For example, this will be something like "Collapsed\u2029Snooze for 1 hour". The paragraph
- * separator is added to introduce a break in speech, to match what TalkBack does by default
- * when you e.g. press on a notification.
- */
- private void updateContentDescription() {
- //
- }
-
-
- @Override
- public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
- if (super.performAccessibilityActionInternal(action, arguments)) {
- return true;
- }
- if (action == R.id.action_snooze_undo) {
- undoDemote(mUndoButton);
- return true;
- }
- return false;
- }
-
- /**
- * TODO docs
- * @param sbn
- */
- public void setStatusBarNotification(StatusBarNotification sbn) {
- mSbn = sbn;
- TextView demoteExplanation = (TextView) findViewById(R.id.demote_explain);
- demoteExplanation.setText(mContext.getResources().getString(R.string.demote_explain_text,
- mSbn.getPackageName()));
- }
-
- @Override
- public void onClick(View v) {
- if (mGutsContainer != null) {
- mGutsContainer.resetFalsingCheck();
- }
- final int id = v.getId();
- if (id == R.id.undo) {
- undoDemote(v);
- }
-
- }
-
- private void undoDemote(View v) {
- // Don't commit the demote action, instead log the undo and dismiss the view.
- mGutsContainer.closeControls(v, /* save= */ false);
- }
-
- @Override
- public int getActualHeight() {
- return getHeight();
- }
-
- @Override
- public boolean willBeRemoved() {
- return false;
- }
-
- @Override
- public View getContentView() {
- return this;
- }
-
- @Override
- public void setGutsParent(NotificationGuts guts) {
- mGutsContainer = guts;
- }
-
- @Override
- public boolean handleCloseControls(boolean save, boolean force) {
- if (!save) {
- // Undo changes and let the guts handle closing the view
- return false;
- } else {
- // Commit demote action.
- mDemoteAction.onClick(this);
- return false;
- }
- }
-
- @Override
- public boolean isLeavebehind() {
- return true;
- }
-
- @Override
- public boolean shouldBeSavedOnClose() {
- return true;
- }
-
- @Override
- public boolean needsFalsingProtection() {
- return false;
- }
-
- public void setOnDemoteAction(OnClickListener demoteAction) {
- mDemoteAction = demoteAction;
- }
-
-}
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 503256accff0..9fea75048e3e 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
@@ -3220,7 +3220,8 @@ public class NotificationStackScrollLayout
updateAnimationState(child);
updateChronometerForChild(child);
if (child instanceof ExpandableNotificationRow row) {
- row.setDismissUsingRowTranslationX(mDismissUsingRowTranslationX, /* force= */ true);
+ row.setDismissUsingRowTranslationX(mDismissUsingRowTranslationX);
+
}
}
@@ -6156,7 +6157,7 @@ public class NotificationStackScrollLayout
View child = getChildAt(i);
if (child instanceof ExpandableNotificationRow) {
((ExpandableNotificationRow) child).setDismissUsingRowTranslationX(
- dismissUsingRowTranslationX, /* force= */ false);
+ dismissUsingRowTranslationX);
}
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index bc7ab9d4fe3c..2ea4e7f67b3c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -582,7 +582,7 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
public void testIconScrollXAfterTranslationAndReset() throws Exception {
ExpandableNotificationRow group = mNotificationTestHelper.createGroup();
- group.setDismissUsingRowTranslationX(false, false);
+ group.setDismissUsingRowTranslationX(false);
group.setTranslation(50);
assertEquals(50, -group.getEntry().getIcons().getShelfIcon().getScrollX());