Merge "Enable back gesture when a SysUI dialog is showing (1/2)" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-02-22 17:19:42 +00:00
committed by Android (Google) Code Review
16 changed files with 74 additions and 110 deletions

View File

@@ -103,8 +103,8 @@ public class QuickStepContract {
// enabled (since it's used to navigate back within the bubbled app, or to collapse the bubble // enabled (since it's used to navigate back within the bubbled app, or to collapse the bubble
// stack. // stack.
public static final int SYSUI_STATE_BUBBLES_EXPANDED = 1 << 14; public static final int SYSUI_STATE_BUBBLES_EXPANDED = 1 << 14;
// The global actions dialog is showing // A SysUI dialog is showing.
public static final int SYSUI_STATE_GLOBAL_ACTIONS_SHOWING = 1 << 15; public static final int SYSUI_STATE_DIALOG_SHOWING = 1 << 15;
// The one-handed mode is active // The one-handed mode is active
public static final int SYSUI_STATE_ONE_HANDED_ACTIVE = 1 << 16; public static final int SYSUI_STATE_ONE_HANDED_ACTIVE = 1 << 16;
// Allow system gesture no matter the system bar(s) is visible or not // Allow system gesture no matter the system bar(s) is visible or not
@@ -140,7 +140,7 @@ public class QuickStepContract {
SYSUI_STATE_TRACING_ENABLED, SYSUI_STATE_TRACING_ENABLED,
SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED, SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
SYSUI_STATE_BUBBLES_EXPANDED, SYSUI_STATE_BUBBLES_EXPANDED,
SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, SYSUI_STATE_DIALOG_SHOWING,
SYSUI_STATE_ONE_HANDED_ACTIVE, SYSUI_STATE_ONE_HANDED_ACTIVE,
SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY, SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY,
SYSUI_STATE_IME_SHOWING, SYSUI_STATE_IME_SHOWING,
@@ -166,7 +166,7 @@ public class QuickStepContract {
str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0 str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0
? "keygrd_occluded" : ""); ? "keygrd_occluded" : "");
str.add((flags & SYSUI_STATE_BOUNCER_SHOWING) != 0 ? "bouncer_visible" : ""); str.add((flags & SYSUI_STATE_BOUNCER_SHOWING) != 0 ? "bouncer_visible" : "");
str.add((flags & SYSUI_STATE_GLOBAL_ACTIONS_SHOWING) != 0 ? "global_actions" : ""); str.add((flags & SYSUI_STATE_DIALOG_SHOWING) != 0 ? "dialog_showing" : "");
str.add((flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0 ? "a11y_click" : ""); str.add((flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0 ? "a11y_click" : "");
str.add((flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0 ? "a11y_long_click" : ""); str.add((flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0 ? "a11y_long_click" : "");
str.add((flags & SYSUI_STATE_TRACING_ENABLED) != 0 ? "tracing" : ""); str.add((flags & SYSUI_STATE_TRACING_ENABLED) != 0 ? "tracing" : "");
@@ -256,7 +256,7 @@ public class QuickStepContract {
public static boolean isBackGestureDisabled(int sysuiStateFlags) { public static boolean isBackGestureDisabled(int sysuiStateFlags) {
// Always allow when the bouncer/global actions is showing (even on top of the keyguard) // Always allow when the bouncer/global actions is showing (even on top of the keyguard)
if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0 if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0
|| (sysuiStateFlags & SYSUI_STATE_GLOBAL_ACTIONS_SHOWING) != 0) { || (sysuiStateFlags & SYSUI_STATE_DIALOG_SHOWING) != 0) {
return false; return false;
} }
if ((sysuiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0) { if ((sysuiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0) {

View File

@@ -38,6 +38,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver; import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver;
import com.android.systemui.accessibility.floatingmenu.AccessibilityFloatingMenuController; import com.android.systemui.accessibility.floatingmenu.AccessibilityFloatingMenuController;
import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsController;
import com.android.systemui.assist.AssistManager; import com.android.systemui.assist.AssistManager;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -107,6 +108,7 @@ import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider; import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider;
import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.AccessibilityController; import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController;
@@ -372,6 +374,8 @@ public class Dependency {
@Inject Lazy<AmbientState> mAmbientStateLazy; @Inject Lazy<AmbientState> mAmbientStateLazy;
@Inject Lazy<GroupMembershipManager> mGroupMembershipManagerLazy; @Inject Lazy<GroupMembershipManager> mGroupMembershipManagerLazy;
@Inject Lazy<GroupExpansionManager> mGroupExpansionManagerLazy; @Inject Lazy<GroupExpansionManager> mGroupExpansionManagerLazy;
@Inject Lazy<SystemUIDialogManager> mSystemUIDialogManagerLazy;
@Inject Lazy<DialogLaunchAnimator> mDialogLaunchAnimatorLazy;
@Inject @Inject
public Dependency() { public Dependency() {
@@ -592,6 +596,8 @@ public class Dependency {
mProviders.put(AmbientState.class, mAmbientStateLazy::get); mProviders.put(AmbientState.class, mAmbientStateLazy::get);
mProviders.put(GroupMembershipManager.class, mGroupMembershipManagerLazy::get); mProviders.put(GroupMembershipManager.class, mGroupMembershipManagerLazy::get);
mProviders.put(GroupExpansionManager.class, mGroupExpansionManagerLazy::get); mProviders.put(GroupExpansionManager.class, mGroupExpansionManagerLazy::get);
mProviders.put(SystemUIDialogManager.class, mSystemUIDialogManagerLazy::get);
mProviders.put(DialogLaunchAnimator.class, mDialogLaunchAnimatorLazy::get);
Dependency.setInstance(this); Dependency.setInstance(this);
} }

View File

@@ -27,7 +27,6 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
@@ -117,7 +116,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager; import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActionsPanelPlugin; import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.scrim.ScrimDrawable; import com.android.systemui.scrim.ScrimDrawable;
@@ -125,7 +123,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.SystemUIDialog; import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.telephony.TelephonyListenerManager; import com.android.systemui.telephony.TelephonyListenerManager;
@@ -200,7 +197,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
private final TelecomManager mTelecomManager; private final TelecomManager mTelecomManager;
private final MetricsLogger mMetricsLogger; private final MetricsLogger mMetricsLogger;
private final UiEventLogger mUiEventLogger; private final UiEventLogger mUiEventLogger;
private final SysUiState mSysUiState;
// Used for RingerModeTracker // Used for RingerModeTracker
private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this); private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
@@ -241,7 +237,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
protected Handler mMainHandler; protected Handler mMainHandler;
private int mSmallestScreenWidthDp; private int mSmallestScreenWidthDp;
private final Optional<StatusBar> mStatusBarOptional; private final Optional<StatusBar> mStatusBarOptional;
private final SystemUIDialogManager mDialogManager;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final DialogLaunchAnimator mDialogLaunchAnimator; private final DialogLaunchAnimator mDialogLaunchAnimator;
@@ -347,13 +342,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
@Background Executor backgroundExecutor, @Background Executor backgroundExecutor,
UiEventLogger uiEventLogger, UiEventLogger uiEventLogger,
RingerModeTracker ringerModeTracker, RingerModeTracker ringerModeTracker,
SysUiState sysUiState,
@Main Handler handler, @Main Handler handler,
PackageManager packageManager, PackageManager packageManager,
Optional<StatusBar> statusBarOptional, Optional<StatusBar> statusBarOptional,
KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardUpdateMonitor keyguardUpdateMonitor,
DialogLaunchAnimator dialogLaunchAnimator, DialogLaunchAnimator dialogLaunchAnimator) {
SystemUIDialogManager dialogManager) {
mContext = context; mContext = context;
mWindowManagerFuncs = windowManagerFuncs; mWindowManagerFuncs = windowManagerFuncs;
mAudioManager = audioManager; mAudioManager = audioManager;
@@ -379,13 +372,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mIWindowManager = iWindowManager; mIWindowManager = iWindowManager;
mBackgroundExecutor = backgroundExecutor; mBackgroundExecutor = backgroundExecutor;
mRingerModeTracker = ringerModeTracker; mRingerModeTracker = ringerModeTracker;
mSysUiState = sysUiState;
mMainHandler = handler; mMainHandler = handler;
mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp; mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp;
mStatusBarOptional = statusBarOptional; mStatusBarOptional = statusBarOptional;
mKeyguardUpdateMonitor = keyguardUpdateMonitor; mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mDialogLaunchAnimator = dialogLaunchAnimator; mDialogLaunchAnimator = dialogLaunchAnimator;
mDialogManager = dialogManager;
// receive broadcasts // receive broadcasts
IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter();
@@ -682,11 +673,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
ActionsDialogLite dialog = new ActionsDialogLite(mContext, ActionsDialogLite dialog = new ActionsDialogLite(mContext,
com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActionsLite, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActionsLite,
mAdapter, mOverflowAdapter, mSysuiColorExtractor, mAdapter, mOverflowAdapter, mSysuiColorExtractor, mStatusBarService,
mStatusBarService, mNotificationShadeWindowController, mNotificationShadeWindowController, this::onRefresh, mKeyguardShowing,
mSysUiState, this::onRefresh, mKeyguardShowing, mPowerAdapter, mUiEventLogger, mPowerAdapter, mUiEventLogger, mStatusBarOptional, mKeyguardUpdateMonitor,
mStatusBarOptional, mKeyguardUpdateMonitor, mLockPatternUtils, mLockPatternUtils);
mDialogManager);
dialog.setOnDismissListener(this); dialog.setOnDismissListener(this);
dialog.setOnShowListener(this); dialog.setOnShowListener(this);
@@ -2165,7 +2155,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
private boolean mKeyguardShowing; private boolean mKeyguardShowing;
protected float mScrimAlpha; protected float mScrimAlpha;
protected final NotificationShadeWindowController mNotificationShadeWindowController; protected final NotificationShadeWindowController mNotificationShadeWindowController;
protected final SysUiState mSysUiState;
private ListPopupWindow mOverflowPopup; private ListPopupWindow mOverflowPopup;
private Dialog mPowerOptionsDialog; private Dialog mPowerOptionsDialog;
protected final Runnable mOnRefreshCallback; protected final Runnable mOnRefreshCallback;
@@ -2226,15 +2215,13 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
MyOverflowAdapter overflowAdapter, MyOverflowAdapter overflowAdapter,
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService, SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
NotificationShadeWindowController notificationShadeWindowController, NotificationShadeWindowController notificationShadeWindowController,
SysUiState sysuiState, Runnable onRefreshCallback, boolean keyguardShowing, Runnable onRefreshCallback, boolean keyguardShowing,
MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger, MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
Optional<StatusBar> statusBarOptional, Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils, LockPatternUtils lockPatternUtils) {
SystemUIDialogManager systemUiDialogManager) {
// We set dismissOnDeviceLock to false because we have a custom broadcast receiver to // We set dismissOnDeviceLock to false because we have a custom broadcast receiver to
// dismiss this dialog when the device is locked. // dismiss this dialog when the device is locked.
super(context, themeRes, false /* dismissOnDeviceLock */, super(context, themeRes, false /* dismissOnDeviceLock */);
systemUiDialogManager);
mContext = context; mContext = context;
mAdapter = adapter; mAdapter = adapter;
mOverflowAdapter = overflowAdapter; mOverflowAdapter = overflowAdapter;
@@ -2242,7 +2229,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
mColorExtractor = sysuiColorExtractor; mColorExtractor = sysuiColorExtractor;
mStatusBarService = statusBarService; mStatusBarService = statusBarService;
mNotificationShadeWindowController = notificationShadeWindowController; mNotificationShadeWindowController = notificationShadeWindowController;
mSysUiState = sysuiState;
mOnRefreshCallback = onRefreshCallback; mOnRefreshCallback = onRefreshCallback;
mKeyguardShowing = keyguardShowing; mKeyguardShowing = keyguardShowing;
mUiEventLogger = uiEventLogger; mUiEventLogger = uiEventLogger;
@@ -2463,8 +2449,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
public void show() { public void show() {
super.show(); super.show();
mNotificationShadeWindowController.setRequestTopUi(true, TAG); mNotificationShadeWindowController.setRequestTopUi(true, TAG);
mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, true)
.commitUpdate(mContext.getDisplayId());
// By default this dialog windowAnimationStyle is null, and therefore windowAnimations // By default this dialog windowAnimationStyle is null, and therefore windowAnimations
// should be equal to 0 which means we need to animate the dialog in-window. If it's not // should be equal to 0 which means we need to animate the dialog in-window. If it's not
@@ -2563,9 +2547,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
dismissPowerOptions(); dismissPowerOptions();
mNotificationShadeWindowController.setRequestTopUi(false, TAG); mNotificationShadeWindowController.setRequestTopUi(false, TAG);
mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, false)
.commitUpdate(mContext.getDisplayId());
super.dismiss(); super.dismiss();
} }

View File

@@ -56,7 +56,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SystemUIDialog; import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
/** /**
* Base dialog for media output UI * Base dialog for media output UI
@@ -99,9 +98,8 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
} }
}; };
public MediaOutputBaseDialog(Context context, MediaOutputController mediaOutputController, public MediaOutputBaseDialog(Context context, MediaOutputController mediaOutputController) {
SystemUIDialogManager dialogManager) { super(context, R.style.Theme_SystemUI_Dialog_Media);
super(context, R.style.Theme_SystemUI_Dialog_Media, dialogManager);
// Save the context that is wrapped with our theme. // Save the context that is wrapped with our theme.
mContext = getContext(); mContext = getContext();

View File

@@ -66,7 +66,6 @@ import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@@ -91,7 +90,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
private final ShadeController mShadeController; private final ShadeController mShadeController;
private final ActivityStarter mActivityStarter; private final ActivityStarter mActivityStarter;
private final DialogLaunchAnimator mDialogLaunchAnimator; private final DialogLaunchAnimator mDialogLaunchAnimator;
private final SystemUIDialogManager mDialogManager;
private final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>(); private final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>();
private final boolean mAboveStatusbar; private final boolean mAboveStatusbar;
private final boolean mVolumeAdjustmentForRemoteGroupSessions; private final boolean mVolumeAdjustmentForRemoteGroupSessions;
@@ -119,7 +117,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
boolean aboveStatusbar, MediaSessionManager mediaSessionManager, LocalBluetoothManager boolean aboveStatusbar, MediaSessionManager mediaSessionManager, LocalBluetoothManager
lbm, ShadeController shadeController, ActivityStarter starter, lbm, ShadeController shadeController, ActivityStarter starter,
CommonNotifCollection notifCollection, UiEventLogger uiEventLogger, CommonNotifCollection notifCollection, UiEventLogger uiEventLogger,
DialogLaunchAnimator dialogLaunchAnimator, SystemUIDialogManager dialogManager) { DialogLaunchAnimator dialogLaunchAnimator) {
mContext = context; mContext = context;
mPackageName = packageName; mPackageName = packageName;
mMediaSessionManager = mediaSessionManager; mMediaSessionManager = mediaSessionManager;
@@ -135,7 +133,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
mDialogLaunchAnimator = dialogLaunchAnimator; mDialogLaunchAnimator = dialogLaunchAnimator;
mVolumeAdjustmentForRemoteGroupSessions = mContext.getResources().getBoolean( mVolumeAdjustmentForRemoteGroupSessions = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_volumeAdjustmentForRemoteGroupSessions); com.android.internal.R.bool.config_volumeAdjustmentForRemoteGroupSessions);
mDialogManager = dialogManager;
mColorActiveItem = Utils.getColorStateListDefaultColor(mContext, mColorActiveItem = Utils.getColorStateListDefaultColor(mContext,
R.color.media_dialog_active_item_main_content); R.color.media_dialog_active_item_main_content);
mColorInactiveItem = Utils.getColorStateListDefaultColor(mContext, mColorInactiveItem = Utils.getColorStateListDefaultColor(mContext,
@@ -610,10 +607,9 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
// We show the output group dialog from the output dialog. // We show the output group dialog from the output dialog.
MediaOutputController controller = new MediaOutputController(mContext, mPackageName, MediaOutputController controller = new MediaOutputController(mContext, mPackageName,
mAboveStatusbar, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mAboveStatusbar, mMediaSessionManager, mLocalBluetoothManager, mShadeController,
mActivityStarter, mNotifCollection, mUiEventLogger, mDialogLaunchAnimator, mActivityStarter, mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
mDialogManager);
MediaOutputGroupDialog dialog = new MediaOutputGroupDialog(mContext, mAboveStatusbar, MediaOutputGroupDialog dialog = new MediaOutputGroupDialog(mContext, mAboveStatusbar,
controller, mDialogManager); controller);
mDialogLaunchAnimator.showFromView(dialog, mediaOutputDialog); mDialogLaunchAnimator.showFromView(dialog, mediaOutputDialog);
} }

View File

@@ -29,7 +29,6 @@ import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
/** /**
* Dialog for media output transferring. * Dialog for media output transferring.
@@ -39,9 +38,8 @@ public class MediaOutputDialog extends MediaOutputBaseDialog {
final UiEventLogger mUiEventLogger; final UiEventLogger mUiEventLogger;
MediaOutputDialog(Context context, boolean aboveStatusbar, MediaOutputController MediaOutputDialog(Context context, boolean aboveStatusbar, MediaOutputController
mediaOutputController, UiEventLogger uiEventLogger, mediaOutputController, UiEventLogger uiEventLogger) {
SystemUIDialogManager dialogManager) { super(context, mediaOutputController);
super(context, mediaOutputController, dialogManager);
mUiEventLogger = uiEventLogger; mUiEventLogger = uiEventLogger;
mAdapter = new MediaOutputAdapter(mMediaOutputController, this); mAdapter = new MediaOutputAdapter(mMediaOutputController, this);
if (!aboveStatusbar) { if (!aboveStatusbar) {

View File

@@ -25,7 +25,6 @@ import com.android.systemui.animation.DialogLaunchAnimator
import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
import com.android.systemui.statusbar.phone.ShadeController import com.android.systemui.statusbar.phone.ShadeController
import com.android.systemui.statusbar.phone.SystemUIDialogManager
import javax.inject.Inject import javax.inject.Inject
/** /**
@@ -39,8 +38,7 @@ class MediaOutputDialogFactory @Inject constructor(
private val starter: ActivityStarter, private val starter: ActivityStarter,
private val notifCollection: CommonNotifCollection, private val notifCollection: CommonNotifCollection,
private val uiEventLogger: UiEventLogger, private val uiEventLogger: UiEventLogger,
private val dialogLaunchAnimator: DialogLaunchAnimator, private val dialogLaunchAnimator: DialogLaunchAnimator
private val dialogManager: SystemUIDialogManager
) { ) {
companion object { companion object {
var mediaOutputDialog: MediaOutputDialog? = null var mediaOutputDialog: MediaOutputDialog? = null
@@ -53,9 +51,8 @@ class MediaOutputDialogFactory @Inject constructor(
val controller = MediaOutputController(context, packageName, aboveStatusBar, val controller = MediaOutputController(context, packageName, aboveStatusBar,
mediaSessionManager, lbm, shadeController, starter, notifCollection, mediaSessionManager, lbm, shadeController, starter, notifCollection,
uiEventLogger, dialogLaunchAnimator, dialogManager) uiEventLogger, dialogLaunchAnimator)
val dialog = MediaOutputDialog(context, aboveStatusBar, controller, uiEventLogger, val dialog = MediaOutputDialog(context, aboveStatusBar, controller, uiEventLogger)
dialogManager)
mediaOutputDialog = dialog mediaOutputDialog = dialog
// Show the dialog. // Show the dialog.

View File

@@ -25,7 +25,6 @@ import android.view.WindowManager;
import androidx.core.graphics.drawable.IconCompat; import androidx.core.graphics.drawable.IconCompat;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
/** /**
* Dialog for media output group. * Dialog for media output group.
@@ -34,8 +33,8 @@ import com.android.systemui.statusbar.phone.SystemUIDialogManager;
public class MediaOutputGroupDialog extends MediaOutputBaseDialog { public class MediaOutputGroupDialog extends MediaOutputBaseDialog {
MediaOutputGroupDialog(Context context, boolean aboveStatusbar, MediaOutputController MediaOutputGroupDialog(Context context, boolean aboveStatusbar, MediaOutputController
mediaOutputController, SystemUIDialogManager dialogManager) { mediaOutputController) {
super(context, mediaOutputController, dialogManager); super(context, mediaOutputController);
mMediaOutputController.resetGroupMediaDevices(); mMediaOutputController.resetGroupMediaDevices();
mAdapter = new MediaOutputGroupAdapter(mMediaOutputController); mAdapter = new MediaOutputGroupAdapter(mMediaOutputController);
if (!aboveStatusbar) { if (!aboveStatusbar) {

View File

@@ -42,7 +42,10 @@ import androidx.annotation.Nullable;
import com.android.systemui.Dependency; import com.android.systemui.Dependency;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.model.SysUiState;
import com.android.systemui.shared.system.QuickStepContract;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -64,7 +67,8 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
private final Context mContext; private final Context mContext;
@Nullable private final DismissReceiver mDismissReceiver; @Nullable private final DismissReceiver mDismissReceiver;
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
@Nullable private final SystemUIDialogManager mDialogManager; private final SystemUIDialogManager mDialogManager;
private final SysUiState mSysUiState;
private int mLastWidth = Integer.MIN_VALUE; private int mLastWidth = Integer.MIN_VALUE;
private int mLastHeight = Integer.MIN_VALUE; private int mLastHeight = Integer.MIN_VALUE;
@@ -77,24 +81,11 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
this(context, R.style.Theme_SystemUI_Dialog); this(context, R.style.Theme_SystemUI_Dialog);
} }
public SystemUIDialog(Context context, SystemUIDialogManager dialogManager) {
this(context, R.style.Theme_SystemUI_Dialog, true, dialogManager);
}
public SystemUIDialog(Context context, int theme) { public SystemUIDialog(Context context, int theme) {
this(context, theme, true /* dismissOnDeviceLock */); this(context, theme, true /* dismissOnDeviceLock */);
} }
public SystemUIDialog(Context context, int theme, SystemUIDialogManager dialogManager) {
this(context, theme, true /* dismissOnDeviceLock */, dialogManager);
}
public SystemUIDialog(Context context, int theme, boolean dismissOnDeviceLock) { public SystemUIDialog(Context context, int theme, boolean dismissOnDeviceLock) {
this(context, theme, dismissOnDeviceLock, null);
}
public SystemUIDialog(Context context, int theme, boolean dismissOnDeviceLock,
@Nullable SystemUIDialogManager dialogManager) {
super(context, theme); super(context, theme);
mContext = context; mContext = context;
@@ -104,7 +95,12 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
getWindow().setAttributes(attrs); getWindow().setAttributes(attrs);
mDismissReceiver = dismissOnDeviceLock ? new DismissReceiver(this) : null; mDismissReceiver = dismissOnDeviceLock ? new DismissReceiver(this) : null;
mDialogManager = dialogManager;
// TODO(b/219008720): Remove those calls to Dependency.get by introducing a
// SystemUIDialogFactory and make all other dialogs create a SystemUIDialog to which we set
// the content and attach listeners.
mDialogManager = Dependency.get(SystemUIDialogManager.class);
mSysUiState = Dependency.get(SysUiState.class);
} }
@Override @Override
@@ -174,13 +170,11 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
mDismissReceiver.register(); mDismissReceiver.register();
} }
if (mDialogManager != null) {
mDialogManager.setShowing(this, true);
}
// Listen for configuration changes to resize this dialog window. This is mostly necessary // Listen for configuration changes to resize this dialog window. This is mostly necessary
// for foldables that often go from large <=> small screen when folding/unfolding. // for foldables that often go from large <=> small screen when folding/unfolding.
ViewRootImpl.addConfigCallback(this); ViewRootImpl.addConfigCallback(this);
mDialogManager.setShowing(this, true);
mSysUiState.setFlag(QuickStepContract.SYSUI_STATE_DIALOG_SHOWING, true);
} }
@Override @Override
@@ -191,11 +185,9 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
mDismissReceiver.unregister(); mDismissReceiver.unregister();
} }
if (mDialogManager != null) {
mDialogManager.setShowing(this, false);
}
ViewRootImpl.removeConfigCallback(this); ViewRootImpl.removeConfigCallback(this);
mDialogManager.setShowing(this, false);
mSysUiState.setFlag(QuickStepContract.SYSUI_STATE_DIALOG_SHOWING, false);
} }
public void setShowForAllUsers(boolean show) { public void setShowForAllUsers(boolean show) {
@@ -401,10 +393,13 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
private final Dialog mDialog; private final Dialog mDialog;
private boolean mRegistered; private boolean mRegistered;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
private final DialogLaunchAnimator mDialogLaunchAnimator;
DismissReceiver(Dialog dialog) { DismissReceiver(Dialog dialog) {
mDialog = dialog; mDialog = dialog;
// TODO(b/219008720): Remove those calls to Dependency.get.
mBroadcastDispatcher = Dependency.get(BroadcastDispatcher.class); mBroadcastDispatcher = Dependency.get(BroadcastDispatcher.class);
mDialogLaunchAnimator = Dependency.get(DialogLaunchAnimator.class);
} }
void register() { void register() {
@@ -421,6 +416,10 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
// These broadcast are usually received when locking the device, swiping up to home
// (which collapses the shade), etc. In those cases, we usually don't want to animate
// back into the view.
mDialogLaunchAnimator.disableAllCurrentDialogsExitAnimations();
mDialog.dismiss(); mDialog.dismiss();
} }
} }

