115a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root/* 215a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Copyright (C) 2007 The Android Open Source Project 315a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * 415a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Licensed under the Apache License, Version 2.0 (the "License"); 515a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * you may not use this file except in compliance with the License. 615a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * You may obtain a copy of the License at 715a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * 815a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * http://www.apache.org/licenses/LICENSE-2.0 915a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * 1015a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Unless required by applicable law or agreed to in writing, software 1115a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * distributed under the License is distributed on an "AS IS" BASIS, 1215a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1315a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * See the License for the specific language governing permissions and 1415a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * limitations under the License. 1515a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root */ 1615a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root 17a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapupackage android.content.pm; 18a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 19a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapuimport android.os.Parcel; 20a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapuimport android.os.Parcelable; 21a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 2288d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkeyimport com.android.internal.content.PackageHelper; 2388d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey 24a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu/** 25a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * Basic information about a package as specified in its manifest. 26a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * Utility class used in PackageManager methods 27a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * @hide 28a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu */ 29a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapupublic class PackageInfoLite implements Parcelable { 30a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu /** 31a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * The name of this package. From the <manifest> tag's "name" 32a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * attribute. 33a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu */ 34a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public String packageName; 35a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 3688d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey /** Names of any split APKs, ordered by parsed splitName */ 3788d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey public String[] splitNames; 3888d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey 39a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu /** 407767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn * The android:versionCode of the package. 417767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn */ 427767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn public int versionCode; 437767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn 4488d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey /** Revision code of base APK */ 4588d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey public int baseRevisionCode; 4688d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey /** Revision codes of any split APKs, ordered by parsed splitName */ 4788d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey public int[] splitRevisionCodes; 4888d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey 497767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn /** 50ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath * The android:multiArch flag from the package manifest. If set, 51ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath * we will extract all native libraries for the given app, not just those 52ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath * from the preferred ABI. 53ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath */ 54ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath public boolean multiArch; 55ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath 56ff110bd61a69f7ed8602ae14b27f7befec76b2e7Narayan Kamath /** 57a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * Specifies the recommended install location. Can be one of 58a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * {@link #PackageHelper.RECOMMEND_INSTALL_INTERNAL} to install on internal storage 59a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * {@link #PackageHelper.RECOMMEND_INSTALL_EXTERNAL} to install on external media 60a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * {@link PackageHelper.RECOMMEND_FAILED_INSUFFICIENT_STORAGE} for storage errors 61a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu * {@link PackageHelper.RECOMMEND_FAILED_INVALID_APK} for parse errors. 62a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu */ 63a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public int recommendedInstallLocation; 64a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public int installLocation; 65a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 6605ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root public VerifierInfo[] verifiers; 6705ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root 68a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public PackageInfoLite() { 69a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 70a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 71a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public String toString() { 72a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu return "PackageInfoLite{" 73a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu + Integer.toHexString(System.identityHashCode(this)) 74a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu + " " + packageName + "}"; 75a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 76a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 77a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public int describeContents() { 78a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu return 0; 79a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 80a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 81a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public void writeToParcel(Parcel dest, int parcelableFlags) { 82a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu dest.writeString(packageName); 8388d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey dest.writeStringArray(splitNames); 847767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn dest.writeInt(versionCode); 8588d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey dest.writeInt(baseRevisionCode); 8688d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey dest.writeIntArray(splitRevisionCodes); 87a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu dest.writeInt(recommendedInstallLocation); 88a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu dest.writeInt(installLocation); 89a8755a8407d1583425cd9e69fb580bba26a66041Narayan Kamath dest.writeInt(multiArch ? 1 : 0); 9005ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root 9105ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root if (verifiers == null || verifiers.length == 0) { 9205ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root dest.writeInt(0); 9305ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root } else { 9405ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root dest.writeInt(verifiers.length); 9505ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root dest.writeTypedArray(verifiers, parcelableFlags); 9605ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root } 97a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 98a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 99a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public static final Parcelable.Creator<PackageInfoLite> CREATOR 100a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu = new Parcelable.Creator<PackageInfoLite>() { 101a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public PackageInfoLite createFromParcel(Parcel source) { 102a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu return new PackageInfoLite(source); 103a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 104a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 105a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu public PackageInfoLite[] newArray(int size) { 106a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu return new PackageInfoLite[size]; 107a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 108a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu }; 109a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu 110a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu private PackageInfoLite(Parcel source) { 111a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu packageName = source.readString(); 11288d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey splitNames = source.createStringArray(); 1137767eac3232ba2fb9828766813cdb481d6a97584Dianne Hackborn versionCode = source.readInt(); 11488d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey baseRevisionCode = source.readInt(); 11588d2a3c0e1b4a8c53a489db5d627beb80b1b9957Jeff Sharkey splitRevisionCodes = source.createIntArray(); 116a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu recommendedInstallLocation = source.readInt(); 117a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu installLocation = source.readInt(); 118a8755a8407d1583425cd9e69fb580bba26a66041Narayan Kamath multiArch = (source.readInt() != 0); 11905ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root 12005ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root final int verifiersLength = source.readInt(); 12105ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root if (verifiersLength == 0) { 12205ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root verifiers = new VerifierInfo[0]; 12305ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root } else { 12405ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root verifiers = new VerifierInfo[verifiersLength]; 12505ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root source.readTypedArray(verifiers, VerifierInfo.CREATOR); 12605ca4c90644921df9193d92b2abdc81ef77e4a62Kenny Root } 127a2b6c3775ed6b8924232d6a01bae4a19740a15f8Suchi Amalapurapu } 12815a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root} 129