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

Commit d0b23cfd authored by Ben Lin's avatar Ben Lin
Browse files

Don't allow app handle to be drawn for any task w/ default home package.

If there's a task that's of the default home launcher package, let's not
draw the app handle. Although we have ACTIVITY_HOME to guard against
general launcher activity already, there are other activities (e.g.
ProxyActivityStarter) in the package that we don't want to enter
freeform.

Bug: 365023423
Test: no longer seeing app handle when launching widget settings
Flag: EXEMPT bugfix
Change-Id: I33ab6f3d4198d3c531d4323712ae8bdc2672de01
parent 3b816efa
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityTaskManager;
import android.app.IActivityManager;
import android.app.IActivityTaskManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Point;
@@ -1474,6 +1475,9 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                && isTopActivityExemptFromDesktopWindowing(mContext, taskInfo)) {
            return false;
        }
        if (isPartOfDefaultHomePackage(taskInfo)) {
            return false;
        }
        return DesktopModeStatus.canEnterDesktopMode(mContext)
                && !DesktopWallpaperActivity.isWallpaperTask(taskInfo)
                && taskInfo.getWindowingMode() != WINDOWING_MODE_PINNED
@@ -1481,6 +1485,14 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                && !taskInfo.configuration.windowConfiguration.isAlwaysOnTop();
    }

    private boolean isPartOfDefaultHomePackage(RunningTaskInfo taskInfo) {
        final ComponentName currentDefaultHome =
                mContext.getPackageManager().getHomeActivities(new ArrayList<>());
        return currentDefaultHome != null && taskInfo.baseActivity != null
                && currentDefaultHome.getPackageName()
                .equals(taskInfo.baseActivity.getPackageName());
    }

    private void createWindowDecoration(
            ActivityManager.RunningTaskInfo taskInfo,
            SurfaceControl taskSurface,