1 /*
2  * Copyright (c) 2022, 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.devicelock;
18 
19 import android.devicelock.IGetKioskAppsCallback;
20 import android.devicelock.IGetDeviceIdCallback;
21 import android.devicelock.IIsDeviceLockedCallback;
22 import android.devicelock.ILockUnlockDeviceCallback;
23 
24 import android.os.RemoteCallback;
25 
26 /**
27  * Binder interface to communicate with DeviceLockService.
28  * {@hide}
29  */
30 oneway interface IDeviceLockService {
31     /**
32      * Asynchronously lock the device.
33      */
lockDevice(in ILockUnlockDeviceCallback callback)34     void lockDevice(in ILockUnlockDeviceCallback callback);
35 
36     /**
37      * Asynchronously unlock the device.
38      */
unlockDevice(in ILockUnlockDeviceCallback callback)39     void unlockDevice(in ILockUnlockDeviceCallback callback);
40 
41     /**
42      * Asynchronously retrieve the device lock status.
43      */
isDeviceLocked(in IIsDeviceLockedCallback callback)44     void isDeviceLocked(in IIsDeviceLockedCallback callback);
45 
46     /**
47      * Asynchronously retrieve the device identifier.
48      */
getDeviceId(in IGetDeviceIdCallback callback)49     void getDeviceId(in IGetDeviceIdCallback callback);
50 
51     /**
52      * Constant corresponding to a financed device role.
53      * Returned by {@link #getKioskApps}.
54      */
55     const int DEVICE_LOCK_ROLE_FINANCING = 0;
56 
57     /**
58      * Asynchronously retrieve the Kiosk apps roles and package names.
59      */
getKioskApps(in IGetKioskAppsCallback callback)60     void getKioskApps(in IGetKioskAppsCallback callback);
61 
62     // The following are for calls initiated by the Controller.
63 
64     // Value is a boolean for success (true) or failure (false).
65     const String KEY_REMOTE_CALLBACK_RESULT = "KEY_REMOTE_CALLBACK_RESULT";
66 
67     /**
68      * Add the android.app.role.FINANCED_DEVICE_KIOSK role to the kiosk app.
69      */
addFinancedDeviceKioskRole(in String packageName, in RemoteCallback remoteCallback)70     void addFinancedDeviceKioskRole(in String packageName, in RemoteCallback remoteCallback);
71 
72     /**
73      * Remove the android.app.role.FINANCED_DEVICE_KIOSK role from the kiosk app.
74      */
removeFinancedDeviceKioskRole(in String packageName, in RemoteCallback remoteCallback)75     void removeFinancedDeviceKioskRole(in String packageName, in RemoteCallback remoteCallback);
76 
77     /**
78      * Set the exempt from activity background restrction app op mode for the calling uid.
79      */
setCallerExemptFromActivityBgStartRestrictionState(in boolean exempt, in RemoteCallback remoteCallback)80     void setCallerExemptFromActivityBgStartRestrictionState(in boolean exempt,
81      in RemoteCallback remoteCallback);
82 
83     /**
84      * Set whether the caller should be allowed to send undismissible notifications.
85      */
setCallerAllowedToSendUndismissibleNotifications(in boolean allowed, in RemoteCallback remoteCallback)86     void setCallerAllowedToSendUndismissibleNotifications(in boolean allowed,
87      in RemoteCallback remoteCallback);
88 
89     /**
90      * Set the exempt from hibernation, battery usage, data usage restrictions state for the
91      * given uid.
92      */
setUidExemptFromRestrictionsState(in int uid, in boolean exempt, in RemoteCallback remoteCallback)93     void setUidExemptFromRestrictionsState(in int uid, in boolean exempt,
94      in RemoteCallback remoteCallback);
95 
96     /**
97      * Enable kiosk keepalive.
98      */
enableKioskKeepalive(in String packageName, in RemoteCallback remoteCallback)99      void enableKioskKeepalive(in String packageName, in RemoteCallback remoteCallback);
100 
101     /**
102      * Disable kiosk keepalive.
103      */
disableKioskKeepalive(in RemoteCallback remoteCallback)104      void disableKioskKeepalive(in RemoteCallback remoteCallback);
105 
106     /**
107      * Enable controller keepalive.
108      */
enableControllerKeepalive(in RemoteCallback remoteCallback)109      void enableControllerKeepalive(in RemoteCallback remoteCallback);
110 
111     /**
112      * Disable controller keepalive.
113      */
disableControllerKeepalive(in RemoteCallback remoteCallback)114      void disableControllerKeepalive(in RemoteCallback remoteCallback);
115 
116     /**
117      * Set device finalized.
118      */
setDeviceFinalized(in boolean finalized, in RemoteCallback remoteCallback)119      void setDeviceFinalized(in boolean finalized, in RemoteCallback remoteCallback);
120 
121      /**
122       * Set/clear controller POST_NOTIFICATIONS FLAG_PERMISSION_SYSTEM_FIXED flag.
123       */
setPostNotificationsSystemFixed(in boolean systemFixed, in RemoteCallback remoteCallback)124      void setPostNotificationsSystemFixed(in boolean systemFixed, in RemoteCallback remoteCallback);
125 }
126