1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.content.pm; 18 19 import android.annotation.IdRes; 20 import android.annotation.NonNull; 21 import android.os.Parcel; 22 import android.os.Parcelable; 23 24 import com.android.internal.util.DataClass; 25 26 /** 27 * Information about an attribution declared by a package. This corresponds to the information 28 * collected from the AndroidManifest.xml's <attribution> tags. 29 */ 30 @DataClass(genHiddenConstructor = true) 31 public final class Attribution implements Parcelable { 32 33 /** 34 * The tag of this attribution. From the <manifest> tag's "tag" attribute 35 */ 36 private @NonNull String mTag; 37 38 /** 39 * The resource ID of the label of the attribution From the <manifest> tag's "label" 40 * attribute 41 */ 42 private final @IdRes int mLabel; 43 44 45 46 // Code below generated by codegen v1.0.22. 47 // 48 // DO NOT MODIFY! 49 // CHECKSTYLE:OFF Generated code 50 // 51 // To regenerate run: 52 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/content/pm/Attribution.java 53 // 54 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 55 // Settings > Editor > Code Style > Formatter Control 56 //@formatter:off 57 58 59 /** 60 * Creates a new Attribution. 61 * 62 * @param tag 63 * The tag of this attribution. From the <manifest> tag's "tag" attribute 64 * @param label 65 * The resource ID of the label of the attribution From the <manifest> tag's "label" 66 * attribute 67 * @hide 68 */ 69 @DataClass.Generated.Member Attribution( @onNull String tag, @IdRes int label)70 public Attribution( 71 @NonNull String tag, 72 @IdRes int label) { 73 this.mTag = tag; 74 com.android.internal.util.AnnotationValidations.validate( 75 NonNull.class, null, mTag); 76 this.mLabel = label; 77 com.android.internal.util.AnnotationValidations.validate( 78 IdRes.class, null, mLabel); 79 80 // onConstructed(); // You can define this method to get a callback 81 } 82 83 /** 84 * The tag of this attribution. From the <manifest> tag's "tag" attribute 85 */ 86 @DataClass.Generated.Member getTag()87 public @NonNull String getTag() { 88 return mTag; 89 } 90 91 /** 92 * The resource ID of the label of the attribution From the <manifest> tag's "label" 93 * attribute 94 */ 95 @DataClass.Generated.Member getLabel()96 public @IdRes int getLabel() { 97 return mLabel; 98 } 99 100 @Override 101 @DataClass.Generated.Member writeToParcel(@onNull Parcel dest, int flags)102 public void writeToParcel(@NonNull Parcel dest, int flags) { 103 // You can override field parcelling by defining methods like: 104 // void parcelFieldName(Parcel dest, int flags) { ... } 105 106 dest.writeString(mTag); 107 dest.writeInt(mLabel); 108 } 109 110 @Override 111 @DataClass.Generated.Member describeContents()112 public int describeContents() { return 0; } 113 114 /** @hide */ 115 @SuppressWarnings({"unchecked", "RedundantCast"}) 116 @DataClass.Generated.Member Attribution(@onNull Parcel in)117 /* package-private */ Attribution(@NonNull Parcel in) { 118 // You can override field unparcelling by defining methods like: 119 // static FieldType unparcelFieldName(Parcel in) { ... } 120 121 String tag = in.readString(); 122 int label = in.readInt(); 123 124 this.mTag = tag; 125 com.android.internal.util.AnnotationValidations.validate( 126 NonNull.class, null, mTag); 127 this.mLabel = label; 128 com.android.internal.util.AnnotationValidations.validate( 129 IdRes.class, null, mLabel); 130 131 // onConstructed(); // You can define this method to get a callback 132 } 133 134 @DataClass.Generated.Member 135 public static final @NonNull Parcelable.Creator<Attribution> CREATOR 136 = new Parcelable.Creator<Attribution>() { 137 @Override 138 public Attribution[] newArray(int size) { 139 return new Attribution[size]; 140 } 141 142 @Override 143 public Attribution createFromParcel(@NonNull Parcel in) { 144 return new Attribution(in); 145 } 146 }; 147 148 @DataClass.Generated( 149 time = 1608139558081L, 150 codegenVersion = "1.0.22", 151 sourceFile = "frameworks/base/core/java/android/content/pm/Attribution.java", 152 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)") 153 @Deprecated __metadata()154 private void __metadata() {} 155 156 157 //@formatter:on 158 // End of generated code 159 160 } 161