BaseIDevicePolicyManager.java revision 7f31bb047820bd5bbf3baab461d24d49f1128052
1031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova/*
2031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * Copyright (C) 2017 The Android Open Source Project
3031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *
4031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * Licensed under the Apache License, Version 2.0 (the "License");
5031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * you may not use this file except in compliance with the License.
6031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * You may obtain a copy of the License at
7031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *
8031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *      http://www.apache.org/licenses/LICENSE-2.0
9031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *
10031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * Unless required by applicable law or agreed to in writing, software
11031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * distributed under the License is distributed on an "AS IS" BASIS,
12031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * See the License for the specific language governing permissions and
14031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * limitations under the License.
15031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova */
16031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtovapackage com.android.server.devicepolicy;
17031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova
187f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaruimport android.annotation.UserIdInt;
19031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtovaimport android.app.admin.IDevicePolicyManager;
200de748d833bef8e08329ef1abb9b681391e34ac8yuemingwimport android.content.ComponentName;
2108841efcdf4ff8cf5d743fd5f6f995730b5f876farangelovimport android.os.PersistableBundle;
22a173064047d304837d907b9b39ece5c14adf2b25Eran Messeriimport android.security.keymaster.KeymasterCertificateChain;
23a173064047d304837d907b9b39ece5c14adf2b25Eran Messeriimport android.security.keystore.ParcelableKeyGenParameterSpec;
24031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova
25031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtovaimport com.android.internal.R;
26031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtovaimport com.android.server.SystemService;
27031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova
287f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaruimport java.util.List;
297f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru
30031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova/**
31031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * Defines the required interface for IDevicePolicyManager implemenation.
32031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *
33031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * <p>The interface consists of public parts determined by {@link IDevicePolicyManager} and also
34031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * several package private methods required by internal infrastructure.
35031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova *
36031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * <p>Whenever adding an AIDL method to {@link IDevicePolicyManager}, an empty override method
37031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova * should be added here to avoid build breakage in downstream branches.
38031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova */
39031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtovaabstract class BaseIDevicePolicyManager extends IDevicePolicyManager.Stub {
40031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    /**
41031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * To be called by {@link DevicePolicyManagerService#Lifecycle} during the various boot phases.
42031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     *
43031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * @see {@link SystemService#onBootPhase}.
44031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     */
45031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    abstract void systemReady(int phase);
46031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    /**
47031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a new user starts.
48031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     *
49031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * @see {@link SystemService#onStartUser}
50031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     */
51031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    abstract void handleStartUser(int userId);
52031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    /**
53031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being unlocked.
54031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     *
55031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * @see {@link SystemService#onUnlockUser}
56031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     */
57031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    abstract void handleUnlockUser(int userId);
58031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    /**
59031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * To be called by {@link DevicePolicyManagerService#Lifecycle} when a user is being stopped.
60031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     *
61031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     * @see {@link SystemService#onStopUser}
62031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova     */
63031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova    abstract void handleStopUser(int userId);
64a173064047d304837d907b9b39ece5c14adf2b25Eran Messeri
650de748d833bef8e08329ef1abb9b681391e34ac8yuemingw    public void setSystemSetting(ComponentName who, String setting, String value){}
6608841efcdf4ff8cf5d743fd5f6f995730b5f876farangelov
6708841efcdf4ff8cf5d743fd5f6f995730b5f876farangelov    public void transferOwner(ComponentName admin, ComponentName target, PersistableBundle bundle) {}
68c4f87e9ceb4d5ce78c1663912bc166e0d41554aaPavel Grafov
69a173064047d304837d907b9b39ece5c14adf2b25Eran Messeri    public boolean generateKeyPair(ComponentName who, String callerPackage, String algorithm,
70a173064047d304837d907b9b39ece5c14adf2b25Eran Messeri            ParcelableKeyGenParameterSpec keySpec, KeymasterCertificateChain attestationChain) {
71a173064047d304837d907b9b39ece5c14adf2b25Eran Messeri        return false;
72a173064047d304837d907b9b39ece5c14adf2b25Eran Messeri    }
73c4f87e9ceb4d5ce78c1663912bc166e0d41554aaPavel Grafov
747f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    @Override
757f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    public boolean setPasswordBlacklist(ComponentName who, String name, List<String> blacklist,
767f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru            boolean parent) {
777f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru        return false;
787f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    }
797f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru
807f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    @Override
817f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    public String getPasswordBlacklistName(ComponentName who, @UserIdInt int userId,
827f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru            boolean parent) {
837f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru        return null;
847f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    }
857f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru
867f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    @Override
877f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    public boolean isPasswordBlacklisted(@UserIdInt int userId, String password) {
887f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru        return false;
897f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru    }
907f31bb047820bd5bbf3baab461d24d49f1128052Alexandru-Andrei Rotaru
91c4f87e9ceb4d5ce78c1663912bc166e0d41554aaPavel Grafov    public boolean isUsingUnifiedPassword(ComponentName who) {
92c4f87e9ceb4d5ce78c1663912bc166e0d41554aaPavel Grafov        return true;
93c4f87e9ceb4d5ce78c1663912bc166e0d41554aaPavel Grafov    }
94031a2f1aafbc4e39ab5601567862d498e8949538Lenka Trochtova}
95