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

Commit 873b9604 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8937168 from 616be90e to tm-qpr1-release

Change-Id: I9ce61bbcb23f05eac92b4710184d6cc3809befa6
parents 1185bc01 616be90e
Loading
Loading
Loading
Loading
+42 −1
Original line number Diff line number Diff line
@@ -309,6 +309,21 @@ public class PropertyInvalidatedCache<Query, Result> {
     */
    public static final String MODULE_TELEPHONY = "telephony";

    /**
     * Constants that affect retries when the process is unable to write the property.
     * The first constant is the number of times the process will attempt to set the
     * property.  The second constant is the delay between attempts.
     */

    /**
     * Wait 200ms between retry attempts and the retry limit is 5.  That gives a total possible
     * delay of 1s, which should be less than ANR timeouts.  The goal is to have the system crash
     * because the property could not be set (which is a condition that is easily recognized) and
     * not crash because of an ANR (which can be confusing to debug).
     */
    private static final int PROPERTY_FAILURE_RETRY_DELAY_MILLIS = 200;
    private static final int PROPERTY_FAILURE_RETRY_LIMIT = 5;

    /**
     * Construct a system property that matches the rules described above.  The module is
     * one of the permitted values above.  The API is a string that is a legal Java simple
@@ -670,7 +685,33 @@ public class PropertyInvalidatedCache<Query, Result> {
                }
            }
        }
        RuntimeException failure = null;
        for (int attempt = 0; attempt < PROPERTY_FAILURE_RETRY_LIMIT; attempt++) {
            try {
                SystemProperties.set(name, Long.toString(val));
                if (attempt > 0) {
                    // This log is not guarded.  Based on known bug reports, it should
                    // occur once a week or less.  The purpose of the log message is to
                    // identify the retries as a source of delay that might be otherwise
                    // be attributed to the cache itself.
                    Log.w(TAG, "Nonce set after " + attempt + " tries");
                }
                return;
            } catch (RuntimeException e) {
                if (failure == null) {
                    failure = e;
                }
                try {
                    Thread.sleep(PROPERTY_FAILURE_RETRY_DELAY_MILLIS);
                } catch (InterruptedException x) {
                    // Ignore this exception.  The desired delay is only approximate and
                    // there is no issue if the sleep sometimes terminates early.
                }
            }
        }
        // This point is reached only if SystemProperties.set() fails at least once.
        // Rethrow the first exception that was received.
        throw failure;
    }

    // Set the nonce in a static context.  No handle is available.
+29 −2
Original line number Diff line number Diff line
@@ -4396,15 +4396,42 @@ public interface WindowManager extends ViewManager {
                changes |= LAYOUT_CHANGED;
            }

            if (!Arrays.equals(paramsForRotation, o.paramsForRotation)) {
            if (paramsForRotation != o.paramsForRotation) {
                if ((changes & LAYOUT_CHANGED) == 0) {
                    if (paramsForRotation != null && o.paramsForRotation != null
                            && paramsForRotation.length == o.paramsForRotation.length) {
                        for (int i = paramsForRotation.length - 1; i >= 0; i--) {
                            if (hasLayoutDiff(paramsForRotation[i], o.paramsForRotation[i])) {
                                changes |= LAYOUT_CHANGED;
                                break;
                            }
                        }
                    } else {
                        changes |= LAYOUT_CHANGED;
                    }
                }
                paramsForRotation = o.paramsForRotation;
                checkNonRecursiveParams();
                changes |= LAYOUT_CHANGED;
            }

            return changes;
        }

        /**
         * Returns {@code true} if the 2 params may have difference results of
         * {@link WindowLayout#computeFrames}.
         */
        private static boolean hasLayoutDiff(LayoutParams a, LayoutParams b) {
            return a.width != b.width || a.height != b.height || a.x != b.x || a.y != b.y
                    || a.horizontalMargin != b.horizontalMargin
                    || a.verticalMargin != b.verticalMargin
                    || a.layoutInDisplayCutoutMode != b.layoutInDisplayCutoutMode
                    || a.gravity != b.gravity || !Arrays.equals(a.providedInsets, b.providedInsets)
                    || a.mFitInsetsTypes != b.mFitInsetsTypes
                    || a.mFitInsetsSides != b.mFitInsetsSides
                    || a.mFitInsetsIgnoringVisibility != b.mFitInsetsIgnoringVisibility;
        }

        @Override
        public String debug(String output) {
            output += "Contents of " + this + ":";
+30 −0
Original line number Diff line number Diff line
@@ -268,6 +268,20 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Sets whether a task should be translucent. When {@code false}, the existing translucent of
     * the task applies, but when {@code true} the task will be forced to be translucent.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction setForceTranslucent(
            @NonNull WindowContainerToken container, boolean forceTranslucent) {
        Change chg = getOrCreateChange(container.asBinder());
        chg.mForceTranslucent = forceTranslucent;
        chg.mChangeMask |= Change.CHANGE_FORCE_TRANSLUCENT;
        return this;
    }

    /**
     * Used in conjunction with a shell-transition call (usually finishTransition). This is
     * basically a message to the transition system that a particular task should NOT go into
@@ -834,11 +848,13 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int CHANGE_BOUNDS_TRANSACTION_RECT = 1 << 4;
        public static final int CHANGE_IGNORE_ORIENTATION_REQUEST = 1 << 5;
        public static final int CHANGE_FORCE_NO_PIP = 1 << 6;
        public static final int CHANGE_FORCE_TRANSLUCENT = 1 << 7;

        private final Configuration mConfiguration = new Configuration();
        private boolean mFocusable = true;
        private boolean mHidden = false;
        private boolean mIgnoreOrientationRequest = false;
        private boolean mForceTranslucent = false;

        private int mChangeMask = 0;
        private @ActivityInfo.Config int mConfigSetMask = 0;
@@ -858,6 +874,7 @@ public final class WindowContainerTransaction implements Parcelable {
            mFocusable = in.readBoolean();
            mHidden = in.readBoolean();
            mIgnoreOrientationRequest = in.readBoolean();
            mForceTranslucent = in.readBoolean();
            mChangeMask = in.readInt();
            mConfigSetMask = in.readInt();
            mWindowSetMask = in.readInt();
@@ -903,6 +920,9 @@ public final class WindowContainerTransaction implements Parcelable {
            if ((other.mChangeMask & CHANGE_IGNORE_ORIENTATION_REQUEST) != 0) {
                mIgnoreOrientationRequest = other.mIgnoreOrientationRequest;
            }
            if ((other.mChangeMask & CHANGE_FORCE_TRANSLUCENT) != 0) {
                mForceTranslucent = other.mForceTranslucent;
            }
            mChangeMask |= other.mChangeMask;
            if (other.mActivityWindowingMode >= 0) {
                mActivityWindowingMode = other.mActivityWindowingMode;
@@ -953,6 +973,15 @@ public final class WindowContainerTransaction implements Parcelable {
            return mIgnoreOrientationRequest;
        }

        /** Gets the requested force translucent state. */
        public boolean getForceTranslucent() {
            if ((mChangeMask & CHANGE_FORCE_TRANSLUCENT) == 0) {
                throw new RuntimeException("Force translucent not set. "
                        + "Check CHANGE_FORCE_TRANSLUCENT first");
            }
            return mForceTranslucent;
        }

        public int getChangeMask() {
            return mChangeMask;
        }
@@ -1030,6 +1059,7 @@ public final class WindowContainerTransaction implements Parcelable {
            dest.writeBoolean(mFocusable);
            dest.writeBoolean(mHidden);
            dest.writeBoolean(mIgnoreOrientationRequest);
            dest.writeBoolean(mForceTranslucent);
            dest.writeInt(mChangeMask);
            dest.writeInt(mConfigSetMask);
            dest.writeInt(mWindowSetMask);
+3 −2
Original line number Diff line number Diff line
@@ -219,8 +219,9 @@ public class ScreenshotHelper {
                throw new IllegalArgumentException("Bundle does not contain a hardware bitmap");
            }

            HardwareBuffer buffer = bundle.getParcelable(KEY_BUFFER);
            ParcelableColorSpace colorSpace = bundle.getParcelable(KEY_COLOR_SPACE);
            HardwareBuffer buffer = bundle.getParcelable(KEY_BUFFER, HardwareBuffer.class);
            ParcelableColorSpace colorSpace = bundle.getParcelable(KEY_COLOR_SPACE,
                    ParcelableColorSpace.class);

            return Bitmap.wrapHardwareBuffer(Objects.requireNonNull(buffer),
                    colorSpace.getColorSpace());
+43 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ 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.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:minWidth="350dp"
              android:layout_gravity="center"
              android:theme="?attr/alertDialogTheme">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fp_power_button_enrollment_title"
        android:singleLine="true"
        android:ellipsize="end"
        android:paddingLeft="20dp"/>
    <Space
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"/>
    <Button
        android:id="@+id/turn_off_screen"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fp_power_button_enrollment_button_text"
        android:paddingRight="20dp"
        style="?android:attr/buttonBarNegativeButtonStyle"
        android:maxLines="1"/>
</LinearLayout>
 No newline at end of file
Loading