Debian Codegraph @

core/java/com/android/internal/compat/CompatibilityOverridesByPackageConfig.java

raw symbols SCIP
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.internal.compat;
18
19 import android.os.Parcel;
20 import android.os.Parcelable;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25 /**
26 * Parcelable containing compat config overrides by application.
27 * @hide
28 */
29 public final class CompatibilityOverridesByPackageConfig implements Parcelable {
30 public final Map<String, CompatibilityOverrideConfig> packageNameToOverrides;
31
32 public CompatibilityOverridesByPackageConfig(
33 Map<String, CompatibilityOverrideConfig> packageNameToOverrides) {
34 this.packageNameToOverrides = packageNameToOverrides;
35 }
36
37 private CompatibilityOverridesByPackageConfig(Parcel in) {
38 int keyCount = in.readInt();
39 packageNameToOverrides = new HashMap<>();
40 for (int i = 0; i < keyCount; i++) {
41 String key = in.readString();
42 packageNameToOverrides.put(key,
43 CompatibilityOverrideConfig.CREATOR.createFromParcel(in));
44 }
45 }
46
47 @Override
48 public int describeContents() {
49 return 0;
50 }
51
52 @Override
53 public void writeToParcel(Parcel dest, int flags) {
54 dest.writeInt(packageNameToOverrides.size());
55 for (String key : packageNameToOverrides.keySet()) {
56 dest.writeString(key);
57 packageNameToOverrides.get(key).writeToParcel(dest, /* flags= */ 0);
58 }
59 }
60
61 public static final Parcelable.Creator<CompatibilityOverridesByPackageConfig> CREATOR =
62 new Parcelable.Creator<CompatibilityOverridesByPackageConfig>() {
63
64 @Override
65 public CompatibilityOverridesByPackageConfig createFromParcel(Parcel in) {
66 return new CompatibilityOverridesByPackageConfig(in);
67 }
68
69 @Override
70 public CompatibilityOverridesByPackageConfig[] newArray(int size) {
71 return new CompatibilityOverridesByPackageConfig[size];
72 }
73 };
74 }