Merge "Fix handling usb notification after pr_swap complete" am: b681fec035

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1984546

Change-Id: I2df61f61b2ce2ff7934286e8e04d572f2042a523
This commit is contained in:
Treehugger Robot
2022-02-16 04:45:07 +00:00
committed by Automerger Merge Worker

View File

@@ -489,6 +489,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
// current USB state // current USB state
private boolean mHostConnected; private boolean mHostConnected;
private boolean mUsbAccessoryConnected;
private boolean mSourcePower; private boolean mSourcePower;
private boolean mSinkPower; private boolean mSinkPower;
private boolean mConfigured; private boolean mConfigured;
@@ -958,10 +959,10 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
break; break;
case MSG_UPDATE_HOST_STATE: case MSG_UPDATE_HOST_STATE:
Iterator devices = (Iterator) msg.obj; Iterator devices = (Iterator) msg.obj;
boolean connected = (msg.arg1 == 1); mUsbAccessoryConnected = (msg.arg1 == 1);
if (DEBUG) { if (DEBUG) {
Slog.i(TAG, "HOST_STATE connected:" + connected); Slog.i(TAG, "HOST_STATE connected:" + mUsbAccessoryConnected);
} }
mHideUsbNotification = false; mHideUsbNotification = false;
@@ -1215,7 +1216,7 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser
} else if (mSourcePower) { } else if (mSourcePower) {
titleRes = com.android.internal.R.string.usb_supplying_notification_title; titleRes = com.android.internal.R.string.usb_supplying_notification_title;
id = SystemMessage.NOTE_USB_SUPPLYING; id = SystemMessage.NOTE_USB_SUPPLYING;
} else if (mHostConnected && mSinkPower && mUsbCharging) { } else if (mHostConnected && mSinkPower && (mUsbCharging || mUsbAccessoryConnected)) {
titleRes = com.android.internal.R.string.usb_charging_notification_title; titleRes = com.android.internal.R.string.usb_charging_notification_title;
id = SystemMessage.NOTE_USB_CHARGING; id = SystemMessage.NOTE_USB_CHARGING;
} }