Debian Codegraph @

core/java/android/content/res/ObbInfo.java

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