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

Commit 0271ef98 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I8d43f5bc,I5ca4b0ca

* changes:
  OMS: Enable uninstallation of overlays
  PackageManager: allow overlays to be installed when signature matches platform cert
parents 71e8c409 b67fc5fb
Loading
Loading
Loading
Loading
+6 −29
Original line number Diff line number Diff line
@@ -16,14 +16,10 @@

package android.content.pm;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;

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

/**
 * Overall information about the contents of a package.  This corresponds
 * to all of the information collected from AndroidManifest.xml.
@@ -370,28 +366,9 @@ public class PackageInfo implements Parcelable {
    public int overlayPriority;

    /**
     * Flag for use with {@link #mOverlayFlags}. Marks the overlay as static, meaning it cannot
     * be enabled/disabled at runtime.
     */
    static final int FLAG_OVERLAY_STATIC = 1 << 1;

    /**
     * Flag for use with {@link #mOverlayFlags}. Marks the overlay as trusted (not 3rd party).
     */
    static final int FLAG_OVERLAY_TRUSTED = 1 << 2;

    @IntDef(flag = true, prefix = "FLAG_OVERLAY_", value = {
            FLAG_OVERLAY_STATIC,
            FLAG_OVERLAY_TRUSTED
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface OverlayFlags {}

    /**
     * Modifiers that affect the state of this overlay. See {@link #FLAG_OVERLAY_STATIC},
     * {@link #FLAG_OVERLAY_TRUSTED}.
     * Whether the overlay is static, meaning it cannot be enabled/disabled at runtime.
     */
    @OverlayFlags int mOverlayFlags;
    boolean mOverlayIsStatic;

    /**
     * The user-visible SDK version (ex. 26) of the framework against which the application claims
@@ -424,7 +401,7 @@ public class PackageInfo implements Parcelable {
     * @hide
     */
    public boolean isOverlayPackage() {
        return overlayTarget != null && (mOverlayFlags & FLAG_OVERLAY_TRUSTED) != 0;
        return overlayTarget != null;
    }

    /**
@@ -433,7 +410,7 @@ public class PackageInfo implements Parcelable {
     * @hide
     */
    public boolean isStaticOverlayPackage() {
        return overlayTarget != null && (mOverlayFlags & FLAG_OVERLAY_STATIC) != 0;
        return overlayTarget != null && mOverlayIsStatic;
    }

    @Override
@@ -488,7 +465,7 @@ public class PackageInfo implements Parcelable {
        dest.writeString(requiredAccountType);
        dest.writeString(overlayTarget);
        dest.writeInt(overlayPriority);
        dest.writeInt(mOverlayFlags);
        dest.writeBoolean(mOverlayIsStatic);
        dest.writeInt(compileSdkVersion);
        dest.writeString(compileSdkVersionCodename);
    }
@@ -543,7 +520,7 @@ public class PackageInfo implements Parcelable {
        requiredAccountType = source.readString();
        overlayTarget = source.readString();
        overlayPriority = source.readInt();
        mOverlayFlags = source.readInt();
        mOverlayIsStatic = source.readBoolean();
        compileSdkVersion = source.readInt();
        compileSdkVersionCodename = source.readString();

+5 −16
Original line number Diff line number Diff line
@@ -679,15 +679,7 @@ public class PackageParser {
        pi.requiredAccountType = p.mRequiredAccountType;
        pi.overlayTarget = p.mOverlayTarget;
        pi.overlayPriority = p.mOverlayPriority;

        if (p.mIsStaticOverlay) {
            pi.mOverlayFlags |= PackageInfo.FLAG_OVERLAY_STATIC;
        }

        if (p.mTrustedOverlay) {
            pi.mOverlayFlags |= PackageInfo.FLAG_OVERLAY_TRUSTED;
        }

        pi.mOverlayIsStatic = p.mOverlayIsStatic;
        pi.compileSdkVersion = p.mCompileSdkVersion;
        pi.compileSdkVersionCodename = p.mCompileSdkVersionCodename;
        pi.firstInstallTime = firstInstallTime;
@@ -2085,7 +2077,7 @@ public class PackageParser {
                pkg.mOverlayPriority = sa.getInt(
                        com.android.internal.R.styleable.AndroidManifestResourceOverlay_priority,
                        0);
                pkg.mIsStaticOverlay = sa.getBoolean(
                pkg.mOverlayIsStatic = sa.getBoolean(
                        com.android.internal.R.styleable.AndroidManifestResourceOverlay_isStatic,
                        false);
                final String propName = sa.getString(
@@ -6094,8 +6086,7 @@ public class PackageParser {

        public String mOverlayTarget;
        public int mOverlayPriority;
        public boolean mIsStaticOverlay;
        public boolean mTrustedOverlay;
        public boolean mOverlayIsStatic;

        public int mCompileSdkVersion;
        public String mCompileSdkVersionCodename;
@@ -6625,8 +6616,7 @@ public class PackageParser {
            mRequiredAccountType = dest.readString();
            mOverlayTarget = dest.readString();
            mOverlayPriority = dest.readInt();
            mIsStaticOverlay = (dest.readInt() == 1);
            mTrustedOverlay = (dest.readInt() == 1);
            mOverlayIsStatic = (dest.readInt() == 1);
            mCompileSdkVersion = dest.readInt();
            mCompileSdkVersionCodename = dest.readString();
            mUpgradeKeySets = (ArraySet<String>) dest.readArraySet(boot);
@@ -6749,8 +6739,7 @@ public class PackageParser {
            dest.writeString(mRequiredAccountType);
            dest.writeString(mOverlayTarget);
            dest.writeInt(mOverlayPriority);
            dest.writeInt(mIsStaticOverlay ? 1 : 0);
            dest.writeInt(mTrustedOverlay ? 1 : 0);
            dest.writeInt(mOverlayIsStatic ? 1 : 0);
            dest.writeInt(mCompileSdkVersion);
            dest.writeString(mCompileSdkVersionCodename);
            dest.writeArraySet(mUpgradeKeySets);
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.server.om.test">

    <uses-sdk android:minSdkVersion="21" />

    <application>
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
                     android:targetPackage="com.android.server.om.test" />

</manifest>
Loading