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

Commit 9f266150 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8912782 from 7f1d9514 to tm-qpr1-release

Change-Id: I62152083e1d9b33c247aae870aaeb1d9ed68b265
parents 508795d8 7f1d9514
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ import android.util.Log;


import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.GuardedBy;


import java.util.Objects;
import java.util.Set;
import java.util.Set;


/**
/**
@@ -87,12 +86,6 @@ public class Account implements Parcelable {
        if (TextUtils.isEmpty(type)) {
        if (TextUtils.isEmpty(type)) {
            throw new IllegalArgumentException("the type must not be empty: " + type);
            throw new IllegalArgumentException("the type must not be empty: " + type);
        }
        }
        if (name.length() > 200) {
            throw new IllegalArgumentException("account name is longer than 200 characters");
        }
        if (type.length() > 200) {
            throw new IllegalArgumentException("account type is longer than 200 characters");
        }
        this.name = name;
        this.name = name;
        this.type = type;
        this.type = type;
        this.accessId = accessId;
        this.accessId = accessId;
+1 −1
Original line number Original line Diff line number Diff line
@@ -733,7 +733,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        }
        }
        for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
        for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
            // Only update the server side insets here.
            // Only update the server side insets here.
            if (type == ITYPE_CAPTION_BAR) continue;
            if (!CAPTION_ON_SHELL && type == ITYPE_CAPTION_BAR) continue;
            InsetsSource source = mState.peekSource(type);
            InsetsSource source = mState.peekSource(type);
            if (source == null) continue;
            if (source == null) continue;
            if (newState.peekSource(type) == null) {
            if (newState.peekSource(type) == null) {
+55 −17
Original line number Original line Diff line number Diff line
@@ -32,8 +32,10 @@ import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.SparseArray;
import android.view.RemoteAnimationDefinition;
import android.view.RemoteAnimationDefinition;


import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executor;


@@ -72,6 +74,12 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
     */
     */
    private final Executor mExecutor;
    private final Executor mExecutor;


    // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release.
    /** Map from Task id to client tokens of TaskFragments in the Task. */
    private final SparseArray<List<IBinder>> mTaskIdToFragmentTokens = new SparseArray<>();
    /** Map from Task id to Task configuration. */
    private final SparseArray<Configuration> mTaskIdToConfigurations = new SparseArray<>();

    public TaskFragmentOrganizer(@NonNull Executor executor) {
    public TaskFragmentOrganizer(@NonNull Executor executor) {
        mExecutor = executor;
        mExecutor = executor;
    }
    }
