Fix text is cut off in corner cut out condition
There is a todo that it needs to handle the corner cut out. In the
condition of RTL and Corner Cut out, HeadsUpStatusBarView's padding
is wrong because displayCutout.getSafeInsetRight() is 0 but corner
cut out actually impact HeadsUpStatusBar's layout. Corner cut out
make icon's start more big but mCutOutInset is 0 so the newPadding
is a negative number.
The handle method is to detect the part of overlaying with corner
cut out. i.e. center cut out is exclude. To count the cut out start
as cutOutStart and compare cutOutStart with icon's start. The cut
out is not corner cut out if cutOutStart < icon's start.
icon's minus the width of overlay part to prevent from negative
padding.
move the get screen size from onLayout to fitSystemWindows and
onAttachToWindow because there is a chance to new object in
onLayout. To new object in onLayout is not good practice. And,
there is an chance to invoke ANR because Display.getRealSize() may
do IPC.
Fixes: 80271465
Test: atest SystemUITests
Change-Id: I36fa5c880f5e624747133e46950c1c1695a5fa58
2 files changed