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

Commit 4e7e814f authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9376496 from 5b7da895 to tm-qpr2-release

Change-Id: I6984a9d120929f10ef747ab92391a415a09fcebf
parents 60de0f17 5b7da895
Loading
Loading
Loading
Loading
+63 −8
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
@@ -502,6 +503,13 @@ public final class ViewRootImpl implements ViewParent,
    Region mTouchableRegion;
    Region mPreviousTouchableRegion;

    private int mMeasuredWidth;
    private int mMeasuredHeight;

    // This indicates that we've already known the window size but without measuring the views.
    // If this is true, we must measure the views before laying out them.
    private boolean mViewMeasureDeferred;

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    int mWidth;
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@@ -2566,7 +2574,8 @@ public final class ViewRootImpl implements ViewParent,
    }

    private boolean measureHierarchy(final View host, final WindowManager.LayoutParams lp,
            final Resources res, final int desiredWindowWidth, final int desiredWindowHeight) {
            final Resources res, final int desiredWindowWidth, final int desiredWindowHeight,
            boolean forRootSizeOnly) {
        int childWidthMeasureSpec;
        int childHeightMeasureSpec;
        boolean windowSizeMayChange = false;
@@ -2622,7 +2631,15 @@ public final class ViewRootImpl implements ViewParent,
                    lp.privateFlags);
            childHeightMeasureSpec = getRootMeasureSpec(desiredWindowHeight, lp.height,
                    lp.privateFlags);
            if (!forRootSizeOnly || !setMeasuredRootSizeFromSpec(
                    childWidthMeasureSpec, childHeightMeasureSpec)) {
                performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);
            } else {
                // We already know how big the window should be before measuring the views.
                // We can measure the views before laying out them. This is to avoid unnecessary
                // measure.
                mViewMeasureDeferred = true;
            }
            if (mWidth != host.getMeasuredWidth() || mHeight != host.getMeasuredHeight()) {
                windowSizeMayChange = true;
            }
@@ -2637,6 +2654,25 @@ public final class ViewRootImpl implements ViewParent,
        return windowSizeMayChange;
    }

    /**
     * Sets the measured root size for requesting the window frame.
     *
     * @param widthMeasureSpec contains the size and the mode of the width.
     * @param heightMeasureSpec contains the size and the mode of the height.
     * @return {@code true} if we actually set the measured size; {@code false} otherwise.
     */
    private boolean setMeasuredRootSizeFromSpec(int widthMeasureSpec, int heightMeasureSpec) {
        final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
        final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        if (widthMode != MeasureSpec.EXACTLY || heightMode != MeasureSpec.EXACTLY) {
            // We don't know the exact size. We need to measure the hierarchy to know that.
            return false;
        }
        mMeasuredWidth = MeasureSpec.getSize(widthMeasureSpec);
        mMeasuredHeight = MeasureSpec.getSize(heightMeasureSpec);
        return true;
    }

    /**
     * Modifies the input matrix such that it maps view-local coordinates to
     * on-screen coordinates.
@@ -2724,6 +2760,14 @@ public final class ViewRootImpl implements ViewParent,
                || lp.type == TYPE_VOLUME_OVERLAY;
    }

    /**
     * @return {@code true} if we should reduce unnecessary measure for the window.
     * TODO(b/260382739): Apply this to all windows.
     */
    private static boolean shouldOptimizeMeasure(final WindowManager.LayoutParams lp) {
        return lp.type == TYPE_NOTIFICATION_SHADE;
    }

    private Rect getWindowBoundsInsetSystemBars() {
        final Rect bounds = new Rect(
                mContext.getResources().getConfiguration().windowConfiguration.getBounds());
@@ -2774,6 +2818,7 @@ public final class ViewRootImpl implements ViewParent,
        mAppVisibilityChanged = false;
        final boolean viewUserVisibilityChanged = !mFirst &&
                ((mViewVisibility == View.VISIBLE) != (viewVisibility == View.VISIBLE));
        final boolean shouldOptimizeMeasure = shouldOptimizeMeasure(lp);

        WindowManager.LayoutParams params = null;
        CompatibilityInfo compatibilityInfo =
@@ -2895,7 +2940,7 @@ public final class ViewRootImpl implements ViewParent,

            // Ask host how big it wants to be
            windowSizeMayChange |= measureHierarchy(host, lp, mView.getContext().getResources(),
                    desiredWindowWidth, desiredWindowHeight);
                    desiredWindowWidth, desiredWindowHeight, shouldOptimizeMeasure);
        }

        if (collectViewAttributes()) {
@@ -2935,8 +2980,8 @@ public final class ViewRootImpl implements ViewParent,
                // we don't need to go through two layout passes when things
                // change due to fitting system windows, which can happen a lot.
                windowSizeMayChange |= measureHierarchy(host, lp,
                        mView.getContext().getResources(),
                        desiredWindowWidth, desiredWindowHeight);
                        mView.getContext().getResources(), desiredWindowWidth, desiredWindowHeight,
                        shouldOptimizeMeasure);
            }
        }

