Alex Klyubin | 8effa36 | 2015-06-24 16:06:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 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 | * |
Alex Klyubin | 8effa36 | 2015-06-24 16:06:55 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 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 | |
Andrei Onea | fbc8cfd | 2019-03-22 11:32:59 +0000 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 20 | import android.os.Parcel; |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * @hide |
| 24 | */ |
| 25 | class 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 Brubaker | 534bf9c | 2015-03-22 04:56:46 -0700 | [diff] [blame] | 32 | switch (KeymasterDefs.getTagType(tag)) { |
| 33 | case KeymasterDefs.KM_BOOL: |
| 34 | break; // OK. |
| 35 | default: |
| 36 | throw new IllegalArgumentException("Bad bool tag " + tag); |
| 37 | } |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 38 | } |
| 39 | |
Andrei Onea | fbc8cfd | 2019-03-22 11:32:59 +0000 | [diff] [blame] | 40 | @UnsupportedAppUsage |
Chad Brubaker | 45ff13e | 2015-01-21 14:00:55 -0800 | [diff] [blame] | 41 | 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 | } |