diff options
-rwxr-xr-x[-rw-r--r--] | services/core/java/com/android/server/am/BaseErrorDialog.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/BaseErrorDialog.java b/services/core/java/com/android/server/am/BaseErrorDialog.java index 6ede8f8..35bdee0 100644..100755 --- a/services/core/java/com/android/server/am/BaseErrorDialog.java +++ b/services/core/java/com/android/server/am/BaseErrorDialog.java @@ -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; } |