Debian Codegraph @

core/java/com/android/internal/compat/CompatibilityOverridesToRemoveByPackageConfig.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 change IDs for which to remove overrides by application.
27 *
28 * <p>This class is separate from CompatibilityOverridesByPackageConfig since we only need change
29 * IDs.
30 * @hide
31 */
32 public final class CompatibilityOverridesToRemoveByPackageConfig implements Parcelable {
33 public final Map<String, CompatibilityOverridesToRemoveConfig> packageNameToOverridesToRemove;
34
35 public CompatibilityOverridesToRemoveByPackageConfig(
36 Map<String, CompatibilityOverridesToRemoveConfig> packageNameToOverridesToRemove) {
37 this.packageNameToOverridesToRemove = packageNameToOverridesToRemove;
38 }
39
40 private CompatibilityOverridesToRemoveByPackageConfig(Parcel in) {
41 int keyCount = in.readInt();
42 packageNameToOverridesToRemove = new HashMap<>();
43 for (int i = 0; i < keyCount; i++) {
44 String key = in.readString();
45 packageNameToOverridesToRemove.put(key,
46 CompatibilityOverridesToRemoveConfig.CREATOR.createFromParcel(in));
47 }
48 }
49
50 @Override
51 public int describeContents() {
52 return 0;
53 }
54
55 @Override
56 public void writeToParcel(Parcel dest, int flags) {
57 dest.writeInt(packageNameToOverridesToRemove.size());
58 for (String key : packageNameToOverridesToRemove.keySet()) {
59 dest.writeString(key);
60 packageNameToOverridesToRemove.get(key).writeToParcel(dest, /* flags= */ 0);
61 }
62 }
63
64 public static final Parcelable.Creator<CompatibilityOverridesToRemoveByPackageConfig> CREATOR =
65 new Parcelable.Creator<CompatibilityOverridesToRemoveByPackageConfig>() {
66
67 @Override
68 public CompatibilityOverridesToRemoveByPackageConfig createFromParcel(Parcel in) {
69 return new CompatibilityOverridesToRemoveByPackageConfig(in);
70 }
71
72 @Override
73 public CompatibilityOverridesToRemoveByPackageConfig[] newArray(int size) {
74 return new CompatibilityOverridesToRemoveByPackageConfig[size];
75 }
76 };
77 }