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

Commit b69451bd authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am 6cb91260: Make next activity opaque when media stops

* commit '6cb9126068b084248276a21e2b72451d8618a30a':
  Make next activity opaque when media stops
parents 84c242f1 fa387ad6
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -1099,6 +1099,51 @@ final class ActivityStack {
        }
    }

    // Find the first visible activity above the passed activity and if it is translucent return it
    // otherwise return null;
    ActivityRecord findNextTranslucentActivity(ActivityRecord r) {
        TaskRecord task = r.task;
        if (task == null) {
            return null;
        }

        ActivityStack stack = task.stack;
        if (stack == null) {
            return null;
        }

        int stackNdx = mStacks.indexOf(stack);

        ArrayList<TaskRecord> tasks = stack.mTaskHistory;
        int taskNdx = tasks.indexOf(task);

        ArrayList<ActivityRecord> activities = task.mActivities;
        int activityNdx = activities.indexOf(r) + 1;

        final int numStacks = mStacks.size();
        while (stackNdx < numStacks) {
            tasks = mStacks.get(stackNdx).mTaskHistory;
            final int numTasks = tasks.size();
            while (taskNdx < numTasks) {
                activities = tasks.get(taskNdx).mActivities;
                final int numActivities = activities.size();
                while (activityNdx < numActivities) {
                    final ActivityRecord activity = activities.get(activityNdx);
                    if (!activity.finishing) {
                        return activity.fullscreen ? null : activity;
                    }
                    ++activityNdx;
                }
                activityNdx = 0;
                ++taskNdx;
            }
            taskNdx = 0;
            ++stackNdx;
        }

        return null;
    }

    // Checks if any of the stacks above this one has a fullscreen activity behind it.
    // If so, this stack is hidden, otherwise it is visible.
    private boolean isStackVisible() {
+7 −0
Original line number Diff line number Diff line
@@ -2680,6 +2680,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }

        stack.setMediaPlayer(playing ? r : null);
        if (!playing) {
            // Make the activity immediately above r opaque.
            final ActivityRecord next = stack.findNextTranslucentActivity(r);
            if (next != null) {
                mService.convertFromTranslucent(next.appToken);
            }
        }
        try {
            top.app.thread.scheduleBackgroundMediaPlayingChanged(top.appToken, playing);
        } catch (RemoteException e) {