am 08881385: Merge "[ActivityManager] Prevent potential deadlock from system error dialog and InputMethodManager."
* commit '08881385a86bf887669a555ae03759c374ec9c50': [ActivityManager] Prevent potential deadlock from system error dialog and InputMethodManager.
This commit is contained in:
15
services/java/com/android/server/am/BaseErrorDialog.java
Normal file → Executable file
15
services/java/com/android/server/am/BaseErrorDialog.java
Normal file → Executable file
@@ -27,6 +27,11 @@ import android.view.WindowManager;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
class BaseErrorDialog extends AlertDialog {
|
class BaseErrorDialog extends AlertDialog {
|
||||||
|
private static final int ENABLE_BUTTONS = 0;
|
||||||
|
private static final int DISABLE_BUTTONS = 1;
|
||||||
|
|
||||||
|
private boolean mConsuming = true;
|
||||||
|
|
||||||
public BaseErrorDialog(Context context) {
|
public BaseErrorDialog(Context context) {
|
||||||
super(context, com.android.internal.R.style.Theme_Dialog_AppError);
|
super(context, com.android.internal.R.style.Theme_Dialog_AppError);
|
||||||
|
|
||||||
@@ -41,8 +46,8 @@ class BaseErrorDialog extends AlertDialog {
|
|||||||
|
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
setEnabled(false);
|
mHandler.sendEmptyMessage(DISABLE_BUTTONS);
|
||||||
mHandler.sendMessageDelayed(mHandler.obtainMessage(0), 1000);
|
mHandler.sendMessageDelayed(mHandler.obtainMessage(ENABLE_BUTTONS), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
@@ -71,12 +76,12 @@ class BaseErrorDialog extends AlertDialog {
|
|||||||
|
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
if (msg.what == 0) {
|
if (msg.what == ENABLE_BUTTONS) {
|
||||||
mConsuming = false;
|
mConsuming = false;
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
} else if (msg.what == DISABLE_BUTTONS) {
|
||||||
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean mConsuming = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user