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 Device Lock Controller exempt from starting an activity from the background 79 * for the calling user. 80 */ setExemptFromActivityBackgroundStartRestriction(in boolean exempt, in RemoteCallback remoteCallback)81 void setExemptFromActivityBackgroundStartRestriction(in boolean exempt, 82 in RemoteCallback remoteCallback); 83 84 /** 85 * Exampt kiosk app from hibernation. 86 */ setExemptFromHibernation(in String packageName, in boolean exempt, in RemoteCallback remoteCallback)87 void setExemptFromHibernation(in String packageName, in boolean exempt, 88 in RemoteCallback remoteCallback); 89 } 90