- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
109 lines
3.9 KiB
Java
109 lines
3.9 KiB
Java
package androidx.datastore.migrations;
|
|
|
|
import android.content.SharedPreferences;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import kotlin.collections.CollectionsKt___CollectionsKt;
|
|
import kotlin.collections.MapsKt__MapsJVMKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class SharedPreferencesView {
|
|
private final Set<String> keySet;
|
|
private final SharedPreferences prefs;
|
|
|
|
public SharedPreferencesView(SharedPreferences prefs, Set<String> set) {
|
|
Intrinsics.checkNotNullParameter(prefs, "prefs");
|
|
this.prefs = prefs;
|
|
this.keySet = set;
|
|
}
|
|
|
|
public final boolean contains(String key) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.contains(checkKey(key));
|
|
}
|
|
|
|
public final boolean getBoolean(String key, boolean z) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.getBoolean(checkKey(key), z);
|
|
}
|
|
|
|
public final float getFloat(String key, float f) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.getFloat(checkKey(key), f);
|
|
}
|
|
|
|
public final int getInt(String key, int i) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.getInt(checkKey(key), i);
|
|
}
|
|
|
|
public final long getLong(String key, long j) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.getLong(checkKey(key), j);
|
|
}
|
|
|
|
public static /* synthetic */ String getString$default(SharedPreferencesView sharedPreferencesView, String str, String str2, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str2 = null;
|
|
}
|
|
return sharedPreferencesView.getString(str, str2);
|
|
}
|
|
|
|
public final String getString(String key, String str) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
return this.prefs.getString(checkKey(key), str);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ Set getStringSet$default(SharedPreferencesView sharedPreferencesView, String str, Set set, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
set = null;
|
|
}
|
|
return sharedPreferencesView.getStringSet(str, set);
|
|
}
|
|
|
|
public final Set<String> getStringSet(String key, Set<String> set) {
|
|
Intrinsics.checkNotNullParameter(key, "key");
|
|
Set<String> stringSet = this.prefs.getStringSet(checkKey(key), set);
|
|
if (stringSet == null) {
|
|
return null;
|
|
}
|
|
return CollectionsKt___CollectionsKt.toMutableSet(stringSet);
|
|
}
|
|
|
|
public final Map<String, Object> getAll() {
|
|
int mapCapacity;
|
|
Map<String, ?> all = this.prefs.getAll();
|
|
Intrinsics.checkNotNullExpressionValue(all, "prefs.all");
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
for (Map.Entry<String, ?> entry : all.entrySet()) {
|
|
String key = entry.getKey();
|
|
Set<String> set = this.keySet;
|
|
if (set == null || set.contains(key)) {
|
|
linkedHashMap.put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
mapCapacity = MapsKt__MapsJVMKt.mapCapacity(linkedHashMap.size());
|
|
LinkedHashMap linkedHashMap2 = new LinkedHashMap(mapCapacity);
|
|
for (Map.Entry entry2 : linkedHashMap.entrySet()) {
|
|
Object key2 = entry2.getKey();
|
|
Object value = entry2.getValue();
|
|
if (value instanceof Set) {
|
|
value = CollectionsKt___CollectionsKt.toSet((Iterable) value);
|
|
}
|
|
linkedHashMap2.put(key2, value);
|
|
}
|
|
return linkedHashMap2;
|
|
}
|
|
|
|
private final String checkKey(String str) {
|
|
Set<String> set = this.keySet;
|
|
if (set == null || set.contains(str)) {
|
|
return str;
|
|
}
|
|
throw new IllegalStateException(Intrinsics.stringPlus("Can't access key outside migration: ", str).toString());
|
|
}
|
|
}
|