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

Commit 0be571b5 authored by Matt Sziklay's avatar Matt Sziklay Committed by Android (Google) Code Review
Browse files

Merge "Remove matching taskId check from getTaskScreenshots." into main

parents 93fd7e40 3b2212ad
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -850,7 +850,9 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        mBgExecutor.execute(() -> {
            final ArrayList<Pair<Integer, TaskSnapshot>> snapshotList =
                    getTaskSnapshots(decor.mTaskInfo);
            if (!snapshotList.isEmpty()) {
                mMainExecutor.execute(() -> decor.createManageWindowsMenu(snapshotList));
            }
        });
    }

@@ -915,17 +917,17 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                    ActivityManager.RECENT_WITH_EXCLUDED,
                    activityManager.getCurrentUser().id);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
            ProtoLog.e(WM_SHELL_DESKTOP_MODE,
                    "%s: Error getting recent tasks: %s", TAG, e);
            return new ArrayList<>();
        }
        final String callerPackageName = callerTaskInfo.baseActivity.getPackageName();
        for (ActivityManager.RecentTaskInfo info : recentTasks) {
            if (info.taskId == callerTaskInfo.taskId || info.baseActivity == null) continue;
            if (info.baseActivity == null) continue;
            final String infoPackageName = info.baseActivity.getPackageName();
            if (!infoPackageName.equals(callerPackageName)) {
                continue;
            }
            if (info.baseActivity != null) {
                if (callerPackageName.equals(infoPackageName)) {
            // TODO(b/337903443): Fix this returning null for freeform tasks.
            try {
                TaskSnapshot screenshot = activityTaskManagerService
@@ -936,9 +938,9 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                }
                snapshotList.add(new Pair(info.taskId, screenshot));
            } catch (RemoteException e) {
                        throw new RuntimeException(e);
                    }
                }
                ProtoLog.e(WM_SHELL_DESKTOP_MODE,
                        "%s: Error getting task snapshot for task %d: %s", TAG, info.taskId, e);
                return new ArrayList<>();
            }
        }
        return snapshotList;
+3 −1
Original line number Diff line number Diff line
@@ -1530,7 +1530,9 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    void createManageWindowsMenu(@NonNull List<Pair<Integer, TaskSnapshot>> snapshotList) {
        final Function1<Integer, Unit> onOpenInstanceListener = (requestedTaskId) -> {
            closeManageWindowsMenu();
            if (mTaskInfo.taskId != requestedTaskId) {
                mWindowDecorationActions.onOpenInstance(mTaskInfo, requestedTaskId);
            }
            return Unit.INSTANCE;
        };
        if (mTaskInfo.isFreeform()) {