Toggle switch back when user dismisses dialog by tapping screen

The reboot dialog can be dismissed when user:
1) Clicks any button on the reboot dialog
2) Taps any screen area outside of reboot dialog

We want to toggle back the "Enable ANGLE" switch
whenever the user chooses to not reboot the device
immetiately.

This change adds the function to toggle the
"Enable ANGLE" switch back when:
1) User clicks "Cancel" on reboot dialog.
2) User taps screen area outside of reboot dialog
to dismiss the reboot dialog.

Bug: b/270994705
Test: m; flash and device can boot.
atest -c GraphicsDriverEnableAngleAsSystemDriverControllerJUnitTest

Change-Id: I84fde5ea5bae9d8793bcef30f4c37d832152ae43
This commit is contained in:
Yuxin Hu
2023-05-13 01:04:16 +00:00
parent 66dba214e6
commit 2cbb587f81
4 changed files with 338 additions and 140 deletions

View File

@@ -20,22 +20,20 @@ import android.content.Context;
import android.content.Intent;
/**
* Host of {@link RebootConfirmationDialogFragment} that provides callback when user
* interacts with the UI.
* Host of {@link RebootConfirmationDialogFragment} that provides callback when user interacts with
* the UI.
*/
public interface RebootConfirmationDialogHost {
/**
* Called when user made a decision to reboot the device.
*/
/** Called when user made a decision to reboot the device. */
default void onRebootConfirmed(Context context) {
// user presses button "Reboot now", reboot the device
final Intent intent = new Intent(Intent.ACTION_REBOOT);
context.startActivity(intent);
}
/**
* Called when user made a decision to cancel the reboot
* Default to do nothing
*/
/** Called when user made a decision to cancel the reboot Default to do nothing */
default void onRebootCancelled() {}
/** Called when reboot dialog is dismissed Default to do nothing */
default void onRebootDialogDismissed() {}
}