Loading packages/SystemUI/src/com/android/systemui/controls/management/PanelConfirmationDialogFactory.kt +7 −8 Original line number Diff line number Diff line Loading @@ -28,12 +28,11 @@ import javax.inject.Inject /** * Factory to create dialogs for consenting to show app panels for specific apps. * * [internalDialogFactory] is for facilitating testing. * [dialogFactory] is for facilitating testing. */ class PanelConfirmationDialogFactory( private val internalDialogFactory: (Context) -> SystemUIDialog class PanelConfirmationDialogFactory @Inject constructor( private val dialogFactory: SystemUIDialog.Factory ) { @Inject constructor() : this({ SystemUIDialog(it) }) /** * Creates a dialog to show to the user. [response] will be true if an only if the user responds Loading @@ -48,7 +47,7 @@ class PanelConfirmationDialogFactory( DialogInterface.OnClickListener { _, which -> response.accept(which == DialogInterface.BUTTON_POSITIVE) } return internalDialogFactory(context).apply { return dialogFactory.create(context).apply { setTitle(this.context.getString(R.string.controls_panel_authorization_title, appName)) setMessage(this.context.getString(R.string.controls_panel_authorization, appName)) setCanceledOnTouchOutside(true) Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsDialogsFactory.kt +7 −6 Original line number Diff line number Diff line Loading @@ -25,9 +25,10 @@ import com.android.systemui.statusbar.phone.SystemUIDialog import java.util.function.Consumer import javax.inject.Inject class ControlsDialogsFactory(private val internalDialogFactory: (Context) -> SystemUIDialog) { class ControlsDialogsFactory @Inject constructor( private val dialogFactory: SystemUIDialog.Factory ) { @Inject constructor() : this({ SystemUIDialog(it) }) fun createRemoveAppDialog( context: Context, Loading @@ -38,7 +39,7 @@ class ControlsDialogsFactory(private val internalDialogFactory: (Context) -> Sys DialogInterface.OnClickListener { _, which -> response.accept(which == DialogInterface.BUTTON_POSITIVE) } return internalDialogFactory(context).apply { return dialogFactory.create(context).apply { setTitle(context.getString(R.string.controls_panel_remove_app_authorization, appName)) setCanceledOnTouchOutside(true) setOnCancelListener { response.accept(false) } Loading packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +15 −7 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import java.util.Locale; import java.util.Objects; import javax.inject.Inject; import javax.inject.Provider; /** */ Loading Loading @@ -149,6 +150,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { public static final String EXTRA_CONFIRM_ONLY = "extra_confirm_only"; private final Context mContext; private final SystemUIDialog.Factory mSystemUIDialogFactory; private final NotificationManager mNoMan; private final PowerManager mPowerMan; private final KeyguardManager mKeyguard; Loading Loading @@ -186,11 +188,17 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { /** */ @Inject public PowerNotificationWarnings(Context context, ActivityStarter activityStarter, BroadcastSender broadcastSender, Lazy<BatteryController> batteryControllerLazy, DialogLaunchAnimator dialogLaunchAnimator, UiEventLogger uiEventLogger, GlobalSettings globalSettings, UserTracker userTracker) { public PowerNotificationWarnings( Context context, ActivityStarter activityStarter, BroadcastSender broadcastSender, Lazy<BatteryController> batteryControllerLazy, DialogLaunchAnimator dialogLaunchAnimator, UiEventLogger uiEventLogger, UserTracker userTracker, SystemUIDialog.Factory systemUIDialogFactory) { mContext = context; mSystemUIDialogFactory = systemUIDialogFactory; mNoMan = mContext.getSystemService(NotificationManager.class); mPowerMan = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mKeyguard = mContext.getSystemService(KeyguardManager.class); Loading Loading @@ -444,7 +452,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showHighTemperatureDialog() { if (mHighTempDialog != null) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); d.setIconAttribute(android.R.attr.alertDialogIcon); d.setTitle(R.string.high_temp_title); d.setMessage(R.string.high_temp_dialog_message); Loading Loading @@ -479,7 +487,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showThermalShutdownDialog() { if (mThermalShutdownDialog != null) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); d.setIconAttribute(android.R.attr.alertDialogIcon); d.setTitle(R.string.thermal_shutdown_title); d.setMessage(R.string.thermal_shutdown_dialog_message); Loading Loading @@ -643,7 +651,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showStartSaverConfirmation(Bundle extras) { if (mSaverConfirmation != null || mUseExtraSaverConfirmation) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); final boolean confirmOnly = extras.getBoolean(BatterySaverUtils.EXTRA_CONFIRM_TEXT_ONLY); final int batterySaverTriggerMode = extras.getInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER, Loading packages/SystemUI/src/com/android/systemui/qs/FgsManagerController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,8 @@ class FgsManagerControllerImpl @Inject constructor( private val deviceConfigProxy: DeviceConfigProxy, private val dialogLaunchAnimator: DialogLaunchAnimator, private val broadcastDispatcher: BroadcastDispatcher, private val dumpManager: DumpManager private val dumpManager: DumpManager, private val systemUIDialogFactory: SystemUIDialog.Factory, ) : Dumpable, FgsManagerController { companion object { Loading Loading @@ -375,7 +376,7 @@ class FgsManagerControllerImpl @Inject constructor( override fun showDialog(expandable: Expandable?) { synchronized(lock) { if (dialog == null) { val dialog = SystemUIDialog(context) val dialog = systemUIDialogFactory.create() dialog.setTitle(R.string.fgs_manager_dialog_title) dialog.setMessage(R.string.fgs_manager_dialog_message) Loading packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java +5 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements private final DataSaverController mDataSaverController; private final DialogLaunchAnimator mDialogLaunchAnimator; private final SystemUIDialog.Factory mSystemUIDialogFactory; @Inject public DataSaverTile( Loading @@ -68,12 +69,14 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements ActivityStarter activityStarter, QSLogger qsLogger, DataSaverController dataSaverController, DialogLaunchAnimator dialogLaunchAnimator DialogLaunchAnimator dialogLaunchAnimator, SystemUIDialog.Factory systemUIDialogFactory ) { super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, statusBarStateController, activityStarter, qsLogger); mDataSaverController = dataSaverController; mDialogLaunchAnimator = dialogLaunchAnimator; mSystemUIDialogFactory = systemUIDialogFactory; mDataSaverController.observe(getLifecycle(), this); } Loading @@ -98,7 +101,7 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements // Show a dialog to confirm first. Dialogs shown by the DialogLaunchAnimator must be created // and shown on the main thread, so we post it to the UI handler. mUiHandler.post(() -> { SystemUIDialog dialog = new SystemUIDialog(mContext); SystemUIDialog dialog = mSystemUIDialogFactory.create(); dialog.setTitle(com.android.internal.R.string.data_saver_enable_title); dialog.setMessage(com.android.internal.R.string.data_saver_description); dialog.setPositiveButton(com.android.internal.R.string.data_saver_enable_button, Loading Loading
packages/SystemUI/src/com/android/systemui/controls/management/PanelConfirmationDialogFactory.kt +7 −8 Original line number Diff line number Diff line Loading @@ -28,12 +28,11 @@ import javax.inject.Inject /** * Factory to create dialogs for consenting to show app panels for specific apps. * * [internalDialogFactory] is for facilitating testing. * [dialogFactory] is for facilitating testing. */ class PanelConfirmationDialogFactory( private val internalDialogFactory: (Context) -> SystemUIDialog class PanelConfirmationDialogFactory @Inject constructor( private val dialogFactory: SystemUIDialog.Factory ) { @Inject constructor() : this({ SystemUIDialog(it) }) /** * Creates a dialog to show to the user. [response] will be true if an only if the user responds Loading @@ -48,7 +47,7 @@ class PanelConfirmationDialogFactory( DialogInterface.OnClickListener { _, which -> response.accept(which == DialogInterface.BUTTON_POSITIVE) } return internalDialogFactory(context).apply { return dialogFactory.create(context).apply { setTitle(this.context.getString(R.string.controls_panel_authorization_title, appName)) setMessage(this.context.getString(R.string.controls_panel_authorization, appName)) setCanceledOnTouchOutside(true) Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsDialogsFactory.kt +7 −6 Original line number Diff line number Diff line Loading @@ -25,9 +25,10 @@ import com.android.systemui.statusbar.phone.SystemUIDialog import java.util.function.Consumer import javax.inject.Inject class ControlsDialogsFactory(private val internalDialogFactory: (Context) -> SystemUIDialog) { class ControlsDialogsFactory @Inject constructor( private val dialogFactory: SystemUIDialog.Factory ) { @Inject constructor() : this({ SystemUIDialog(it) }) fun createRemoveAppDialog( context: Context, Loading @@ -38,7 +39,7 @@ class ControlsDialogsFactory(private val internalDialogFactory: (Context) -> Sys DialogInterface.OnClickListener { _, which -> response.accept(which == DialogInterface.BUTTON_POSITIVE) } return internalDialogFactory(context).apply { return dialogFactory.create(context).apply { setTitle(context.getString(R.string.controls_panel_remove_app_authorization, appName)) setCanceledOnTouchOutside(true) setOnCancelListener { response.accept(false) } Loading
packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +15 −7 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ import java.util.Locale; import java.util.Objects; import javax.inject.Inject; import javax.inject.Provider; /** */ Loading Loading @@ -149,6 +150,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { public static final String EXTRA_CONFIRM_ONLY = "extra_confirm_only"; private final Context mContext; private final SystemUIDialog.Factory mSystemUIDialogFactory; private final NotificationManager mNoMan; private final PowerManager mPowerMan; private final KeyguardManager mKeyguard; Loading Loading @@ -186,11 +188,17 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { /** */ @Inject public PowerNotificationWarnings(Context context, ActivityStarter activityStarter, BroadcastSender broadcastSender, Lazy<BatteryController> batteryControllerLazy, DialogLaunchAnimator dialogLaunchAnimator, UiEventLogger uiEventLogger, GlobalSettings globalSettings, UserTracker userTracker) { public PowerNotificationWarnings( Context context, ActivityStarter activityStarter, BroadcastSender broadcastSender, Lazy<BatteryController> batteryControllerLazy, DialogLaunchAnimator dialogLaunchAnimator, UiEventLogger uiEventLogger, UserTracker userTracker, SystemUIDialog.Factory systemUIDialogFactory) { mContext = context; mSystemUIDialogFactory = systemUIDialogFactory; mNoMan = mContext.getSystemService(NotificationManager.class); mPowerMan = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mKeyguard = mContext.getSystemService(KeyguardManager.class); Loading Loading @@ -444,7 +452,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showHighTemperatureDialog() { if (mHighTempDialog != null) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); d.setIconAttribute(android.R.attr.alertDialogIcon); d.setTitle(R.string.high_temp_title); d.setMessage(R.string.high_temp_dialog_message); Loading Loading @@ -479,7 +487,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showThermalShutdownDialog() { if (mThermalShutdownDialog != null) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); d.setIconAttribute(android.R.attr.alertDialogIcon); d.setTitle(R.string.thermal_shutdown_title); d.setMessage(R.string.thermal_shutdown_dialog_message); Loading Loading @@ -643,7 +651,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { private void showStartSaverConfirmation(Bundle extras) { if (mSaverConfirmation != null || mUseExtraSaverConfirmation) return; final SystemUIDialog d = new SystemUIDialog(mContext); final SystemUIDialog d = mSystemUIDialogFactory.create(); final boolean confirmOnly = extras.getBoolean(BatterySaverUtils.EXTRA_CONFIRM_TEXT_ONLY); final int batterySaverTriggerMode = extras.getInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER, Loading
packages/SystemUI/src/com/android/systemui/qs/FgsManagerController.kt +3 −2 Original line number Diff line number Diff line Loading @@ -148,7 +148,8 @@ class FgsManagerControllerImpl @Inject constructor( private val deviceConfigProxy: DeviceConfigProxy, private val dialogLaunchAnimator: DialogLaunchAnimator, private val broadcastDispatcher: BroadcastDispatcher, private val dumpManager: DumpManager private val dumpManager: DumpManager, private val systemUIDialogFactory: SystemUIDialog.Factory, ) : Dumpable, FgsManagerController { companion object { Loading Loading @@ -375,7 +376,7 @@ class FgsManagerControllerImpl @Inject constructor( override fun showDialog(expandable: Expandable?) { synchronized(lock) { if (dialog == null) { val dialog = SystemUIDialog(context) val dialog = systemUIDialogFactory.create() dialog.setTitle(R.string.fgs_manager_dialog_title) dialog.setMessage(R.string.fgs_manager_dialog_message) Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/DataSaverTile.java +5 −2 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements private final DataSaverController mDataSaverController; private final DialogLaunchAnimator mDialogLaunchAnimator; private final SystemUIDialog.Factory mSystemUIDialogFactory; @Inject public DataSaverTile( Loading @@ -68,12 +69,14 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements ActivityStarter activityStarter, QSLogger qsLogger, DataSaverController dataSaverController, DialogLaunchAnimator dialogLaunchAnimator DialogLaunchAnimator dialogLaunchAnimator, SystemUIDialog.Factory systemUIDialogFactory ) { super(host, uiEventLogger, backgroundLooper, mainHandler, falsingManager, metricsLogger, statusBarStateController, activityStarter, qsLogger); mDataSaverController = dataSaverController; mDialogLaunchAnimator = dialogLaunchAnimator; mSystemUIDialogFactory = systemUIDialogFactory; mDataSaverController.observe(getLifecycle(), this); } Loading @@ -98,7 +101,7 @@ public class DataSaverTile extends QSTileImpl<BooleanState> implements // Show a dialog to confirm first. Dialogs shown by the DialogLaunchAnimator must be created // and shown on the main thread, so we post it to the UI handler. mUiHandler.post(() -> { SystemUIDialog dialog = new SystemUIDialog(mContext); SystemUIDialog dialog = mSystemUIDialogFactory.create(); dialog.setTitle(com.android.internal.R.string.data_saver_enable_title); dialog.setMessage(com.android.internal.R.string.data_saver_description); dialog.setPositiveButton(com.android.internal.R.string.data_saver_enable_button, Loading