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
This commit is contained in:
Daichi Hirono
2016-03-22 11:04:29 +09:00
parent 147fa9f542
commit 0f6796284b

View File

@@ -68,7 +68,9 @@ public class UsbModeChooserActivity extends Activity {
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();
}
}