@@ -3351,6 +3396,13 @@ public final class ViewRootImpl implements ViewParent,
            maybeHandleWindowMove(frame);
        }

        if (mViewMeasureDeferred) {
            // It's time to measure the views since we are going to layout them.
            performMeasure(
                    MeasureSpec.makeMeasureSpec(frame.width(), MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(frame.height(), MeasureSpec.EXACTLY));
        }

        if (!mRelayoutRequested && mCheckIfCanDraw) {
            // We had a sync previously, but we didn't call IWindowSession#relayout in this
            // traversal. So we don't know if the sync is complete that we can continue to draw.
@@ -3940,6 +3992,9 @@ public final class ViewRootImpl implements ViewParent,
        } finally {
            Trace.traceEnd(Trace.TRACE_TAG_VIEW);
        }
        mMeasuredWidth = mView.getMeasuredWidth();
        mMeasuredHeight = mView.getMeasuredHeight();
        mViewMeasureDeferred = false;
    }

    /**
@@ -4035,7 +4090,7 @@ public final class ViewRootImpl implements ViewParent,
                        view.requestLayout();
                    }
                    measureHierarchy(host, lp, mView.getContext().getResources(),
                            desiredWindowWidth, desiredWindowHeight);
                            desiredWindowWidth, desiredWindowHeight, false /* forRootSizeOnly */);
                    mInLayout = true;
                    host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());