View File

@@ -21,7 +21,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DIALOG_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
@@ -97,7 +97,7 @@ public final class WMShell extends CoreStartable
implements CommandQueue.Callbacks, ProtoTraceable<SystemUiTraceProto> { implements CommandQueue.Callbacks, ProtoTraceable<SystemUiTraceProto> {
private static final String TAG = WMShell.class.getName(); private static final String TAG = WMShell.class.getName();
private static final int INVALID_SYSUI_STATE_MASK = private static final int INVALID_SYSUI_STATE_MASK =
SYSUI_STATE_GLOBAL_ACTIONS_SHOWING SYSUI_STATE_DIALOG_SHOWING
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
| SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
| SYSUI_STATE_BOUNCER_SHOWING | SYSUI_STATE_BOUNCER_SHOWING

View File

@@ -42,6 +42,7 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
@@ -112,6 +113,11 @@ public abstract class SysuiTestCase {
// KeyguardUpdateMonitor to be created (injected). // KeyguardUpdateMonitor to be created (injected).
// TODO(b/1531701009) Clean up NotificationContentView creation to prevent this // TODO(b/1531701009) Clean up NotificationContentView creation to prevent this
mDependency.injectMockDependency(SmartReplyController.class); mDependency.injectMockDependency(SmartReplyController.class);
// Make sure that all tests on any SystemUIDialog does not crash because this dependency
// is missing (constructing the actual one would throw).
// TODO(b/219008720): Remove this.
mDependency.injectMockDependency(SystemUIDialogManager.class);
} }
@After @After

View File

@@ -19,7 +19,6 @@ package com.android.systemui.globalactions;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
@@ -57,13 +56,11 @@ import com.android.systemui.SysuiTestCase;
import com.android.systemui.animation.DialogLaunchAnimator; import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.GlobalActions; import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.settings.UserContextProvider; import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper; import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.telephony.TelephonyListenerManager; import com.android.systemui.telephony.TelephonyListenerManager;
@@ -112,7 +109,6 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
@Mock private UiEventLogger mUiEventLogger; @Mock private UiEventLogger mUiEventLogger;
@Mock private RingerModeTracker mRingerModeTracker; @Mock private RingerModeTracker mRingerModeTracker;
@Mock private RingerModeLiveData mRingerModeLiveData; @Mock private RingerModeLiveData mRingerModeLiveData;
@Mock private SysUiState mSysUiState;
@Mock private PackageManager mPackageManager; @Mock private PackageManager mPackageManager;
@Mock private Handler mHandler; @Mock private Handler mHandler;
@Mock private UserContextProvider mUserContextProvider; @Mock private UserContextProvider mUserContextProvider;
@@ -120,7 +116,6 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
@Mock private StatusBar mStatusBar; @Mock private StatusBar mStatusBar;
@Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor; @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
@Mock private DialogLaunchAnimator mDialogLaunchAnimator; @Mock private DialogLaunchAnimator mDialogLaunchAnimator;
@Mock private SystemUIDialogManager mDialogManager;
private TestableLooper mTestableLooper; private TestableLooper mTestableLooper;
@@ -161,19 +156,16 @@ public class GlobalActionsDialogLiteTest extends SysuiTestCase {
mBackgroundExecutor, mBackgroundExecutor,
mUiEventLogger, mUiEventLogger,
mRingerModeTracker, mRingerModeTracker,
mSysUiState,
mHandler, mHandler,
mPackageManager, mPackageManager,
Optional.of(mStatusBar), Optional.of(mStatusBar),
mKeyguardUpdateMonitor, mKeyguardUpdateMonitor,
mDialogLaunchAnimator, mDialogLaunchAnimator);
mDialogManager);
mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting(); mGlobalActionsDialogLite.setZeroDialogPressDelayForTesting();
ColorExtractor.GradientColors backdropColors = new ColorExtractor.GradientColors(); ColorExtractor.GradientColors backdropColors = new ColorExtractor.GradientColors();
backdropColors.setMainColor(Color.BLACK); backdropColors.setMainColor(Color.BLACK);
when(mColorExtractor.getNeutralColors()).thenReturn(backdropColors); when(mColorExtractor.getNeutralColors()).thenReturn(backdropColors);
when(mSysUiState.setFlag(anyInt(), anyBoolean())).thenReturn(mSysUiState);
} }
@Test @Test

