BaseIDevicePolicyManager.java revision 101c353a7d039b352cbfe9146807f072ff340469
1/* 2 * Copyright (C) 2017 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 */ 16package com.android.server.devicepolicy; 17 18import android.annotation.UserIdInt; 19import android.app.admin.IDevicePolicyManager; 20import android.content.ComponentName; 21import android.os.PersistableBundle; 22import android.security.keymaster.KeymasterCertificateChain; 23import android.security.keystore.ParcelableKeyGenParameterSpec; 24 25import com.android.internal.R; 26import com.android.server.SystemService; 27 28import java.util.List; 29 30/** 31 * Defines the required interface for IDevicePolicyManager implemenation. 32 * 33 * <p>The interface consists of public parts determined by {@link IDevicePolicyManager} and also 34 * several package private methods required by internal infrastructure. 35 * 36 * <p>Whenever adding an AIDL method to {@link IDevicePolicyManager}, an empty override method 37 * should be added here to avoid build breakage in downstream branches. 38 */ 39abstract class BaseIDevicePolicyManager extends IDevicePolicyManager.Stub { 40 /** 41 * To be called by {@link DevicePolicyManagerService#Lifecycle} when the service is started. 42 * 43 * @see {@link SystemService#onStart}. 44 */ 45 abstract void handleStart(); 46 /** 47 * To be called by {@link DevicePolicyManagerService#Lifecycle} during the various boot phases. 48 * 49 * @see {@link SystemService#onBootPhase}. 50 */ 51 abstract void systemReady(int phase); 52 /** 53 * To be called by {@link DevicePolicyManagerService#Lifecycle} when a new user starts. 54 * 55 * @see {@link SystemService#onStartUser} 56 */ 57 abstract void handleStartUser(int userId); 58 /** 59 * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being unlocked. 60 * 61 * @see {@link SystemService#onUnlockUser} 62 */ 63 abstract void handleUnlockUser(int userId); 64 /** 65 * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being stopped. 66 * 67 * @see {@link SystemService#onStopUser} 68 */ 69 abstract void handleStopUser(int userId); 70 71 public void setSystemSetting(ComponentName who, String setting, String value){} 72 73 public void transferOwner(ComponentName admin, ComponentName target, PersistableBundle bundle) {} 74 75 public boolean generateKeyPair(ComponentName who, String callerPackage, String algorithm, 76 ParcelableKeyGenParameterSpec keySpec, int idAttestationFlags, 77 KeymasterCertificateChain attestationChain) { 78 return false; 79 } 80 81 @Override 82 public boolean setPasswordBlacklist(ComponentName who, String name, List<String> blacklist, 83 boolean parent) { 84 return false; 85 } 86 87 @Override 88 public String getPasswordBlacklistName(ComponentName who, @UserIdInt int userId, 89 boolean parent) { 90 return null; 91 } 92 93 @Override 94 public boolean isPasswordBlacklisted(@UserIdInt int userId, String password) { 95 return false; 96 } 97 98 public boolean isUsingUnifiedPassword(ComponentName who) { 99 return true; 100 } 101 102 public boolean setKeyPairCertificate(ComponentName who, String callerPackage, String alias, 103 byte[] cert, byte[] chain, boolean isUserSelectable) { 104 return false; 105 } 106} 107