BaseIDevicePolicyManager.java revision 7f31bb047820bd5bbf3baab461d24d49f1128052
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} during the various boot phases.
42     *
43     * @see {@link SystemService#onBootPhase}.
44     */
45    abstract void systemReady(int phase);
46    /**
47     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a new user starts.
48     *
49     * @see {@link SystemService#onStartUser}
50     */
51    abstract void handleStartUser(int userId);
52    /**
53     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being unlocked.
54     *
55     * @see {@link SystemService#onUnlockUser}
56     */
57    abstract void handleUnlockUser(int userId);
58    /**
59     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being stopped.
60     *
61     * @see {@link SystemService#onStopUser}
62     */
63    abstract void handleStopUser(int userId);
64
65    public void setSystemSetting(ComponentName who, String setting, String value){}
66
67    public void transferOwner(ComponentName admin, ComponentName target, PersistableBundle bundle) {}
68
69    public boolean generateKeyPair(ComponentName who, String callerPackage, String algorithm,
70            ParcelableKeyGenParameterSpec keySpec, KeymasterCertificateChain attestationChain) {
71        return false;
72    }
73
74    @Override
75    public boolean setPasswordBlacklist(ComponentName who, String name, List<String> blacklist,
76            boolean parent) {
77        return false;
78    }
79
80    @Override
81    public String getPasswordBlacklistName(ComponentName who, @UserIdInt int userId,
82            boolean parent) {
83        return null;
84    }
85
86    @Override
87    public boolean isPasswordBlacklisted(@UserIdInt int userId, String password) {
88        return false;
89    }
90
91    public boolean isUsingUnifiedPassword(ComponentName who) {
92        return true;
93    }
94}
95