Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +23 −12 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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() { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialog.java +23 −12 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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() { Loading