Debian Codegraph @

core/java/android/content/pm/PackageInfoLite.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 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.compat.annotation.UnsupportedAppUsage;
20 import android.os.Build;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23
24 import com.android.internal.content.InstallLocationUtils;
25
26 /**
27 * Basic information about a package as specified in its manifest.
28 * Utility class used in PackageManager methods
29 * @hide
30 */
31 public class PackageInfoLite implements Parcelable {
32 /**
33 * The name of this package. From the <manifest> tag's "name"
34 * attribute.
35 */
36 public String packageName;
37
38 /** Names of any split APKs, ordered by parsed splitName */
39 public String[] splitNames;
40
41 /**
42 * The android:versionCode of the package.
43 * @deprecated Use {@link #getLongVersionCode()} instead, which includes both
44 * this and the additional
45 * {@link android.R.styleable#AndroidManifest_versionCode versionCodeMajor} attribute.
46 */
47 @Deprecated
48 public int versionCode;
49
50 /**
51 * @hide
52 * The android:versionCodeMajor of the package.
53 */
54 public int versionCodeMajor;
55
56 /**
57 * Return {@link #versionCode} and {@link #versionCodeMajor} combined together as a
58 * single long value. The {@link #versionCodeMajor} is placed in the upper 32 bits.
59 */
60 public long getLongVersionCode() {
61 return PackageInfo.composeLongVersionCode(versionCodeMajor, versionCode);
62 }
63
64 /** Revision code of base APK */
65 public int baseRevisionCode;
66 /** Revision codes of any split APKs, ordered by parsed splitName */
67 public int[] splitRevisionCodes;
68
69 /**
70 * The android:multiArch flag from the package manifest. If set,
71 * we will extract all native libraries for the given app, not just those
72 * from the preferred ABI.
73 */
74 public boolean multiArch;
75
76 /**
77 * The android:debuggable flag from the package manifest.
78 */
79 public boolean debuggable;
80
81 /**
82 * Indicates if this apk is a sdk.
83 */
84 public boolean isSdkLibrary;
85
86 /**
87 * Specifies the recommended install location. Can be one of
88 * {@link InstallLocationUtils#RECOMMEND_INSTALL_INTERNAL} to install on internal storage,
89 * {@link InstallLocationUtils#RECOMMEND_INSTALL_EXTERNAL} to install on external media,
90 * {@link InstallLocationUtils#RECOMMEND_FAILED_INSUFFICIENT_STORAGE} for storage errors,
91 * or {@link InstallLocationUtils#RECOMMEND_FAILED_INVALID_APK} for parse errors.
92 */
93 public int recommendedInstallLocation;
94 public int installLocation;
95
96 public VerifierInfo[] verifiers;
97
98 public PackageInfoLite() {
99 }
100
101 public String toString() {
102 return "PackageInfoLite{"
103 + Integer.toHexString(System.identityHashCode(this))
104 + " " + packageName + "}";
105 }
106
107 public int describeContents() {
108 return 0;
109 }
110
111 public void writeToParcel(Parcel dest, int parcelableFlags) {
112 dest.writeString(packageName);
113 dest.writeStringArray(splitNames);
114 dest.writeInt(versionCode);
115 dest.writeInt(versionCodeMajor);
116 dest.writeInt(baseRevisionCode);
117 dest.writeIntArray(splitRevisionCodes);
118 dest.writeInt(recommendedInstallLocation);
119 dest.writeInt(installLocation);
120 dest.writeInt(multiArch ? 1 : 0);
121 dest.writeInt(debuggable ? 1 : 0);
122
123 if (verifiers == null || verifiers.length == 0) {
124 dest.writeInt(0);
125 } else {
126 dest.writeInt(verifiers.length);
127 dest.writeTypedArray(verifiers, parcelableFlags);
128 }
129 }
130
131 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
132 public static final @android.annotation.NonNull Parcelable.Creator<PackageInfoLite> CREATOR
133 = new Parcelable.Creator<PackageInfoLite>() {
134 public PackageInfoLite createFromParcel(Parcel source) {
135 return new PackageInfoLite(source);
136 }
137
138 public PackageInfoLite[] newArray(int size) {
139 return new PackageInfoLite[size];
140 }
141 };
142
143 private PackageInfoLite(Parcel source) {
144 packageName = source.readString();
145 splitNames = source.createStringArray();
146 versionCode = source.readInt();
147 versionCodeMajor = source.readInt();
148 baseRevisionCode = source.readInt();
149 splitRevisionCodes = source.createIntArray();
150 recommendedInstallLocation = source.readInt();
151 installLocation = source.readInt();
152 multiArch = (source.readInt() != 0);
153 debuggable = (source.readInt() != 0);
154
155 final int verifiersLength = source.readInt();
156 if (verifiersLength == 0) {
157 verifiers = new VerifierInfo[0];
158 } else {
159 verifiers = new VerifierInfo[verifiersLength];
160 source.readTypedArray(verifiers, VerifierInfo.CREATOR);
161 }
162 }
163 }