Add null check to work around async unregistration of receiver
Bug: 193890703 Test: atest SystemUITests Change-Id: I47272513482c2ed31167574d2f2cab6094cfd590
This commit is contained in:
@@ -1642,10 +1642,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
|
|||||||
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
// This receiver is unregistered when the view is detached, but on devices with multiple
|
// TODO(193941146): Currently unregistering a receiver through BroadcastDispatcher is
|
||||||
// displays, it can sometimes still receive an ACTION_SCREEN_ON/ACTION_SCREEN_OFF on
|
// async, but we've already cleared the fields. Just return early in this case.
|
||||||
// display switch, after it was detached, so this null check ensures no crash in that
|
|
||||||
// scenario.
|
|
||||||
if (mNavigationBarView == null) {
|
if (mNavigationBarView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user