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

Commit 0818ce59 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10039348 from 0a00fab1 to udc-qpr1-release

Change-Id: Ia63909c1f869e2eca6895012f1a56460431b4fc4
parents e558d1aa 0a00fab1
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1560,7 +1560,8 @@ public class JobSchedulerService extends com.android.server.SystemService
                    jobStatus.getJob().getMinLatencyMillis(),
                    jobStatus.getEstimatedNetworkDownloadBytes(),
                    jobStatus.getEstimatedNetworkUploadBytes(),
                    jobStatus.getWorkCount());
                    jobStatus.getWorkCount(),
                    ActivityManager.processStateAmToProto(mUidProcStates.get(jobStatus.getUid())));

            // If the job is immediately ready to run, then we can just immediately
            // put it in the pending list and try to schedule it.  This is especially
@@ -1935,6 +1936,7 @@ public class JobSchedulerService extends com.android.server.SystemService
     * {@code incomingJob} is non-null, it replaces {@code cancelled} in the store of
     * currently scheduled jobs.
     */
    @GuardedBy("mLock")
    private void cancelJobImplLocked(JobStatus cancelled, JobStatus incomingJob,
            @JobParameters.StopReason int reason, int internalReasonCode, String debugReason) {
        if (DEBUG) Slog.d(TAG, "CANCEL: " + cancelled.toShortString());
@@ -1986,7 +1988,8 @@ public class JobSchedulerService extends com.android.server.SystemService
                    cancelled.getJob().getMinLatencyMillis(),
                    cancelled.getEstimatedNetworkDownloadBytes(),
                    cancelled.getEstimatedNetworkUploadBytes(),
                    cancelled.getWorkCount());
                    cancelled.getWorkCount(),
                    ActivityManager.processStateAmToProto(mUidProcStates.get(cancelled.getUid())));
        }
        // If this is a replacement, bring in the new version of the job
        if (incomingJob != null) {
+6 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.Manifest;
import android.annotation.BytesLong;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.Notification;
import android.app.compat.CompatChanges;
@@ -476,7 +477,8 @@ public final class JobServiceContext implements ServiceConnection {
                    job.getJob().getMinLatencyMillis(),
                    job.getEstimatedNetworkDownloadBytes(),
                    job.getEstimatedNetworkUploadBytes(),
                    job.getWorkCount());
                    job.getWorkCount(),
                    ActivityManager.processStateAmToProto(mService.getUidProcState(job.getUid())));
            final String sourcePackage = job.getSourcePackageName();
            if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) {
                final String componentPackage = job.getServiceComponent().getPackageName();
@@ -1447,7 +1449,9 @@ public final class JobServiceContext implements ServiceConnection {
                completedJob.getJob().getMinLatencyMillis(),
                completedJob.getEstimatedNetworkDownloadBytes(),
                completedJob.getEstimatedNetworkUploadBytes(),
                completedJob.getWorkCount());
                completedJob.getWorkCount(),
                ActivityManager
                        .processStateAmToProto(mService.getUidProcState(completedJob.getUid())));
        if (Trace.isTagEnabled(Trace.TRACE_TAG_SYSTEM_SERVER)) {
            Trace.asyncTraceForTrackEnd(Trace.TRACE_TAG_SYSTEM_SERVER, "JobScheduler",
                    getId());
+25 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.window;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Rect;
@@ -23,6 +24,9 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.view.SurfaceControl;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Information when removing a starting window of a particular task.
 * @hide
@@ -55,11 +59,28 @@ public final class StartingWindowRemovalInfo implements Parcelable {
     */
    public boolean playRevealAnimation;

    /** The mode is no need to defer removing the starting window for IME */
    public static final int DEFER_MODE_NONE = 0;

    /** The mode to defer removing the starting window until IME has drawn */
    public static final int DEFER_MODE_NORMAL = 1;

    /** The mode to defer the starting window removal until IME drawn and finished the rotation */
    public static final int DEFER_MODE_ROTATION = 2;

    @IntDef(prefix = { "DEFER_MODE_" }, value = {
            DEFER_MODE_NONE,
            DEFER_MODE_NORMAL,
            DEFER_MODE_ROTATION,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface DeferMode {}

    /**
     * Whether need to defer removing the starting window for IME.
     * @hide
     */
    public boolean deferRemoveForIme;
    public @DeferMode int deferRemoveForImeMode;

    /**
     * The rounded corner radius
@@ -95,7 +116,7 @@ public final class StartingWindowRemovalInfo implements Parcelable {
        windowAnimationLeash = source.readTypedObject(SurfaceControl.CREATOR);
        mainFrame = source.readTypedObject(Rect.CREATOR);
        playRevealAnimation = source.readBoolean();
        deferRemoveForIme = source.readBoolean();
        deferRemoveForImeMode = source.readInt();
        roundedCornerRadius = source.readFloat();
        windowlessSurface = source.readBoolean();
        removeImmediately = source.readBoolean();
@@ -107,7 +128,7 @@ public final class StartingWindowRemovalInfo implements Parcelable {
        dest.writeTypedObject(windowAnimationLeash, flags);
        dest.writeTypedObject(mainFrame, flags);
        dest.writeBoolean(playRevealAnimation);
        dest.writeBoolean(deferRemoveForIme);
        dest.writeInt(deferRemoveForImeMode);
        dest.writeFloat(roundedCornerRadius);
        dest.writeBoolean(windowlessSurface);
        dest.writeBoolean(removeImmediately);
@@ -119,7 +140,7 @@ public final class StartingWindowRemovalInfo implements Parcelable {
                + " frame=" + mainFrame
                + " playRevealAnimation=" + playRevealAnimation
                + " roundedCornerRadius=" + roundedCornerRadius
                + " deferRemoveForIme=" + deferRemoveForIme
                + " deferRemoveForImeMode=" + deferRemoveForImeMode
                + " windowlessSurface=" + windowlessSurface
                + " removeImmediately=" + removeImmediately + "}";
    }
+13 −0
Original line number Diff line number Diff line
@@ -59,4 +59,17 @@ public class SplitScreenConstants {

    /** Flag applied to a transition change to identify it as a divider bar for animation. */
    public static final int FLAG_IS_DIVIDER_BAR = FLAG_FIRST_CUSTOM;

    public static final String splitPositionToString(@SplitPosition int pos) {
        switch (pos) {
            case SPLIT_POSITION_UNDEFINED:
                return "SPLIT_POSITION_UNDEFINED";
            case SPLIT_POSITION_TOP_OR_LEFT:
                return "SPLIT_POSITION_TOP_OR_LEFT";
            case SPLIT_POSITION_BOTTOM_OR_RIGHT:
                return "SPLIT_POSITION_BOTTOM_OR_RIGHT";
            default:
                return "UNKNOWN";
        }
    }
}
+70 −33
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIV
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
import static com.android.wm.shell.common.split.SplitScreenConstants.splitPositionToString;
import static com.android.wm.shell.common.split.SplitScreenUtils.reverseSplitPosition;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN;
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_SIDE;
@@ -378,40 +379,18 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,

    boolean moveToStage(ActivityManager.RunningTaskInfo task, @SplitPosition int stagePosition,
            WindowContainerTransaction wct) {
        StageTaskListener targetStage;
        int sideStagePosition;
        if (isSplitScreenVisible()) {
            // If the split screen is foreground, retrieves target stage based on position.
            targetStage = stagePosition == mSideStagePosition ? mSideStage : mMainStage;
            sideStagePosition = mSideStagePosition;
        } else {
            targetStage = mSideStage;
            sideStagePosition = stagePosition;
        }

        if (!isSplitActive()) {
            mSplitLayout.init();
        prepareEnterSplitScreen(wct, task, stagePosition);
        if (ENABLE_SHELL_TRANSITIONS) {
            mSplitTransitions.startEnterTransition(TRANSIT_TO_FRONT, wct,
                    null, this, null /* consumedCallback */, null /* finishedCallback */,
                    isSplitScreenVisible()
                            ? TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE : TRANSIT_SPLIT_SCREEN_PAIR_OPEN);
        } else {
            mSyncQueue.queue(wct);
            mSyncQueue.runInSync(t -> {
                updateSurfaceBounds(mSplitLayout, t, false /* applyResizingOffset */);
                setDividerVisibility(true, t);
            });
        } else {
            setSideStagePosition(sideStagePosition, wct);
            targetStage.addTask(task, wct);
            targetStage.evictAllChildren(wct);
            if (!isSplitScreenVisible()) {
                final StageTaskListener anotherStage = targetStage == mMainStage
                        ? mSideStage : mMainStage;
                anotherStage.reparentTopTask(wct);
                anotherStage.evictAllChildren(wct);
                wct.reorder(mRootTaskInfo.token, true);
        }
            setRootForceTranslucent(false, wct);
            mSyncQueue.queue(wct);
        }

        // Due to drag already pip task entering split by this method so need to reset flag here.
        mIsDropEntering = false;
        return true;
@@ -1509,9 +1488,51 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
     */
    void prepareEnterSplitScreen(WindowContainerTransaction wct,
            @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition) {
        if (mMainStage.isActive()) return;

        onSplitScreenEnter();
        if (isSplitActive()) {
            prepareBringSplit(wct, taskInfo, startPosition);
        } else {
            prepareActiveSplit(wct, taskInfo, startPosition);
        }
    }

    private void prepareBringSplit(WindowContainerTransaction wct,
            @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition) {
        StageTaskListener targetStage;
        if (isSplitScreenVisible()) {
            // If the split screen is foreground, retrieves target stage based on position.
            targetStage = startPosition == mSideStagePosition ? mSideStage : mMainStage;
        } else {
            targetStage = mSideStage;
        }

        if (taskInfo != null) {
            wct.startTask(taskInfo.taskId,
                    resolveStartStage(STAGE_TYPE_UNDEFINED, startPosition, null, wct));
            targetStage.evictAllChildren(wct);
        }
        // If running background, we need to reparent current top visible task to another stage
        // and evict all tasks current under its.
        if (!isSplitScreenVisible()) {
            // Recreate so we need to reset position rather than keep position of background split.
            mSplitLayout.resetDividerPosition();
            updateWindowBounds(mSplitLayout, wct);
            final StageTaskListener anotherStage = targetStage == mMainStage
                    ? mSideStage : mMainStage;
            anotherStage.evictAllChildren(wct);
            anotherStage.reparentTopTask(wct);
            wct.reorder(mRootTaskInfo.token, true);
            setRootForceTranslucent(false, wct);
        }
    }

    private void prepareActiveSplit(WindowContainerTransaction wct,
            @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition) {
        if (!ENABLE_SHELL_TRANSITIONS) {
            // Legacy transition we need to create divider here, shell transition case we will
            // create it on #finishEnterSplitScreen
            mSplitLayout.init();
        }
        if (taskInfo != null) {
            setSideStagePosition(startPosition, wct);
            mSideStage.addTask(taskInfo, wct);
@@ -2383,7 +2404,17 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                }

                final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
                if (taskInfo == null || !taskInfo.hasParentTask()) continue;
                if (taskInfo == null) continue;
                if (taskInfo.token.equals(mRootTaskInfo.token)) {
                    if (isOpeningType(change.getMode())) {
                        // Split is opened by someone so set it as visible.
                        setSplitsVisible(true);
                    } else if (isClosingType(change.getMode())) {
                        // Split is closed by someone so set it as invisible.
                        setSplitsVisible(false);
                    }
                    continue;
                }
                final StageTaskListener stage = getStageOfTask(taskInfo);
                if (stage == null) continue;
                if (isOpeningType(change.getMode())) {
@@ -2823,12 +2854,18 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        final String childPrefix = innerPrefix + "  ";
        pw.println(prefix + TAG + " mDisplayId=" + mDisplayId);
        pw.println(innerPrefix + "mDividerVisible=" + mDividerVisible);
        pw.println(innerPrefix + "isSplitActive=" + isSplitActive());
        pw.println(innerPrefix + "isSplitVisible=" + isSplitScreenVisible());
        pw.println(innerPrefix + "MainStage");
        pw.println(childPrefix + "stagePosition=" + getMainStagePosition());
        pw.println(childPrefix + "stagePosition=" + splitPositionToString(getMainStagePosition()));
        pw.println(childPrefix + "isActive=" + mMainStage.isActive());
        mMainStage.dump(pw, childPrefix);
        pw.println(innerPrefix + "MainStageListener");
        mMainStageListener.dump(pw, childPrefix);
        pw.println(innerPrefix + "SideStage");
        pw.println(childPrefix + "stagePosition=" + getSideStagePosition());
        pw.println(childPrefix + "stagePosition=" + splitPositionToString(getSideStagePosition()));
        mSideStage.dump(pw, childPrefix);
        pw.println(innerPrefix + "SideStageListener");
        mSideStageListener.dump(pw, childPrefix);
        if (mMainStage.isActive()) {
            pw.println(innerPrefix + "SplitLayout");
Loading