diff options
author | 2024-01-05 16:52:57 +0900 | |
---|---|---|
committer | 2024-01-10 04:52:13 +0000 | |
commit | fd66c04cbb9a6cd80b487ab45873a226073f2428 (patch) | |
tree | 467440e4663bd817eebd971c6753fe6211fccc48 | |
parent | d53919e1e4057be97c2702e1b9a4cc79ce97357e (diff) |
Dismiss dialogs in onStop()
Dismiss WifiDialog dialogs in onStop() to prevent ANRs when the activity
is frozen but the dialog is still being shown with the screen off.
Bug: 317837996
Test: `adb shell cmd wifi launch-dialog-simple -t` while screen is off,
verify dialog appears when screen turns on.
Change-Id: I8f55d4c81a4f0ab28d17865feceb370ec8e3a83d
-rw-r--r-- | WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java index 198e07d532..479227009a 100644 --- a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java +++ b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java @@ -249,19 +249,17 @@ public class WifiDialogActivity extends Activity { @Override protected void onStop() { super.onStop(); - if (!isChangingConfigurations()) { - if (!BuildCompat.isAtLeastU()) { - // Before U, we don't have INTERNAL_SYSTEM_WINDOW permission to always show at the - // top, so close all dialogs when we're not visible anymore. - for (int i = 0; i < mActiveDialogsPerId.size(); i++) { - mActiveDialogsPerId.valueAt(i).cancel(); - } + if (!isChangingConfigurations() && !BuildCompat.isAtLeastU()) { + // Before U, we don't have INTERNAL_SYSTEM_WINDOW permission to always show at the + // top, so close all dialogs when we're not visible anymore (i.e. another app launches + // on top of us). + for (int i = 0; i < mActiveDialogsPerId.size(); i++) { + mActiveDialogsPerId.valueAt(i).cancel(); } return; } - // If we're stopping due to a configuration change, dismiss all the dialogs without - // removing it from mLaunchIntentsPerId to prevent window leaking. The dialogs will be - // recreated from mLaunchIntentsPerId in onStart(). + // Dismiss all the dialogs without removing it from mLaunchIntentsPerId to prevent window + // leaking. The dialogs will be recreated from mLaunchIntentsPerId in onStart(). for (int i = 0; i < mActiveDialogsPerId.size(); i++) { Dialog dialog = mActiveDialogsPerId.valueAt(i); // Set the dismiss listener to null to prevent removing the Intent from |