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

Commit 250714c6 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 3156477,...

Merge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 3156477, 3156098, 3156099, 3156100, 3156101, 3156102, 3158393, 3155699, 3155700, 3156195, 3156196, 3156019, 3156020, 3158394] into oc-mr1-release

Change-Id: I5b1e8ce0b0d4c129cf502ab21733dd7bc65aed67
parents 37e2e248 d52b215f
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.app;

import static android.os.Build.VERSION_CODES.O_MR1;

import static java.lang.Character.MIN_VALUE;

import android.annotation.CallSuper;
@@ -990,18 +988,6 @@ public class Activity extends ContextThemeWrapper
    @CallSuper
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        if (DEBUG_LIFECYCLE) Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState);

        if (getApplicationInfo().targetSdkVersion >= O_MR1 && mActivityInfo.isFixedOrientation()) {
            final TypedArray ta = obtainStyledAttributes(com.android.internal.R.styleable.Window);
            final boolean isTranslucentOrFloating = ActivityInfo.isTranslucentOrFloating(ta);
            ta.recycle();

            if (isTranslucentOrFloating) {
                throw new IllegalStateException(
                        "Only fullscreen opaque activities can request orientation");
            }
        }

        if (mLastNonConfigurationInstances != null) {
            mFragments.restoreLoaderNonConfig(mLastNonConfigurationInstances.loaders);
        }
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ interface INotificationManager
    void setNotificationPolicy(String pkg, in NotificationManager.Policy policy);
    boolean isNotificationPolicyAccessGrantedForPackage(String pkg);
    void setNotificationPolicyAccessGranted(String pkg, boolean granted);
    void setNotificationPolicyAccessGrantedForUser(String pkg, int userId, boolean granted);
    AutomaticZenRule getAutomaticZenRule(String id);
    List<ZenModeConfig.ZenRule> getZenRules();
    String addAutomaticZenRule(in AutomaticZenRule automaticZenRule);
