• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.server.devicepolicy;
18 
19 import android.app.admin.DeviceAdminInfo;
20 import android.content.ComponentName;
21 
22 import com.android.internal.util.JournaledFile;
23 
24 import java.util.function.Function;
25 
26 /**
27  * An interface for providing the {@code PolicyVersionUpgrader} with all the data necessary
28  * to go through the upgrade process.
29  */
30 public interface PolicyUpgraderDataProvider {
31     /**
32      * Returns true if the storage manager indicates file-based encryption is enabled.
33      */
storageManagerIsFileBasedEncryptionEnabled()34     boolean storageManagerIsFileBasedEncryptionEnabled();
35 
36     /**
37      * Returns the journaled policies file for a given user.
38      */
makeDevicePoliciesJournaledFile(int userId)39     JournaledFile makeDevicePoliciesJournaledFile(int userId);
40 
41     /**
42      * Returns the journaled policy version file for a given user.
43      */
makePoliciesVersionJournaledFile(int userId)44     JournaledFile makePoliciesVersionJournaledFile(int userId);
45 
46     /**
47      * Returns a function which provides the component name and device admin info for a given
48      * user.
49      */
getAdminInfoSupplier(int userId)50     Function<ComponentName, DeviceAdminInfo> getAdminInfoSupplier(int userId);
51 
52     /**
53      * Returns the users to upgrade.
54      */
getUsersForUpgrade()55     int[] getUsersForUpgrade();
56 }
57