| 1 | /* |
| 2 | * Copyright 2018 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; |
| 18 | |
| 19 | import android.annotation.NonNull; |
| 20 | |
| 21 | /** |
| 22 | * Callback class used when signaling that a prompt is no longer being presented. |
| 23 | */ |
| 24 | public abstract class ConfirmationCallback { |
| 25 | /** |
| 26 | * Called when the requested prompt was accepted by the user. |
| 27 | * |
| 28 | * The format of 'dataThatWasConfirmed' parameter is a <a href="http://cbor.io/">CBOR</a> |
| 29 | * encoded map (type 5) with (at least) the keys <strong>prompt</strong> and |
| 30 | * <strong>extra</strong>. The keys are encoded as CBOR text string (type 3). The value of |
| 31 | * promptText is encoded as CBOR text string (type 3), and the value of extraData is encoded as |
| 32 | * CBOR byte string (type 2). Other keys may be added in the future. |
| 33 | * |
| 34 | * @param dataThatWasConfirmed the data that was confirmed, see above for the format. |
| 35 | */ |
| 36 | public void onConfirmed(@NonNull byte[] dataThatWasConfirmed) {} |
| 37 | |
| 38 | /** |
| 39 | * Called when the requested prompt was dismissed (not accepted) by the user. |
| 40 | */ |
| 41 | public void onDismissed() {} |
| 42 | |
| 43 | /** |
| 44 | * Called when the requested prompt was dismissed by the application. |
| 45 | */ |
| 46 | public void onCanceled() {} |
| 47 | |
| 48 | /** |
| 49 | * Called when the requested prompt was dismissed because of a low-level error. |
| 50 | * |
| 51 | * @param e a throwable representing the error. |
| 52 | */ |
| 53 | public void onError(Throwable e) {} |
| 54 | } |