1 /*
2  * Copyright (C) 2019 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.ext.services.watchdog;
18 
19 /**
20  * A type of explicit health check that can be performed on a device, e.g network health check
21  */
22 interface ExplicitHealthChecker {
23     /**
24      * Requests a checker to listen to explicit health checks for {@link #getPackageName}.
25      *  {@link #isPending} will now return {@code true}.
26      */
request()27     void request();
28 
29     /**
30      * Cancels a pending explicit health check request for {@link #getPackageName}.
31      * {@link #isPending} will now return {@code false}.
32      */
cancel()33     void cancel();
34 
35     /**
36      * Returns {@code true} if a request is pending, {@code false} otherwise.
37      */
isPending()38     boolean isPending();
39 
40     /**
41      * Returns the name of the package this checker can make requests for.
42      */
getSupportedPackageName()43     String getSupportedPackageName();
44 }
45