Home | History | Annotate | Download | only in res
      1 /*
      2  * Copyright (C) 2010 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.res;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 /**
     23  * Basic information about a Opaque Binary Blob (OBB) that reflects the info
     24  * from the footer on the OBB file. This information may be manipulated by a
     25  * developer with the <code>obbtool</code> program in the Android SDK.
     26  */
     27 public class ObbInfo implements Parcelable {
     28     /** Flag noting that this OBB is an overlay patch for a base OBB. */
     29     public static final int OBB_OVERLAY = 1 << 0;
     30 
     31     /**
     32      * The canonical filename of the OBB.
     33      */
     34     public String filename;
     35 
     36     /**
     37      * The name of the package to which the OBB file belongs.
     38      */
     39     public String packageName;
     40 
     41     /**
     42      * The version of the package to which the OBB file belongs.
     43      */
     44     public int version;
     45 
     46     /**
     47      * The flags relating to the OBB.
     48      */
     49     public int flags;
     50 
     51     /**
     52      * The salt for the encryption algorithm.
     53      *
     54      * @hide
     55      */
     56     public byte[] salt;
     57 
     58     // Only allow things in this package to instantiate.
     59     /* package */ ObbInfo() {
     60     }
     61 
     62     public String toString() {
     63         StringBuilder sb = new StringBuilder();
     64         sb.append("ObbInfo{");
     65         sb.append(Integer.toHexString(System.identityHashCode(this)));
     66         sb.append(" packageName=");
     67         sb.append(packageName);
     68         sb.append(",version=");
     69         sb.append(version);
     70         sb.append(",flags=");
     71         sb.append(flags);
     72         sb.append('}');
     73         return sb.toString();
     74     }
     75 
     76     public int describeContents() {
     77         return 0;
     78     }
     79 
     80     public void writeToParcel(Parcel dest, int parcelableFlags) {
     81         dest.writeString(filename);
     82         dest.writeString(packageName);
     83         dest.writeInt(version);
     84         dest.writeInt(flags);
     85         dest.writeByteArray(salt);
     86     }
     87 
     88     public static final Parcelable.Creator<ObbInfo> CREATOR
     89             = new Parcelable.Creator<ObbInfo>() {
     90         public ObbInfo createFromParcel(Parcel source) {
     91             return new ObbInfo(source);
     92         }
     93 
     94         public ObbInfo[] newArray(int size) {
     95             return new ObbInfo[size];
     96         }
     97     };
     98 
     99     private ObbInfo(Parcel source) {
    100         filename = source.readString();
    101         packageName = source.readString();
    102         version = source.readInt();
    103         flags = source.readInt();
    104         salt = source.createByteArray();
    105     }
    106 }
    107