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

Commit 744b9f18 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Catch getDrawable throw exception when add splash screen window." into sc-dev

parents 4d53e640 c79329e7
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ public class StartingSurfaceDrawer {
            labelRes = app.labelRes;
        }

        final int taskId = taskInfo.taskId;
        Context context = mContext;
        // replace with the default theme if the application didn't set
        final int theme = windowInfo.splashScreenThemeResId != 0
@@ -153,6 +154,7 @@ public class StartingSurfaceDrawer {
            } catch (PackageManager.NameNotFoundException e) {
                Slog.w(TAG, "Failed creating package context with package name "
                        + activityInfo.packageName + " for user " + taskInfo.userId, e);
                return;
            }
        }

@@ -167,6 +169,7 @@ public class StartingSurfaceDrawer {
            final TypedArray typedArray = overrideContext.obtainStyledAttributes(
                    com.android.internal.R.styleable.Window);
            final int resId = typedArray.getResourceId(R.styleable.Window_windowBackground, 0);
            try {
                if (resId != 0 && overrideContext.getDrawable(resId) != null) {
                    // We want to use the windowBackground for the override context if it is
                    // available, otherwise we use the default one to make sure a themed starting
@@ -177,6 +180,11 @@ public class StartingSurfaceDrawer {
                    }
                    context = overrideContext;
                }
            } catch (Resources.NotFoundException e) {
                Slog.w(TAG, "failed creating starting window for overrideConfig at taskId: "
                        + taskId, e);
                return;
            }
            typedArray.recycle();
        }

@@ -258,7 +266,6 @@ public class StartingSurfaceDrawer {
        params.setTitle("Splash Screen " + activityInfo.packageName);

        // TODO(b/173975965) tracking performance
        final int taskId = taskInfo.taskId;
        SplashScreenView sView = null;
        try {
            final View view = win.getDecorView();
+2 −1
Original line number Diff line number Diff line
@@ -112,7 +112,8 @@ public class StartingSurfaceDrawerTests {
        spyOn(context);
        spyOn(realWindowManager);
        try {
            doReturn(context).when(context).createPackageContext(anyString(), anyInt());
            doReturn(context).when(context)
                    .createPackageContextAsUser(anyString(), anyInt(), any());
        } catch (PackageManager.NameNotFoundException e) {
            //
        }