blob: a92ef327de3c7f69c00d203ccb7cdd99d0924bbe [file] [log] [blame]
Hai Zhangb7776682018-09-25 15:10:57 -07001/*
2 * Copyright (C) 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
17package android.app.role;
18
19import android.annotation.SystemApi;
Hai Zhang6329be42018-11-19 11:05:34 -080020import android.annotation.TestApi;
Hai Zhangb7776682018-09-25 15:10:57 -070021
Eugene Susla92b88c72019-01-11 13:31:20 -080022import java.util.concurrent.CompletableFuture;
23
Hai Zhangb7776682018-09-25 15:10:57 -070024/**
25 * Callback for a {@link RoleManager} request.
26 *
27 * @hide
28 */
29@SystemApi
Hai Zhang6329be42018-11-19 11:05:34 -080030@TestApi
Hai Zhangb7776682018-09-25 15:10:57 -070031public interface RoleManagerCallback {
32
33 /**
34 * Signals a success.
35 */
36 void onSuccess();
37
38 /**
39 * Signals a failure.
40 */
41 void onFailure();
Eugene Susla92b88c72019-01-11 13:31:20 -080042
43 /** @hide */
44 class Future extends CompletableFuture<Void> implements RoleManagerCallback {
45
46 @Override
47 public void onSuccess() {
48 complete(null);
49 }
50
51 @Override
52 public void onFailure() {
53 completeExceptionally(new RuntimeException());
54 }
55 }
Hai Zhangb7776682018-09-25 15:10:57 -070056}