Home | History | Annotate | Download | only in pm
      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.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 /**
     23  * Basic information about a package as specified in its manifest.
     24  * Utility class used in PackageManager methods
     25  * @hide
     26  */
     27 public class PackageInfoLite implements Parcelable {
     28     /**
     29      * The name of this package.  From the <manifest> tag's "name"
     30      * attribute.
     31      */
     32     public String packageName;
     33 
     34     /**
     35      * Specifies the recommended install location. Can be one of
     36      * {@link #PackageHelper.RECOMMEND_INSTALL_INTERNAL} to install on internal storage
     37      * {@link #PackageHelper.RECOMMEND_INSTALL_EXTERNAL} to install on external media
     38      * {@link PackageHelper.RECOMMEND_FAILED_INSUFFICIENT_STORAGE} for storage errors
     39      * {@link PackageHelper.RECOMMEND_FAILED_INVALID_APK} for parse errors.
     40      */
     41     public int recommendedInstallLocation;
     42     public int installLocation;
     43 
     44     public PackageInfoLite() {
     45     }
     46 
     47     public String toString() {
     48         return "PackageInfoLite{"
     49             + Integer.toHexString(System.identityHashCode(this))
     50             + " " + packageName + "}";
     51     }
     52 
     53     public int describeContents() {
     54         return 0;
     55     }
     56 
     57     public void writeToParcel(Parcel dest, int parcelableFlags) {
     58         dest.writeString(packageName);
     59         dest.writeInt(recommendedInstallLocation);
     60         dest.writeInt(installLocation);
     61     }
     62 
     63     public static final Parcelable.Creator<PackageInfoLite> CREATOR
     64             = new Parcelable.Creator<PackageInfoLite>() {
     65         public PackageInfoLite createFromParcel(Parcel source) {
     66             return new PackageInfoLite(source);
     67         }
     68 
     69         public PackageInfoLite[] newArray(int size) {
     70             return new PackageInfoLite[size];
     71         }
     72     };
     73 
     74     private PackageInfoLite(Parcel source) {
     75         packageName = source.readString();
     76         recommendedInstallLocation = source.readInt();
     77         installLocation = source.readInt();
     78     }
     79 }
     80