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

Commit 8eb32b93 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Load enterprise thumbnail drawable only if needed" into main

parents 83af6f36 629dcc36
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -584,20 +584,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    // Tracking splash screen status from previous activity
    boolean mSplashScreenStyleSolidColor = false;

    Drawable mEnterpriseThumbnailDrawable;

    boolean mPauseSchedulePendingForPip = false;

    // Gets set to indicate that the activity is currently being auto-pipped.
    boolean mAutoEnteringPip = false;

    private void updateEnterpriseThumbnailDrawable(Context context) {
        DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
        mEnterpriseThumbnailDrawable = dpm.getResources().getDrawable(
                WORK_PROFILE_ICON, OUTLINE, PROFILE_SWITCH_ANIMATION,
                () -> context.getDrawable(R.drawable.ic_corp_badge));
    }

    static final int LAUNCH_SOURCE_TYPE_SYSTEM = 1;
    static final int LAUNCH_SOURCE_TYPE_HOME = 2;
    static final int LAUNCH_SOURCE_TYPE_SYSTEMUI = 3;
@@ -2212,8 +2203,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        mActivityRecordInputSink = new ActivityRecordInputSink(this, sourceRecord);

        updateEnterpriseThumbnailDrawable(mAtmService.getUiContext());

        boolean appActivityEmbeddingEnabled = false;
        try {
            appActivityEmbeddingEnabled = WindowManager.hasWindowExtensionsEnabled()
@@ -7714,9 +7703,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return;
        }
        final Rect frame = win.getRelativeFrame();
        final Drawable thumbnailDrawable = task.mUserId == mWmService.mCurrentUserId
                ? mAtmService.getUiContext().getDrawable(R.drawable.ic_account_circle)
                : mEnterpriseThumbnailDrawable;
        final Context context = mAtmService.getUiContext();
        final Drawable thumbnailDrawable;
        if (task.mUserId == mWmService.mCurrentUserId) {
            thumbnailDrawable = context.getDrawable(R.drawable.ic_account_circle);
        } else {
            final DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
            thumbnailDrawable = dpm.getResources().getDrawable(
                    WORK_PROFILE_ICON, OUTLINE, PROFILE_SWITCH_ANIMATION,
                    () -> context.getDrawable(R.drawable.ic_corp_badge));
        }
        final HardwareBuffer thumbnail = getDisplayContent().mAppTransition
                .createCrossProfileAppsThumbnail(thumbnailDrawable, frame);
        if (thumbnail == null) {