summaryrefslogtreecommitdiff
path: root/WifiDialog/src
diff options
context:
space:
mode:
author Quang Luong <qal@google.com> 2022-11-09 21:55:48 +0000
committer Quang Luong <qal@google.com> 2022-12-05 21:33:04 +0000
commitd7fa29fbc6d201b56c9a4481e87041183260cd90 (patch)
tree76f1992a33876ebaa07a048b53b34b360575fedd /WifiDialog/src
parentba6ee84b316b907bb7370bbaa4c7e8db1e8a3a0b (diff)
Kill WifiDialog process from Wifi service
Have Wifi service send signal to kill the WifiDialog process instead of handling it implicitly from WifiDialogActivity. This allows for future synchronization to avoid launching a dialog at the same time the process is being killed, which causes undefined race-condition behavior. Bug: 257398441 Test: adb shell cmd wifi launch-dialog-simple -t Title -m Message, verify process is killed in logcat when dialog is replied/cancelled/home button pressed. Change-Id: Ia08a8226867d0171fd3b72f35e0c11802a920851
Diffstat (limited to 'WifiDialog/src')
-rw-r--r--WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java28
1 files changed, 0 insertions, 28 deletions
diff --git a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
index b73bee04be..e5b2ac6b59 100644
--- a/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
+++ b/WifiDialog/src/com/android/wifi/dialog/WifiDialogActivity.java
@@ -37,7 +37,6 @@ import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
-import android.os.Process;
import android.os.SystemClock;
import android.os.Vibrator;
import android.text.Editable;
@@ -72,8 +71,6 @@ import java.util.Set;
* Main Activity of the WifiDialog application. All dialogs should be created and managed from here.
*/
public class WifiDialogActivity extends Activity {
- private static int sNumActiveInstances = 0;
-
private static final String TAG = "WifiDialog";
private static final String KEY_DIALOG_INTENTS = "KEY_DIALOG_INTENTS";
private static final String EXTRA_DIALOG_EXPIRATION_TIME_MS =
@@ -213,10 +210,6 @@ public class WifiDialogActivity extends Activity {
@Override
protected void onStart() {
super.onStart();
- sNumActiveInstances++;
- if (mIsVerboseLoggingEnabled) {
- Log.v(TAG, "onStart() incrementing sActiveInstances to " + sNumActiveInstances);
- }
registerReceiver(
mCloseSystemDialogsReceiver, new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
ArraySet<Integer> invalidDialogIds = new ArraySet<>();
@@ -260,10 +253,6 @@ public class WifiDialogActivity extends Activity {
@Override
protected void onStop() {
super.onStop();
- sNumActiveInstances--;
- if (mIsVerboseLoggingEnabled) {
- Log.v(TAG, "onStop() decrementing sActiveInstances to " + sNumActiveInstances);
- }
unregisterReceiver(mCloseSystemDialogsReceiver);
if (isChangingConfigurations()) {
@@ -328,23 +317,6 @@ public class WifiDialogActivity extends Activity {
}
}
- @Override
- protected void onDestroy() {
- super.onDestroy();
- if (isFinishing()) {
- if (sNumActiveInstances > 0) {
- if (mIsVerboseLoggingEnabled) {
- Log.v(TAG, "Finished with sNumActiveInstances: " + sNumActiveInstances);
- }
- return;
- }
- if (mIsVerboseLoggingEnabled) {
- Log.v(TAG, "Finished with no active instances left. Killing process.");
- }
- Process.killProcess(android.os.Process.myPid());
- }
- }
-
/**
* Creates and shows a dialog for the given dialogId and Intent.
* Returns {@code true} if the dialog was successfully created, {@code false} otherwise.