diff options
| author | 2022-06-25 07:41:45 +0000 | |
|---|---|---|
| committer | 2022-06-25 07:41:45 +0000 | |
| commit | bab6d2d2f4fd7927ed07de640b32ee84f6bd916c (patch) | |
| tree | e3df442761a0334b26313456f34fe1a2a2da0cbb | |
| parent | 887f52608d79d1af4a7b9f1fbc863afa9609808a (diff) | |
| parent | 6d6a373d25877ea92f52e30e839d0c9b441cacf3 (diff) | |
Merge "Add explicit SystemUIDialog dependencies as parameters" into tm-qpr-dev am: 6d6a373d25
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19046029
Change-Id: I90ca277f542990ee64ea67c4176a20825fd9e331
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java index 36a045637a87..26bc3e3c0920 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java @@ -93,6 +93,17 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh } public SystemUIDialog(Context context, int theme, boolean dismissOnDeviceLock) { + // 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. + this(context, theme, dismissOnDeviceLock, Dependency.get(SystemUIDialogManager.class), + Dependency.get(SysUiState.class), Dependency.get(BroadcastDispatcher.class), + Dependency.get(DialogLaunchAnimator.class)); + } + + public SystemUIDialog(Context context, int theme, boolean dismissOnDeviceLock, + SystemUIDialogManager dialogManager, SysUiState sysUiState, + BroadcastDispatcher broadcastDispatcher, DialogLaunchAnimator dialogLaunchAnimator) { super(context, theme); mContext = context; @@ -101,13 +112,10 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh attrs.setTitle(getClass().getSimpleName()); getWindow().setAttributes(attrs); - mDismissReceiver = dismissOnDeviceLock ? new DismissReceiver(this) : null; - - // 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); + mDismissReceiver = dismissOnDeviceLock ? new DismissReceiver(this, broadcastDispatcher, + dialogLaunchAnimator) : null; + mDialogManager = dialogManager; + mSysUiState = sysUiState; } @Override @@ -326,7 +334,10 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh * @param dismissAction An action to run when the dialog is dismissed. */ public static void registerDismissListener(Dialog dialog, @Nullable Runnable dismissAction) { - DismissReceiver dismissReceiver = new DismissReceiver(dialog); + // TODO(b/219008720): Remove those calls to Dependency.get. + DismissReceiver dismissReceiver = new DismissReceiver(dialog, + Dependency.get(BroadcastDispatcher.class), + Dependency.get(DialogLaunchAnimator.class)); dialog.setOnDismissListener(d -> { dismissReceiver.unregister(); if (dismissAction != null) dismissAction.run(); @@ -408,11 +419,11 @@ public class SystemUIDialog extends AlertDialog implements ViewRootImpl.ConfigCh private final BroadcastDispatcher mBroadcastDispatcher; private final DialogLaunchAnimator mDialogLaunchAnimator; - DismissReceiver(Dialog dialog) { + DismissReceiver(Dialog dialog, BroadcastDispatcher broadcastDispatcher, + DialogLaunchAnimator dialogLaunchAnimator) { mDialog = dialog; - // TODO(b/219008720): Remove those calls to Dependency.get. - mBroadcastDispatcher = Dependency.get(BroadcastDispatcher.class); - mDialogLaunchAnimator = Dependency.get(DialogLaunchAnimator.class); + mBroadcastDispatcher = broadcastDispatcher; + mDialogLaunchAnimator = dialogLaunchAnimator; } void register() { |