Fix potential crash when exit splash screen
- Make sure mDecorView is attached before calling its WindowInsetsController. - Amend modifier declare sequence for a better code style. Bug: 258270145 Bug: 256766422 Test: atest SplashscreenTests StartingSurfaceDrawerTests Change-Id: I4d3b184252ed9516827812adfa0c76e07a6527e7 Merged-In: I4d3b184252ed9516827812adfa0c76e07a6527e7
This commit is contained in:
@@ -430,7 +430,8 @@ public class StartingSurfaceDrawer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable SplashScreenView get() {
|
@Nullable
|
||||||
|
public SplashScreenView get() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
while (!mIsViewSet) {
|
while (!mIsViewSet) {
|
||||||
try {
|
try {
|
||||||
@@ -691,7 +692,7 @@ public class StartingSurfaceDrawer {
|
|||||||
private final TaskSnapshotWindow mTaskSnapshotWindow;
|
private final TaskSnapshotWindow mTaskSnapshotWindow;
|
||||||
private SplashScreenView mContentView;
|
private SplashScreenView mContentView;
|
||||||
private boolean mSetSplashScreen;
|
private boolean mSetSplashScreen;
|
||||||
private @StartingWindowType int mSuggestType;
|
@StartingWindowType private int mSuggestType;
|
||||||
private int mBGColor;
|
private int mBGColor;
|
||||||
private final long mCreateTime;
|
private final long mCreateTime;
|
||||||
private int mSystemBarAppearance;
|
private int mSystemBarAppearance;
|
||||||
@@ -732,7 +733,7 @@ public class StartingSurfaceDrawer {
|
|||||||
|
|
||||||
// Reset the system bar color which set by splash screen, make it align to the app.
|
// Reset the system bar color which set by splash screen, make it align to the app.
|
||||||
private void clearSystemBarColor() {
|
private void clearSystemBarColor() {
|
||||||
if (mDecorView == null) {
|
if (mDecorView == null || !mDecorView.isAttachedToWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mDecorView.getLayoutParams() instanceof WindowManager.LayoutParams) {
|
if (mDecorView.getLayoutParams() instanceof WindowManager.LayoutParams) {
|
||||||
|
|||||||
Reference in New Issue
Block a user