+1 −30
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.IntDef;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Configuration.NativeConfig;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Printer;
@@ -454,7 +453,6 @@ public class ActivityInfo extends ComponentInfo
     */
    public static final int FLAG_TURN_SCREEN_ON = 0x1000000;


    /**
     * @hide Bit in {@link #flags}: If set, this component will only be seen
     * by the system user.  Only works with broadcast receivers.  Set from the
@@ -993,19 +991,11 @@ public class ActivityInfo extends ComponentInfo
     * Returns true if the activity's orientation is fixed.
     * @hide
     */
    public boolean isFixedOrientation() {
    boolean isFixedOrientation() {
        return isFixedOrientationLandscape() || isFixedOrientationPortrait()
                || screenOrientation == SCREEN_ORIENTATION_LOCKED;
    }

    /**
     * Returns true if the specified orientation is considered fixed.
     * @hide
     */
    static public boolean isFixedOrientation(int orientation) {
        return isFixedOrientationLandscape(orientation) || isFixedOrientationPortrait(orientation);
    }

    /**
     * Returns true if the activity's orientation is fixed to landscape.
     * @hide
@@ -1185,25 +1175,6 @@ public class ActivityInfo extends ComponentInfo
        dest.writeFloat(maxAspectRatio);
    }

    /**
     * Determines whether the {@link Activity} is considered translucent or floating.
     * @hide
     */
    public static boolean isTranslucentOrFloating(TypedArray attributes) {
        final boolean isTranslucent =
                attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsTranslucent,
                        false);
        final boolean isSwipeToDismiss = !attributes.hasValue(
                com.android.internal.R.styleable.Window_windowIsTranslucent)
                && attributes.getBoolean(
                        com.android.internal.R.styleable.Window_windowSwipeToDismiss, false);
        final boolean isFloating =
                attributes.getBoolean(com.android.internal.R.styleable.Window_windowIsFloating,
                        false);

        return isFloating || isTranslucent || isSwipeToDismiss;
    }

    public static final Parcelable.Creator<ActivityInfo> CREATOR
            = new Parcelable.Creator<ActivityInfo>() {
        public ActivityInfo createFromParcel(Parcel source) {
+55 −11
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ import android.util.TypedValue;
import android.util.Xml;
import android.view.DisplayAdjustments;

import com.android.internal.util.GrowingArrayUtils;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

@@ -117,6 +119,13 @@ public class ResourcesImpl {
    private final ConfigurationBoundResourceCache<StateListAnimator> mStateListAnimatorCache =
            new ConfigurationBoundResourceCache<>();

    // A stack of all the resourceIds already referenced when parsing a resource. This is used to
    // detect circular references in the xml.
    // Using a ThreadLocal variable ensures that we have different stacks for multiple parallel
    // calls to ResourcesImpl
    private final ThreadLocal<LookupStack> mLookupStack =
            ThreadLocal.withInitial(() -> new LookupStack());

    /** Size of the cyclical cache used to map XML files to blocks. */
    private static final int XML_BLOCK_CACHE_SIZE = 4;

@@ -784,6 +793,13 @@ public class ResourcesImpl {
        final Drawable dr;

        Trace.traceBegin(Trace.TRACE_TAG_RESOURCES, file);
        LookupStack stack = mLookupStack.get();
        try {
            // Perform a linear search to check if we have already referenced this resource before.
            if (stack.contains(id)) {
                throw new Exception("Recursive reference in drawable");
            }
            stack.push(id);
            try {
                if (file.endsWith(".xml")) {
                    final XmlResourceParser rp = loadXmlResourceParser(
@@ -796,7 +812,10 @@ public class ResourcesImpl {
                    dr = Drawable.createFromResourceStream(wrapper, value, is, file, null);
                    is.close();
                }
        } catch (Exception | StackOverflowError e) {
            } finally {
                stack.pop();
            }
        } catch (Exception e) {
            Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
            final NotFoundException rnf = new NotFoundException(
                    "File " + file + " from drawable resource ID #0x" + Integer.toHexString(id));
@@ -1377,4 +1396,29 @@ public class ResourcesImpl {
            }
        }
    }

    private static class LookupStack {

        // Pick a reasonable default size for the array, it is grown as needed.
        private int[] mIds = new int[4];
        private int mSize = 0;

        public void push(int id) {
            mIds = GrowingArrayUtils.append(mIds, mSize, id);
            mSize++;
        }

        public boolean contains(int id) {
            for (int i = 0; i < mSize; i++) {
                if (mIds[i] == id) {
                    return true;
                }
            }
            return false;
        }

        public void pop() {
            mSize--;
        }
    }
}
+15 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemProperties;
import android.provider.Settings.Secure;
import android.provider.Settings.System;
import android.util.Slog;
@@ -100,6 +101,12 @@ public final class NightDisplayController {
     */
    public static final int COLOR_MODE_SATURATED = 2;

    /**
     * See com.android.server.display.DisplayTransformManager.
     */
    private static final String PERSISTENT_PROPERTY_SATURATION = "persist.sys.sf.color_saturation";
    private static final String PERSISTENT_PROPERTY_NATIVE_MODE = "persist.sys.sf.native_mode";

    private final Context mContext;
    private final int mUserId;

@@ -334,9 +341,15 @@ public final class NightDisplayController {
     */
    public int getColorMode() {
        final int colorMode = System.getIntForUser(mContext.getContentResolver(),
            System.DISPLAY_COLOR_MODE, COLOR_MODE_BOOSTED, mUserId);
            System.DISPLAY_COLOR_MODE, -1, mUserId);
        if (colorMode < COLOR_MODE_NATURAL || colorMode > COLOR_MODE_SATURATED) {
            return COLOR_MODE_BOOSTED;
            // There still might be a legacy system property controlling color mode that we need to
            // respect.
            if ("1".equals(SystemProperties.get(PERSISTENT_PROPERTY_NATIVE_MODE))) {
                return COLOR_MODE_SATURATED;
            }
            return "1.0".equals(SystemProperties.get(PERSISTENT_PROPERTY_SATURATION))
                    ? COLOR_MODE_NATURAL : COLOR_MODE_BOOSTED;
        }
        return colorMode;
    }
Loading