Don't close USB type notification when USB is connected to USB devices.
Previously we show a notificatino to show the UsbModeChooser when
Android is connected to another Android via USB type C cable.
However UsbModeChoooser activity was closed immediately after a user
tapped the notification, if the Android worked as host.
FIXED=27535640
Change-Id: I707dcbf1021e7381096c0ae7cc2d712892ac5a5a
diff --git a/src/com/android/settings/deviceinfo/UsbModeChooserActivity.java b/src/com/android/settings/deviceinfo/UsbModeChooserActivity.java
index bb8ffc1..d592fcc 100644
--- a/src/com/android/settings/deviceinfo/UsbModeChooserActivity.java
+++ b/src/com/android/settings/deviceinfo/UsbModeChooserActivity.java
@@ -68,7 +68,9 @@
String action = intent.getAction();
if (UsbManager.ACTION_USB_STATE.equals(action)) {
boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
- if (!connected) {
+ boolean hostConnected =
+ intent.getBooleanExtra(UsbManager.USB_HOST_CONNECTED, false);
+ if (!connected && !hostConnected) {
mDialog.dismiss();
}
}