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.role;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.annotation.UserIdInt;
22 
23 import java.util.Map;
24 import java.util.Set;
25 
26 /**
27  * Helper inside the platform for role service.
28  *
29  * @hide
30  */
31 @SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
32 public interface RoleServicePlatformHelper {
33     /**
34      * Get the legacy role state stored in the platform.
35      * <p>
36      * The role state may come from two sources, either the different pre-role default app settings,
37      * or the pre-modularization roles.xml file stored in platform.
38      *
39      * @param userId the user ID
40      * @return a mapping of role name to its set of holders
41      */
42     @NonNull
getLegacyRoleState(@serIdInt int userId)43     Map<String, Set<String>> getLegacyRoleState(@UserIdInt int userId);
44 
45     /**
46      * Compute a hash for the current package state in the system.
47      *
48      * @param userId the user ID
49      * @return the computed hash
50      */
51     @NonNull
computePackageStateHash(@serIdInt int userId)52     String computePackageStateHash(@UserIdInt int userId);
53 }
54