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