Debian Codegraph @

core/java/android/content/pm/KeySet.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2012 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.annotation.Nullable;
20 import android.os.IBinder;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23
24 /**
25 * Represents a {@code KeySet} that has been declared in the AndroidManifest.xml
26 * file for the application. A {@code KeySet} can be used explicitly to
27 * represent a trust relationship with other applications on the device.
28 * @hide
29 */
30 public class KeySet implements Parcelable {
31
32 private IBinder token;
33
34 /** @hide */
35 public KeySet(IBinder token) {
36 if (token == null) {
37 throw new NullPointerException("null value for KeySet IBinder token");
38 }
39 this.token = token;
40 }
41
42 /** @hide */
43 public IBinder getToken() {
44 return token;
45 }
46
47 /** @hide */
48 @Override
49 public boolean equals(@Nullable Object o) {
50 if (o instanceof KeySet) {
51 KeySet ks = (KeySet) o;
52 return token == ks.token;
53 }
54 return false;
55 }
56
57 /** @hide */
58 @Override
59 public int hashCode() {
60 return token.hashCode();
61 }
62
63 /**
64 * Implement Parcelable
65 * @hide
66 */
67 public static final @android.annotation.NonNull Parcelable.Creator<KeySet> CREATOR
68 = new Parcelable.Creator<KeySet>() {
69
70 /**
71 * Create a KeySet from a Parcel
72 *
73 * @param in The parcel containing the KeySet
74 */
75 public KeySet createFromParcel(Parcel source) {
76 return readFromParcel(source);
77 }
78
79 /**
80 * Create an array of null KeySets
81 */
82 public KeySet[] newArray(int size) {
83 return new KeySet[size];
84 }
85 };
86
87 /**
88 * @hide
89 */
90 private static KeySet readFromParcel(Parcel in) {
91 IBinder token = in.readStrongBinder();
92 return new KeySet(token);
93 }
94
95 /**
96 * @hide
97 */
98 @Override
99 public void writeToParcel(Parcel out, int flags) {
100 out.writeStrongBinder(token);
101 }
102
103 /**
104 * @hide
105 */
106 @Override
107 public int describeContents() {
108 return 0;
109 }
110 }