Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3c35f37 authored by Zhenhua Deng's avatar Zhenhua Deng Committed by Tiger
Browse files

Fix IMC NPE for try to access view without attach window

Somtimes apk can frequently switch into Immersive Mode, this tip
show will kind of messed while apk immediatelly finish and start again,
if something stucked, immersive mode win will focus enter delayed,
apply instes but still not attached window.

Bug: 351098088
Flag: EXEMPT bugfix
Test: run monkey auto test
Change-Id: I60168c8166f95efcb6f8a56489ddee67e4a084b1
parent 002dd68f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -485,9 +485,8 @@ public class ImmersiveModeConfirmation implements CoreStartable, CommandQueue.Ca
            final boolean intersectsTopCutout = topDisplayCutout.intersects(
                    width - (windowWidth / 2), 0,
                    width + (windowWidth / 2), topDisplayCutout.bottom);
            if (mClingWindow != null &&
                    (windowWidth < 0 || (width > 0 && intersectsTopCutout))) {
                final View iconView = mClingWindow.findViewById(R.id.immersive_cling_icon);
            if (windowWidth < 0 || (width > 0 && intersectsTopCutout)) {
                final View iconView = findViewById(R.id.immersive_cling_icon);
                RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams)
                        iconView.getLayoutParams();
                lp.topMargin = topDisplayCutout.bottom;
+2 −3
Original line number Diff line number Diff line
@@ -408,9 +408,8 @@ public class ImmersiveModeConfirmation {
            final boolean intersectsTopCutout = topDisplayCutout.intersects(
                    width - (windowWidth / 2), 0,
                    width + (windowWidth / 2), topDisplayCutout.bottom);
            if (mClingWindow != null &&
                    (windowWidth < 0 || (width > 0 && intersectsTopCutout))) {
                final View iconView = mClingWindow.findViewById(R.id.immersive_cling_icon);
            if (windowWidth < 0 || (width > 0 && intersectsTopCutout)) {
                final View iconView = findViewById(R.id.immersive_cling_icon);
                RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams)
                        iconView.getLayoutParams();
                lp.topMargin = topDisplayCutout.bottom;