@@ -160,6 +168,27 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
    public void onTaskFragmentParentInfoChanged(
    public void onTaskFragmentParentInfoChanged(
            @NonNull IBinder fragmentToken, @NonNull Configuration parentConfig) {}
            @NonNull IBinder fragmentToken, @NonNull Configuration parentConfig) {}


    /**
     * Called when the parent leaf Task of organized TaskFragments is changed.
     * When the leaf Task is changed, the organizer may want to update the TaskFragments in one
     * transaction.
     *
     * For case like screen size change, it will trigger onTaskFragmentParentInfoChanged with new
     * Task bounds, but may not trigger onTaskFragmentInfoChanged because there can be an override
     * bounds.
     * @hide
     */
    public void onTaskFragmentParentInfoChanged(int taskId, @NonNull Configuration parentConfig) {
        // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next release.
        final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId);
        if (tokens == null || tokens.isEmpty()) {
            return;
        }
        for (int i = tokens.size() - 1; i >= 0; i--) {
            onTaskFragmentParentInfoChanged(tokens.get(i), parentConfig);
        }
    }

    /**
    /**
     * Called when the {@link WindowContainerTransaction} created with
     * Called when the {@link WindowContainerTransaction} created with
     * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} failed on the server side.
     * {@link WindowContainerTransaction#setErrorCallbackToken(IBinder)} failed on the server side.
@@ -221,34 +250,43 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
        final List<TaskFragmentTransaction.Change> changes = transaction.getChanges();
        final List<TaskFragmentTransaction.Change> changes = transaction.getChanges();
        for (TaskFragmentTransaction.Change change : changes) {
        for (TaskFragmentTransaction.Change change : changes) {
            // TODO(b/240519866): apply all changes in one WCT.
            // TODO(b/240519866): apply all changes in one WCT.
            final int taskId = change.getTaskId();
            switch (change.getType()) {
            switch (change.getType()) {
                case TYPE_TASK_FRAGMENT_APPEARED:
                case TYPE_TASK_FRAGMENT_APPEARED:
                    onTaskFragmentAppeared(change.getTaskFragmentInfo());
                    // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next
                    if (change.getTaskConfiguration() != null) {
                    // release.
                        // TODO(b/240519866): convert to pass TaskConfiguration for all TFs in the
                    if (!mTaskIdToFragmentTokens.contains(taskId)) {
                        // same Task
                        mTaskIdToFragmentTokens.put(taskId, new ArrayList<>());
                        onTaskFragmentParentInfoChanged(
                                change.getTaskFragmentToken(),
                                change.getTaskConfiguration());
                    }
                    }
                    mTaskIdToFragmentTokens.get(taskId).add(change.getTaskFragmentToken());
                    onTaskFragmentParentInfoChanged(change.getTaskFragmentToken(),
                            mTaskIdToConfigurations.get(taskId));

                    onTaskFragmentAppeared(change.getTaskFragmentInfo());
                    break;
                    break;
                case TYPE_TASK_FRAGMENT_INFO_CHANGED:
                case TYPE_TASK_FRAGMENT_INFO_CHANGED:
                    if (change.getTaskConfiguration() != null) {
                        // TODO(b/240519866): convert to pass TaskConfiguration for all TFs in the
                        // same Task
                        onTaskFragmentParentInfoChanged(
                                change.getTaskFragmentToken(),
                                change.getTaskConfiguration());
                    }
                    onTaskFragmentInfoChanged(change.getTaskFragmentInfo());
                    onTaskFragmentInfoChanged(change.getTaskFragmentInfo());
                    break;
                    break;
                case TYPE_TASK_FRAGMENT_VANISHED:
                case TYPE_TASK_FRAGMENT_VANISHED:
                    // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next
                    // release.
                    if (mTaskIdToFragmentTokens.contains(taskId)) {
                        final List<IBinder> tokens = mTaskIdToFragmentTokens.get(taskId);
                        tokens.remove(change.getTaskFragmentToken());
                        if (tokens.isEmpty()) {
                            mTaskIdToFragmentTokens.remove(taskId);
                            mTaskIdToConfigurations.remove(taskId);
                        }
                    }

                    onTaskFragmentVanished(change.getTaskFragmentInfo());
                    onTaskFragmentVanished(change.getTaskFragmentInfo());
                    break;
                    break;
                case TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED:
                case TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED:
                    onTaskFragmentParentInfoChanged(
                    // TODO(b/240519866): doing so to keep CTS compatibility. Remove in the next
                            change.getTaskFragmentToken(),
                    // release.
                            change.getTaskConfiguration());
                    mTaskIdToConfigurations.put(taskId, change.getTaskConfiguration());

                    onTaskFragmentParentInfoChanged(taskId, change.getTaskConfiguration());
                    break;
                    break;
                case TYPE_TASK_FRAGMENT_ERROR:
                case TYPE_TASK_FRAGMENT_ERROR:
                    final Bundle errorBundle = change.getErrorBundle();
                    final Bundle errorBundle = change.getErrorBundle();
+14 −1
Original line number Original line Diff line number Diff line
@@ -66,6 +66,8 @@ public class FrameTracker extends SurfaceControl.OnJankDataListener
    private static final long INVALID_ID = -1;
    private static final long INVALID_ID = -1;
    public static final int NANOS_IN_MILLISECOND = 1_000_000;
    public static final int NANOS_IN_MILLISECOND = 1_000_000;


    private static final int MAX_LENGTH_EVENT_DESC = 20;

    static final int REASON_END_UNKNOWN = -1;
    static final int REASON_END_UNKNOWN = -1;
    static final int REASON_END_NORMAL = 0;
    static final int REASON_END_NORMAL = 0;
    static final int REASON_END_SURFACE_DESTROYED = 1;
    static final int REASON_END_SURFACE_DESTROYED = 1;
@@ -394,7 +396,18 @@ public class FrameTracker extends SurfaceControl.OnJankDataListener
        return true;
        return true;
    }
    }


    private void markEvent(String desc) {
    /**
     * Mark the FrameTracker events in the trace.
     *
     * @param desc The description of the trace event,
     *            shouldn't exceed {@link #MAX_LENGTH_EVENT_DESC}.
     */
    private void markEvent(@NonNull String desc) {
        if (desc.length() > MAX_LENGTH_EVENT_DESC) {
            throw new IllegalArgumentException(TextUtils.formatSimple(
                    "The length of the trace event description <%s> exceeds %d",
                    desc, MAX_LENGTH_EVENT_DESC));
        }
        Trace.beginSection(TextUtils.formatSimple("%s#%s", mSession.getName(), desc));
        Trace.beginSection(TextUtils.formatSimple("%s#%s", mSession.getName(), desc));
        Trace.endSection();
        Trace.endSection();
    }
    }
