Merge "Add null check to work around async unregistration of receiver" into sc-dev am: 72922c8a85

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

Change-Id: Ie1e6546b22174f680af8996cf98057251d6ab690
This commit is contained in:
Winson Chung
2021-07-20 00:23:01 +00:00
committed by Automerger Merge Worker

View File

@@ -1620,6 +1620,11 @@ 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) {
// TODO(193941146): Currently unregistering a receiver through BroadcastDispatcher is
// async, but we've already cleared the fields. Just return early in this case.
if (mNavigationBarView == null) {
return;
}
String action = intent.getAction(); String action = intent.getAction();
if (Intent.ACTION_SCREEN_OFF.equals(action) if (Intent.ACTION_SCREEN_OFF.equals(action)
|| Intent.ACTION_SCREEN_ON.equals(action)) { || Intent.ACTION_SCREEN_ON.equals(action)) {