- Key Java files showing custom server implementation - Original AndroidManifest.xml for reference - SynergyEnvironmentImpl.java - Custom server configuration - HttpRequest.java - HTTP implementation details - Documentation explaining each file's purpose Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
491 lines
24 KiB
Java
491 lines
24 KiB
Java
package com.ea.nimble;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import com.ea.nimble.Error;
|
|
import com.ea.nimble.Log;
|
|
import com.ea.nimble.Network;
|
|
import com.ea.nimble.Persistence;
|
|
import com.ea.nimble.SynergyEnvironmentUpdater;
|
|
import java.io.Serializable;
|
|
import java.util.HashMap;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class SynergyEnvironmentImpl extends Component implements ISynergyEnvironment, LogSource {
|
|
private static final String PERSISTENCE_DATA_ID = "environmentData";
|
|
public static final int SYNERGY_APP_VERSION_OK = 0;
|
|
public static final int SYNERGY_APP_VERSION_UPDATE_RECOMMENDED = 1;
|
|
public static final int SYNERGY_APP_VERSION_UPDATE_REQUIRED = 2;
|
|
private static final String SYNERGY_INT_SERVER_URL = "https://director-int.sn.eamobile.com";
|
|
private static final String SYNERGY_LIVE_SERVER_URL = "https://syn-dir.sn.eamobile.com";
|
|
private static final String SYNERGY_STAGE_SERVER_URL = "https://director-stage.sn.eamobile.com";
|
|
public static final double SYNERGY_UPDATE_RATE_LIMIT_PERIOD_IN_SECONDS = 60.0d;
|
|
public static final double SYNERGY_UPDATE_REFRESH_PERIOD_IN_SECONDS = 300.0d;
|
|
private BaseCore m_core;
|
|
private EnvironmentDataContainer m_environmentDataContainer;
|
|
private EnvironmentDataContainer m_previousValidEnvironmentDataContainer;
|
|
private Long m_synergyEnvironmentUpdateRateLimitTriggerTimestamp;
|
|
private SynergyEnvironmentUpdater m_synergyStartupObject;
|
|
private BroadcastReceiver m_networkStatusChangeReceiver = null;
|
|
private boolean m_dataLoadedOnComponentSetup = false;
|
|
private boolean m_pendingStartupFinishedNotification = false;
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public String getComponentId() {
|
|
return SynergyEnvironment.COMPONENT_ID;
|
|
}
|
|
|
|
@Override // com.ea.nimble.LogSource
|
|
public String getLogSourceTitle() {
|
|
return "SynergyEnv";
|
|
}
|
|
|
|
public SynergyEnvironmentImpl(BaseCore baseCore) {
|
|
this.m_core = baseCore;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getEADeviceId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getEADeviceId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getSynergyId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getSynergyId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getSellId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getSellId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getProductId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getProductId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getEAHardwareId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getEAHardwareId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public Error setServerUrl(String str, String str2) {
|
|
return this.m_environmentDataContainer.setServerUrl(str, str2);
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getServerUrlWithKey(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getServerUrlWithKey(str);
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public int getLatestAppVersionCheckResult() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return 0;
|
|
}
|
|
return environmentDataContainer.getLatestAppVersionCheckResult();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public int getTrackingPostInterval() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return -1;
|
|
}
|
|
return environmentDataContainer.getTrackingPostInterval();
|
|
}
|
|
|
|
/* renamed from: com.ea.nimble.SynergyEnvironmentImpl$3, reason: invalid class name */
|
|
public static /* synthetic */ class AnonymousClass3 {
|
|
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration;
|
|
|
|
static {
|
|
int[] iArr = new int[NimbleConfiguration.values().length];
|
|
$SwitchMap$com$ea$nimble$NimbleConfiguration = iArr;
|
|
try {
|
|
iArr[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
int i = AnonymousClass3.$SwitchMap$com$ea$nimble$NimbleConfiguration[nimbleConfiguration.ordinal()];
|
|
if (i == 1) {
|
|
return SYNERGY_INT_SERVER_URL;
|
|
}
|
|
if (i == 2) {
|
|
return SYNERGY_STAGE_SERVER_URL;
|
|
}
|
|
if (i == 3) {
|
|
return SYNERGY_LIVE_SERVER_URL;
|
|
}
|
|
if (i == 4) {
|
|
return NimbleApplicationConfiguration.getConfigValueAsString("NimbleCustomizedSynergyServerEndpointUrl", SYNERGY_LIVE_SERVER_URL);
|
|
}
|
|
Log.Helper.LOGF(this, "Request for Synergy Director server URL with unknown NimbleConfiguration, %d.", nimbleConfiguration);
|
|
return SYNERGY_LIVE_SERVER_URL;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public boolean isDataAvailable() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_environmentDataContainer != null;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public boolean isUpdateInProgress() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.m_synergyStartupObject != null;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public Error checkAndInitiateSynergyEnvironmentUpdate() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
if (isUpdateInProgress()) {
|
|
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Update in progress.");
|
|
}
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer != null && environmentDataContainer.getMostRecentDirectorResponseTimestamp() != null) {
|
|
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Environment data already cached.");
|
|
}
|
|
if (isInSynergyEnvironmentUpdateRateLimitingPeriod()) {
|
|
Log.Helper.LOGD(this, "Attempt to re-initiate Synergy environment update blocked by rate limiting. %.2f seconds of rate limiting left", Double.valueOf(60.0d - ((System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue()) / 1000.0d)));
|
|
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Synergy environment update rate limit in effect.");
|
|
}
|
|
startSynergyEnvironmentUpdate();
|
|
return null;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public boolean isFeatureDisabled(String str) {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
return environmentDataContainer != null && environmentDataContainer.isFeatureDisabled(str);
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void setup() {
|
|
Log.Helper.LOGFUNC(this);
|
|
this.m_dataLoadedOnComponentSetup = restoreEnvironmentDataFromPersistent(true);
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void restore() {
|
|
Log.Helper.LOGFUNC(this);
|
|
if (this.m_dataLoadedOnComponentSetup) {
|
|
this.m_dataLoadedOnComponentSetup = false;
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT);
|
|
} else {
|
|
restoreEnvironmentDataFromPersistent(false);
|
|
}
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null || environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue()) / 1000.0d > 300.0d) {
|
|
startSynergyEnvironmentUpdate();
|
|
} else {
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
}
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void suspend() {
|
|
Log.Helper.LOGFUNC(this);
|
|
SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject;
|
|
if (synergyEnvironmentUpdater != null) {
|
|
synergyEnvironmentUpdater.cancel();
|
|
this.m_synergyStartupObject = null;
|
|
}
|
|
BroadcastReceiver broadcastReceiver = this.m_networkStatusChangeReceiver;
|
|
if (broadcastReceiver != null) {
|
|
Utility.unregisterReceiver(broadcastReceiver);
|
|
this.m_networkStatusChangeReceiver = null;
|
|
}
|
|
saveEnvironmentDataToPersistent();
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void resume() {
|
|
Log.Helper.LOGFUNC(this);
|
|
clearSynergyEnvironmentUpdateRateLimiting();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null || environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue()) / 1000.0d > 300.0d) {
|
|
startSynergyEnvironmentUpdate();
|
|
}
|
|
if (this.m_pendingStartupFinishedNotification) {
|
|
this.m_pendingStartupFinishedNotification = false;
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put("result", "1");
|
|
Log.Helper.LOGD(this, "App is running in forground, sending delayed the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap);
|
|
}
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void cleanup() {
|
|
Log.Helper.LOGFUNC(this);
|
|
SynergyEnvironmentUpdater synergyEnvironmentUpdater = this.m_synergyStartupObject;
|
|
if (synergyEnvironmentUpdater != null) {
|
|
synergyEnvironmentUpdater.cancel();
|
|
this.m_synergyStartupObject = null;
|
|
}
|
|
BroadcastReceiver broadcastReceiver = this.m_networkStatusChangeReceiver;
|
|
if (broadcastReceiver != null) {
|
|
Utility.unregisterReceiver(broadcastReceiver);
|
|
this.m_networkStatusChangeReceiver = null;
|
|
}
|
|
saveEnvironmentDataToPersistent();
|
|
this.m_environmentDataContainer = null;
|
|
}
|
|
|
|
@Override // com.ea.nimble.Component
|
|
public void teardown() {
|
|
Log.Helper.LOGFUNC(this);
|
|
this.m_environmentDataContainer = null;
|
|
}
|
|
|
|
private void startSynergyEnvironmentUpdate() {
|
|
SynergyEnvironmentUpdater synergyEnvironmentUpdater;
|
|
Log.Helper.LOGFUNC(this);
|
|
synchronized (this) {
|
|
try {
|
|
if (this.m_synergyStartupObject == null) {
|
|
synergyEnvironmentUpdater = new SynergyEnvironmentUpdater(this.m_core);
|
|
this.m_synergyStartupObject = synergyEnvironmentUpdater;
|
|
} else {
|
|
synergyEnvironmentUpdater = null;
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
if (synergyEnvironmentUpdater == null) {
|
|
Log.Helper.LOGD(this, "Attempt made to start Synergy environment update while a previous one is active. Exiting.", new Object[0]);
|
|
return;
|
|
}
|
|
if (Network.getComponent().getStatus() == Network.Status.OK) {
|
|
startSynergyEnvironmentUpdateImpl(synergyEnvironmentUpdater);
|
|
} else if (this.m_networkStatusChangeReceiver == null) {
|
|
this.m_networkStatusChangeReceiver = new BroadcastReceiver() { // from class: com.ea.nimble.SynergyEnvironmentImpl.1
|
|
@Override // android.content.BroadcastReceiver
|
|
public void onReceive(Context context, Intent intent) {
|
|
if (intent.getAction().equals(Global.NOTIFICATION_NETWORK_STATUS_CHANGE) && Network.getComponent().getStatus() == Network.Status.OK) {
|
|
Log.Helper.LOGD(this, "Network restored. Starting Synergy environment update.", new Object[0]);
|
|
Utility.unregisterReceiver(SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver);
|
|
SynergyEnvironmentImpl.this.m_networkStatusChangeReceiver = null;
|
|
SynergyEnvironmentImpl synergyEnvironmentImpl = SynergyEnvironmentImpl.this;
|
|
synergyEnvironmentImpl.startSynergyEnvironmentUpdateImpl(synergyEnvironmentImpl.m_synergyStartupObject);
|
|
}
|
|
}
|
|
};
|
|
Log.Helper.LOGD(this, "Network not available to perform environment update. Setting receiver to listen for network status change.", new Object[0]);
|
|
Utility.registerReceiver(Global.NOTIFICATION_NETWORK_STATUS_CHANGE, this.m_networkStatusChangeReceiver);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void startSynergyEnvironmentUpdateImpl(final SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
|
|
Log.Helper.LOGFUNC(this);
|
|
if (synergyEnvironmentUpdater == null) {
|
|
Log.Helper.LOGD(this, "Synergy Environment Update canceled before it could start", new Object[0]);
|
|
return;
|
|
}
|
|
this.m_previousValidEnvironmentDataContainer = this.m_environmentDataContainer;
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put("result", "1");
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_STARTED, hashMap);
|
|
synergyEnvironmentUpdater.startSynergyStartupSequence(this.m_previousValidEnvironmentDataContainer, new SynergyEnvironmentUpdater.CompletionCallback() { // from class: com.ea.nimble.SynergyEnvironmentImpl.2
|
|
@Override // com.ea.nimble.SynergyEnvironmentUpdater.CompletionCallback
|
|
public void callback(Exception exc) {
|
|
if (exc == null) {
|
|
if (SynergyEnvironmentImpl.this.m_synergyStartupObject != null && synergyEnvironmentUpdater.getEnvironmentDataContainer() != null) {
|
|
SynergyEnvironmentImpl.this.m_environmentDataContainer = synergyEnvironmentUpdater.getEnvironmentDataContainer();
|
|
SynergyEnvironmentImpl.this.saveEnvironmentDataToPersistent();
|
|
if (SynergyEnvironmentImpl.this.m_environmentDataContainer.getKeysOfDifferences(SynergyEnvironmentImpl.this.m_previousValidEnvironmentDataContainer) != null) {
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED);
|
|
}
|
|
HashMap hashMap2 = new HashMap();
|
|
hashMap2.put("result", "1");
|
|
if (ApplicationEnvironment.isMainApplicationActive()) {
|
|
Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap2);
|
|
} else {
|
|
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
|
SynergyEnvironmentImpl.this.m_pendingStartupFinishedNotification = true;
|
|
}
|
|
} else {
|
|
Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. Update was canceled", new Object[0]);
|
|
}
|
|
} else {
|
|
Log.Helper.LOGE(this, "StartupError(%s)", exc);
|
|
if (!(exc instanceof Error)) {
|
|
if (SynergyEnvironmentImpl.this.m_synergyStartupObject == null || synergyEnvironmentUpdater.getEnvironmentDataContainer() == null) {
|
|
Log.Helper.LOGD(this, "Synergy Environment Update object or dataContainer null at callback. More than one update was being peroformed", new Object[0]);
|
|
}
|
|
} else {
|
|
Error error = (Error) exc;
|
|
if (error.isError(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT) || error.isError(Error.Code.SYNERGY_SERVER_FULL)) {
|
|
Log.Helper.LOGD(this, "GetDirection request timed out or ServerUnavailable signal received. Start rate limiting of /getDirection call.", new Object[0]);
|
|
SynergyEnvironmentImpl.this.startSynergyEnvironmentUpdateRateLimiting();
|
|
}
|
|
}
|
|
HashMap hashMap3 = new HashMap();
|
|
hashMap3.put("result", "0");
|
|
hashMap3.put("error", exc.toString());
|
|
if (ApplicationEnvironment.isMainApplicationActive()) {
|
|
Log.Helper.LOGD(this, "App is running in forground, send the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_FINISHED, hashMap3);
|
|
} else {
|
|
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
|
}
|
|
}
|
|
SynergyEnvironmentImpl.this.m_synergyStartupObject = null;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void startSynergyEnvironmentUpdateRateLimiting() {
|
|
Log.Helper.LOGFUNC(this);
|
|
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = Long.valueOf(System.currentTimeMillis());
|
|
}
|
|
|
|
private boolean isInSynergyEnvironmentUpdateRateLimitingPeriod() {
|
|
Log.Helper.LOGFUNC(this);
|
|
return this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp != null && ((double) (System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue())) <= 60000.0d;
|
|
}
|
|
|
|
private void clearSynergyEnvironmentUpdateRateLimiting() {
|
|
Log.Helper.LOGFUNC(this);
|
|
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = null;
|
|
}
|
|
|
|
private boolean restoreEnvironmentDataFromPersistent(boolean z) {
|
|
Log.Helper.LOGFUNC(this);
|
|
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
|
|
if (persistenceForNimbleComponent != null) {
|
|
Serializable value = persistenceForNimbleComponent.getValue(PERSISTENCE_DATA_ID);
|
|
if (value == null) {
|
|
Log.Helper.LOGD(this, "Environment persistence data value not found in persistence object. Probably first install.", new Object[0]);
|
|
} else {
|
|
try {
|
|
EnvironmentDataContainer environmentDataContainer = (EnvironmentDataContainer) value;
|
|
this.m_environmentDataContainer = environmentDataContainer;
|
|
Log.Helper.LOGD(this, "Restored environment data from persistent. Restored data timestamp, %s", environmentDataContainer.getMostRecentDirectorResponseTimestamp());
|
|
if (!z) {
|
|
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT);
|
|
}
|
|
return true;
|
|
} catch (ClassCastException unused) {
|
|
Log.Helper.LOGE(this, "Environment persistence data value is not the expected type.", new Object[0]);
|
|
}
|
|
}
|
|
} else {
|
|
Log.Helper.LOGE(this, "Could not get environment persistence object to restore from", new Object[0]);
|
|
}
|
|
this.m_environmentDataContainer = null;
|
|
return false;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void saveEnvironmentDataToPersistent() {
|
|
Log.Helper.LOGFUNC(this);
|
|
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent(SynergyEnvironment.COMPONENT_ID, Persistence.Storage.CACHE);
|
|
if (persistenceForNimbleComponent != null) {
|
|
Log.Helper.LOGD(this, "Saving environment data to persistent.", new Object[0]);
|
|
persistenceForNimbleComponent.setValue(PERSISTENCE_DATA_ID, this.m_environmentDataContainer);
|
|
persistenceForNimbleComponent.lambda$new$0();
|
|
return;
|
|
}
|
|
Log.Helper.LOGE(this, "Could not get environment persistence object to save to.", new Object[0]);
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getNexusClientId() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getNexusClientId();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getNexusClientSecret() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getNexusClientSecret();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyEnvironment
|
|
public String getGosMdmAppKey() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
checkAndInitiateSynergyEnvironmentUpdate();
|
|
EnvironmentDataContainer environmentDataContainer = this.m_environmentDataContainer;
|
|
if (environmentDataContainer == null) {
|
|
return null;
|
|
}
|
|
return environmentDataContainer.getGosMdmAppKey();
|
|
}
|
|
}
|