@@ -8101,8 +8156,8 @@ public final class ViewRootImpl implements ViewParent,
        final WindowConfiguration winConfigFromWm =
                mLastReportedMergedConfiguration.getGlobalConfiguration().windowConfiguration;
        final WindowConfiguration winConfig = getCompatWindowConfiguration();
        final int measuredWidth = mView.getMeasuredWidth();
        final int measuredHeight = mView.getMeasuredHeight();
        final int measuredWidth = mMeasuredWidth;
        final int measuredHeight = mMeasuredHeight;
        final boolean relayoutAsync;
        if (LOCAL_LAYOUT
                && (mViewFrameInfo.flags & FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED) == 0
+41 −0
Original line number Diff line number Diff line
@@ -826,6 +826,26 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Sets/removes the reparent leaf task flag for this {@code windowContainer}.
     * When this is set, the server side will try to reparent the leaf task to task display area
     * if there is an existing activity in history during the activity launch. This operation only
     * support on the organized root task.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction setReparentLeafTaskIfRelaunch(
            @NonNull WindowContainerToken windowContainer, boolean reparentLeafTaskIfRelaunch) {
        final HierarchyOp hierarchyOp =
                new HierarchyOp.Builder(
                        HierarchyOp.HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH)
                        .setContainer(windowContainer.asBinder())
                        .setReparentLeafTaskIfRelaunch(reparentLeafTaskIfRelaunch)
                        .build();
        mHierarchyOps.add(hierarchyOp);
        return this;
    }

    /**
     * Merges another WCT into this one.
     * @param transfer When true, this will transfer everything from other potentially leaving
@@ -1241,6 +1261,7 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int HIERARCHY_OP_TYPE_REMOVE_TASK = 20;
        public static final int HIERARCHY_OP_TYPE_FINISH_ACTIVITY = 21;
        public static final int HIERARCHY_OP_TYPE_SET_COMPANION_TASK_FRAGMENT = 22;
        public static final int HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH = 23;

        // The following key(s) are for use with mLaunchOptions:
        // When launching a task (eg. from recents), this is the taskId to be launched.
@@ -1293,6 +1314,8 @@ public final class WindowContainerTransaction implements Parcelable {

        private boolean mAlwaysOnTop;

        private boolean mReparentLeafTaskIfRelaunch;

        public static HierarchyOp createForReparent(
                @NonNull IBinder container, @Nullable IBinder reparent, boolean toTop) {
            return new HierarchyOp.Builder(HIERARCHY_OP_TYPE_REPARENT)
@@ -1398,6 +1421,7 @@ public final class WindowContainerTransaction implements Parcelable {
            mPendingIntent = copy.mPendingIntent;
            mShortcutInfo = copy.mShortcutInfo;
            mAlwaysOnTop = copy.mAlwaysOnTop;
            mReparentLeafTaskIfRelaunch = copy.mReparentLeafTaskIfRelaunch;
        }

        protected HierarchyOp(Parcel in) {
@@ -1420,6 +1444,7 @@ public final class WindowContainerTransaction implements Parcelable {
            mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
            mShortcutInfo = in.readTypedObject(ShortcutInfo.CREATOR);
            mAlwaysOnTop = in.readBoolean();
            mReparentLeafTaskIfRelaunch = in.readBoolean();
        }

        public int getType() {
@@ -1494,6 +1519,10 @@ public final class WindowContainerTransaction implements Parcelable {
            return mAlwaysOnTop;
        }

        public boolean isReparentLeafTaskIfRelaunch() {
            return mReparentLeafTaskIfRelaunch;
        }

        @Nullable
        public TaskFragmentCreationParams getTaskFragmentCreationOptions() {
            return mTaskFragmentCreationOptions;
@@ -1572,6 +1601,9 @@ public final class WindowContainerTransaction implements Parcelable {
                case HIERARCHY_OP_TYPE_SET_COMPANION_TASK_FRAGMENT:
                    return "{setCompanionTaskFragment: container = " + mContainer + " companion = "
                            + mReparent + "}";
                case HIERARCHY_OP_TYPE_SET_REPARENT_LEAF_TASK_IF_RELAUNCH:
                    return "{setReparentLeafTaskIfRelaunch: container= " + mContainer
                            + " reparentLeafTaskIfRelaunch= " + mReparentLeafTaskIfRelaunch + "}";
                default:
                    return "{mType=" + mType + " container=" + mContainer + " reparent=" + mReparent
                            + " mToTop=" + mToTop
@@ -1602,6 +1634,7 @@ public final class WindowContainerTransaction implements Parcelable {
            dest.writeTypedObject(mPendingIntent, flags);
            dest.writeTypedObject(mShortcutInfo, flags);
            dest.writeBoolean(mAlwaysOnTop);
            dest.writeBoolean(mReparentLeafTaskIfRelaunch);
        }

        @Override
@@ -1662,6 +1695,8 @@ public final class WindowContainerTransaction implements Parcelable {

            private boolean mAlwaysOnTop;

            private boolean mReparentLeafTaskIfRelaunch;

            Builder(int type) {
                mType = type;
            }
@@ -1732,6 +1767,11 @@ public final class WindowContainerTransaction implements Parcelable {
                return this;
            }

            Builder setReparentLeafTaskIfRelaunch(boolean reparentLeafTaskIfRelaunch) {
                mReparentLeafTaskIfRelaunch = reparentLeafTaskIfRelaunch;
                return this;
            }

            Builder setShortcutInfo(@Nullable ShortcutInfo shortcutInfo) {
                mShortcutInfo = shortcutInfo;
                return this;
@@ -1757,6 +1797,7 @@ public final class WindowContainerTransaction implements Parcelable {
                hierarchyOp.mAlwaysOnTop = mAlwaysOnTop;
                hierarchyOp.mTaskFragmentCreationOptions = mTaskFragmentCreationOptions;
                hierarchyOp.mShortcutInfo = mShortcutInfo;
                hierarchyOp.mReparentLeafTaskIfRelaunch = mReparentLeafTaskIfRelaunch;

                return hierarchyOp;
            }
+3 −0
Original line number Diff line number Diff line
@@ -328,4 +328,7 @@ oneway interface IStatusBar

    /** Shows rear display educational dialog */
    void showRearDisplayDialog(int currentBaseState);

    /** Called when requested to go to fullscreen from the active split app. */
    void goToFullscreenFromSplit();
}
+2 −2
Original line number Diff line number Diff line
@@ -1167,8 +1167,8 @@
    <string name="no" msgid="5122037903299899715">"Скасувати"</string>
    <string name="dialog_alert_title" msgid="651856561974090712">"Увага"</string>
    <string name="loading" msgid="3138021523725055037">"Завантаження..."</string>
    <string name="capital_on" msgid="2770685323900821829">"УВІМК"</string>
    <string name="capital_off" msgid="7443704171014626777">"ВИМК"</string>
    <string name="capital_on" msgid="2770685323900821829">"УВІМКНЕНО"</string>
    <string name="capital_off" msgid="7443704171014626777">"ВИМКНЕНО"</string>
    <string name="checked" msgid="9179896827054513119">"вибрано"</string>
    <string name="not_checked" msgid="7972320087569023342">"не вибрано"</string>
    <string name="selected" msgid="6614607926197755875">"вибрано"</string>
