blob: 4286aa0d4ae3202161393e1a6d8cb97738eaabf3 [file] [log] [blame]
Alex Klyubin8effa362015-06-24 16:06:55 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
Chad Brubaker45ff13e2015-01-21 14:00:55 -08003 *
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 *
Alex Klyubin8effa362015-06-24 16:06:55 -07008 * http://www.apache.org/licenses/LICENSE-2.0
Chad Brubaker45ff13e2015-01-21 14:00:55 -08009 *
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.security.keymaster;
18
Andrei Oneafbc8cfd2019-03-22 11:32:59 +000019import android.annotation.UnsupportedAppUsage;
Chad Brubaker45ff13e2015-01-21 14:00:55 -080020import android.os.Parcel;
Chad Brubaker45ff13e2015-01-21 14:00:55 -080021
22/**
23 * @hide
24 */
25class KeymasterBooleanArgument extends KeymasterArgument {
26
27 // Boolean arguments are always true if they exist and false if they don't.
28 public final boolean value = true;
29
30 public KeymasterBooleanArgument(int tag) {
31 super(tag);
Chad Brubaker534bf9c2015-03-22 04:56:46 -070032 switch (KeymasterDefs.getTagType(tag)) {
33 case KeymasterDefs.KM_BOOL:
34 break; // OK.
35 default:
36 throw new IllegalArgumentException("Bad bool tag " + tag);
37 }
Chad Brubaker45ff13e2015-01-21 14:00:55 -080038 }
39
Andrei Oneafbc8cfd2019-03-22 11:32:59 +000040 @UnsupportedAppUsage
Chad Brubaker45ff13e2015-01-21 14:00:55 -080041 public KeymasterBooleanArgument(int tag, Parcel in) {
42 super(tag);
43 }
44
45 @Override
46 public void writeValue(Parcel out) {
47 // Do nothing, value is implicit.
48 }
49}