OSDN Git Service

Update KeymasterDefs
[android-x86/frameworks-base.git] / core / java / android / security / keymaster / KeymasterLongArgument.java
1 /**
2  * Copyright (c) 2015, 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.security.keymaster;
18
19 import android.os.Parcel;
20 import android.os.Parcelable;
21
22 /**
23  * @hide
24  */
25 class KeymasterLongArgument extends KeymasterArgument {
26     public final long value;
27
28     public KeymasterLongArgument(int tag, long value) {
29         super(tag);
30         switch (KeymasterDefs.getTagType(tag)) {
31             case KeymasterDefs.KM_ULONG:
32             case KeymasterDefs.KM_ULONG_REP:
33                 break; // OK.
34             default:
35                 throw new IllegalArgumentException("Bad long tag " + tag);
36         }
37         this.value = value;
38     }
39
40     public KeymasterLongArgument(int tag, Parcel in) {
41         super(tag);
42         value = in.readLong();
43     }
44
45     @Override
46     public void writeValue(Parcel out) {
47         out.writeLong(value);
48     }
49 }