Merge "Reset selected Notification importance after closing the guts" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae8173760e
@@ -165,7 +165,7 @@ public class FeedbackInfo extends LinearLayout implements NotificationGuts.GutsC
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void positiveFeedback(View v) {
|
private void positiveFeedback(View v) {
|
||||||
mGutsContainer.closeControls(v, false);
|
mGutsContainer.closeControls(v, /* save= */ false);
|
||||||
handleFeedback(true);
|
handleFeedback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ public class FeedbackInfo extends LinearLayout implements NotificationGuts.GutsC
|
|||||||
menuItem = mMenuRowPlugin.getLongpressMenuItem(mContext);
|
menuItem = mMenuRowPlugin.getLongpressMenuItem(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
mGutsContainer.closeControls(v, false);
|
mGutsContainer.closeControls(v, /* save= */ false);
|
||||||
mNotificationGutsManager.openGuts(mExpandableNotificationRow, 0, 0, menuItem);
|
mNotificationGutsManager.openGuts(mExpandableNotificationRow, 0, 0, menuItem);
|
||||||
handleFeedback(false);
|
handleFeedback(false);
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ public class FeedbackInfo extends LinearLayout implements NotificationGuts.GutsC
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void closeControls(View v) {
|
private void closeControls(View v) {
|
||||||
mGutsContainer.closeControls(v, false);
|
mGutsContainer.closeControls(v, /* save= */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -232,7 +232,7 @@ public class FeedbackInfo extends LinearLayout implements NotificationGuts.GutsC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSavedOnClose() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
mShadeController.animateCollapsePanels();
|
mShadeController.animateCollapsePanels();
|
||||||
mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
|
mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
|
||||||
}
|
}
|
||||||
mGutsContainer.closeControls(v, true);
|
mGutsContainer.closeControls(v, /* save= */ true);
|
||||||
};
|
};
|
||||||
|
|
||||||
public NotificationConversationInfo(Context context, AttributeSet attrs) {
|
public NotificationConversationInfo(Context context, AttributeSet attrs) {
|
||||||
@@ -186,7 +186,6 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void bindNotification(
|
public void bindNotification(
|
||||||
@Action int selectedAction,
|
|
||||||
ShortcutManager shortcutManager,
|
ShortcutManager shortcutManager,
|
||||||
PackageManager pm,
|
PackageManager pm,
|
||||||
PeopleSpaceWidgetManager peopleSpaceWidgetManager,
|
PeopleSpaceWidgetManager peopleSpaceWidgetManager,
|
||||||
@@ -205,8 +204,6 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
OnConversationSettingsClickListener onConversationSettingsClickListener,
|
OnConversationSettingsClickListener onConversationSettingsClickListener,
|
||||||
Optional<BubblesManager> bubblesManagerOptional,
|
Optional<BubblesManager> bubblesManagerOptional,
|
||||||
ShadeController shadeController) {
|
ShadeController shadeController) {
|
||||||
mPressedApply = false;
|
|
||||||
mSelectedAction = selectedAction;
|
|
||||||
mINotificationManager = iNotificationManager;
|
mINotificationManager = iNotificationManager;
|
||||||
mPeopleSpaceWidgetManager = peopleSpaceWidgetManager;
|
mPeopleSpaceWidgetManager = peopleSpaceWidgetManager;
|
||||||
mOnUserInteractionCallback = onUserInteractionCallback;
|
mOnUserInteractionCallback = onUserInteractionCallback;
|
||||||
@@ -417,9 +414,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedClosing() {
|
public void onFinishedClosing() { }
|
||||||
mSelectedAction = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean needsFalsingProtection() {
|
public boolean needsFalsingProtection() {
|
||||||
@@ -564,7 +559,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSavedOnClose() {
|
||||||
return mPressedApply;
|
return mPressedApply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,6 +573,12 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
if (save && mSelectedAction > -1) {
|
if (save && mSelectedAction > -1) {
|
||||||
updateChannel();
|
updateChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the selected importance when closing, so when when we open again,
|
||||||
|
// we starts from a clean state.
|
||||||
|
mSelectedAction = -1;
|
||||||
|
mPressedApply = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case AccessibilityNodeInfo.ACTION_LONG_CLICK:
|
case AccessibilityNodeInfo.ACTION_LONG_CLICK:
|
||||||
closeControls(host, false);
|
closeControls(host, /* save= */ false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
/**
|
/**
|
||||||
* Return whether something changed and needs to be saved, possibly requiring a bouncer.
|
* Return whether something changed and needs to be saved, possibly requiring a bouncer.
|
||||||
*/
|
*/
|
||||||
boolean shouldBeSaved();
|
boolean shouldBeSavedOnClose();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the guts view has finished its close animation.
|
* Called when the guts view has finished its close animation.
|
||||||
@@ -259,7 +259,7 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
if (mGutsContent != null) {
|
if (mGutsContent != null) {
|
||||||
if ((mGutsContent.isLeavebehind() && leavebehinds)
|
if ((mGutsContent.isLeavebehind() && leavebehinds)
|
||||||
|| (!mGutsContent.isLeavebehind() && controls)) {
|
|| (!mGutsContent.isLeavebehind() && controls)) {
|
||||||
closeControls(x, y, mGutsContent.shouldBeSaved(), force);
|
closeControls(x, y, mGutsContent.shouldBeSavedOnClose(), force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -463,7 +463,6 @@ public class NotificationGutsManager implements NotifGutsViewManager {
|
|||||||
R.dimen.notification_guts_conversation_icon_size));
|
R.dimen.notification_guts_conversation_icon_size));
|
||||||
|
|
||||||
notificationInfoView.bindNotification(
|
notificationInfoView.bindNotification(
|
||||||
notificationInfoView.getSelectedAction(),
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
pmUser,
|
pmUser,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
|
|||||||
// used by standard ui
|
// used by standard ui
|
||||||
private OnClickListener mOnDismissSettings = v -> {
|
private OnClickListener mOnDismissSettings = v -> {
|
||||||
mPressedApply = true;
|
mPressedApply = true;
|
||||||
mGutsContainer.closeControls(v, true);
|
mGutsContainer.closeControls(v, /* save= */ true);
|
||||||
};
|
};
|
||||||
|
|
||||||
public NotificationInfo(Context context, AttributeSet attrs) {
|
public NotificationInfo(Context context, AttributeSet attrs) {
|
||||||
@@ -541,10 +541,6 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedClosing() {
|
public void onFinishedClosing() {
|
||||||
if (mChosenImportance != null) {
|
|
||||||
mStartingChannelImportance = mChosenImportance;
|
|
||||||
}
|
|
||||||
|
|
||||||
bindInlineControls();
|
bindInlineControls();
|
||||||
|
|
||||||
logUiEvent(NotificationControlsEvent.NOTIFICATION_CONTROLS_CLOSE);
|
logUiEvent(NotificationControlsEvent.NOTIFICATION_CONTROLS_CLOSE);
|
||||||
@@ -604,7 +600,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSavedOnClose() {
|
||||||
return mPressedApply;
|
return mPressedApply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,6 +623,12 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
|
|||||||
if (save) {
|
if (save) {
|
||||||
saveImportance();
|
saveImportance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear the selected importance when closing, so when when we open again,
|
||||||
|
// we starts from a clean state.
|
||||||
|
mChosenImportance = null;
|
||||||
|
mPressedApply = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
private void undoSnooze(View v) {
|
private void undoSnooze(View v) {
|
||||||
mSelectedOption = null;
|
mSelectedOption = null;
|
||||||
showSnoozeOptions(false);
|
showSnoozeOptions(false);
|
||||||
mGutsContainer.closeControls(v, false);
|
mGutsContainer.closeControls(v, /* save= */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -433,7 +433,7 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSavedOnClose() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,22 +16,13 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.notification.row;
|
package com.android.systemui.statusbar.notification.row;
|
||||||
|
|
||||||
import static android.app.Notification.EXTRA_IS_GROUP_CONVERSATION;
|
|
||||||
|
|
||||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
|
||||||
import android.app.INotificationManager;
|
import android.app.INotificationManager;
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationChannelGroup;
|
import android.app.NotificationChannelGroup;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.Icon;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -46,8 +37,6 @@ import com.android.internal.annotations.VisibleForTesting;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,8 +60,6 @@ public class PartialConversationInfo extends LinearLayout implements
|
|||||||
private Set<NotificationChannel> mUniqueChannelsInRow;
|
private Set<NotificationChannel> mUniqueChannelsInRow;
|
||||||
private Drawable mPkgIcon;
|
private Drawable mPkgIcon;
|
||||||
|
|
||||||
private @Action int mSelectedAction = -1;
|
|
||||||
private boolean mPressedApply;
|
|
||||||
private boolean mPresentingChannelEditorDialog = false;
|
private boolean mPresentingChannelEditorDialog = false;
|
||||||
|
|
||||||
private NotificationInfo.OnSettingsClickListener mOnSettingsClickListener;
|
private NotificationInfo.OnSettingsClickListener mOnSettingsClickListener;
|
||||||
@@ -82,14 +69,8 @@ public class PartialConversationInfo extends LinearLayout implements
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mSkipPost = false;
|
boolean mSkipPost = false;
|
||||||
|
|
||||||
@Retention(SOURCE)
|
|
||||||
@IntDef({ACTION_SETTINGS})
|
|
||||||
private @interface Action {}
|
|
||||||
static final int ACTION_SETTINGS = 5;
|
|
||||||
|
|
||||||
private OnClickListener mOnDone = v -> {
|
private OnClickListener mOnDone = v -> {
|
||||||
mPressedApply = true;
|
mGutsContainer.closeControls(v, /* save= */ false);
|
||||||
mGutsContainer.closeControls(v, true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public PartialConversationInfo(Context context, AttributeSet attrs) {
|
public PartialConversationInfo(Context context, AttributeSet attrs) {
|
||||||
@@ -107,7 +88,6 @@ public class PartialConversationInfo extends LinearLayout implements
|
|||||||
NotificationInfo.OnSettingsClickListener onSettingsClick,
|
NotificationInfo.OnSettingsClickListener onSettingsClick,
|
||||||
boolean isDeviceProvisioned,
|
boolean isDeviceProvisioned,
|
||||||
boolean isNonBlockable) {
|
boolean isNonBlockable) {
|
||||||
mSelectedAction = -1;
|
|
||||||
mINotificationManager = iNotificationManager;
|
mINotificationManager = iNotificationManager;
|
||||||
mPackageName = pkg;
|
mPackageName = pkg;
|
||||||
mSbn = entry.getSbn();
|
mSbn = entry.getSbn();
|
||||||
@@ -286,8 +266,8 @@ public class PartialConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSavedOnClose() {
|
||||||
return mPressedApply;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testBindNotification_SetsShortcutIcon() {
|
public void testBindNotification_SetsShortcutIcon() {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -261,7 +260,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
public void testBindNotification_SetsTextApplicationName() {
|
public void testBindNotification_SetsTextApplicationName() {
|
||||||
when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name");
|
when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name");
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -314,7 +312,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setGroup(group.getId());
|
mConversationChannel.setGroup(group.getId());
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -340,7 +337,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testBindNotification_GroupNameHiddenIfNoGroup() {
|
public void testBindNotification_GroupNameHiddenIfNoGroup() {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -365,7 +361,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testBindNotification_noDelegate() {
|
public void testBindNotification_noDelegate() {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -401,7 +396,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
.setShortcutInfo(mShortcutInfo)
|
.setShortcutInfo(mShortcutInfo)
|
||||||
.build();
|
.build();
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -427,7 +421,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
public void testBindNotification_SetsOnClickListenerForSettings() {
|
public void testBindNotification_SetsOnClickListenerForSettings() {
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -457,7 +450,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() {
|
public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -482,7 +474,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
public void testBindNotification_SettingsButtonInvisibleWhenDeviceUnprovisioned() {
|
public void testBindNotification_SettingsButtonInvisibleWhenDeviceUnprovisioned() {
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -511,7 +502,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportance(IMPORTANCE_LOW);
|
mConversationChannel.setImportance(IMPORTANCE_LOW);
|
||||||
mConversationChannel.setImportantConversation(true);
|
mConversationChannel.setImportantConversation(true);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -540,7 +530,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mConversationChannel.setAllowBubbles(true);
|
mConversationChannel.setAllowBubbles(true);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -572,7 +561,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mConversationChannel.setAllowBubbles(true);
|
mConversationChannel.setAllowBubbles(true);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -610,7 +598,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mConversationChannel.setAllowBubbles(false);
|
mConversationChannel.setAllowBubbles(false);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -639,7 +626,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mConversationChannel.setAllowBubbles(false);
|
mConversationChannel.setAllowBubbles(false);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -675,7 +661,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mConversationChannel.setAllowBubbles(true);
|
mConversationChannel.setAllowBubbles(true);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -704,7 +689,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -735,7 +719,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
.isEqualTo(GONE);
|
.isEqualTo(GONE);
|
||||||
|
|
||||||
// no changes until hit done
|
// no changes until hit done
|
||||||
assertFalse(mNotificationInfo.shouldBeSaved());
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
||||||
anyString(), anyInt(), any());
|
anyString(), anyInt(), any());
|
||||||
assertFalse(mConversationChannel.isImportantConversation());
|
assertFalse(mConversationChannel.isImportantConversation());
|
||||||
@@ -749,7 +733,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportance(IMPORTANCE_LOW);
|
mConversationChannel.setImportance(IMPORTANCE_LOW);
|
||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -779,7 +762,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
.isEqualTo(GONE);
|
.isEqualTo(GONE);
|
||||||
|
|
||||||
// no changes until hit done
|
// no changes until hit done
|
||||||
assertFalse(mNotificationInfo.shouldBeSaved());
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
||||||
anyString(), anyInt(), any());
|
anyString(), anyInt(), any());
|
||||||
assertFalse(mConversationChannel.isImportantConversation());
|
assertFalse(mConversationChannel.isImportantConversation());
|
||||||
@@ -793,7 +776,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -825,7 +807,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
.isEqualTo(VISIBLE);
|
.isEqualTo(VISIBLE);
|
||||||
|
|
||||||
// no changes until save
|
// no changes until save
|
||||||
assertFalse(mNotificationInfo.shouldBeSaved());
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
|
||||||
anyString(), anyInt(), any());
|
anyString(), anyInt(), any());
|
||||||
assertEquals(IMPORTANCE_DEFAULT, mConversationChannel.getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, mConversationChannel.getImportance());
|
||||||
@@ -838,7 +820,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -868,6 +849,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
assertTrue(captor.getValue().isImportantConversation());
|
assertTrue(captor.getValue().isImportantConversation());
|
||||||
assertTrue(captor.getValue().canBubble());
|
assertTrue(captor.getValue().canBubble());
|
||||||
assertEquals(IMPORTANCE_DEFAULT, captor.getValue().getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, captor.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -876,7 +858,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportance(9);
|
mConversationChannel.setImportance(9);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -913,7 +894,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(true);
|
mConversationChannel.setImportantConversation(true);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -954,7 +934,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// WHEN we indicate no selected action
|
// WHEN we indicate no selected action
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1, // no action selected by default
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -984,8 +963,8 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
|
|
||||||
// WHEN we indicate the selected action should be "Favorite"
|
// WHEN we indicate the selected action should be "Favorite"
|
||||||
|
mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
NotificationConversationInfo.ACTION_FAVORITE, // "Favorite" selected by default
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1015,7 +994,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
||||||
mConversationChannel.setImportantConversation(true);
|
mConversationChannel.setImportantConversation(true);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1044,6 +1022,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
assertFalse(captor.getValue().isImportantConversation());
|
assertFalse(captor.getValue().isImportantConversation());
|
||||||
assertFalse(captor.getValue().canBubble());
|
assertFalse(captor.getValue().canBubble());
|
||||||
assertEquals(IMPORTANCE_HIGH, captor.getValue().getImportance());
|
assertEquals(IMPORTANCE_HIGH, captor.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1052,7 +1031,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
||||||
mConversationChannel.setImportantConversation(false);
|
mConversationChannel.setImportantConversation(false);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1089,7 +1067,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1125,7 +1102,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setAllowBubbles(true);
|
mConversationChannel.setAllowBubbles(true);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1155,12 +1131,46 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
assertFalse(captor.getValue().isImportantConversation());
|
assertFalse(captor.getValue().isImportantConversation());
|
||||||
assertFalse(captor.getValue().canBubble());
|
assertFalse(captor.getValue().canBubble());
|
||||||
assertEquals(IMPORTANCE_LOW, captor.getValue().getImportance());
|
assertEquals(IMPORTANCE_LOW, captor.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSilence_closeGutsThenTryToSave() {
|
||||||
|
mConversationChannel.setImportance(IMPORTANCE_DEFAULT);
|
||||||
|
mConversationChannel.setImportantConversation(true);
|
||||||
|
mConversationChannel.setAllowBubbles(true);
|
||||||
|
|
||||||
|
mNotificationInfo.bindNotification(
|
||||||
|
mShortcutManager,
|
||||||
|
mMockPackageManager,
|
||||||
|
mPeopleSpaceWidgetManager,
|
||||||
|
mMockINotificationManager,
|
||||||
|
mOnUserInteractionCallback,
|
||||||
|
TEST_PACKAGE_NAME,
|
||||||
|
mNotificationChannel,
|
||||||
|
mEntry,
|
||||||
|
mBubbleMetadata,
|
||||||
|
null,
|
||||||
|
mIconFactory,
|
||||||
|
mContext,
|
||||||
|
true,
|
||||||
|
mTestHandler,
|
||||||
|
mTestHandler, null, Optional.of(mBubblesManager),
|
||||||
|
mShadeController);
|
||||||
|
|
||||||
|
mNotificationInfo.findViewById(R.id.silence).performClick();
|
||||||
|
mNotificationInfo.handleCloseControls(false, false);
|
||||||
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
|
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertEquals(IMPORTANCE_DEFAULT, mConversationChannel.getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBindNotification_createsNewChannel() throws Exception {
|
public void testBindNotification_createsNewChannel() throws Exception {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1186,7 +1196,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
public void testBindNotification_doesNotCreateNewChannelIfExists() throws Exception {
|
public void testBindNotification_doesNotCreateNewChannelIfExists() throws Exception {
|
||||||
mNotificationChannel.setConversationId("", CONVERSATION_ID);
|
mNotificationChannel.setConversationId("", CONVERSATION_ID);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1213,7 +1222,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
//WHEN channel is default importance
|
//WHEN channel is default importance
|
||||||
mNotificationChannel.setImportantConversation(false);
|
mNotificationChannel.setImportantConversation(false);
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1244,7 +1252,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testSelectDefaultDoesNotRequestPinPeopleTile() {
|
public void testSelectDefaultDoesNotRequestPinPeopleTile() {
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
@@ -1279,7 +1286,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mConversationChannel.setImportantConversation(true);
|
mConversationChannel.setImportantConversation(true);
|
||||||
|
|
||||||
mNotificationInfo.bindNotification(
|
mNotificationInfo.bindNotification(
|
||||||
-1,
|
|
||||||
mShortcutManager,
|
mShortcutManager,
|
||||||
mMockPackageManager,
|
mMockPackageManager,
|
||||||
mPeopleSpaceWidgetManager,
|
mPeopleSpaceWidgetManager,
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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.testing.AndroidTestingRunner
|
||||||
|
import android.testing.TestableLooper.RunWithLooper
|
||||||
|
import android.testing.ViewUtils
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import androidx.test.filters.SmallTest
|
||||||
|
import com.android.systemui.R
|
||||||
|
import com.android.systemui.SysuiTestCase
|
||||||
|
import org.junit.After
|
||||||
|
import org.junit.Before
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
import org.mockito.Mock
|
||||||
|
import org.mockito.Mockito.verify
|
||||||
|
import org.mockito.Mockito.`when` as whenever
|
||||||
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
|
@SmallTest
|
||||||
|
@RunWith(AndroidTestingRunner::class)
|
||||||
|
@RunWithLooper
|
||||||
|
class NotificationGutsTest : SysuiTestCase() {
|
||||||
|
|
||||||
|
private lateinit var guts: NotificationGuts
|
||||||
|
private lateinit var gutsContentView: View
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private lateinit var gutsContent: NotificationGuts.GutsContent
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private lateinit var gutsClosedListener: NotificationGuts.OnGutsClosedListener
|
||||||
|
|
||||||
|
@Before
|
||||||
|
fun setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this)
|
||||||
|
|
||||||
|
val layoutInflater = LayoutInflater.from(mContext)
|
||||||
|
guts = layoutInflater.inflate(R.layout.notification_guts, null) as NotificationGuts
|
||||||
|
gutsContentView = View(mContext)
|
||||||
|
|
||||||
|
whenever(gutsContent.contentView).thenReturn(gutsContentView)
|
||||||
|
|
||||||
|
ViewUtils.attachView(guts)
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
ViewUtils.detachView(guts)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun setGutsContent() {
|
||||||
|
guts.gutsContent = gutsContent
|
||||||
|
|
||||||
|
verify(gutsContent).setGutsParent(guts)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun openControls() {
|
||||||
|
guts.gutsContent = gutsContent
|
||||||
|
|
||||||
|
guts.openControls(true, 0, 0, false, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun closeControlsWithSave() {
|
||||||
|
guts.gutsContent = gutsContent
|
||||||
|
guts.setClosedListener(gutsClosedListener)
|
||||||
|
|
||||||
|
guts.closeControls(gutsContentView, true)
|
||||||
|
|
||||||
|
verify(gutsContent).handleCloseControls(true, false)
|
||||||
|
verify(gutsClosedListener).onGutsClosed(guts)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun closeControlsWithoutSave() {
|
||||||
|
guts.gutsContent = gutsContent
|
||||||
|
guts.setClosedListener(gutsClosedListener)
|
||||||
|
|
||||||
|
guts.closeControls(gutsContentView, false)
|
||||||
|
|
||||||
|
verify(gutsContent).handleCloseControls(false, false)
|
||||||
|
verify(gutsClosedListener).onGutsClosed(guts)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,6 +50,7 @@ import android.content.pm.ApplicationInfo;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
@@ -1090,6 +1091,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
mUiEventLogger.eventId(0));
|
mUiEventLogger.eventId(0));
|
||||||
assertEquals(NotificationControlsEvent.NOTIFICATION_CONTROLS_SAVE_IMPORTANCE.getId(),
|
assertEquals(NotificationControlsEvent.NOTIFICATION_CONTROLS_SAVE_IMPORTANCE.getId(),
|
||||||
mUiEventLogger.eventId(1));
|
mUiEventLogger.eventId(1));
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1124,6 +1126,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
assertTrue((updated.getValue().getUserLockedFields()
|
assertTrue((updated.getValue().getUserLockedFields()
|
||||||
& USER_LOCKED_IMPORTANCE) != 0);
|
& USER_LOCKED_IMPORTANCE) != 0);
|
||||||
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1156,6 +1159,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
verify(mMockINotificationManager, times(1)).unlockNotificationChannel(
|
verify(mMockINotificationManager, times(1)).unlockNotificationChannel(
|
||||||
anyString(), eq(TEST_UID), any());
|
anyString(), eq(TEST_UID), any());
|
||||||
assertEquals(IMPORTANCE_DEFAULT, mNotificationChannel.getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, mNotificationChannel.getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1191,6 +1195,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
assertTrue((updated.getValue().getUserLockedFields()
|
assertTrue((updated.getValue().getUserLockedFields()
|
||||||
& USER_LOCKED_IMPORTANCE) != 0);
|
& USER_LOCKED_IMPORTANCE) != 0);
|
||||||
assertEquals(IMPORTANCE_LOW, updated.getValue().getImportance());
|
assertEquals(IMPORTANCE_LOW, updated.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1229,6 +1234,37 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
anyString(), eq(TEST_UID), updated.capture());
|
anyString(), eq(TEST_UID), updated.capture());
|
||||||
assertTrue((updated.getValue().getUserLockedFields() & USER_LOCKED_IMPORTANCE) != 0);
|
assertTrue((updated.getValue().getUserLockedFields() & USER_LOCKED_IMPORTANCE) != 0);
|
||||||
assertEquals(IMPORTANCE_MIN, updated.getValue().getImportance());
|
assertEquals(IMPORTANCE_MIN, updated.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSilence_closeGutsThenTryToSave() throws RemoteException {
|
||||||
|
mNotificationChannel.setImportance(IMPORTANCE_DEFAULT);
|
||||||
|
mNotificationInfo.bindNotification(
|
||||||
|
mMockPackageManager,
|
||||||
|
mMockINotificationManager,
|
||||||
|
mOnUserInteractionCallback,
|
||||||
|
mChannelEditorDialogController,
|
||||||
|
TEST_PACKAGE_NAME,
|
||||||
|
mNotificationChannel,
|
||||||
|
mNotificationChannelSet,
|
||||||
|
mEntry,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
mUiEventLogger,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
mAssistantFeedbackController);
|
||||||
|
|
||||||
|
mNotificationInfo.findViewById(R.id.silence).performClick();
|
||||||
|
mNotificationInfo.handleCloseControls(false, false);
|
||||||
|
mNotificationInfo.handleCloseControls(true, false);
|
||||||
|
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertEquals(IMPORTANCE_DEFAULT, mNotificationChannel.getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1267,6 +1303,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
anyString(), eq(TEST_UID), updated.capture());
|
anyString(), eq(TEST_UID), updated.capture());
|
||||||
assertTrue((updated.getValue().getUserLockedFields() & USER_LOCKED_IMPORTANCE) != 0);
|
assertTrue((updated.getValue().getUserLockedFields() & USER_LOCKED_IMPORTANCE) != 0);
|
||||||
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1294,6 +1331,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
mNotificationInfo.handleCloseControls(true, false);
|
mNotificationInfo.handleCloseControls(true, false);
|
||||||
|
|
||||||
verify(mOnUserInteractionCallback).onImportanceChanged(mEntry);
|
verify(mOnUserInteractionCallback).onImportanceChanged(mEntry);
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1360,6 +1398,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
assertTrue((updated.getValue().getUserLockedFields()
|
assertTrue((updated.getValue().getUserLockedFields()
|
||||||
& USER_LOCKED_IMPORTANCE) != 0);
|
& USER_LOCKED_IMPORTANCE) != 0);
|
||||||
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
assertEquals(IMPORTANCE_DEFAULT, updated.getValue().getImportance());
|
||||||
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1450,7 +1489,7 @@ public class NotificationInfoTest extends SysuiTestCase {
|
|||||||
|
|
||||||
mNotificationInfo.findViewById(R.id.alert).performClick();
|
mNotificationInfo.findViewById(R.id.alert).performClick();
|
||||||
|
|
||||||
assertFalse(mNotificationInfo.shouldBeSaved());
|
assertFalse(mNotificationInfo.shouldBeSavedOnClose());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.notification.row;
|
package com.android.systemui.statusbar.notification.row;
|
||||||
|
|
||||||
import static android.app.Notification.EXTRA_IS_GROUP_CONVERSATION;
|
|
||||||
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||||
import static android.print.PrintManager.PRINT_SPOOLER_PACKAGE_NAME;
|
import static android.print.PrintManager.PRINT_SPOOLER_PACKAGE_NAME;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
@@ -25,7 +24,6 @@ import static android.view.View.VISIBLE;
|
|||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyObject;
|
|
||||||
import static org.mockito.Mockito.any;
|
import static org.mockito.Mockito.any;
|
||||||
import static org.mockito.Mockito.anyBoolean;
|
import static org.mockito.Mockito.anyBoolean;
|
||||||
import static org.mockito.Mockito.anyInt;
|
import static org.mockito.Mockito.anyInt;
|
||||||
@@ -36,8 +34,6 @@ import static org.mockito.Mockito.when;
|
|||||||
import android.app.INotificationManager;
|
import android.app.INotificationManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationChannelGroup;
|
|
||||||
import android.app.Person;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
|||||||
Reference in New Issue
Block a user