diff options
| author | Amith Yamasani <yamasani@google.com> | 2012-04-25 17:31:03 -0700 |
|---|---|---|
| committer | Amith Yamasani <yamasani@google.com> | 2012-04-25 18:18:30 -0700 |
| commit | 2efb6a94ca528beb96e26bd3ad2f4b995fb75b49 (patch) | |
| tree | 4fc9ed913b547dd1b5f2da59819249791211a3b4 | |
| parent | 1fa1de527e541c88fb3809279b67b0dc29419bac (diff) | |
| download | frameworks_base-2efb6a94ca528beb96e26bd3ad2f4b995fb75b49.zip frameworks_base-2efb6a94ca528beb96e26bd3ad2f4b995fb75b49.tar.gz frameworks_base-2efb6a94ca528beb96e26bd3ad2f4b995fb75b49.tar.bz2 | |
Don't unregister receiver twice.
Bug: 6008202
Change-Id: I3a9c76b74c1451b634341806d9c93768925737cd
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/GlobalActions.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index cd6da85..3fa79b6 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -114,14 +114,21 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mDeviceProvisioned = isDeviceProvisioned; if (mDialog != null) { mDialog.dismiss(); + mDialog = null; + // Show delayed, so that the dismiss of the previous dialog completes + mHandler.sendEmptyMessage(MESSAGE_SHOW); + } else { + handleShow(); } + } + + private void handleShow() { mDialog = createDialog(); prepareDialog(); mDialog.show(); mDialog.getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_DISABLE_EXPAND); } - /** * Create the global actions dialog. * @return A new dialog. @@ -280,7 +287,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac } } - /** {@inheritDoc} */ public void onDismiss(DialogInterface dialog) { if (SHOW_SILENT_TOGGLE) { @@ -694,16 +700,23 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private static final int MESSAGE_DISMISS = 0; private static final int MESSAGE_REFRESH = 1; + private static final int MESSAGE_SHOW = 2; private static final int DIALOG_DISMISS_DELAY = 300; // ms private Handler mHandler = new Handler() { public void handleMessage(Message msg) { - if (msg.what == MESSAGE_DISMISS) { + switch (msg.what) { + case MESSAGE_DISMISS: if (mDialog != null) { mDialog.dismiss(); } - } else if (msg.what == MESSAGE_REFRESH) { + break; + case MESSAGE_REFRESH: mAdapter.notifyDataSetChanged(); + break; + case MESSAGE_SHOW: + handleShow(); + break; } } }; |