View File

@@ -45,7 +45,6 @@ import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -68,7 +67,6 @@ public class MediaOutputBaseDialogTest extends SysuiTestCase {
mock(NotificationEntryManager.class); mock(NotificationEntryManager.class);
private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class); private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class);
private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class); private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class);
private final SystemUIDialogManager mDialogManager = mock(SystemUIDialogManager.class);
private MediaOutputBaseDialogImpl mMediaOutputBaseDialogImpl; private MediaOutputBaseDialogImpl mMediaOutputBaseDialogImpl;
private MediaOutputController mMediaOutputController; private MediaOutputController mMediaOutputController;
@@ -82,7 +80,7 @@ public class MediaOutputBaseDialogTest extends SysuiTestCase {
public void setUp() { public void setUp() {
mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false, mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator);
mMediaOutputBaseDialogImpl = new MediaOutputBaseDialogImpl(mContext, mMediaOutputBaseDialogImpl = new MediaOutputBaseDialogImpl(mContext,
mMediaOutputController); mMediaOutputController);
mMediaOutputBaseDialogImpl.onCreate(new Bundle()); mMediaOutputBaseDialogImpl.onCreate(new Bundle());
@@ -175,7 +173,7 @@ public class MediaOutputBaseDialogTest extends SysuiTestCase {
class MediaOutputBaseDialogImpl extends MediaOutputBaseDialog { class MediaOutputBaseDialogImpl extends MediaOutputBaseDialog {
MediaOutputBaseDialogImpl(Context context, MediaOutputController mediaOutputController) { MediaOutputBaseDialogImpl(Context context, MediaOutputController mediaOutputController) {
super(context, mediaOutputController, mDialogManager); super(context, mediaOutputController);
mAdapter = mMediaOutputBaseAdapter; mAdapter = mMediaOutputBaseAdapter;
} }

View File

@@ -55,7 +55,6 @@ import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection; import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -94,7 +93,6 @@ public class MediaOutputControllerTest extends SysuiTestCase {
private CommonNotifCollection mNotifCollection = mock(CommonNotifCollection.class); private CommonNotifCollection mNotifCollection = mock(CommonNotifCollection.class);
private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class); private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class);
private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class); private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class);
private final SystemUIDialogManager mDialogManager = mock(SystemUIDialogManager.class);
private Context mSpyContext; private Context mSpyContext;
private MediaOutputController mMediaOutputController; private MediaOutputController mMediaOutputController;
@@ -117,7 +115,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
mMediaOutputController = new MediaOutputController(mSpyContext, TEST_PACKAGE_NAME, false, mMediaOutputController = new MediaOutputController(mSpyContext, TEST_PACKAGE_NAME, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotifCollection, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
mLocalMediaManager = spy(mMediaOutputController.mLocalMediaManager); mLocalMediaManager = spy(mMediaOutputController.mLocalMediaManager);
mMediaOutputController.mLocalMediaManager = mLocalMediaManager; mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
MediaDescription.Builder builder = new MediaDescription.Builder(); MediaDescription.Builder builder = new MediaDescription.Builder();
@@ -161,7 +159,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
public void start_withoutPackageName_verifyMediaControllerInit() { public void start_withoutPackageName_verifyMediaControllerInit() {
mMediaOutputController = new MediaOutputController(mSpyContext, null, false, mMediaOutputController = new MediaOutputController(mSpyContext, null, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotifCollection, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
mMediaOutputController.start(mCb); mMediaOutputController.start(mCb);
@@ -182,7 +180,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
public void stop_withoutPackageName_verifyMediaControllerDeinit() { public void stop_withoutPackageName_verifyMediaControllerDeinit() {
mMediaOutputController = new MediaOutputController(mSpyContext, null, false, mMediaOutputController = new MediaOutputController(mSpyContext, null, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotifCollection, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
mMediaOutputController.start(mCb); mMediaOutputController.start(mCb);
@@ -453,7 +451,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
public void getNotificationLargeIcon_withoutPackageName_returnsNull() { public void getNotificationLargeIcon_withoutPackageName_returnsNull() {
mMediaOutputController = new MediaOutputController(mSpyContext, null, false, mMediaOutputController = new MediaOutputController(mSpyContext, null, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotifCollection, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
assertThat(mMediaOutputController.getNotificationIcon()).isNull(); assertThat(mMediaOutputController.getNotificationIcon()).isNull();
} }

View File

@@ -40,7 +40,6 @@ import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@@ -68,7 +67,6 @@ public class MediaOutputDialogTest extends SysuiTestCase {
mock(NotificationEntryManager.class); mock(NotificationEntryManager.class);
private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class); private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class);
private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class); private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class);
private final SystemUIDialogManager mDialogManager = mock(SystemUIDialogManager.class);
private MediaOutputDialog mMediaOutputDialog; private MediaOutputDialog mMediaOutputDialog;
private MediaOutputController mMediaOutputController; private MediaOutputController mMediaOutputController;
@@ -78,10 +76,10 @@ public class MediaOutputDialogTest extends SysuiTestCase {
public void setUp() { public void setUp() {
mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false, mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator);
mMediaOutputController.mLocalMediaManager = mLocalMediaManager; mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
mMediaOutputDialog = new MediaOutputDialog(mContext, false, mMediaOutputDialog = new MediaOutputDialog(mContext, false,
mMediaOutputController, mUiEventLogger, mDialogManager); mMediaOutputController, mUiEventLogger);
mMediaOutputDialog.show(); mMediaOutputDialog.show();
when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice); when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice);
@@ -127,7 +125,7 @@ public class MediaOutputDialogTest extends SysuiTestCase {
// and verify if the calling times increases. // and verify if the calling times increases.
public void onCreate_ShouldLogVisibility() { public void onCreate_ShouldLogVisibility() {
MediaOutputDialog testDialog = new MediaOutputDialog(mContext, false, MediaOutputDialog testDialog = new MediaOutputDialog(mContext, false,
mMediaOutputController, mUiEventLogger, mDialogManager); mMediaOutputController, mUiEventLogger);
testDialog.show(); testDialog.show();
testDialog.dismissDialog(); testDialog.dismissDialog();

View File

@@ -38,7 +38,6 @@ import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@@ -67,7 +66,6 @@ public class MediaOutputGroupDialogTest extends SysuiTestCase {
mock(NotificationEntryManager.class); mock(NotificationEntryManager.class);
private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class); private final UiEventLogger mUiEventLogger = mock(UiEventLogger.class);
private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class); private final DialogLaunchAnimator mDialogLaunchAnimator = mock(DialogLaunchAnimator.class);
private final SystemUIDialogManager mDialogManager = mock(SystemUIDialogManager.class);
private MediaOutputGroupDialog mMediaOutputGroupDialog; private MediaOutputGroupDialog mMediaOutputGroupDialog;
private MediaOutputController mMediaOutputController; private MediaOutputController mMediaOutputController;
@@ -77,10 +75,10 @@ public class MediaOutputGroupDialogTest extends SysuiTestCase {
public void setUp() { public void setUp() {
mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false, mMediaOutputController = new MediaOutputController(mContext, TEST_PACKAGE, false,
mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter, mMediaSessionManager, mLocalBluetoothManager, mShadeController, mStarter,
mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator, mDialogManager); mNotificationEntryManager, mUiEventLogger, mDialogLaunchAnimator);
mMediaOutputController.mLocalMediaManager = mLocalMediaManager; mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
mMediaOutputGroupDialog = new MediaOutputGroupDialog(mContext, false, mMediaOutputGroupDialog = new MediaOutputGroupDialog(mContext, false,
mMediaOutputController, mDialogManager); mMediaOutputController);
mMediaOutputGroupDialog.show(); mMediaOutputGroupDialog.show();
when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mMediaDevices); when(mLocalMediaManager.getSelectedMediaDevice()).thenReturn(mMediaDevices);
} }