ObbInfo.java revision 02ca31fbae9f35dd30f79de6927fae11b549391a
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 17package android.content.res; 18 19import android.os.Parcel; 20import android.os.Parcelable; 21 22/** 23 * Basic information about a Opaque Binary Blob (OBB) that reflects 24 * the info from the footer on the OBB file. 25 * @hide 26 */ 27public 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 name of the package to which the OBB file belongs. 33 */ 34 public String packageName; 35 36 /** 37 * The version of the package to which the OBB file belongs. 38 */ 39 public int version; 40 41 /** 42 * The flags relating to the OBB. 43 */ 44 public int flags; 45 46 public ObbInfo() { 47 } 48 49 public String toString() { 50 StringBuilder sb = new StringBuilder(); 51 sb.append("ObbInfo{"); 52 sb.append(Integer.toHexString(System.identityHashCode(this))); 53 sb.append(" packageName="); 54 sb.append(packageName); 55 sb.append(",version="); 56 sb.append(version); 57 sb.append(",flags="); 58 sb.append(flags); 59 sb.append('}'); 60 return sb.toString(); 61 } 62 63 public int describeContents() { 64 return 0; 65 } 66 67 public void writeToParcel(Parcel dest, int parcelableFlags) { 68 dest.writeString(packageName); 69 dest.writeInt(version); 70 dest.writeInt(flags); 71 } 72 73 public static final Parcelable.Creator<ObbInfo> CREATOR 74 = new Parcelable.Creator<ObbInfo>() { 75 public ObbInfo createFromParcel(Parcel source) { 76 return new ObbInfo(source); 77 } 78 79 public ObbInfo[] newArray(int size) { 80 return new ObbInfo[size]; 81 } 82 }; 83 84 private ObbInfo(Parcel source) { 85 packageName = source.readString(); 86 version = source.readInt(); 87 flags = source.readInt(); 88 } 89} 90