summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-08 22:47:08 -0500
committerMike Lockwood <lockwood@android.com>2011-03-08 22:47:08 -0500
commitd591357524091254483849e37697255cc8fce2ad (patch)
tree914eabcaf84171f276213569a28fb1ec99fbe408 /packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
parent3a68b8338b431eb15d28e92f06452efbbda9493e (diff)
downloadframeworks_base-d591357524091254483849e37697255cc8fce2ad.zip
frameworks_base-d591357524091254483849e37697255cc8fce2ad.tar.gz
frameworks_base-d591357524091254483849e37697255cc8fce2ad.tar.bz2
Close USB dialogs if their corresponding accessory or device has disconnected
BUG: 4060065 Change-Id: Ib517e5e4a5422f9f0c8fca601308cecf7743c5d1 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
index 92c6d3d..f1784df 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbPermissionActivity.java
@@ -57,6 +57,7 @@ public class UsbPermissionActivity extends AlertActivity
private String mPackageName;
private int mUid;
private boolean mPermissionGranted;
+ private UsbDisconnectedReceiver mDisconnectedReceiver;
@Override
public void onCreate(Bundle icicle) {
@@ -85,8 +86,10 @@ public class UsbPermissionActivity extends AlertActivity
ap.mTitle = appName;
if (mDevice == null) {
ap.mMessage = getString(R.string.usb_accessory_permission_prompt, appName);
+ mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mAccessory);
} else {
ap.mMessage = getString(R.string.usb_device_permission_prompt, appName);
+ mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mDevice);
}
ap.mPositiveButtonText = getString(com.android.internal.R.string.ok);
ap.mNegativeButtonText = getString(com.android.internal.R.string.cancel);
@@ -142,6 +145,9 @@ public class UsbPermissionActivity extends AlertActivity
Log.e(TAG, "IUsbService connection failed", e);
}
+ if (mDisconnectedReceiver != null) {
+ unregisterReceiver(mDisconnectedReceiver);
+ }
super.onDestroy();
}