1 /*
2  * Copyright 2023 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.remoteauth;
18 
19 import android.annotation.NonNull;
20 
21 import androidx.annotation.IntDef;
22 
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 
26 /**
27  * Reports newly discovered remote devices.
28  *
29  * @hide
30  */
31 // TODO(b/290092977): Add back after M-2023-11 release - @SystemApi(client = MODULE_LIBRARIES)
32 public interface DeviceDiscoveryCallback {
33     /** The device is no longer seen in the discovery process. */
34     int STATE_LOST = 0;
35     /** The device is seen in the discovery process */
36     int STATE_SEEN = 1;
37     /** @hide */
38     @Retention(RetentionPolicy.SOURCE)
39     @IntDef({STATE_LOST, STATE_SEEN})
40     @interface State {}
41 
42     /**
43      * Invoked for every change in remote device state.
44      *
45      * @param device remote device
46      * @param state indicates if found or lost
47      */
onDeviceUpdate(@onNull RemoteDevice device, @State int state)48     void onDeviceUpdate(@NonNull RemoteDevice device, @State int state);
49 
50     /** Invoked when discovery is stopped due to timeout. */
onTimeout()51     void onTimeout();
52 }
53