| ziyiw | b8651d7 | 2024-08-19 23:30:10 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2024 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 | package android.nfc; |
| 17 | |
| 18 | import android.annotation.FlaggedApi; |
| 19 | import android.annotation.RequiresPermission; |
| 20 | import android.annotation.SystemApi; |
| 21 | import android.nfc.cardemulation.CardEmulation; |
| 22 | |
| 23 | /** |
| 24 | * A class indicating default route, ISO-DEP route and off-host route. |
| 25 | * |
| 26 | * @hide |
| 27 | */ |
| 28 | @SystemApi |
| 29 | @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) |
| 30 | public class RoutingStatus { |
| 31 | private final @CardEmulation.ProtocolAndTechnologyRoute int mDefaultRoute; |
| 32 | private final @CardEmulation.ProtocolAndTechnologyRoute int mDefaultIsoDepRoute; |
| 33 | private final @CardEmulation.ProtocolAndTechnologyRoute int mDefaultOffHostRoute; |
| 34 | |
| 35 | RoutingStatus(@CardEmulation.ProtocolAndTechnologyRoute int mDefaultRoute, |
| 36 | @CardEmulation.ProtocolAndTechnologyRoute int mDefaultIsoDepRoute, |
| 37 | @CardEmulation.ProtocolAndTechnologyRoute int mDefaultOffHostRoute) { |
| 38 | this.mDefaultRoute = mDefaultRoute; |
| 39 | this.mDefaultIsoDepRoute = mDefaultIsoDepRoute; |
| 40 | this.mDefaultOffHostRoute = mDefaultOffHostRoute; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Getter of the default route. |
| 45 | * @return an integer defined in |
| 46 | * {@link android.nfc.cardemulation.CardEmulation.ProtocolAndTechnologyRoute} |
| 47 | */ |
| 48 | @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) |
| 49 | @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) |
| 50 | @CardEmulation.ProtocolAndTechnologyRoute |
| 51 | public int getDefaultRoute() { |
| 52 | return mDefaultRoute; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Getter of the default ISO-DEP route. |
| 57 | * @return an integer defined in |
| 58 | * {@link android.nfc.cardemulation.CardEmulation.ProtocolAndTechnologyRoute} |
| 59 | */ |
| 60 | @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) |
| 61 | @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) |
| 62 | @CardEmulation.ProtocolAndTechnologyRoute |
| 63 | public int getDefaultIsoDepRoute() { |
| 64 | return mDefaultIsoDepRoute; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Getter of the default off-host route. |
| 69 | * @return an integer defined in |
| 70 | * {@link android.nfc.cardemulation.CardEmulation.ProtocolAndTechnologyRoute} |
| 71 | */ |
| 72 | @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION) |
| 73 | @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) |
| 74 | @CardEmulation.ProtocolAndTechnologyRoute |
| 75 | public int getDefaultOffHostRoute() { |
| 76 | return mDefaultOffHostRoute; |
| 77 | } |
| 78 | |
| 79 | } |