[Settings] Additional route for dismiss activity dialog

Previous design dismiss an activity dialog through Intent would lead to a pair of creating and finishing activity. The task switch during the creating and finishing may introduce some side effect to the other apps.

This change tried to add additional route to avoid from dismiss through Intent
but sending an async close request to that specific dialog (if available).

Bug: 236956105
Test: local, auto testing
Merged-In: I7a912a3393694155d29614d325796e08598985bf
Merged-In: I0a7e0e9826a301f2aa0ca34f40b5570f0e384b4f
Change-Id: I88a6c0632c1be906b310a10c154149c319d34759
This commit is contained in:
Bonian Chen
2022-11-22 10:39:18 +00:00
parent 5125477d7b
commit 68c294df24
4 changed files with 114 additions and 18 deletions

View File

@@ -65,6 +65,8 @@ public class SimDialogActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SimDialogProhibitService.supportDismiss(this);
getWindow().addSystemFlags(
WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
showOrUpdateDialog();
@@ -225,4 +227,15 @@ public class SimDialogActivity extends FragmentActivity {
}
return null;
}
/*
* Force dismiss this Activity.
*/
protected void forceClose() {
if (isFinishing() || isDestroyed()) {
return;
}
Log.d(TAG, "Dismissed by Service");
finishAndRemoveTask();
}
}