+28 −3
Original line number Original line Diff line number Diff line
@@ -149,6 +149,10 @@ public class InteractionJankMonitor {
    private static final int DEFAULT_TRACE_THRESHOLD_MISSED_FRAMES = 3;
    private static final int DEFAULT_TRACE_THRESHOLD_MISSED_FRAMES = 3;
    private static final int DEFAULT_TRACE_THRESHOLD_FRAME_TIME_MILLIS = 64;
    private static final int DEFAULT_TRACE_THRESHOLD_FRAME_TIME_MILLIS = 64;


    @VisibleForTesting
    public static final int MAX_LENGTH_OF_CUJ_NAME = 80;
    private static final int MAX_LENGTH_SESSION_NAME = 100;

    public static final String ACTION_SESSION_END = ACTION_PREFIX + ".ACTION_SESSION_END";
    public static final String ACTION_SESSION_END = ACTION_PREFIX + ".ACTION_SESSION_END";
    public static final String ACTION_SESSION_CANCEL = ACTION_PREFIX + ".ACTION_SESSION_CANCEL";
    public static final String ACTION_SESSION_CANCEL = ACTION_PREFIX + ".ACTION_SESSION_CANCEL";


@@ -732,6 +736,9 @@ public class InteractionJankMonitor {
     * @return the name of the cuj type
     * @return the name of the cuj type
     */
     */
    public static String getNameOfCuj(int cujType) {
    public static String getNameOfCuj(int cujType) {
        // Please note:
        // 1. The length of the returned string shouldn't exceed MAX_LENGTH_OF_CUJ_NAME.
        // 2. The returned string should be the same with the name defined in atoms.proto.
        switch (cujType) {
        switch (cujType) {
            case CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE:
            case CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE:
                return "SHADE_EXPAND_COLLAPSE";
                return "SHADE_EXPAND_COLLAPSE";
@@ -1106,9 +1113,27 @@ public class InteractionJankMonitor {
        public Session(@CujType int cujType, @NonNull String postfix) {
        public Session(@CujType int cujType, @NonNull String postfix) {
            mCujType = cujType;
            mCujType = cujType;
            mTimeStamp = System.nanoTime();
            mTimeStamp = System.nanoTime();
            mName = TextUtils.isEmpty(postfix)
            mName = generateSessionName(getNameOfCuj(cujType), postfix);
                    ? String.format("J<%s>", getNameOfCuj(mCujType))
        }
                    : String.format("J<%s::%s>", getNameOfCuj(mCujType), postfix);

        private String generateSessionName(@NonNull String cujName, @NonNull String cujPostfix) {
            final boolean hasPostfix = !TextUtils.isEmpty(cujPostfix);
            // We assert that the cujName shouldn't exceed MAX_LENGTH_OF_CUJ_NAME.
            if (cujName.length() > MAX_LENGTH_OF_CUJ_NAME) {
                throw new IllegalArgumentException(TextUtils.formatSimple(
                        "The length of cuj name <%s> exceeds %d", cujName, MAX_LENGTH_OF_CUJ_NAME));
            }
            if (hasPostfix) {
                final int remaining = MAX_LENGTH_SESSION_NAME - cujName.length();
                if (cujPostfix.length() > remaining) {
                    cujPostfix = cujPostfix.substring(0, remaining - 3).concat("...");
                }
            }
            // The max length of the whole string should be:
            // 105 with postfix, 83 without postfix
            return hasPostfix
                    ? TextUtils.formatSimple("J<%s::%s>", cujName, cujPostfix)
                    : TextUtils.formatSimple("J<%s>", cujName);
        }
        }


        @CujType
        @CujType
Loading