1 /*
2  * Copyright (C) 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 com.android.server.devicelock;
18 
19 import android.os.OutcomeReceiver;
20 
21 /**
22  * Connector class that acts as the interface between the system service and the DLC service.
23  */
24 public interface DeviceLockControllerConnector {
25 
26     /**
27      * Unbinds the Device Lock Controller service.
28      */
unbind()29     void unbind();
30 
31     /**
32      * Locks the device.
33      */
lockDevice(OutcomeReceiver<Void, Exception> callback)34     void lockDevice(OutcomeReceiver<Void, Exception> callback);
35 
36     /**
37      * Unlocks the device.
38      */
unlockDevice(OutcomeReceiver<Void, Exception> callback)39     void unlockDevice(OutcomeReceiver<Void, Exception> callback);
40 
41     /**
42      * Returns whether the device is currently locked.
43      */
isDeviceLocked(OutcomeReceiver<Boolean, Exception> callback)44     void isDeviceLocked(OutcomeReceiver<Boolean, Exception> callback);
45 
46     /**
47      * Gets the device id.
48      */
getDeviceId(OutcomeReceiver<String, Exception> callback)49     void getDeviceId(OutcomeReceiver<String, Exception> callback);
50 
51     /**
52      * Clears the device restrictions
53      */
clearDeviceRestrictions(OutcomeReceiver<Void, Exception> callback)54     void clearDeviceRestrictions(OutcomeReceiver<Void, Exception> callback);
55 
56     /**
57      * Called when the user has switched.
58      */
onUserSwitching(OutcomeReceiver<Void, Exception> callback)59     void onUserSwitching(OutcomeReceiver<Void, Exception> callback);
60 
61     /**
62      * Called when the user is unlocked.
63      */
onUserUnlocked(OutcomeReceiver<Void, Exception> callback)64     void onUserUnlocked(OutcomeReceiver<Void, Exception> callback);
65 
66     /**
67      * Called when the user has completed setup.
68      */
onUserSetupCompleted(OutcomeReceiver<Void, Exception> callback)69     void onUserSetupCompleted(OutcomeReceiver<Void, Exception> callback);
70 
71     /**
72      * Called when the controller or kiosk app has crashed.
73      */
onAppCrashed(boolean isKiosk, OutcomeReceiver<Void, Exception> callback)74     void onAppCrashed(boolean isKiosk, OutcomeReceiver<Void, Exception> callback);
75 }
76