- 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
693 lines
30 KiB
Java
693 lines
30 KiB
Java
package com.ea.nimble;
|
|
|
|
import android.app.backup.BackupManager;
|
|
import android.content.Context;
|
|
import com.ea.nimble.Log;
|
|
import com.ea.nimble.PersistenceService;
|
|
import com.facebook.internal.security.CertificateUtil;
|
|
import com.ironsource.x8;
|
|
import java.io.BufferedInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InvalidClassException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.io.Serializable;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class Persistence implements LogSource {
|
|
private static final int PERSISTENCE_VERSION = 101;
|
|
static final Object s_dataLock = new Object();
|
|
private boolean m_backUp;
|
|
private boolean m_changed;
|
|
private Map<String, byte[]> m_content;
|
|
private boolean m_encryption;
|
|
private final Encryptor m_encryptor;
|
|
private final String m_identifier;
|
|
private String m_persistencePath;
|
|
private final Storage m_storage;
|
|
private final Timer m_synchronizeTimer;
|
|
|
|
public enum Storage {
|
|
DOCUMENT,
|
|
CACHE,
|
|
TEMP
|
|
}
|
|
|
|
@Override // com.ea.nimble.LogSource
|
|
public String getLogSourceTitle() {
|
|
return "Persistence";
|
|
}
|
|
|
|
public Persistence(String str, Storage storage, Encryptor encryptor) {
|
|
this.m_persistencePath = null;
|
|
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Persistence.this.lambda$new$0();
|
|
}
|
|
});
|
|
this.m_content = new HashMap();
|
|
this.m_identifier = str;
|
|
this.m_storage = storage;
|
|
this.m_encryptor = encryptor;
|
|
this.m_encryption = false;
|
|
this.m_backUp = false;
|
|
this.m_changed = false;
|
|
}
|
|
|
|
public Persistence(Persistence persistence, String str) {
|
|
this.m_persistencePath = null;
|
|
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Persistence.this.lambda$new$0();
|
|
}
|
|
});
|
|
this.m_content = new HashMap(persistence.m_content);
|
|
this.m_identifier = str;
|
|
this.m_storage = persistence.m_storage;
|
|
this.m_encryptor = persistence.m_encryptor;
|
|
this.m_encryption = persistence.m_encryption;
|
|
this.m_backUp = persistence.m_backUp;
|
|
flagChange();
|
|
}
|
|
|
|
public String getIdentifier() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_identifier;
|
|
}
|
|
|
|
public Storage getStorage() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_storage;
|
|
}
|
|
|
|
public boolean getEncryption() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_encryption;
|
|
}
|
|
|
|
public void setEncryption(boolean z) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
if (z != this.m_encryption) {
|
|
this.m_encryption = z;
|
|
flagChange();
|
|
}
|
|
}
|
|
|
|
public boolean getBackUp() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_backUp;
|
|
}
|
|
|
|
public void setBackUp(boolean z) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
if (this.m_storage == Storage.DOCUMENT) {
|
|
this.m_backUp = z;
|
|
return;
|
|
}
|
|
Log.Helper.LOGF(this, "Error: Backup flag not supported for storage: " + this.m_storage, new Object[0]);
|
|
}
|
|
|
|
public void merge(Persistence persistence, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
|
|
Log.Helper.LOGFUNC(this);
|
|
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[persistenceMergePolicy.ordinal()];
|
|
if (i == 1) {
|
|
this.m_content = new HashMap(persistence.m_content);
|
|
return;
|
|
}
|
|
if (i == 2) {
|
|
this.m_content.putAll(persistence.m_content);
|
|
return;
|
|
}
|
|
if (i != 3) {
|
|
return;
|
|
}
|
|
for (String str : persistence.m_content.keySet()) {
|
|
if (this.m_content.get(str) == null) {
|
|
this.m_content.put(str, persistence.m_content.get(str));
|
|
}
|
|
}
|
|
}
|
|
|
|
public void restore(boolean z, Context context) {
|
|
Log.Helper.LOGFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
loadPersistenceData(z, context);
|
|
}
|
|
}
|
|
|
|
public boolean hasKey(String str) {
|
|
boolean z;
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
z = this.m_content.get(str) != null;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public void setValue(String str, Serializable serializable) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
try {
|
|
if (!Utility.validString(str)) {
|
|
Log.Helper.LOGD(this, "Key " + str + " is an invalid string", new Object[0]);
|
|
Log.Helper.LOGE(this, "NimblePersistence cannot accept an invalid string as key", new Object[0]);
|
|
return;
|
|
}
|
|
if (serializable == null) {
|
|
if (this.m_content.get(str) != null) {
|
|
this.m_content.remove(str);
|
|
flagChange();
|
|
}
|
|
return;
|
|
}
|
|
try {
|
|
putValue(str, serializable);
|
|
} catch (IOException unused) {
|
|
Log.Helper.LOGD(this, "Value " + serializable + " was unable to be archived", new Object[0]);
|
|
Log.Helper.LOGF(this, "NimblePersistence cannot archive value", new Object[0]);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
public Serializable getValue(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
byte[] bArr = this.m_content.get(str);
|
|
if (bArr == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
return (Serializable) new ObjectInputStream(new ByteArrayInputStream(bArr)).readObject();
|
|
} catch (Exception e) {
|
|
Log.Helper.LOGD(this, "PERSIST: Exception getting value, " + str + CertificateUtil.DELIMITER + e, new Object[0]);
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public String getStringValue(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
Serializable value = getValue(str);
|
|
try {
|
|
return (String) value;
|
|
} catch (ClassCastException unused) {
|
|
Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]);
|
|
Log.Helper.LOGF(this, "Invalid value type for getStringValueCall", new Object[0]);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public boolean getBoolValue(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
Serializable value = getValue(str);
|
|
if (value != null) {
|
|
try {
|
|
return ((Boolean) value).booleanValue();
|
|
} catch (ClassCastException unused) {
|
|
Log.Helper.LOGD(this, "Invalid value is " + value.getClass().getName(), new Object[0]);
|
|
Log.Helper.LOGF(this, "Invalid value type for getBoolValue", new Object[0]);
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void addEntries(Object... objArr) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
String str = null;
|
|
for (int i = 0; i < objArr.length; i++) {
|
|
if (i % 2 == 0) {
|
|
try {
|
|
str = (String) objArr[i];
|
|
if (!Utility.validString(str)) {
|
|
throw new RuntimeException("Invalid key");
|
|
}
|
|
} catch (Exception unused) {
|
|
Log.Helper.LOGF(this, "Invalid key in NimblePersistence.addEntries at index %d, not a string", Integer.valueOf(i));
|
|
return;
|
|
}
|
|
} else {
|
|
try {
|
|
putValue(str, (Serializable) objArr[i]);
|
|
} catch (Exception unused2) {
|
|
Log.Helper.LOGD(this, "Invalid value for key %s", str);
|
|
Log.Helper.LOGF(this, "Invalid value in NimblePersistence.addEntries at index %d", Integer.valueOf(i));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void addEntriesFromMap(Map<String, Serializable> map) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
try {
|
|
for (Map.Entry<String, Serializable> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
if (!Utility.validString(key)) {
|
|
Log.Helper.LOGD(this, "Invalid key %s", key);
|
|
Log.Helper.LOGE(this, "Invalid key in NimblePersistence.addEntriesInDictionary, not a string, skip it", new Object[0]);
|
|
} else {
|
|
Serializable value = entry.getValue();
|
|
if (value != null) {
|
|
try {
|
|
putValue(key, value);
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
Log.Helper.LOGD(this, "Invalid key %s", key);
|
|
Log.Helper.LOGE(this, "Invalid value in NimblePersistence.addEntries for key", new Object[0]);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void clean() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
try {
|
|
this.m_content.clear();
|
|
clearSynchronizeTimer();
|
|
String persistencePath = getPersistencePath(null);
|
|
if (persistencePath != null) {
|
|
File file = new File(persistencePath);
|
|
if (file.exists() && !file.delete()) {
|
|
Log.Helper.LOGE(this, "Fail to clean persistence file for id[%s] in storage %s", this.m_identifier, this.m_storage.toString());
|
|
}
|
|
} else {
|
|
Log.Helper.LOGE(this, "Could not get path to persistence for id[%s] in storage %s", this.m_identifier, this.m_storage.toString());
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: synchronize, reason: merged with bridge method [inline-methods] */
|
|
public void lambda$new$0() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
try {
|
|
if (!this.m_changed) {
|
|
Log.Helper.LOGD(this, "Not synchronizing to persistence for id[%s] since there is no change", this.m_identifier);
|
|
return;
|
|
}
|
|
clearSynchronizeTimer();
|
|
savePersistenceData();
|
|
if (this.m_backUp) {
|
|
new BackupManager(ApplicationEnvironment.getComponent().getApplicationContext()).dataChanged();
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void clearSynchronizeTimer() {
|
|
Log.Helper.LOGFUNC(this);
|
|
synchronized (s_dataLock) {
|
|
this.m_synchronizeTimer.cancel();
|
|
}
|
|
}
|
|
|
|
private void flagChange() {
|
|
Log.Helper.LOGFUNC(this);
|
|
this.m_changed = true;
|
|
synchronized (s_dataLock) {
|
|
clearSynchronizeTimer();
|
|
this.m_synchronizeTimer.schedule(0.5d, false);
|
|
}
|
|
}
|
|
|
|
private void putValue(String str, Serializable serializable) throws IOException {
|
|
Log.Helper.LOGFUNC(this);
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
|
objectOutputStream.writeObject(serializable);
|
|
objectOutputStream.close();
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
if (Arrays.equals(byteArray, this.m_content.get(str))) {
|
|
return;
|
|
}
|
|
this.m_content.put(str, byteArray);
|
|
flagChange();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r4v10, types: [boolean] */
|
|
/* JADX WARN: Type inference failed for: r4v16, types: [java.lang.String] */
|
|
private void loadPersistenceData(boolean z, Context context) {
|
|
FileInputStream fileInputStream;
|
|
ObjectInputStream objectInputStream;
|
|
ObjectInputStream objectInputStream2;
|
|
Log.Helper.LOGFUNC(this);
|
|
String persistencePath = getPersistencePath(context);
|
|
if (persistencePath == null) {
|
|
return;
|
|
}
|
|
File file = new File(persistencePath);
|
|
if (!file.exists() || file.length() == 0) {
|
|
Log.Helper.LOGD(this, "No persistence file for id[%s] to restore from storage %s", this.m_identifier, this.m_storage.toString());
|
|
return;
|
|
}
|
|
Log.Helper.LOGD(this, "Loading persistence file size %d", Long.valueOf(file.length()));
|
|
FileInputStream fileInputStream2 = null;
|
|
FileInputStream fileInputStream3 = null;
|
|
try {
|
|
try {
|
|
try {
|
|
fileInputStream = new FileInputStream(file);
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
}
|
|
} catch (Exception e) {
|
|
e = e;
|
|
}
|
|
try {
|
|
objectInputStream = new ObjectInputStream(fileInputStream);
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
fileInputStream3 = fileInputStream;
|
|
Log.Helper.LOGE(this, "Can't read persistence (%s) file, %s: %s", this.m_identifier, persistencePath, e.toString());
|
|
e.printStackTrace();
|
|
fileInputStream2 = fileInputStream3;
|
|
if (fileInputStream3 != null) {
|
|
fileInputStream3.close();
|
|
fileInputStream2 = fileInputStream3;
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
fileInputStream2 = fileInputStream;
|
|
if (fileInputStream2 != null) {
|
|
try {
|
|
fileInputStream2.close();
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
throw th;
|
|
}
|
|
if (objectInputStream.readInt() != 101) {
|
|
throw new InvalidClassException("com.ea.nimble.Persistence", "Persistence version doesn't match");
|
|
}
|
|
this.m_encryption = objectInputStream.readBoolean();
|
|
?? readBoolean = objectInputStream.readBoolean();
|
|
this.m_backUp = readBoolean;
|
|
FileInputStream fileInputStream4 = readBoolean;
|
|
if (!z) {
|
|
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
|
|
if (this.m_encryption) {
|
|
objectInputStream2 = this.m_encryptor.decryptInputStream(bufferedInputStream);
|
|
} else {
|
|
objectInputStream2 = new ObjectInputStream(bufferedInputStream);
|
|
}
|
|
this.m_content = (Map) objectInputStream2.readObject();
|
|
Log.Helper.LOGD(this, "Persistence file for id[%s] restored from storage %s", this.m_identifier, this.m_storage.toString());
|
|
objectInputStream2.close();
|
|
fileInputStream4 = "Persistence file for id[%s] restored from storage %s";
|
|
}
|
|
objectInputStream.close();
|
|
fileInputStream.close();
|
|
fileInputStream2 = fileInputStream4;
|
|
} catch (IOException unused2) {
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:24:0x00b5, code lost:
|
|
|
|
if (r7 == null) goto L32;
|
|
*/
|
|
/* JADX WARN: Not initialized variable reg: 7, insn: 0x0043: MOVE (r1 I:??[OBJECT, ARRAY]) = (r7 I:??[OBJECT, ARRAY]), block:B:32:0x0043 */
|
|
/* JADX WARN: Removed duplicated region for block: B:35:0x00cc A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private void savePersistenceData() {
|
|
/*
|
|
r13 = this;
|
|
java.lang.String r0 = "Fail to save persistence file for id[%s] in storage %s: %s"
|
|
com.ea.nimble.Log.Helper.LOGFUNC(r13)
|
|
r1 = 0
|
|
java.lang.String r2 = r13.getPersistencePath(r1)
|
|
if (r2 != 0) goto Ld
|
|
return
|
|
Ld:
|
|
java.io.File r3 = new java.io.File
|
|
r3.<init>(r2)
|
|
r2 = 3
|
|
r4 = 1
|
|
r5 = 0
|
|
r6 = 2
|
|
java.io.FileOutputStream r7 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L72 java.security.GeneralSecurityException -> L74 java.io.IOException -> L79
|
|
r7.<init>(r3) // Catch: java.lang.Throwable -> L72 java.security.GeneralSecurityException -> L74 java.io.IOException -> L79
|
|
java.io.ObjectOutputStream r1 = new java.io.ObjectOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r1.<init>(r7) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r8 = 101(0x65, float:1.42E-43)
|
|
r1.writeInt(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
boolean r8 = r13.m_encryption // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r1.writeBoolean(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
boolean r8 = r13.m_backUp // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r1.writeBoolean(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r1.flush() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
java.io.BufferedOutputStream r8 = new java.io.BufferedOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r8.<init>(r7) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
boolean r9 = r13.m_encryption // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
if (r9 == 0) goto L4a
|
|
com.ea.nimble.Encryptor r9 = r13.m_encryptor // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
java.io.ObjectOutputStream r8 = r9.encryptOutputStream(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
goto L50
|
|
L42:
|
|
r0 = move-exception
|
|
r1 = r7
|
|
goto Lca
|
|
L46:
|
|
r1 = move-exception
|
|
goto L7e
|
|
L48:
|
|
r1 = move-exception
|
|
goto L9b
|
|
L4a:
|
|
java.io.ObjectOutputStream r9 = new java.io.ObjectOutputStream // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r9.<init>(r8) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r8 = r9
|
|
L50:
|
|
java.util.Map<java.lang.String, byte[]> r9 = r13.m_content // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r8.writeObject(r9) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
java.lang.String r9 = "Synchronize persistence for id[%s] in storage %s"
|
|
java.lang.Object[] r10 = new java.lang.Object[r6] // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
java.lang.String r11 = r13.m_identifier // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r10[r5] = r11 // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
com.ea.nimble.Persistence$Storage r11 = r13.m_storage // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
java.lang.String r11 = r11.toString() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r10[r4] = r11 // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
com.ea.nimble.Log.Helper.LOGD(r13, r9, r10) // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r8.close() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
r1.close() // Catch: java.lang.Throwable -> L42 java.security.GeneralSecurityException -> L46 java.io.IOException -> L48
|
|
L6e:
|
|
r7.close() // Catch: java.io.IOException -> Lb8
|
|
goto Lb8
|
|
L72:
|
|
r0 = move-exception
|
|
goto Lca
|
|
L74:
|
|
r7 = move-exception
|
|
r12 = r7
|
|
r7 = r1
|
|
r1 = r12
|
|
goto L7e
|
|
L79:
|
|
r7 = move-exception
|
|
r12 = r7
|
|
r7 = r1
|
|
r1 = r12
|
|
goto L9b
|
|
L7e:
|
|
java.lang.Object[] r2 = new java.lang.Object[r2] // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r8 = r13.m_identifier // Catch: java.lang.Throwable -> L42
|
|
r2[r5] = r8 // Catch: java.lang.Throwable -> L42
|
|
com.ea.nimble.Persistence$Storage r5 = r13.m_storage // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r5 = r5.toString() // Catch: java.lang.Throwable -> L42
|
|
r2[r4] = r5 // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L42
|
|
r2[r6] = r4 // Catch: java.lang.Throwable -> L42
|
|
com.ea.nimble.Log.Helper.LOGE(r13, r0, r2) // Catch: java.lang.Throwable -> L42
|
|
r1.printStackTrace() // Catch: java.lang.Throwable -> L42
|
|
if (r7 == 0) goto Lb8
|
|
goto L6e
|
|
L9b:
|
|
java.lang.Object[] r2 = new java.lang.Object[r2] // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r8 = r13.m_identifier // Catch: java.lang.Throwable -> L42
|
|
r2[r5] = r8 // Catch: java.lang.Throwable -> L42
|
|
com.ea.nimble.Persistence$Storage r5 = r13.m_storage // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r5 = r5.toString() // Catch: java.lang.Throwable -> L42
|
|
r2[r4] = r5 // Catch: java.lang.Throwable -> L42
|
|
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L42
|
|
r2[r6] = r4 // Catch: java.lang.Throwable -> L42
|
|
com.ea.nimble.Log.Helper.LOGE(r13, r0, r2) // Catch: java.lang.Throwable -> L42
|
|
r1.printStackTrace() // Catch: java.lang.Throwable -> L42
|
|
if (r7 == 0) goto Lb8
|
|
goto L6e
|
|
Lb8:
|
|
long r0 = r3.length()
|
|
java.lang.Long r0 = java.lang.Long.valueOf(r0)
|
|
java.lang.Object[] r0 = new java.lang.Object[]{r0}
|
|
java.lang.String r1 = "Saving persistence file size %d"
|
|
com.ea.nimble.Log.Helper.LOGD(r13, r1, r0)
|
|
return
|
|
Lca:
|
|
if (r1 == 0) goto Lcf
|
|
r1.close() // Catch: java.io.IOException -> Lcf
|
|
Lcf:
|
|
throw r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.savePersistenceData():void");
|
|
}
|
|
|
|
/* renamed from: com.ea.nimble.Persistence$1, reason: invalid class name */
|
|
public static /* synthetic */ class AnonymousClass1 {
|
|
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$Persistence$Storage;
|
|
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy;
|
|
|
|
static {
|
|
int[] iArr = new int[Storage.values().length];
|
|
$SwitchMap$com$ea$nimble$Persistence$Storage = iArr;
|
|
try {
|
|
iArr[Storage.DOCUMENT.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$Persistence$Storage[Storage.CACHE.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$Persistence$Storage[Storage.TEMP.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
int[] iArr2 = new int[PersistenceService.PersistenceMergePolicy.values().length];
|
|
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy = iArr2;
|
|
try {
|
|
iArr2[PersistenceService.PersistenceMergePolicy.OVERWRITE.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[PersistenceService.PersistenceMergePolicy.SOURCE_FIRST.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused5) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[PersistenceService.PersistenceMergePolicy.TARGET_FIRST.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused6) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static File getPersistenceDirectory(Storage storage) {
|
|
String documentPath;
|
|
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
|
|
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Persistence$Storage[storage.ordinal()];
|
|
if (i == 1) {
|
|
documentPath = component.getDocumentPath();
|
|
} else if (i == 2) {
|
|
documentPath = component.getCachePath();
|
|
} else if (i == 3) {
|
|
documentPath = component.getTempPath();
|
|
} else {
|
|
Log.Helper.LOGES("Persistence", "Unknown storage type", new Object[0]);
|
|
return null;
|
|
}
|
|
File file = new File(documentPath + File.separator + "persistence");
|
|
if (file.isDirectory() || file.mkdirs()) {
|
|
return file;
|
|
}
|
|
Log.Helper.LOGE("Persistence", "Cannot create persistence folder in storage(%s) %s", storage, file.toString());
|
|
return null;
|
|
}
|
|
|
|
public static File getPersistenceDirectory(Storage storage, Context context) {
|
|
String path;
|
|
int i = AnonymousClass1.$SwitchMap$com$ea$nimble$Persistence$Storage[storage.ordinal()];
|
|
if (i == 1) {
|
|
File filesDir = context.getFilesDir();
|
|
if (filesDir != null) {
|
|
path = filesDir.getPath();
|
|
}
|
|
path = null;
|
|
} else if (i == 2 || i == 3) {
|
|
File cacheDir = context.getCacheDir();
|
|
if (cacheDir != null) {
|
|
path = cacheDir.getPath();
|
|
}
|
|
path = null;
|
|
} else {
|
|
android.util.Log.e(Global.NIMBLE_ID, "Persistence : Unknown storage type");
|
|
return null;
|
|
}
|
|
if (path == null) {
|
|
Log.Helper.LOGE(Global.NIMBLE_ID, "Persistence : Could not build base path for storage(%s)", storage);
|
|
return null;
|
|
}
|
|
String configValueAsString = NimbleApplicationConfiguration.getConfigValueAsString(BaseCore.NIMBLE_SERVER_CONFIG);
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(path);
|
|
String str = File.separator;
|
|
sb.append(str);
|
|
sb.append(Global.NIMBLE_ID);
|
|
sb.append(str);
|
|
sb.append(configValueAsString);
|
|
sb.append(str);
|
|
sb.append("persistence");
|
|
String sb2 = sb.toString();
|
|
if (storage == Storage.TEMP) {
|
|
sb2 = sb2 + str + x8.D;
|
|
}
|
|
File file = new File(sb2);
|
|
if (file.isDirectory() || file.mkdirs()) {
|
|
return file;
|
|
}
|
|
android.util.Log.e(Global.NIMBLE_ID, String.format("Persistence : Cannot create persistence folder in storage(%s) %s", storage, sb2));
|
|
return null;
|
|
}
|
|
|
|
public String getPersistencePath(Context context) {
|
|
if (this.m_persistencePath == null) {
|
|
if (context == null) {
|
|
this.m_persistencePath = getPersistencePath(this.m_identifier, this.m_storage);
|
|
} else {
|
|
this.m_persistencePath = getPersistencePath(this.m_identifier, this.m_storage, context);
|
|
}
|
|
}
|
|
return this.m_persistencePath;
|
|
}
|
|
|
|
public static String getPersistencePath(String str, Storage storage) {
|
|
File persistenceDirectory = getPersistenceDirectory(storage);
|
|
if (persistenceDirectory == null) {
|
|
return null;
|
|
}
|
|
return persistenceDirectory + File.separator + str + ".dat";
|
|
}
|
|
|
|
public static String getPersistencePath(String str, Storage storage, Context context) {
|
|
File persistenceDirectory = getPersistenceDirectory(storage, context);
|
|
if (persistenceDirectory == null) {
|
|
return null;
|
|
}
|
|
return persistenceDirectory + File.separator + str + ".dat";
|
|
}
|
|
}
|