Prevent NullPointerException and remove unsed variable

Bug: 234093736
Test: presubmit
Change-Id: Id4298f3af970cba0608960bcac21c141bb2d99aa
This commit is contained in:
Tiger
2023-02-06 18:46:40 +08:00
parent b9f60293ca
commit ccf95f2467
2 changed files with 6 additions and 1 deletions

View File

@@ -69,7 +69,6 @@ public class SurfaceControlViewHostInsetsTest {
private InsetsState statusBarState(boolean visible) {
final InsetsState insetsState = new InsetsState();
final int id = InsetsSource.createId(null /* owner */, 0 /* index */, statusBars());
insetsState.setDisplayFrame(new Rect(0, 0, 1000, 1000));
insetsState.getOrCreateSource(
InsetsSource.createId(null /* owner */, 0 /* index */, statusBars()), statusBars())

View File

@@ -635,6 +635,12 @@ class InsetsPolicy {
final SparseArray<InsetsSourceControl> controlsReady = new SparseArray<>();
final InsetsSourceControl[] controls =
mStateController.getControlsForDispatch(mDummyControlTarget);
if (controls == null) {
if (callback != null) {
DisplayThread.getHandler().post(callback);
}
return;
}
for (InsetsSourceControl control : controls) {
if (isTransient(control.getType()) && control.getLeash() != null) {
typesReady |= control.getType();