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