blob: 7da9d11f172f043387cef7825ecebbf0436d0630 [file] [log] [blame]
Hai Zhang47c1de22020-01-16 20:59:15 -08001/*
2 * Copyright (C) 2020 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
17package com.android.role.persistence;
18
19import android.annotation.NonNull;
20import android.annotation.Nullable;
21import android.annotation.SystemApi;
Makoto Onukiaf97aef2020-02-03 10:32:52 -080022import android.annotation.SystemApi.Client;
Hai Zhang47c1de22020-01-16 20:59:15 -080023
24import java.util.Map;
25import java.util.Set;
26
27/**
28 * State of all roles.
29 *
30 * TODO(b/147914847): Remove @hide when it becomes the default.
31 * @hide
32 */
Makoto Onukiaf97aef2020-02-03 10:32:52 -080033@SystemApi(client = Client.SYSTEM_SERVER)
Hai Zhang47c1de22020-01-16 20:59:15 -080034public final class RolesState {
35
36 /**
37 * The version of the roles.
38 */
39 private final int mVersion;
40
41 /**
42 * The hash of all packages in the system.
43 */
44 @Nullable
45 private final String mPackagesHash;
46
47 /**
48 * The roles.
49 */
50 @NonNull
51 private final Map<String, Set<String>> mRoles;
52
53 public RolesState(int version, @Nullable String packagesHash,
54 @NonNull Map<String, Set<String>> roles) {
55 mVersion = version;
56 mPackagesHash = packagesHash;
57 mRoles = roles;
58 }
59
60 public int getVersion() {
61 return mVersion;
62 }
63
64 @Nullable
65 public String getPackagesHash() {
66 return mPackagesHash;
67 }
68
69 @NonNull
70 public Map<String, Set<String>> getRoles() {
71 return mRoles;
72 }
73}