Merge "Update conversation priority onboarding" into rvc-dev am: ff182768f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11707052 Change-Id: Id4975ef9595efbb9461f7ffbe7088ee84f3d80cc
This commit is contained in:
@@ -1777,6 +1777,15 @@ public final class Settings {
|
|||||||
public static final String ACTION_NOTIFICATION_SETTINGS
|
public static final String ACTION_NOTIFICATION_SETTINGS
|
||||||
= "android.settings.NOTIFICATION_SETTINGS";
|
= "android.settings.NOTIFICATION_SETTINGS";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity Action: Show conversation settings.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||||
|
public static final String ACTION_CONVERSATION_SETTINGS
|
||||||
|
= "android.settings.CONVERSATION_SETTINGS";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity Action: Show notification history screen.
|
* Activity Action: Show notification history screen.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,156 +38,66 @@
|
|||||||
android:background="@drawable/rounded_bg_full"
|
android:background="@drawable/rounded_bg_full"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- We have a known number of rows that can be shown; just design them all here -->
|
<ImageView
|
||||||
<LinearLayout
|
android:id="@+id/conversation_icon"
|
||||||
android:id="@+id/show_at_top_tip"
|
android:layout_width="@dimen/notification_guts_conversation_icon_size"
|
||||||
|
android:layout_height="@dimen/notification_guts_conversation_icon_size"
|
||||||
|
android:layout_gravity="center_horizontal" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="8dp"
|
android:gravity="center_horizontal"
|
||||||
android:paddingBottom="8dp"
|
android:layout_marginTop="16dp"
|
||||||
android:paddingStart="4dp"
|
android:text="@string/priority_onboarding_title"
|
||||||
android:paddingEnd="4dp"
|
style="@style/TextAppearance.NotificationImportanceChannel"
|
||||||
android:orientation="horizontal"
|
/>
|
||||||
>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/bell_icon"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_notifications_alert"
|
|
||||||
android:tint="?android:attr/colorControlNormal" />
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
android:id="@+id/show_at_top_text"
|
android:id="@+id/divider"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0.5dp"
|
||||||
android:paddingStart="16dp"
|
android:layout_marginTop="20dp"
|
||||||
android:paddingEnd="16dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:gravity="center_vertical|start"
|
android:background="@color/material_grey_300" />
|
||||||
android:textSize="15sp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:text="@string/priority_onboarding_show_at_top_text"
|
|
||||||
style="@style/TextAppearance.NotificationInfo"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/show_avatar_tip"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="8dp"
|
android:gravity="start"
|
||||||
android:paddingBottom="8dp"
|
android:text="@string/priority_onboarding_behavior"
|
||||||
android:paddingStart="4dp"
|
style="@style/TextAppearance.NotificationImportanceChannelGroup"
|
||||||
android:paddingEnd="4dp"
|
/>
|
||||||
android:orientation="horizontal"
|
|
||||||
>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/avatar_icon"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_person"
|
|
||||||
android:tint="?android:attr/colorControlNormal" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/avatar_text"
|
android:id="@+id/behaviors"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:gravity="center_vertical|start"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:text="@string/priority_onboarding_show_avatar_text"
|
|
||||||
style="@style/TextAppearance.NotificationInfo"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- These rows show optionally -->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/floating_bubble_tip"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="8dp"
|
android:gravity="start"
|
||||||
android:paddingBottom="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:paddingStart="4dp"
|
style="@style/TextAppearance.NotificationImportanceChannelGroup"
|
||||||
android:paddingEnd="4dp"
|
/>
|
||||||
android:orientation="horizontal"
|
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/bubble_icon"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_create_bubble"
|
|
||||||
android:tint="?android:attr/colorControlNormal" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/bubble_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:gravity="center_vertical|start"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:text="@string/priority_onboarding_appear_as_bubble_text"
|
|
||||||
style="@style/TextAppearance.NotificationInfo"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/ignore_dnd_tip"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingStart="4dp"
|
|
||||||
android:paddingEnd="4dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/dnd_icon"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:src="@drawable/moon"
|
|
||||||
android:tint="?android:attr/colorControlNormal" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dnd_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:gravity="center_vertical|start"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:text="@string/priority_onboarding_ignores_dnd_text"
|
|
||||||
style="@style/TextAppearance.NotificationInfo"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- Bottom button container -->
|
<!-- Bottom button container -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/button_container"
|
android:id="@+id/button_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="4dp"
|
android:layout_marginTop="32dp"
|
||||||
android:paddingEnd="4dp"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
>
|
>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/settings_button"
|
||||||
|
android:text="@string/priority_onboarding_settings_button_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:minWidth="@dimen/notification_importance_toggle_size"
|
||||||
|
android:minHeight="@dimen/notification_importance_toggle_size"
|
||||||
|
android:maxWidth="125dp"
|
||||||
|
style="@style/TextAppearance.NotificationInfo.Button"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/done_button"
|
android:id="@+id/done_button"
|
||||||
android:text="@string/priority_onboarding_done_button_title"
|
android:text="@string/priority_onboarding_done_button_title"
|
||||||
|
|||||||
@@ -224,6 +224,7 @@
|
|||||||
<dimen name="notification_guts_conversation_icon_size">56dp</dimen>
|
<dimen name="notification_guts_conversation_icon_size">56dp</dimen>
|
||||||
<dimen name="notification_guts_conversation_action_height">56dp</dimen>
|
<dimen name="notification_guts_conversation_action_height">56dp</dimen>
|
||||||
<dimen name="notification_guts_conversation_action_text_padding_start">32dp</dimen>
|
<dimen name="notification_guts_conversation_action_text_padding_start">32dp</dimen>
|
||||||
|
<dimen name="conversation_onboarding_bullet_gap_width">6dp</dimen>
|
||||||
|
|
||||||
<!-- The height of the header in inline settings -->
|
<!-- The height of the header in inline settings -->
|
||||||
<dimen name="notification_guts_header_height">24dp</dimen>
|
<dimen name="notification_guts_header_height">24dp</dimen>
|
||||||
|
|||||||
@@ -2667,6 +2667,11 @@
|
|||||||
<string name="inattentive_sleep_warning_title">Standby</string>
|
<string name="inattentive_sleep_warning_title">Standby</string>
|
||||||
|
|
||||||
<!-- Priority conversation onboarding screen -->
|
<!-- Priority conversation onboarding screen -->
|
||||||
|
<!-- title of priority onboarding [CHAR LIMIT=75] -->
|
||||||
|
<string name="priority_onboarding_title">Conversation set to priority</string>
|
||||||
|
<!-- Text explaining that the following actions are the behaviors of priority conversations.
|
||||||
|
E.g. priority conversations will show at the top of the conversation section [CHAR LIMIT=75] -->
|
||||||
|
<string name="priority_onboarding_behavior">Priority conversations will:</string>
|
||||||
<!-- Text explaining that priority conversations show at the top of the conversation section [CHAR LIMIT=75] -->
|
<!-- Text explaining that priority conversations show at the top of the conversation section [CHAR LIMIT=75] -->
|
||||||
<string name="priority_onboarding_show_at_top_text">Show at top of conversation section</string>
|
<string name="priority_onboarding_show_at_top_text">Show at top of conversation section</string>
|
||||||
<!-- Text explaining that priority conversations show an avatar on the lock screen [CHAR LIMIT=75] -->
|
<!-- Text explaining that priority conversations show an avatar on the lock screen [CHAR LIMIT=75] -->
|
||||||
@@ -2677,6 +2682,8 @@
|
|||||||
<string name="priority_onboarding_ignores_dnd_text">Interrupt Do Not Disturb</string>
|
<string name="priority_onboarding_ignores_dnd_text">Interrupt Do Not Disturb</string>
|
||||||
<!-- Title for the affirmative button [CHAR LIMIT=50] -->
|
<!-- Title for the affirmative button [CHAR LIMIT=50] -->
|
||||||
<string name="priority_onboarding_done_button_title">Got it</string>
|
<string name="priority_onboarding_done_button_title">Got it</string>
|
||||||
|
<!-- Title for the settings button button [CHAR LIMIT=50] -->
|
||||||
|
<string name="priority_onboarding_settings_button_title">Settings</string>
|
||||||
|
|
||||||
<!-- Window Magnification strings -->
|
<!-- Window Magnification strings -->
|
||||||
<!-- Title for Magnification Overlay Window [CHAR LIMIT=NONE] -->
|
<!-- Title for Magnification Overlay Window [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public final class Prefs {
|
|||||||
String HAS_SEEN_REVERSE_BOTTOM_SHEET = "HasSeenReverseBottomSheet";
|
String HAS_SEEN_REVERSE_BOTTOM_SHEET = "HasSeenReverseBottomSheet";
|
||||||
String CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT = "ControlsStructureSwipeTooltipCount";
|
String CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT = "ControlsStructureSwipeTooltipCount";
|
||||||
/** Tracks whether the user has seen the onboarding screen for priority conversations */
|
/** Tracks whether the user has seen the onboarding screen for priority conversations */
|
||||||
String HAS_SEEN_PRIORITY_ONBOARDING = "HasSeenPriorityOnboarding";
|
String HAS_SEEN_PRIORITY_ONBOARDING = "HaveShownPriorityOnboarding";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
|
public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import android.transition.TransitionManager;
|
|||||||
import android.transition.TransitionSet;
|
import android.transition.TransitionSet;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.Slog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
@@ -115,6 +116,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
private OnSnoozeClickListener mOnSnoozeClickListener;
|
private OnSnoozeClickListener mOnSnoozeClickListener;
|
||||||
private OnSettingsClickListener mOnSettingsClickListener;
|
private OnSettingsClickListener mOnSettingsClickListener;
|
||||||
private NotificationGuts mGutsContainer;
|
private NotificationGuts mGutsContainer;
|
||||||
|
private OnConversationSettingsClickListener mOnConversationSettingsClickListener;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean mSkipPost = false;
|
boolean mSkipPost = false;
|
||||||
@@ -164,6 +166,10 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
|
|
||||||
private OnClickListener mOnDone = v -> {
|
private OnClickListener mOnDone = v -> {
|
||||||
mPressedApply = true;
|
mPressedApply = true;
|
||||||
|
// If the user selected Priority, maybe show the priority onboarding
|
||||||
|
if (mSelectedAction == ACTION_FAVORITE && shouldShowPriorityOnboarding()) {
|
||||||
|
showPriorityOnboarding();
|
||||||
|
}
|
||||||
mGutsContainer.closeControls(v, true);
|
mGutsContainer.closeControls(v, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,6 +181,10 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
void onClick(View v, NotificationChannel channel, int appUid);
|
void onClick(View v, NotificationChannel channel, int appUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnConversationSettingsClickListener {
|
||||||
|
void onClick();
|
||||||
|
}
|
||||||
|
|
||||||
public interface OnAppSettingsClickListener {
|
public interface OnAppSettingsClickListener {
|
||||||
void onClick(View v, Intent intent);
|
void onClick(View v, Intent intent);
|
||||||
}
|
}
|
||||||
@@ -190,14 +200,6 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSelectedAction = selectedAction;
|
mSelectedAction = selectedAction;
|
||||||
onSelectedActionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSelectedActionChanged() {
|
|
||||||
// If the user selected Priority, maybe show the priority onboarding
|
|
||||||
if (mSelectedAction == ACTION_FAVORITE && shouldShowPriorityOnboarding()) {
|
|
||||||
showPriorityOnboarding();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindNotification(
|
public void bindNotification(
|
||||||
@@ -216,7 +218,8 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
Provider<PriorityOnboardingDialogController.Builder> builderProvider,
|
Provider<PriorityOnboardingDialogController.Builder> builderProvider,
|
||||||
boolean isDeviceProvisioned,
|
boolean isDeviceProvisioned,
|
||||||
@Main Handler mainHandler,
|
@Main Handler mainHandler,
|
||||||
@Background Handler bgHandler) {
|
@Background Handler bgHandler,
|
||||||
|
OnConversationSettingsClickListener onConversationSettingsClickListener) {
|
||||||
mSelectedAction = -1;
|
mSelectedAction = -1;
|
||||||
mINotificationManager = iNotificationManager;
|
mINotificationManager = iNotificationManager;
|
||||||
mVisualStabilityManager = visualStabilityManager;
|
mVisualStabilityManager = visualStabilityManager;
|
||||||
@@ -231,6 +234,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
mDelegatePkg = mSbn.getOpPkg();
|
mDelegatePkg = mSbn.getOpPkg();
|
||||||
mIsDeviceProvisioned = isDeviceProvisioned;
|
mIsDeviceProvisioned = isDeviceProvisioned;
|
||||||
mOnSnoozeClickListener = onSnoozeClickListener;
|
mOnSnoozeClickListener = onSnoozeClickListener;
|
||||||
|
mOnConversationSettingsClickListener = onConversationSettingsClickListener;
|
||||||
mIconFactory = conversationIconFactory;
|
mIconFactory = conversationIconFactory;
|
||||||
mUserContext = userContext;
|
mUserContext = userContext;
|
||||||
mBubbleMetadata = bubbleMetadata;
|
mBubbleMetadata = bubbleMetadata;
|
||||||
@@ -323,7 +327,6 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
ImageView image = findViewById(R.id.conversation_icon);
|
ImageView image = findViewById(R.id.conversation_icon);
|
||||||
image.setImageDrawable(mIconFactory.getConversationDrawable(
|
image.setImageDrawable(mIconFactory.getConversationDrawable(
|
||||||
mShortcutInfo, mPackageName, mAppUid, important));
|
mShortcutInfo, mPackageName, mAppUid, important));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindPackage() {
|
private void bindPackage() {
|
||||||
@@ -521,9 +524,9 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
|
|
||||||
boolean ignoreDnd = false;
|
boolean ignoreDnd = false;
|
||||||
try {
|
try {
|
||||||
ignoreDnd = (mINotificationManager
|
ignoreDnd = mINotificationManager
|
||||||
.getConsolidatedNotificationPolicy().priorityConversationSenders
|
.getConsolidatedNotificationPolicy().priorityConversationSenders ==
|
||||||
& NotificationManager.Policy.CONVERSATION_SENDERS_IMPORTANT) != 0;
|
NotificationManager.Policy.CONVERSATION_SENDERS_IMPORTANT;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Could not check conversation senders", e);
|
Log.e(TAG, "Could not check conversation senders", e);
|
||||||
}
|
}
|
||||||
@@ -538,6 +541,8 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
.setView(onboardingView)
|
.setView(onboardingView)
|
||||||
.setIgnoresDnd(ignoreDnd)
|
.setIgnoresDnd(ignoreDnd)
|
||||||
.setShowsAsBubble(showAsBubble)
|
.setShowsAsBubble(showAsBubble)
|
||||||
|
.setIcon(((ImageView) findViewById(R.id.conversation_icon)).getDrawable())
|
||||||
|
.setOnSettingsClick(mOnConversationSettingsClickListener)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
controller.init();
|
controller.init();
|
||||||
@@ -613,8 +618,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
|||||||
try {
|
try {
|
||||||
switch (mAction) {
|
switch (mAction) {
|
||||||
case ACTION_FAVORITE:
|
case ACTION_FAVORITE:
|
||||||
mChannelToUpdate.setImportantConversation(
|
mChannelToUpdate.setImportantConversation(true);
|
||||||
!mChannelToUpdate.isImportantConversation());
|
|
||||||
if (mChannelToUpdate.isImportantConversation()) {
|
if (mChannelToUpdate.isImportantConversation()) {
|
||||||
mChannelToUpdate.setAllowBubbles(true);
|
mChannelToUpdate.setAllowBubbles(true);
|
||||||
if (mAppBubble == BUBBLE_PREFERENCE_NONE) {
|
if (mAppBubble == BUBBLE_PREFERENCE_NONE) {
|
||||||
|
|||||||
@@ -216,6 +216,11 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startConversationSettingsActivity(int uid, ExpandableNotificationRow row) {
|
||||||
|
final Intent intent = new Intent(Settings.ACTION_CONVERSATION_SETTINGS);
|
||||||
|
mNotificationActivityStarter.startNotificationGutsIntent(intent, uid, row);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean bindGuts(final ExpandableNotificationRow row) {
|
private boolean bindGuts(final ExpandableNotificationRow row) {
|
||||||
row.ensureGutsInflated();
|
row.ensureGutsInflated();
|
||||||
return bindGuts(row, mGutsMenuItem);
|
return bindGuts(row, mGutsMenuItem);
|
||||||
@@ -438,6 +443,12 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
|
|||||||
mListContainer.getSwipeActionHelper().snooze(sbn, hours);
|
mListContainer.getSwipeActionHelper().snooze(sbn, hours);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
final NotificationConversationInfo.OnConversationSettingsClickListener
|
||||||
|
onConversationSettingsListener =
|
||||||
|
() -> {
|
||||||
|
startConversationSettingsActivity(sbn.getUid(), row);
|
||||||
|
};
|
||||||
|
|
||||||
if (!userHandle.equals(UserHandle.ALL)
|
if (!userHandle.equals(UserHandle.ALL)
|
||||||
|| mLockscreenUserManager.getCurrentUserId() == UserHandle.USER_SYSTEM) {
|
|| mLockscreenUserManager.getCurrentUserId() == UserHandle.USER_SYSTEM) {
|
||||||
onSettingsClick = (View v, NotificationChannel channel, int appUid) -> {
|
onSettingsClick = (View v, NotificationChannel channel, int appUid) -> {
|
||||||
@@ -468,7 +479,8 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
mDeviceProvisionedController.isDeviceProvisioned(),
|
mDeviceProvisionedController.isDeviceProvisioned(),
|
||||||
mMainHandler,
|
mMainHandler,
|
||||||
mBgHandler);
|
mBgHandler,
|
||||||
|
onConversationSettingsListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,19 +21,21 @@ import android.content.Context
|
|||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.PixelFormat
|
import android.graphics.PixelFormat
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.text.style.BulletSpan
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.view.WindowInsets.Type.statusBars
|
import android.view.WindowInsets.Type.statusBars
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.LinearLayout
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.android.systemui.Prefs
|
import com.android.systemui.Prefs
|
||||||
import com.android.systemui.R
|
import com.android.systemui.R
|
||||||
import java.lang.IllegalStateException
|
import com.android.systemui.statusbar.notification.row.NotificationConversationInfo.OnConversationSettingsClickListener
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +45,9 @@ class PriorityOnboardingDialogController @Inject constructor(
|
|||||||
val view: View,
|
val view: View,
|
||||||
val context: Context,
|
val context: Context,
|
||||||
val ignoresDnd: Boolean,
|
val ignoresDnd: Boolean,
|
||||||
val showsAsBubble: Boolean
|
val showsAsBubble: Boolean,
|
||||||
|
val icon : Drawable,
|
||||||
|
val onConversationSettingsClickListener : OnConversationSettingsClickListener
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private lateinit var dialog: Dialog
|
private lateinit var dialog: Dialog
|
||||||
@@ -62,11 +66,21 @@ class PriorityOnboardingDialogController @Inject constructor(
|
|||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun settings() {
|
||||||
|
// Log that the user has seen the onboarding
|
||||||
|
Prefs.putBoolean(context, Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING, true)
|
||||||
|
dialog.dismiss()
|
||||||
|
onConversationSettingsClickListener?.onClick()
|
||||||
|
}
|
||||||
|
|
||||||
class Builder @Inject constructor() {
|
class Builder @Inject constructor() {
|
||||||
private lateinit var view: View
|
private lateinit var view: View
|
||||||
private lateinit var context: Context
|
private lateinit var context: Context
|
||||||
private var ignoresDnd = false
|
private var ignoresDnd = false
|
||||||
private var showAsBubble = false
|
private var showAsBubble = false
|
||||||
|
private lateinit var icon: Drawable
|
||||||
|
private lateinit var onConversationSettingsClickListener
|
||||||
|
: OnConversationSettingsClickListener
|
||||||
|
|
||||||
fun setView(v: View): Builder {
|
fun setView(v: View): Builder {
|
||||||
view = v
|
view = v
|
||||||
@@ -88,9 +102,20 @@ class PriorityOnboardingDialogController @Inject constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setIcon(draw : Drawable) : Builder {
|
||||||
|
icon = draw
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnSettingsClick(onClick : OnConversationSettingsClickListener) : Builder {
|
||||||
|
onConversationSettingsClickListener = onClick
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
fun build(): PriorityOnboardingDialogController {
|
fun build(): PriorityOnboardingDialogController {
|
||||||
val controller = PriorityOnboardingDialogController(
|
val controller = PriorityOnboardingDialogController(
|
||||||
view, context, ignoresDnd, showAsBubble)
|
view, context, ignoresDnd, showAsBubble, icon,
|
||||||
|
onConversationSettingsClickListener)
|
||||||
return controller
|
return controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,13 +138,32 @@ class PriorityOnboardingDialogController @Inject constructor(
|
|||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoresDnd) {
|
findViewById<TextView>(R.id.settings_button)?.setOnClickListener {
|
||||||
findViewById<LinearLayout>(R.id.ignore_dnd_tip).visibility = GONE
|
settings()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showsAsBubble) {
|
findViewById<ImageView>(R.id.conversation_icon)?.setImageDrawable(icon)
|
||||||
findViewById<LinearLayout>(R.id.floating_bubble_tip).visibility = GONE
|
|
||||||
|
val gapWidth = dialog.context.getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.conversation_onboarding_bullet_gap_width)
|
||||||
|
val description = SpannableStringBuilder()
|
||||||
|
description.append(context.getText(R.string.priority_onboarding_show_at_top_text),
|
||||||
|
BulletSpan(gapWidth), /* flags */0)
|
||||||
|
description.append(System.lineSeparator())
|
||||||
|
description.append(context.getText(R.string.priority_onboarding_show_avatar_text),
|
||||||
|
BulletSpan(gapWidth), /* flags */0)
|
||||||
|
if (showsAsBubble) {
|
||||||
|
description.append(System.lineSeparator())
|
||||||
|
description.append(context.getText(
|
||||||
|
R.string.priority_onboarding_appear_as_bubble_text),
|
||||||
|
BulletSpan(gapWidth), /* flags */0)
|
||||||
}
|
}
|
||||||
|
if (ignoresDnd) {
|
||||||
|
description.append(System.lineSeparator())
|
||||||
|
description.append(context.getText(R.string.priority_onboarding_ignores_dnd_text),
|
||||||
|
BulletSpan(gapWidth), /* flags */0)
|
||||||
|
}
|
||||||
|
findViewById<TextView>(R.id.behaviors).setText(description)
|
||||||
|
|
||||||
window?.apply {
|
window?.apply {
|
||||||
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
@@ -129,7 +173,7 @@ class PriorityOnboardingDialogController @Inject constructor(
|
|||||||
|
|
||||||
attributes = attributes.apply {
|
attributes = attributes.apply {
|
||||||
format = PixelFormat.TRANSLUCENT
|
format = PixelFormat.TRANSLUCENT
|
||||||
title = ChannelEditorDialogController::class.java.simpleName
|
title = PriorityOnboardingDialogController::class.java.simpleName
|
||||||
gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
|
gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL
|
||||||
fitInsetsTypes = attributes.fitInsetsTypes and statusBars().inv()
|
fitInsetsTypes = attributes.fitInsetsTypes and statusBars().inv()
|
||||||
width = MATCH_PARENT
|
width = MATCH_PARENT
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final ImageView view = mNotificationInfo.findViewById(R.id.conversation_icon);
|
final ImageView view = mNotificationInfo.findViewById(R.id.conversation_icon);
|
||||||
assertEquals(mIconDrawable, view.getDrawable());
|
assertEquals(mIconDrawable, view.getDrawable());
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final TextView textView = mNotificationInfo.findViewById(R.id.pkg_name);
|
final TextView textView = mNotificationInfo.findViewById(R.id.pkg_name);
|
||||||
assertTrue(textView.getText().toString().contains("App Name"));
|
assertTrue(textView.getText().toString().contains("App Name"));
|
||||||
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
||||||
@@ -331,7 +331,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
|
final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
|
||||||
assertTrue(textView.getText().toString().contains(group.getName()));
|
assertTrue(textView.getText().toString().contains(group.getName()));
|
||||||
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
||||||
@@ -356,7 +356,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
|
final TextView textView = mNotificationInfo.findViewById(R.id.group_name);
|
||||||
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
|
||||||
assertEquals(GONE, textView.getVisibility());
|
assertEquals(GONE, textView.getVisibility());
|
||||||
@@ -380,7 +380,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
|
final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
|
||||||
assertEquals(GONE, nameView.getVisibility());
|
assertEquals(GONE, nameView.getVisibility());
|
||||||
}
|
}
|
||||||
@@ -415,7 +415,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
|
final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name);
|
||||||
assertEquals(VISIBLE, nameView.getVisibility());
|
assertEquals(VISIBLE, nameView.getVisibility());
|
||||||
assertTrue(nameView.getText().toString().contains("Proxied"));
|
assertTrue(nameView.getText().toString().contains("Proxied"));
|
||||||
@@ -443,7 +443,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
||||||
settingsButton.performClick();
|
settingsButton.performClick();
|
||||||
@@ -469,7 +469,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
||||||
assertTrue(settingsButton.getVisibility() != View.VISIBLE);
|
assertTrue(settingsButton.getVisibility() != View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -496,7 +496,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
false,
|
false,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
final View settingsButton = mNotificationInfo.findViewById(R.id.info);
|
||||||
assertTrue(settingsButton.getVisibility() != View.VISIBLE);
|
assertTrue(settingsButton.getVisibility() != View.VISIBLE);
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
View view = mNotificationInfo.findViewById(R.id.silence);
|
View view = mNotificationInfo.findViewById(R.id.silence);
|
||||||
assertThat(view.isSelected()).isTrue();
|
assertThat(view.isSelected()).isTrue();
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
||||||
assertThat(view.isSelected()).isTrue();
|
assertThat(view.isSelected()).isTrue();
|
||||||
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
||||||
@@ -580,7 +580,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
||||||
assertThat(view.isSelected()).isTrue();
|
assertThat(view.isSelected()).isTrue();
|
||||||
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
||||||
@@ -610,7 +610,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
View fave = mNotificationInfo.findViewById(R.id.priority);
|
View fave = mNotificationInfo.findViewById(R.id.priority);
|
||||||
fave.performClick();
|
fave.performClick();
|
||||||
@@ -654,7 +654,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
@@ -697,7 +697,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
View silence = mNotificationInfo.findViewById(R.id.silence);
|
View silence = mNotificationInfo.findViewById(R.id.silence);
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
View fave = mNotificationInfo.findViewById(R.id.priority);
|
View fave = mNotificationInfo.findViewById(R.id.priority);
|
||||||
fave.performClick();
|
fave.performClick();
|
||||||
@@ -778,7 +778,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
View fave = mNotificationInfo.findViewById(R.id.priority);
|
View fave = mNotificationInfo.findViewById(R.id.priority);
|
||||||
fave.performClick();
|
fave.performClick();
|
||||||
@@ -792,6 +792,45 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
assertEquals(IMPORTANCE_HIGH, captor.getValue().getImportance());
|
assertEquals(IMPORTANCE_HIGH, captor.getValue().getImportance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFavorite_thenDefaultThenFavorite_andSave_nothingChanged() throws Exception {
|
||||||
|
mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH);
|
||||||
|
mConversationChannel.setImportance(IMPORTANCE_HIGH);
|
||||||
|
mConversationChannel.setImportantConversation(true);
|
||||||
|
|
||||||
|
mNotificationInfo.bindNotification(
|
||||||
|
mShortcutManager,
|
||||||
|
mMockPackageManager,
|
||||||
|
mMockINotificationManager,
|
||||||
|
mVisualStabilityManager,
|
||||||
|
TEST_PACKAGE_NAME,
|
||||||
|
mNotificationChannel,
|
||||||
|
mEntry,
|
||||||
|
mBubbleMetadata,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
mIconFactory,
|
||||||
|
mContext,
|
||||||
|
mBuilderProvider,
|
||||||
|
true,
|
||||||
|
mTestHandler,
|
||||||
|
mTestHandler, null);
|
||||||
|
|
||||||
|
View fave = mNotificationInfo.findViewById(R.id.priority);
|
||||||
|
fave.performClick();
|
||||||
|
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
||||||
|
fave.performClick();
|
||||||
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
ArgumentCaptor<NotificationChannel> captor =
|
||||||
|
ArgumentCaptor.forClass(NotificationChannel.class);
|
||||||
|
verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage(
|
||||||
|
anyString(), anyInt(), captor.capture());
|
||||||
|
assertEquals(IMPORTANCE_HIGH, captor.getValue().getImportance());
|
||||||
|
assertTrue(captor.getValue().isImportantConversation());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefault_andSave() throws Exception {
|
public void testDefault_andSave() throws Exception {
|
||||||
mConversationChannel.setAllowBubbles(true);
|
mConversationChannel.setAllowBubbles(true);
|
||||||
@@ -813,7 +852,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
||||||
mNotificationInfo.findViewById(R.id.done).performClick();
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
@@ -849,7 +888,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
||||||
mNotificationInfo.findViewById(R.id.done).performClick();
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
@@ -885,7 +924,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
mNotificationInfo.findViewById(R.id.default_behavior).performClick();
|
||||||
mNotificationInfo.findViewById(R.id.done).performClick();
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
@@ -920,7 +959,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
View silence = mNotificationInfo.findViewById(R.id.silence);
|
View silence = mNotificationInfo.findViewById(R.id.silence);
|
||||||
silence.performClick();
|
silence.performClick();
|
||||||
@@ -954,7 +993,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage(
|
verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage(
|
||||||
anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
|
anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
|
||||||
@@ -979,7 +1018,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
mBuilderProvider,
|
mBuilderProvider,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage(
|
verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage(
|
||||||
anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
|
anyString(), anyInt(), anyString(), any(), eq(CONVERSATION_ID));
|
||||||
@@ -1014,10 +1053,14 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
() -> b,
|
() -> b,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
// WHEN user clicks "priority"
|
// WHEN user clicks "priority"
|
||||||
mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
|
mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
|
||||||
|
verify(controller, never()).show();
|
||||||
|
|
||||||
|
// and then done
|
||||||
|
mNotificationInfo.findViewById(R.id.done).performClick();
|
||||||
|
|
||||||
// THEN the user is presented with the priority onboarding screen
|
// THEN the user is presented with the priority onboarding screen
|
||||||
verify(controller, atLeastOnce()).show();
|
verify(controller, atLeastOnce()).show();
|
||||||
@@ -1050,7 +1093,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
|||||||
() -> b,
|
() -> b,
|
||||||
true,
|
true,
|
||||||
mTestHandler,
|
mTestHandler,
|
||||||
mTestHandler);
|
mTestHandler, null);
|
||||||
|
|
||||||
// WHEN user clicks "priority"
|
// WHEN user clicks "priority"
|
||||||
mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
|
mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);
|
||||||
|
|||||||
Reference in New Issue
Block a user