Hai Zhang | 47c1de2 | 2020-01-16 20:59:15 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.role.persistence; |
| 18 | |
| 19 | import android.annotation.NonNull; |
| 20 | import android.annotation.Nullable; |
| 21 | import android.annotation.SystemApi; |
Makoto Onuki | af97aef | 2020-02-03 10:32:52 -0800 | [diff] [blame] | 22 | import android.annotation.SystemApi.Client; |
Hai Zhang | 47c1de2 | 2020-01-16 20:59:15 -0800 | [diff] [blame] | 23 | |
| 24 | import java.util.Map; |
| 25 | import 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 Onuki | af97aef | 2020-02-03 10:32:52 -0800 | [diff] [blame] | 33 | @SystemApi(client = Client.SYSTEM_SERVER) |
Hai Zhang | 47c1de2 | 2020-01-16 20:59:15 -0800 | [diff] [blame] | 34 | public 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 | } |