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

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

Merge "Add attributions to PackageInfo"

parents 62ca35b0 9978f3a2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -11641,6 +11641,14 @@ package android.content.pm {
    method public final int compare(android.content.pm.ApplicationInfo, android.content.pm.ApplicationInfo);
  }
  public final class Attribution implements android.os.Parcelable {
    method public int describeContents();
    method @IdRes public int getLabel();
    method @NonNull public String getTag();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.Attribution> CREATOR;
  }
  public final class ChangedPackages implements android.os.Parcelable {
    ctor public ChangedPackages(int, @NonNull java.util.List<java.lang.String>);
    method public int describeContents();
@@ -11890,6 +11898,7 @@ package android.content.pm {
    field public static final int REQUESTED_PERMISSION_GRANTED = 2; // 0x2
    field public android.content.pm.ActivityInfo[] activities;
    field public android.content.pm.ApplicationInfo applicationInfo;
    field @Nullable public android.content.pm.Attribution[] attributions;
    field public int baseRevisionCode;
    field public android.content.pm.ConfigurationInfo[] configPreferences;
    field public android.content.pm.FeatureGroupInfo[] featureGroups;
@@ -12338,6 +12347,7 @@ package android.content.pm {
    field public static final int FLAG_PERMISSION_WHITELIST_SYSTEM = 1; // 0x1
    field public static final int FLAG_PERMISSION_WHITELIST_UPGRADE = 4; // 0x4
    field public static final int GET_ACTIVITIES = 1; // 0x1
    field public static final int GET_ATTRIBUTIONS = -2147483648; // 0x80000000
    field public static final int GET_CONFIGURATIONS = 16384; // 0x4000
    field @Deprecated public static final int GET_DISABLED_COMPONENTS = 512; // 0x200
    field @Deprecated public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

package android.content.pm;

parcelable Attribution;
+160 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

package android.content.pm;

import android.annotation.IdRes;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

import com.android.internal.util.DataClass;

/**
 * Information about an attribution declared by a package. This corresponds to the information
 * collected from the AndroidManifest.xml's &lt;attribution&gt; tags.
 */
@DataClass(genHiddenConstructor = true)
public final class Attribution implements Parcelable {

    /**
     * The tag of this attribution. From the &lt;manifest&gt; tag's "tag" attribute
     */
    private @NonNull String mTag;

    /**
     * The resource ID of the label of the attribution From the &lt;manifest&gt; tag's "label"
     * attribute
     */
    private final @IdRes int mLabel;



    // Code below generated by codegen v1.0.22.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
    //
    // To regenerate run:
    // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/Attribution.java
    //
    // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
    //   Settings > Editor > Code Style > Formatter Control
    //@formatter:off


    /**
     * Creates a new Attribution.
     *
     * @param tag
     *   The tag of this attribution. From the &lt;manifest&gt; tag's "tag" attribute
     * @param label
     *   The resource ID of the label of the attribution From the &lt;manifest&gt; tag's "label"
     *   attribute
     * @hide
     */
    @DataClass.Generated.Member
    public Attribution(
            @NonNull String tag,
            @IdRes int label) {
        this.mTag = tag;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mTag);
        this.mLabel = label;
        com.android.internal.util.AnnotationValidations.validate(
                IdRes.class, null, mLabel);

        // onConstructed(); // You can define this method to get a callback
    }

    /**
     * The tag of this attribution. From the &lt;manifest&gt; tag's "tag" attribute
     */
    @DataClass.Generated.Member
    public @NonNull String getTag() {
        return mTag;
    }

    /**
     * The resource ID of the label of the attribution From the &lt;manifest&gt; tag's "label"
     * attribute
     */
    @DataClass.Generated.Member
    public @IdRes int getLabel() {
        return mLabel;
    }

    @Override
    @DataClass.Generated.Member
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        // You can override field parcelling by defining methods like:
        // void parcelFieldName(Parcel dest, int flags) { ... }

        dest.writeString(mTag);
        dest.writeInt(mLabel);
    }

    @Override
    @DataClass.Generated.Member
    public int describeContents() { return 0; }

    /** @hide */
    @SuppressWarnings({"unchecked", "RedundantCast"})
    @DataClass.Generated.Member
    /* package-private */ Attribution(@NonNull Parcel in) {
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }

        String tag = in.readString();
        int label = in.readInt();

        this.mTag = tag;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mTag);
        this.mLabel = label;
        com.android.internal.util.AnnotationValidations.validate(
                IdRes.class, null, mLabel);

        // onConstructed(); // You can define this method to get a callback
    }

    @DataClass.Generated.Member
    public static final @NonNull Parcelable.Creator<Attribution> CREATOR
            = new Parcelable.Creator<Attribution>() {
        @Override
        public Attribution[] newArray(int size) {
            return new Attribution[size];
        }

        @Override
        public Attribution createFromParcel(@NonNull Parcel in) {
            return new Attribution(in);
        }
    };

    @DataClass.Generated(
            time = 1608139558081L,
            codegenVersion = "1.0.22",
            sourceFile = "frameworks/base/core/java/android/content/pm/Attribution.java",
            inputSignatures = "private @android.annotation.NonNull java.lang.String mTag\nprivate final @android.annotation.IdRes int mLabel\nclass Attribution extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true)")
    @Deprecated
    private void __metadata() {}


    //@formatter:on
    // End of generated code

}
+10 −0
Original line number Diff line number Diff line
@@ -217,6 +217,14 @@ public class PackageInfo implements Parcelable {
     */
    public int[] requestedPermissionsFlags;

    /**
     * Array of all {@link android.R.styleable#AndroidManifestAttribution
     * &lt;attribution&gt;} tags included under &lt;manifest&gt;, or null if there were none. This
     * is only filled if the flag {@link PackageManager#GET_ATTRIBUTIONS} was set.
     */
    @SuppressWarnings("ArrayReturn")
    public @Nullable Attribution[] attributions;

    /**
     * Flag for {@link #requestedPermissionsFlags}: the requested permission
     * is required for the application to run; the user can not optionally
@@ -471,6 +479,7 @@ public class PackageInfo implements Parcelable {
        dest.writeTypedArray(configPreferences, parcelableFlags);
        dest.writeTypedArray(reqFeatures, parcelableFlags);
        dest.writeTypedArray(featureGroups, parcelableFlags);
        dest.writeTypedArray(attributions, parcelableFlags);
        dest.writeInt(installLocation);
        dest.writeInt(isStub ? 1 : 0);
        dest.writeInt(coreApp ? 1 : 0);
@@ -536,6 +545,7 @@ public class PackageInfo implements Parcelable {
        configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);
        reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
        featureGroups = source.createTypedArray(FeatureGroupInfo.CREATOR);
        attributions = source.createTypedArray(Attribution.CREATOR);
        installLocation = source.readInt();
        isStub = source.readInt() != 0;
        coreApp = source.readInt() != 0;
+6 −0
Original line number Diff line number Diff line
@@ -449,6 +449,7 @@ public abstract class PackageManager {
            GET_DISABLED_UNTIL_USED_COMPONENTS,
            GET_UNINSTALLED_PACKAGES,
            MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS,
            GET_ATTRIBUTIONS,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface PackageInfoFlags {}
@@ -842,6 +843,11 @@ public abstract class PackageManager {
     */
    public static final int MATCH_DIRECT_BOOT_AUTO = 0x10000000;

    /**
     * {@link PackageInfo} flag: return all attributions declared in the package manifest
     */
    public static final int GET_ATTRIBUTIONS = 0x80000000;

    /** @hide */
    @Deprecated
    public static final int MATCH_DEBUG_TRIAGED_MISSING = MATCH_DIRECT_BOOT_AUTO;
Loading