Files
rr3-apk/decompiled/sources/com/ea/nimble/PersistenceService.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

123 lines
5.5 KiB
Java

package com.ea.nimble;
import android.app.backup.BackupAgent;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import com.ea.nimble.Log;
import com.ea.nimble.Persistence;
import java.io.FileOutputStream;
import java.io.IOException;
/* loaded from: classes2.dex */
public class PersistenceService {
private static final String APPLICATION_PERSISTENCE_ID = "[APPLICATION]";
public static final String COMPONENT_ID = "com.ea.nimble.persistence";
private static final String NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE = "[COMPONENT]%s";
public enum PersistenceMergePolicy {
OVERWRITE,
SOURCE_FIRST,
TARGET_FIRST
}
public static class PersistenceBackupAgent extends BackupAgent {
@Override // android.app.backup.BackupAgent
public void onBackup(ParcelFileDescriptor parcelFileDescriptor, BackupDataOutput backupDataOutput, ParcelFileDescriptor parcelFileDescriptor2) throws IOException {
synchronized (Persistence.s_dataLock) {
PersistenceService.writeBackup(parcelFileDescriptor, backupDataOutput, parcelFileDescriptor2, this);
}
}
@Override // android.app.backup.BackupAgent
public void onRestore(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor) throws IOException {
synchronized (Persistence.s_dataLock) {
PersistenceService.readBackup(backupDataInput, i, parcelFileDescriptor, this);
}
}
}
public static IPersistenceService getComponent() {
return BaseCore.getInstance().getPersistenceService();
}
public static Persistence getAppPersistence(Persistence.Storage storage) {
return getComponent().getPersistence(APPLICATION_PERSISTENCE_ID, storage);
}
public static Persistence getPersistenceForNimbleComponent(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return null;
}
return getComponent().getPersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
public static void removePersistenceForNimbleComponent(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return;
}
getComponent().removePersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
public static void cleanReferenceToPersistence(String str, Persistence.Storage storage) {
if (!Utility.validString(str)) {
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
return;
}
getComponent().cleanPersistenceReference(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
}
/* JADX WARN: Removed duplicated region for block: B:6:0x0040 */
/* JADX WARN: Removed duplicated region for block: B:9:0x004a */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void writeBackup(android.os.ParcelFileDescriptor r16, android.app.backup.BackupDataOutput r17, android.os.ParcelFileDescriptor r18, android.content.Context r19) throws java.io.IOException {
/*
Method dump skipped, instructions count: 266
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.PersistenceService.writeBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor, android.content.Context):void");
}
public static void readBackup(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor, Context context) throws IOException {
while (true) {
FileOutputStream fileOutputStream = null;
if (!backupDataInput.readNextHeader()) {
break;
}
String key = backupDataInput.getKey();
int dataSize = backupDataInput.getDataSize();
byte[] bArr = new byte[dataSize];
backupDataInput.readEntityData(bArr, 0, dataSize);
try {
FileOutputStream fileOutputStream2 = new FileOutputStream(Persistence.getPersistencePath(key, Persistence.Storage.DOCUMENT, context));
try {
fileOutputStream2.write(bArr);
fileOutputStream2.close();
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream2;
if (fileOutputStream != null) {
fileOutputStream.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
if (ApplicationEnvironment.isMainApplicationRunning()) {
for (Persistence persistence : ((PersistenceServiceImpl) getComponent()).m_persistences.values()) {
if (persistence.getBackUp()) {
persistence.restore(false, null);
}
}
}
}
}