+20 −21
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="48dp"
@@ -25,13 +25,12 @@
        android:fillAlpha="0.8"
        android:pathData="M0,24 a24,24 0 1,0 48,0 a24,24 0 1,0 -48,0"/>
    <group
        android:translateX="12"
        android:translateY="12">
        android:scaleX="0.8"
        android:scaleY="0.8"
        android:translateX="10"
        android:translateY="10">
        <path
            android:fillColor="@color/compat_controls_text"
            android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02C8.17,18.43 6,15.97 6,13z"/>
        <path
            android:fillColor="@color/compat_controls_text"
            android:pathData="M20,13c0,-4.42 -3.58,-8 -8,-8c-0.06,0 -0.12,0.01 -0.18,0.01v0l1.09,-1.09L11.5,2.5L8,6l3.5,3.5l1.41,-1.41l-1.08,-1.08C11.89,7.01 11.95,7 12,7c3.31,0 6,2.69 6,6c0,2.97 -2.17,5.43 -5,5.91v2.02C16.95,20.44 20,17.08 20,13z"/>
            android:pathData="M0,36V24.5H3V30.85L10.4,23.45L12.55,25.6L5.15,33H11.5V36H0ZM24.5,36V33H30.85L23.5,25.65L25.65,23.5L33,30.85V24.5H36V36H24.5ZM10.35,12.5L3,5.15V11.5H0V0H11.5V3H5.15L12.5,10.35L10.35,12.5ZM25.65,12.5L23.5,10.35L30.85,3H24.5V0H36V11.5H33V5.15L25.65,12.5Z"
            android:fillColor="@color/compat_controls_text"/>
    </group>
</vector>
Loading