Explicity receive sticky usb intent
Sticky intents are both returned by onReceive and broadcast to the receiver. In some cases though, the receiver could be unregistered so quickly that it has no time to receive it. When this happens the screen is not refreshed, so explicity handle the intent to ensure a refresh. Fixes: 74255559 Test: screen refreshed property in multi-window Change-Id: I2480dc35e28f98561ffed4b557f4bdaf83a73e9c
This commit is contained in:
@@ -98,7 +98,11 @@ public class UsbConnectionBroadcastReceiver extends BroadcastReceiver implements
|
||||
final IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(UsbManager.ACTION_USB_STATE);
|
||||
intentFilter.addAction(UsbManager.ACTION_USB_PORT_CHANGED);
|
||||
mContext.registerReceiver(this, intentFilter);
|
||||
final Intent intent = mContext.registerReceiver(this, intentFilter);
|
||||
// TODO b/77240599 use an api instead of sticky intent
|
||||
if (intent != null) {
|
||||
onReceive(mContext, intent);
|
||||
}
|
||||
mListeningToUsbEvents = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user