diff options
author | Joe Onorato <joeo@google.com> | 2011-02-07 13:43:50 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-02-07 13:43:50 -0800 |
commit | 91445d73e069d03110d39a4c711c9ef462b9f24e (patch) | |
tree | 61c36412073faceae7f8eda6c201cd0510f75baf /packages | |
parent | d4a4680a237797475d6b52d06d1190695a783b10 (diff) | |
parent | 3162211bc78c98836f0c9d76a8e94741e4255bed (diff) | |
download | frameworks_base-91445d73e069d03110d39a4c711c9ef462b9f24e.zip frameworks_base-91445d73e069d03110d39a4c711c9ef462b9f24e.tar.gz frameworks_base-91445d73e069d03110d39a4c711c9ef462b9f24e.tar.bz2 |
am 3162211b: am 2742c9c2: am 163c28b5: Merge "Managed dialogs should run on the same thread as their activity." into gingerbread
* commit '3162211bc78c98836f0c9d76a8e94741e4255bed':
Managed dialogs should run on the same thread as their activity.
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java index a834266..1368baa 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java +++ b/packages/SystemUI/src/com/android/systemui/usb/UsbStorageActivity.java @@ -71,6 +71,7 @@ public class UsbStorageActivity extends Activity private static final int DLG_CONFIRM_KILL_STORAGE_USERS = 1; private static final int DLG_ERROR_SHARING = 2; static final boolean localLOGV = false; + private boolean mDestroyed; // UI thread private Handler mUIHandler; @@ -136,6 +137,12 @@ public class UsbStorageActivity extends Activity mProgressBar = (ProgressBar) findViewById(com.android.internal.R.id.progress); } + @Override + protected void onDestroy() { + super.onDestroy(); + mDestroyed = true; + } + private void switchDisplay(final boolean usbStorageInUse) { mUIHandler.post(new Runnable() { @Override @@ -232,9 +239,16 @@ public class UsbStorageActivity extends Activity return null; } - private void showDialogInner(int id) { - removeDialog(id); - showDialog(id); + private void scheduleShowDialog(final int id) { + mUIHandler.post(new Runnable() { + @Override + public void run() { + if (!mDestroyed) { + removeDialog(id); + showDialog(id); + } + } + }); } private void switchUsbMassStorage(final boolean on) { @@ -276,7 +290,7 @@ public class UsbStorageActivity extends Activity IMountService ims = getMountService(); if (ims == null) { // Display error dialog - showDialogInner(DLG_ERROR_SHARING); + scheduleShowDialog(DLG_ERROR_SHARING); } String extStoragePath = Environment.getExternalStorageDirectory().toString(); boolean showDialog = false; @@ -294,11 +308,11 @@ public class UsbStorageActivity extends Activity } } catch (RemoteException e) { // Display error dialog - showDialogInner(DLG_ERROR_SHARING); + scheduleShowDialog(DLG_ERROR_SHARING); } if (showDialog) { // Display dialog to user - showDialogInner(DLG_CONFIRM_KILL_STORAGE_USERS); + scheduleShowDialog(DLG_CONFIRM_KILL_STORAGE_USERS); } else { if (localLOGV) Log.i(TAG, "Enabling UMS"); switchUsbMassStorage(true); |