1 /* 2 * Copyright (C) 2021 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.bedstead.nene.devicepolicy; 18 19 /** Device Policy helper methods common to host and device. */ 20 public class CommonDevicePolicy { CommonDevicePolicy()21 CommonDevicePolicy() { 22 23 } 24 25 /** See {@code DevicePolicyManager#DELEGATION_CERT_INSTALL}. */ 26 public static final String DELEGATION_CERT_INSTALL = "delegation-cert-install"; 27 28 /** See {@code DevicePolicyManager#DELEGATION_APP_RESTRICTIONS}. */ 29 public static final String DELEGATION_APP_RESTRICTIONS = "delegation-app-restrictions"; 30 31 /** See {@code DevicePolicyManager#DELEGATION_BLOCK_UNINSTALL}. */ 32 public static final String DELEGATION_BLOCK_UNINSTALL = "delegation-block-uninstall"; 33 34 /** See {@code DevicePolicyManager#DELEGATION_PERMISSION_GRANT}. */ 35 public static final String DELEGATION_PERMISSION_GRANT = "delegation-permission-grant"; 36 37 /** See {@code DevicePolicyManager#DELEGATION_PACKAGE_ACCESS}. */ 38 public static final String DELEGATION_PACKAGE_ACCESS = "delegation-package-access"; 39 40 /** See {@code DevicePolicyManager#DELEGATION_ENABLE_SYSTEM_APP}. */ 41 public static final String DELEGATION_ENABLE_SYSTEM_APP = "delegation-enable-system-app"; 42 43 /** See {@code DevicePolicyManager#DELEGATION_INSTALL_EXISTING_PACKAGE}. */ 44 public static final String DELEGATION_INSTALL_EXISTING_PACKAGE = 45 "delegation-install-existing-package"; 46 47 /** See {@code DevicePolicyManager#DELEGATION_KEEP_UNINSTALLED_PACKAGES}. */ 48 public static final String DELEGATION_KEEP_UNINSTALLED_PACKAGES = 49 "delegation-keep-uninstalled-packages"; 50 51 /** See {@code DevicePolicyManager#DELEGATION_NETWORK_LOGGING}. */ 52 public static final String DELEGATION_NETWORK_LOGGING = "delegation-network-logging"; 53 54 /** See {@code DevicePolicyManager#DELEGATION_CERT_SELECTION}. */ 55 public static final String DELEGATION_CERT_SELECTION = "delegation-cert-selection"; 56 57 /** See {@code DevicePolicyManager#DELEGATION_SECURITY_LOGGING}. */ 58 public static final String DELEGATION_SECURITY_LOGGING = "delegation-security-logging"; 59 60 /** See {@code android.app.admin.DevicePolicyManager#DevicePolicyOperation}. */ 61 public enum DevicePolicyOperation { 62 OPERATION_NONE(-1), 63 OPERATION_LOCK_NOW(1), 64 OPERATION_SWITCH_USER(2), 65 OPERATION_START_USER_IN_BACKGROUND(3), 66 OPERATION_STOP_USER(4), 67 OPERATION_CREATE_AND_MANAGE_USER(5), 68 OPERATION_REMOVE_USER(6), 69 OPERATION_REBOOT(7), 70 OPERATION_WIPE_DATA(8), 71 OPERATION_LOGOUT_USER(9), 72 OPERATION_SET_USER_RESTRICTION(10), 73 OPERATION_SET_SYSTEM_SETTING(11), 74 OPERATION_SET_KEYGUARD_DISABLED(12), 75 OPERATION_SET_STATUS_BAR_DISABLED(13), 76 OPERATION_SET_SYSTEM_UPDATE_POLICY(14), 77 OPERATION_SET_APPLICATION_HIDDEN(15), 78 OPERATION_SET_APPLICATION_RESTRICTIONS(16), 79 OPERATION_SET_KEEP_UNINSTALLED_PACKAGES(17), 80 OPERATION_SET_LOCK_TASK_FEATURES(18), 81 OPERATION_SET_LOCK_TASK_PACKAGES(19), 82 OPERATION_SET_PACKAGES_SUSPENDED(20), 83 OPERATION_SET_TRUST_AGENT_CONFIGURATION(21), 84 OPERATION_SET_USER_CONTROL_DISABLED_PACKAGES(22), 85 OPERATION_CLEAR_APPLICATION_USER_DATA(23), 86 OPERATION_INSTALL_CA_CERT(24), 87 OPERATION_INSTALL_KEY_PAIR(25), 88 OPERATION_INSTALL_SYSTEM_UPDATE(26), 89 OPERATION_REMOVE_ACTIVE_ADMIN(27), 90 OPERATION_REMOVE_KEY_PAIR(28), 91 OPERATION_REQUEST_BUGREPORT(29), 92 OPERATION_SET_ALWAYS_ON_VPN_PACKAGE(30), 93 OPERATION_SET_CAMERA_DISABLED(31), 94 OPERATION_SET_FACTORY_RESET_PROTECTION_POLICY(32), 95 OPERATION_SET_GLOBAL_PRIVATE_DNS(33), 96 OPERATION_SET_LOGOUT_ENABLED(34), 97 OPERATION_SET_MASTER_VOLUME_MUTED(35), 98 OPERATION_SET_OVERRIDE_APNS_ENABLED(36), 99 OPERATION_SET_PERMISSION_GRANT_STATE(37), 100 OPERATION_SET_PERMISSION_POLICY(38), 101 OPERATION_SET_RESTRICTIONS_PROVIDER(39), 102 OPERATION_UNINSTALL_CA_CERT(40); 103 104 private final int mValue; 105 DevicePolicyOperation(int value)106 DevicePolicyOperation(int value) { 107 mValue = value; 108 } 109 getValue()110 public int getValue() { 111 return mValue; 112 } 113 } 114 115 /** See {@code android.app.admin.DevicePolicyManager#OperationSafetyReason}. */ 116 public enum OperationSafetyReason { 117 OPERATION_SAFETY_REASON_NONE(-1), 118 OPERATION_SAFETY_REASON_DRIVING_DISTRACTION(1); 119 120 private final int mValue; 121 OperationSafetyReason(int value)122 OperationSafetyReason(int value) { 123 mValue = value; 124 } 125 getValue()126 public int getValue() { 127 return mValue; 128 } 129 } 130 } 131