Compare commits
5
Commits
b093674b6e
...
4296b5d20b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4296b5d20b | ||
|
|
1e6c5846ea | ||
|
|
49a2d575c0 | ||
|
|
7b5bcdb978 | ||
|
|
540eb08e22 |
+1
-16
@@ -50,21 +50,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
|
||||
flavorDimensions.add("nfsmw")
|
||||
|
||||
create("devmenu") {
|
||||
dimension = "nfsmw"
|
||||
minSdk = 21
|
||||
}
|
||||
create("no_devmenu") {
|
||||
dimension = "nfsmw"
|
||||
minSdk = 21
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
@@ -104,7 +89,7 @@ dependencies {
|
||||
androidTestImplementation(libs.ui.test.junit4)
|
||||
debugImplementation(libs.ui.tooling)
|
||||
debugImplementation(libs.ui.test.manifest)
|
||||
implementation(project(mapOf("path" to ":devmenu")))
|
||||
//implementation(project(mapOf("path" to ":devmenu")))
|
||||
|
||||
implementation ("commons-codec:commons-codec:1.15")
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application android:name="com.megboyzz.devmenu.App">
|
||||
<activity
|
||||
android:name="com.megboyzz.devmenu.MainActivity"
|
||||
android:theme="@android:style/Theme.Material.Light.NoActionBar"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -31,29 +31,24 @@
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape">
|
||||
<activity android:name="com.ea.ironmonkey.devmenu.PuppetActivity" >
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.ea.ironmonkey.devmenu.MainActivity"/>
|
||||
|
||||
<activity
|
||||
android:name="com.ea.ironmonkey.devmenu.SettingsActivity"
|
||||
android:title="Настройки" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.ea.ironmonkey.GameActivity"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:configChanges="keyboardHidden|locale|orientation|screenSize|smallestScreenSize"
|
||||
android:launchMode="singleTop"
|
||||
android:exported="true"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
|
||||
<meta-data
|
||||
android:name="foo"
|
||||
android:value="bar" />
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.ea.ironmonkey.devmenu.RecoverListActivity" />
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.ea.nimble.Log;
|
||||
//import com.ea.nimble.Log;
|
||||
|
||||
public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid {
|
||||
private static final boolean DEBUG_LOG_ENABLED = true;
|
||||
@@ -36,7 +36,7 @@ public class VirtualKeyboardAndroidDelegate extends KeyboardAndroid {
|
||||
private volatile int mKeyboardLayout = 1;
|
||||
private Activity mMainActivity;
|
||||
public ViewGroup mMainViewGroup;
|
||||
public int mMaxTextLength = Log.LEVEL_INFO;
|
||||
public int mMaxTextLength = 1;//Log.LEVEL_INFO;
|
||||
public String mNewText;
|
||||
private boolean mPhysicalKeyboardVisible = false;
|
||||
public RelativeLayout mRelativeLayout;
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.ea.EAIO.EAIO
|
||||
import com.ea.EAMIO.StorageDirectory
|
||||
import com.ea.easp.EASPHandler
|
||||
import com.ea.games.nfs13_na.BuildConfig
|
||||
import com.ea.nimble.ApplicationLifecycle
|
||||
//import com.ea.nimble.ApplicationLifecycle
|
||||
import java.io.BufferedReader
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
@@ -40,7 +40,7 @@ import kotlin.system.exitProcess
|
||||
class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
|
||||
init {
|
||||
System.loadLibrary("nimble")
|
||||
//System.loadLibrary("nimble")
|
||||
System.loadLibrary("app")
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
easpHandler!!.onActivityResult(requestCode, resultCode, data)
|
||||
ApplicationLifecycle.onActivityResult(requestCode, resultCode, data, this)
|
||||
//ApplicationLifecycle.onActivityResult(requestCode, resultCode, data, this)
|
||||
}
|
||||
|
||||
public override fun onCreate(bundle: Bundle?) {
|
||||
@@ -352,7 +352,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
easpHandler = EASPHandler(this, frameLayout, gameGLSurfaceView)
|
||||
easpHandler.onCreate()
|
||||
|
||||
ApplicationLifecycle.onActivityCreate(bundle, this)
|
||||
//ApplicationLifecycle.onActivityCreate(bundle, this)
|
||||
Log.d(className, "nativeOnCreate")
|
||||
nativeOnCreate()
|
||||
|
||||
@@ -366,7 +366,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
super.onDestroy()
|
||||
easpHandler.onDestroy()
|
||||
if (state == 8) {
|
||||
ApplicationLifecycle.onActivityDestroy(this)
|
||||
//ApplicationLifecycle.onActivityDestroy(this)
|
||||
nativeOnDestroy()
|
||||
}
|
||||
StorageDirectory.Shutdown()
|
||||
@@ -480,7 +480,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
mAudioManager!!.setStreamMute(3, true)
|
||||
gameGLSurfaceView.onPause()
|
||||
onWindowFocusChanged(false)
|
||||
ApplicationLifecycle.onActivityPause(this)
|
||||
//ApplicationLifecycle.onActivityPause(this)
|
||||
nativeOnPause()
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
Log.i(this.localClassName, "onRestart")
|
||||
Log.i(this.localClassName, "TouchEvent, GameActivity.state = $state")
|
||||
super.onRestart()
|
||||
ApplicationLifecycle.onActivityRestart(this)
|
||||
//ApplicationLifecycle.onActivityRestart(this)
|
||||
nativeOnRestart()
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
gameRenderer.setDrawFrameListener(this)
|
||||
}
|
||||
gameGLSurfaceView.onResume()
|
||||
ApplicationLifecycle.onActivityResume(this)
|
||||
//ApplicationLifecycle.onActivityResume(this)
|
||||
nativeOnResume()
|
||||
MogaController.doForAllControllers {
|
||||
val event = MogaController.createConnectEvent(it)
|
||||
@@ -514,7 +514,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
|
||||
public override fun onSaveInstanceState(bundle: Bundle) {
|
||||
super.onSaveInstanceState(bundle)
|
||||
ApplicationLifecycle.onActivitySaveInstanceState(bundle, this)
|
||||
//ApplicationLifecycle.onActivitySaveInstanceState(bundle, this)
|
||||
}
|
||||
|
||||
public override fun onStart() {
|
||||
@@ -531,7 +531,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
nativeOnStart()
|
||||
Log.i(this.localClassName, "nativeOnStart - end")
|
||||
Log.i(this.localClassName, "ApplicationLifecycle")
|
||||
ApplicationLifecycle.onActivityStart(this)
|
||||
//ApplicationLifecycle.onActivityStart(this)
|
||||
}
|
||||
Log.w(
|
||||
this.localClassName,
|
||||
@@ -576,7 +576,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
|
||||
gameRenderer.setDrawFrameListener(this)
|
||||
}
|
||||
}
|
||||
ApplicationLifecycle.onActivityWindowFocusChanged(hasFocus, this)
|
||||
//ApplicationLifecycle.onActivityWindowFocusChanged(hasFocus, this)
|
||||
}
|
||||
|
||||
fun parseCpuList(cpuInfo: String): List<Int> {
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu;
|
||||
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.MAIN_TABLE_NAME;
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.PATH_TO_REPLACED_ELEMENT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TwoLineListItem;
|
||||
|
||||
import com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
class FileAdapter extends ArrayAdapter<File> {
|
||||
|
||||
private static int count = 0;
|
||||
private List files;
|
||||
private Context context;
|
||||
private ReplacementDataBaseHelper dataBaseHelper;
|
||||
private SQLiteDatabase database;
|
||||
|
||||
public FileAdapter(Context context, List files) {
|
||||
super(context, android.R.layout.simple_list_item_2, files);
|
||||
dataBaseHelper = new ReplacementDataBaseHelper(context);
|
||||
database = dataBaseHelper.getDatabase();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
View view;
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
|
||||
String name = getItem(position).getName();
|
||||
|
||||
Cursor query = database.query(MAIN_TABLE_NAME, new String[]{PATH_TO_REPLACED_ELEMENT},
|
||||
PATH_TO_REPLACED_ELEMENT + " = \"" + getItem(position).getAbsolutePath() + "\""
|
||||
, null, null, null, null);
|
||||
|
||||
if (query.getCount() > 0) {
|
||||
TwoLineListItem listItem = (TwoLineListItem) inflater.inflate(android.R.layout.simple_list_item_2, null, true);
|
||||
listItem.getText1().setText(name);
|
||||
listItem.getText2().setText("Заменен");
|
||||
view = listItem;
|
||||
} else {
|
||||
TextView textView = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, null, true);
|
||||
textView.setText(name);
|
||||
view = textView;
|
||||
}
|
||||
query.close();
|
||||
return view;
|
||||
}
|
||||
|
||||
public List getFiles() {
|
||||
return files;
|
||||
}
|
||||
}
|
||||
@@ -1,458 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu;
|
||||
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.OPEN_FILE_ON_REPLACE_REQUEST;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.copy;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.generateMD5;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.isFirstRun;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TwoLineListItem;
|
||||
|
||||
import com.ea.games.nfs13_na.BuildConfig;
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.GameActivity;
|
||||
import com.ea.ironmonkey.devmenu.components.LongPressContextMenu;
|
||||
import com.ea.ironmonkey.devmenu.util.ResultListener;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
import com.ea.nimble.Utility;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
//TODO сделать нормальный файл сохранения
|
||||
//TODO сделать его нрмальное отображние
|
||||
|
||||
//TODO сделать нормальное отслеживние файлов сохранений
|
||||
//TODO сдлеать настройки отслеживания файла
|
||||
//TODO сделать отображение текущего пути в проводнике
|
||||
//TODO добавить иконки к проводику
|
||||
//TODO сделать динамическое контекстное меню файла
|
||||
|
||||
//TODO реализовать сохранение файлов в память телефона из внутреннего хранилища
|
||||
public class MainActivity extends Activity{
|
||||
|
||||
private final String LOG_TAG = "InjectedActivity";
|
||||
|
||||
private String internalFiles;
|
||||
private String externalFiles;
|
||||
private ResultListener resultListener;
|
||||
private ResultListener openResult = new ResultListener() {};
|
||||
private static Thread observerThread;
|
||||
private String globalPath = "";
|
||||
private ListView fileList;
|
||||
private Button backButton;
|
||||
private static final int READ_FILE_REQUEST_CODE = 101;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
UtilitiesAndData.init(this);
|
||||
internalFiles = UtilitiesAndData.getInternalStorage();
|
||||
externalFiles = UtilitiesAndData.getExternalStorage();
|
||||
|
||||
File replacements = new File(UtilitiesAndData.getReplacementsStorage());
|
||||
if(!replacements.exists()) replacements.mkdir();
|
||||
|
||||
File activityFlag = new File(externalFiles + File.separator + BuildConfig.DEV_MENU_ID);
|
||||
// TODO доделать проверку первого запуска
|
||||
if(isFirstRun()){
|
||||
File data = new File(UtilitiesAndData.getExternalStorage());
|
||||
if(!data.exists()){
|
||||
|
||||
File data1 = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + getPackageName() + "_");
|
||||
if(data1.exists()) {
|
||||
String path = data1.getPath();
|
||||
data1.renameTo(new File(path.substring(0, path.length() - 2)));
|
||||
activityFlag = data1;
|
||||
}
|
||||
}
|
||||
try {
|
||||
File temp = new File(UtilitiesAndData.getInternalStorage() + File.separator + "load");
|
||||
temp.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(!activityFlag.exists()){
|
||||
updateLanguage();
|
||||
runGame();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.custom);
|
||||
|
||||
|
||||
String title = String.format(getString(R.string.dev_menu_title), /*BuildConfig.DEV_MENU_VERSION*/"");
|
||||
|
||||
getActionBar().setTitle(title);
|
||||
|
||||
fileList = (ListView) findViewById(R.id.FileList);
|
||||
|
||||
fileList.setAdapter(new FileAdapter(this, asList(externalFiles)));
|
||||
globalPath = externalFiles;
|
||||
|
||||
RadioGroup group = (RadioGroup) findViewById(R.id.switcherFiles);
|
||||
|
||||
fileList.setOnItemClickListener((parent, view, position, id) -> {
|
||||
String chosenElem =
|
||||
(view instanceof TwoLineListItem) ?
|
||||
((TwoLineListItem) view).getText1().getText().toString() :
|
||||
((TextView) view).getText().toString(); // получаем текст нажатого элемента
|
||||
|
||||
File intermid = new File(globalPath + "/" + chosenElem);
|
||||
if(intermid.isDirectory()) {
|
||||
globalPath += "/" + chosenElem;
|
||||
updateListView();
|
||||
}
|
||||
else{
|
||||
openFile(intermid);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
fileList.setOnItemLongClickListener((parent, view, position, id) -> {
|
||||
String chosenElem =
|
||||
(view instanceof TwoLineListItem) ?
|
||||
((TwoLineListItem) view).getText1().getText().toString() :
|
||||
((TextView) view).getText().toString();
|
||||
|
||||
|
||||
LongPressContextMenu ninja = new LongPressContextMenu(this, globalPath + "/" + chosenElem);
|
||||
return true;
|
||||
});
|
||||
|
||||
group.setOnCheckedChangeListener((group1, checkedId) -> {
|
||||
globalPath = (checkedId == R.id.externalStoreButton) ? externalFiles : internalFiles;
|
||||
updateListView();
|
||||
});
|
||||
|
||||
backButton = (Button)findViewById(R.id.back_button);
|
||||
|
||||
backButton.setOnClickListener(v -> {
|
||||
if(!( globalPath.equals(internalFiles) | globalPath.equals(externalFiles) )
|
||||
& !globalPath.isEmpty()
|
||||
& (new File(globalPath).exists())) {
|
||||
globalPath = globalPath.substring(0, globalPath.lastIndexOf("/"));
|
||||
updateListView();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Настройка языка игры
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
}
|
||||
|
||||
public void readAndSortNumbersFromFile(String fileName) {
|
||||
List<Integer> numbersList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
File file = new File(fileName);
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||
String line;
|
||||
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
try {
|
||||
// Попытайтесь преобразовать строку в целое число и добавить его в список
|
||||
int number = Integer.parseInt(line);
|
||||
numbersList.add(number);
|
||||
} catch (NumberFormatException e) {
|
||||
// Если строка не является числом, проигнорируйте ее
|
||||
Log.e("FileOperations", "Ошибка при чтении числа: " + line);
|
||||
}
|
||||
}
|
||||
|
||||
bufferedReader.close();
|
||||
|
||||
// Отсортируйте числа в списке
|
||||
Collections.sort(numbersList);
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e("Time", "Ошибка при чтении файла: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
backButton.callOnClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.options, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
switch (requestCode){
|
||||
case OPEN_FILE_ON_REPLACE_REQUEST:{
|
||||
resultListener.onResult(data);
|
||||
}break;
|
||||
|
||||
case READ_FILE_REQUEST_CODE:{
|
||||
openResult.onResult(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NonConstantResourceId")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.optionRunTheGame) {
|
||||
updateLanguage();
|
||||
runGame();
|
||||
} else if (itemId == R.id.optionSettings) {
|
||||
Intent goToSettings = new Intent(this, SettingsActivity.class);
|
||||
startActivity(goToSettings);
|
||||
} else if (itemId == R.id.optionDeleteData) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(getString(R.string.remove_action_title));
|
||||
builder.setMessage(getString(R.string.sure_remove_all_data_title));
|
||||
builder.setPositiveButton(R.string.ok_title, (dialogInterface, i) -> {
|
||||
File[] internals = new File(UtilitiesAndData.getInternalStorage()).listFiles();
|
||||
for (File internal : internals) {
|
||||
if (!UtilitiesAndData.isExclusionName(internal.getName())) {
|
||||
internal.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.cancel_title, null);
|
||||
builder.show();
|
||||
} else if (itemId == R.id.optionCheckRecovers) {
|
||||
Intent goToRecovers = new Intent(this, RecoverListActivity.class);
|
||||
startActivity(goToRecovers);
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public void openFile(File url) {
|
||||
File tempFile = null;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
|
||||
if(url.getAbsolutePath().contains(UtilitiesAndData.getInternalStorage())){
|
||||
Log.wtf(LOG_TAG, "WTF, man, you cant read my files!!!");
|
||||
|
||||
//Создаем временный файл, там где можем его прочитать
|
||||
Random random = new Random();
|
||||
tempFile = new File(UtilitiesAndData.getExternalStorage() + File.separator + "temp_" + random.nextInt());
|
||||
|
||||
//Копируем тот файл который хотим посмотреть
|
||||
copy(url.getAbsolutePath(), tempFile.getAbsolutePath());
|
||||
|
||||
//Сохраняем ссылку на окрытый файл, в случае его изменения
|
||||
final File openedFile = url;
|
||||
url = tempFile;
|
||||
File finalTempFile = tempFile;
|
||||
|
||||
//Создаем хеш файла для того чтобы его потом сравнить
|
||||
final byte[] compTemp = generateMD5(finalTempFile);
|
||||
|
||||
openResult = new ResultListener(){
|
||||
@Override
|
||||
public void onResult(Object data) {
|
||||
byte[] bytes = generateMD5(finalTempFile);
|
||||
//Если хеши не одинаковы то заменяем одно на другое
|
||||
if(!Arrays.equals(bytes, compTemp))
|
||||
copy(finalTempFile.getAbsolutePath(), openedFile.getAbsolutePath());
|
||||
finalTempFile.delete();
|
||||
}
|
||||
};
|
||||
intent.putExtra("pathToTemp", tempFile.getAbsolutePath());
|
||||
}
|
||||
// Create URI
|
||||
Uri uri = Uri.fromFile(url);
|
||||
|
||||
if (url.toString().contains(".doc") || url.toString().contains(".docx"))
|
||||
intent.setDataAndType(uri, "application/msword");
|
||||
else if(url.toString().contains(".pdf")) {
|
||||
intent.setDataAndType(uri, "application/pdf");
|
||||
} else if(url.toString().contains(".ppt") || url.toString().contains(".pptx")) {
|
||||
intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
|
||||
} else if(url.toString().contains(".xls") || url.toString().contains(".xlsx")) {
|
||||
intent.setDataAndType(uri, "application/vnd.ms-excel");
|
||||
} else if(url.toString().contains(".zip") || url.toString().contains(".rar")) {
|
||||
intent.setDataAndType(uri, "application/x-wav");
|
||||
} else if(url.toString().contains(".rtf")) {
|
||||
intent.setDataAndType(uri, "application/rtf");
|
||||
} else if(url.toString().contains(".wav") || url.toString().contains(".mp3")) {
|
||||
intent.setDataAndType(uri, "audio/x-wav");
|
||||
} else if(url.toString().contains(".gif")) {
|
||||
intent.setDataAndType(uri, "image/gif");
|
||||
} else if(url.toString().contains(".jpg") || url.toString().contains(".jpeg") || url.toString().contains(".png")) {
|
||||
intent.setDataAndType(uri, "image/jpeg");
|
||||
} else if(url.toString().contains(".txt")) {
|
||||
intent.setDataAndType(uri, "text/plain");
|
||||
} else if(url.toString().contains(".3gp") || url.toString().contains(".mpg") || url.toString().contains(".mpeg") || url.toString().contains(".mpe") || url.toString().contains(".mp4") || url.toString().contains(".avi")) {
|
||||
intent.setDataAndType(uri, "video/*");
|
||||
} else {
|
||||
intent.setDataAndType(uri, "*/*");
|
||||
}
|
||||
|
||||
//intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivityForResult(intent, READ_FILE_REQUEST_CODE);
|
||||
|
||||
}
|
||||
|
||||
private void runGame() {
|
||||
|
||||
Intent GoToGame = new Intent(this, GameActivity.class);
|
||||
startActivity(GoToGame);
|
||||
|
||||
}
|
||||
|
||||
// TODO Сделать номальную систему учета измения файлов
|
||||
public static void observ(){
|
||||
File save = new File(UtilitiesAndData.getInternalStorage() + File.separator + "files/var/nfstr_save.sb");
|
||||
File fileOut = new File(UtilitiesAndData.getExternalStorage() + File.separator + "Log.txt");
|
||||
File pathToSave = new File(UtilitiesAndData.getExternalStorage() + File.separator + "saves");
|
||||
pathToSave.mkdir();
|
||||
if(!fileOut.exists()) {
|
||||
try {
|
||||
fileOut.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss", Locale.getDefault());
|
||||
UtilitiesAndData.setLogger(fileOut);
|
||||
observerThread = new Thread(() -> {
|
||||
int count = 1;
|
||||
byte[] lastMD5 = new byte[10];
|
||||
while (true){
|
||||
byte[] md5 = generateMD5(save);
|
||||
if(!Arrays.equals(md5, lastMD5)) {
|
||||
UtilitiesAndData.printLog(format.format(new Date()) + " | " + Utility.bytesToHexString(md5) + "\n");
|
||||
File change = new File(pathToSave.getAbsolutePath() + File.separator + "nfs_save_change_"+ count +".sb");
|
||||
try {
|
||||
change.createNewFile();
|
||||
copy(save, change);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
lastMD5 = md5;
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
count++;
|
||||
}
|
||||
});
|
||||
observerThread.start();
|
||||
}
|
||||
|
||||
private <T> List<T> asList(T[] a){
|
||||
return Arrays.asList(a);
|
||||
}
|
||||
|
||||
// TODO реализовать сокрытие лишних папок
|
||||
private List<File> asList(String path){
|
||||
return asList(new File(path).listFiles());
|
||||
}
|
||||
|
||||
private void updateLanguage(){
|
||||
//Получаем текущий язык
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String current_lang = preferences.getString(getString(R.string.current_lang), "00");
|
||||
if(current_lang.equals("00")) {
|
||||
Log.e(LOG_TAG, "Not found currentLang preference(");
|
||||
return;
|
||||
}
|
||||
if(current_lang.equals("sys"))
|
||||
current_lang = Locale.getDefault().getLanguage();
|
||||
|
||||
byte[] current_lang_bytes = current_lang.getBytes();
|
||||
|
||||
//Открываем языковой файл и создаем поток чтения
|
||||
File locale = new File(internalFiles + "/files/var/locale");
|
||||
FileInputStream inputStream;
|
||||
|
||||
//Байтовое представление файла
|
||||
byte[] bytes_locale = new byte[4];
|
||||
try {
|
||||
|
||||
inputStream = new FileInputStream(locale);
|
||||
inputStream.read(bytes_locale);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.wtf(LOG_TAG, "No found locale(((((");
|
||||
return;
|
||||
}catch (IOException e){
|
||||
Log.wtf(LOG_TAG, "Couldn't read the locale file((((((");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (
|
||||
bytes_locale[2] != current_lang_bytes[0] &
|
||||
bytes_locale[3] != current_lang_bytes[1]
|
||||
) {
|
||||
bytes_locale[2] = current_lang_bytes[0];
|
||||
bytes_locale[3] = current_lang_bytes[1];
|
||||
} else return;
|
||||
}catch (Exception e){
|
||||
return;
|
||||
}
|
||||
|
||||
FileOutputStream outputStream;
|
||||
try {
|
||||
outputStream = new FileOutputStream(locale, false);
|
||||
outputStream.write(bytes_locale, 0, 4);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}catch (IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setResultListener(ResultListener resultListener) {
|
||||
this.resultListener = resultListener;
|
||||
}
|
||||
|
||||
public void updateListView(){
|
||||
fileList.setAdapter(new FileAdapter(getApplicationContext(), asList(globalPath)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.ea.nimble.ApplicationLifecycle;
|
||||
|
||||
//Активность-марионетка для проверки работы нативных методов жизненного цикла
|
||||
public class PuppetActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ApplicationLifecycle.onActivityCreate(savedInstanceState, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ApplicationLifecycle.onActivityResume(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
ApplicationLifecycle.onActivityStart(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
ApplicationLifecycle.onActivityDestroy(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
ApplicationLifecycle.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
ApplicationLifecycle.onActivityResult(resultCode, requestCode, data, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
ApplicationLifecycle.onActivityPause(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
ApplicationLifecycle.onActivityRestart(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
ApplicationLifecycle.onActivityStop(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
ApplicationLifecycle.onActivityRestoreInstanceState(savedInstanceState, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RecoverListActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
getActionBar().setTitle(R.string.recover_file_title);
|
||||
|
||||
ListView view = new ListView(this);
|
||||
|
||||
SQLiteDatabase database = new ReplacementDataBaseHelper(this).getDatabase();
|
||||
|
||||
Cursor cursor = database.rawQuery("SELECT " + ReplacementDataBaseHelper.PATH_TO_REPLACED_ELEMENT + " FROM " + ReplacementDataBaseHelper.MAIN_TABLE_NAME, null);
|
||||
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
|
||||
ArrayList<String> fullNames = new ArrayList<>();
|
||||
ArrayList<String> shortNames = new ArrayList<>();
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
String string = cursor.getString(0);
|
||||
fullNames.add(string);
|
||||
int from = string.lastIndexOf("/files/");
|
||||
shortNames.add(string.substring(from));
|
||||
}
|
||||
if(fullNames.isEmpty()){
|
||||
shortNames.add("Не чего заменять!!");
|
||||
flag = false;
|
||||
}
|
||||
boolean thereIsSmthToRecover = flag;
|
||||
|
||||
ArrayAdapter<String> adapter;
|
||||
|
||||
view.setOnItemClickListener((parent, view1, position, id) -> {
|
||||
if(thereIsSmthToRecover){
|
||||
|
||||
TextView textView = (TextView) view1;
|
||||
String s = textView.getText().toString();
|
||||
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||
|
||||
//TODO сделать нормальные строки
|
||||
dialog.setTitle("Воостановить?");
|
||||
|
||||
dialog.setPositiveButton(R.string.ok_title, (dialog1, which) -> {
|
||||
shortNames.remove(s);
|
||||
view.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, shortNames));
|
||||
String fullName = fullNames.get(position);
|
||||
fullNames.remove(fullName);
|
||||
UtilitiesAndData.recoverFile(fullName);
|
||||
//System.out.println();
|
||||
//TODO Сделать воостановление
|
||||
});
|
||||
|
||||
dialog.setNegativeButton(R.string.cancel_title, (dialog1, which) -> {
|
||||
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, shortNames);
|
||||
|
||||
view.setAdapter(adapter);
|
||||
|
||||
setContentView(view);
|
||||
cursor.close();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.ea.games.nfs13_na.BuildConfig;
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.devmenu.dialog.OpenFileDialog;
|
||||
import com.ea.ironmonkey.devmenu.util.SaveManager;
|
||||
import com.ea.ironmonkey.devmenu.dialog.SvmwCreatorDialog;
|
||||
import com.ea.ironmonkey.devmenu.dialog.SvmwInspectorDialog;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
import com.ea.nimble.ApplicationLifecycle;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
|
||||
public static final String LOG_TAG = "SettingActivity";
|
||||
|
||||
private static final int PICKFILE_REQUEST_CODE = 128;
|
||||
public static final int PICK_SVMW_REQUEST_CODE = 129;
|
||||
public static final int PICK_SVMW_IN_CREATE = 228;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.settings_xml);
|
||||
|
||||
ApplicationLifecycle.onActivityCreate(savedInstanceState, this);
|
||||
|
||||
String title = String.format(getString(R.string.dev_menu_title), BuildConfig.DEV_MENU_VERSION);
|
||||
getActionBar().setTitle(title);
|
||||
|
||||
Preference chooseSaveFileButton = findPreference(getString(R.string.choose_save_file_title));
|
||||
Preference chooseSVMWfileButton = findPreference(getString(R.string.choose_svmw_file_title));
|
||||
Preference createSVMWfileButton = findPreference(getString(R.string.create_svmw_file_title));
|
||||
Preference turnOffTheDevMenuButton = findPreference(getString(R.string.switch_off_devmenu_title));
|
||||
|
||||
final Context myContext = this;
|
||||
|
||||
turnOffTheDevMenuButton.setOnPreferenceClickListener(preference -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.switch_off_devmenu_title);
|
||||
builder.setMessage(R.string.msg_devmenu_off);
|
||||
builder.setPositiveButton(R.string.ok_title, (dialog, which) -> UtilitiesAndData.getDevMenuSwitcher().delete());
|
||||
builder.setNegativeButton(R.string.cancel_title, null);
|
||||
builder.show();
|
||||
return true;
|
||||
});
|
||||
|
||||
chooseSaveFileButton.setOnPreferenceClickListener(preference -> {
|
||||
|
||||
OpenFileDialog fileDialog = new OpenFileDialog(myContext);
|
||||
fileDialog
|
||||
.setFilter(".*\\.sb")
|
||||
.setOpenDialogListener(fileName -> {
|
||||
|
||||
File save = new File(fileName);
|
||||
SaveManager manager = new SaveManager(this);
|
||||
manager.loadSaveFile(save);
|
||||
|
||||
});
|
||||
|
||||
fileDialog.show();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
chooseSVMWfileButton.setOnPreferenceClickListener(preference -> {
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("file/*");
|
||||
startActivityForResult(intent, PICK_SVMW_REQUEST_CODE);
|
||||
//TODO реализовать выбор svmw
|
||||
return true;
|
||||
});
|
||||
|
||||
//По нажатии на кнопку создания svmw файла осуществляется переход в диалог создания svmw
|
||||
createSVMWfileButton.setOnPreferenceClickListener(preference -> {
|
||||
|
||||
SvmwCreatorDialog dialog = new SvmwCreatorDialog(this);
|
||||
dialog.show();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(data != null) {
|
||||
switch (requestCode) {
|
||||
case PICKFILE_REQUEST_CODE: {
|
||||
String s = data.getData().toString();
|
||||
String s1 = s.replaceAll("file://", "");
|
||||
File file = new File(s1);
|
||||
}
|
||||
break;
|
||||
case PICK_SVMW_REQUEST_CODE: {
|
||||
String s = data.getData().toString();
|
||||
String s1 = s.replaceAll("file://", "");
|
||||
File file = new File(s1);
|
||||
SvmwInspectorDialog inspectorDialog = new SvmwInspectorDialog(this, file);
|
||||
inspectorDialog.show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** Динамический список для контекстного меню файла LongPressContextMenu */
|
||||
public class DynamicOptionsListView extends ListView {
|
||||
|
||||
/** Названия позиций в контекстном меню */
|
||||
private List<String> names = new ArrayList<>();
|
||||
private List<OptionAction> actions = new ArrayList<>();
|
||||
private Context context;
|
||||
|
||||
public DynamicOptionsListView(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
updateList();
|
||||
setOnItemClickListener((parent, view, position, id) -> {
|
||||
try {
|
||||
actions.get(position).action();
|
||||
}catch (IndexOutOfBoundsException e){
|
||||
Log.i("DynamicListView", "No found action to do( in position " + position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateList(){
|
||||
setAdapter(
|
||||
new ArrayAdapter<>(
|
||||
context,
|
||||
android.R.layout.simple_list_item_1,
|
||||
names
|
||||
));
|
||||
}
|
||||
|
||||
public void addOption(String title, OptionAction action){
|
||||
names.add(title);
|
||||
actions.add(action);
|
||||
updateList();
|
||||
}
|
||||
|
||||
public void deleteOption(String title){
|
||||
boolean removeInt = names.remove(title);
|
||||
actions.remove(removeInt);
|
||||
updateList();
|
||||
}
|
||||
|
||||
public String deleteOption(int position){
|
||||
String result = names.remove(position);
|
||||
actions.remove(position);
|
||||
updateList();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.components;
|
||||
|
||||
public interface FileAction {
|
||||
|
||||
void actionReplaceFile();
|
||||
|
||||
void actionRecoverFile();
|
||||
|
||||
void actionRemoveFile();
|
||||
|
||||
void actionTrackTheFile();
|
||||
|
||||
void actionGetPropsOfFile();
|
||||
|
||||
void actionHideTheFile();
|
||||
//sfhsadfhsdjf
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.components;
|
||||
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.MAIN_TABLE_NAME;
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.NAME_OF_BACKUPED_ELEMENT;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.OPEN_FILE_ON_REPLACE_REQUEST;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.copy;
|
||||
import static com.ea.ironmonkey.devmenu.util.UtilitiesAndData.getFileSize;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.devmenu.MainActivity;
|
||||
import com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper;
|
||||
import com.ea.ironmonkey.devmenu.util.ResultListener;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.CharacterIterator;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.StringCharacterIterator;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Контекстное меню управления данными
|
||||
*/
|
||||
public class LongPressContextMenu extends AlertDialog.Builder implements FileAction {
|
||||
|
||||
private File chosenFile;
|
||||
private MainActivity activity;
|
||||
private static final String LOG_TAG = "LongPressContextMenu";
|
||||
|
||||
private AlertDialog show;
|
||||
private ReplacementDataBaseHelper dataBaseHelper;
|
||||
private SQLiteDatabase writableDatabase;
|
||||
private ContentValues values;
|
||||
|
||||
private File generateReplacementFile(){
|
||||
Random random = new Random();
|
||||
int index = random.nextInt();
|
||||
index = (index < 0) ? index * -1 : index;
|
||||
String nameReplacedOriginal = "replacement_" + index + "";
|
||||
File original = new File(UtilitiesAndData.getReplacementsStorage() + File.separator + nameReplacedOriginal);
|
||||
try {
|
||||
original.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
public static String humanReadableByteCountSI(long bytes) {
|
||||
if (-1000 < bytes && bytes < 1000) {
|
||||
return bytes + " B";
|
||||
}
|
||||
CharacterIterator ci = new StringCharacterIterator("kMGTPE");
|
||||
while (bytes <= -999_950 || bytes >= 999_950) {
|
||||
bytes /= 1000;
|
||||
ci.next();
|
||||
}
|
||||
return String.format("%.1f %cB", bytes / 1000.0, ci.current());
|
||||
}
|
||||
|
||||
public LongPressContextMenu(MainActivity activity, String pathToChosenElem) {
|
||||
super(activity);
|
||||
this.activity = activity;
|
||||
chosenFile = new File(pathToChosenElem);
|
||||
DynamicOptionsListView optionsView = new DynamicOptionsListView(activity);
|
||||
|
||||
this.dataBaseHelper = new ReplacementDataBaseHelper(activity);
|
||||
this.writableDatabase = dataBaseHelper.getDatabase();
|
||||
this.values = new ContentValues();
|
||||
|
||||
optionsView.addOption(activity.getString(R.string.replace_file_title), this::actionReplaceFile);
|
||||
optionsView.addOption(activity.getString(R.string.recover_file_title), this::actionRecoverFile);
|
||||
optionsView.addOption(activity.getString(R.string.remove_file_title), this::actionRemoveFile);
|
||||
optionsView.addOption(activity.getString(R.string.track_file_title), this::actionTrackTheFile);
|
||||
optionsView.addOption(activity.getString(R.string.file_props_title), this::actionGetPropsOfFile);
|
||||
optionsView.addOption(activity.getString(R.string.hide_file_title), this::actionHideTheFile);
|
||||
|
||||
setView(optionsView);
|
||||
setTitle(chosenFile.getName()
|
||||
+ " - " +
|
||||
((chosenFile.isDirectory()) ?
|
||||
activity.getString(R.string.folder_title) :
|
||||
activity.getString(R.string.file_title)));
|
||||
|
||||
this.show = show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void actionReplaceFile() {
|
||||
Intent chooseFile = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
chooseFile.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
chooseFile.setType("text/plain");
|
||||
activity.setResultListener(new ResultListener() {
|
||||
@Override
|
||||
public void onResult(Object object) {
|
||||
//Реализовать замену и воостановление данных
|
||||
Intent data;
|
||||
if(object instanceof Intent)
|
||||
data = (Intent) object;
|
||||
else return;
|
||||
|
||||
String selectedFileToReplace = "";
|
||||
selectedFileToReplace = data.getData().getPath();
|
||||
|
||||
//Создание файла куда будет складывться замена
|
||||
File replacement = generateReplacementFile();
|
||||
|
||||
//Копирование выбранного оригинального файла в хранилище замен
|
||||
//Иначе говоря, создание резервной копии
|
||||
String path = chosenFile.getAbsolutePath();
|
||||
copy(path, replacement.getPath());
|
||||
|
||||
//Непосредственная замена
|
||||
copy(selectedFileToReplace, path);
|
||||
|
||||
values.put(NAME_OF_BACKUPED_ELEMENT, replacement.getName());
|
||||
values.put(ReplacementDataBaseHelper.PATH_TO_REPLACED_ELEMENT, path);
|
||||
|
||||
//Запись в бд
|
||||
writableDatabase.insert(MAIN_TABLE_NAME, null, values);
|
||||
|
||||
writableDatabase.close();
|
||||
|
||||
activity.updateListView();
|
||||
show.cancel();
|
||||
//TODO Язык!!!!
|
||||
Toast.makeText(activity, "Заменено!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
activity.startActivityForResult(
|
||||
Intent.createChooser(chooseFile, "Choose a file"),
|
||||
OPEN_FILE_ON_REPLACE_REQUEST
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionRecoverFile() {
|
||||
String path = chosenFile.getAbsolutePath();
|
||||
UtilitiesAndData.recoverFile(path);
|
||||
activity.updateListView();
|
||||
show.cancel();
|
||||
//дщд
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionRemoveFile() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
|
||||
dialog.setTitle(activity.getString(R.string.remove_file_title));
|
||||
String message = String.format(activity.getString(R.string.sure_remove_title), chosenFile.getName());
|
||||
dialog.setMessage(message);
|
||||
|
||||
dialog.setPositiveButton(R.string.ok_title, (dialog1, which) -> {
|
||||
UtilitiesAndData.deleteRecursive(chosenFile);
|
||||
activity.updateListView();
|
||||
});
|
||||
dialog.setNegativeButton(R.string.cancel_title, null);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionTrackTheFile() {}
|
||||
|
||||
@Override
|
||||
public void actionGetPropsOfFile() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(activity);
|
||||
dialog.setTitle(chosenFile.getName()
|
||||
+ " - " +
|
||||
((chosenFile.isDirectory()) ?
|
||||
activity.getString(R.string.folder_title) :
|
||||
activity.getString(R.string.file_title)));
|
||||
|
||||
long lastModified = chosenFile.lastModified();
|
||||
Date date = new Date(lastModified);
|
||||
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss:SS");
|
||||
String formattedDate = sdf.format(date);
|
||||
|
||||
long size = getFileSize(chosenFile);
|
||||
|
||||
|
||||
dialog.setMessage(
|
||||
activity.getString(R.string.file_lastmod_title) + "\n" +
|
||||
formattedDate + "\n\n" +
|
||||
activity.getString(R.string.file_size_title) + "\n" +
|
||||
humanReadableByteCountSI(size) + " (" + size + " B)"
|
||||
);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionHideTheFile() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.components;
|
||||
|
||||
public interface OptionAction {
|
||||
void action();
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.dialog;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Environment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ea.games.nfs13_na.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class OpenFileDialog extends AlertDialog.Builder {
|
||||
|
||||
private String currentPath = Environment.getExternalStorageDirectory().getPath();
|
||||
private FilenameFilter filenameFilter;
|
||||
private List<File> files = new ArrayList<File>();
|
||||
private TextView title;
|
||||
private ListView listView;
|
||||
private int selectedIndex = -1;
|
||||
|
||||
public OpenFileDialog(Context context) {
|
||||
super(context);
|
||||
title = createTitle(context);
|
||||
changeTitle();
|
||||
LinearLayout linearLayout = createMainLayout(context);
|
||||
linearLayout.addView(createBackItem(context));
|
||||
files.addAll(getFiles(currentPath));
|
||||
listView = createListView(context);
|
||||
listView.setAdapter(new FileAdapter(context, files));
|
||||
linearLayout.addView(listView);
|
||||
setCustomTitle(title)
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(R.string.ok_title, (dialog, which) -> {
|
||||
if (selectedIndex > -1 && listener != null) {
|
||||
listener.OnSelectedFile(listView.getItemAtPosition(selectedIndex).toString());
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel_title, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertDialog show() {
|
||||
files.addAll(getFiles(currentPath));
|
||||
listView.setAdapter(new FileAdapter(getContext(), files));
|
||||
return super.show();
|
||||
}
|
||||
|
||||
private <T> List<T> asList(T[] a){
|
||||
return Arrays.asList(a);
|
||||
}
|
||||
|
||||
private List<File> getFiles(String directoryPath){
|
||||
File directory = new File(directoryPath);
|
||||
List<File> fileList = asList(directory.listFiles(filenameFilter));
|
||||
Collections.sort(fileList, (file, file2) -> {
|
||||
if (file.isDirectory() && file2.isFile())
|
||||
return -1;
|
||||
else if (file.isFile() && file2.isDirectory())
|
||||
return 1;
|
||||
else
|
||||
return file.getPath().compareTo(file2.getPath());
|
||||
});
|
||||
return fileList;
|
||||
}
|
||||
|
||||
private TextView createTextView(Context context, int style) {
|
||||
TextView textView = new TextView(context);
|
||||
textView.setTextAppearance(context, style);
|
||||
int itemHeight = getItemHeight(context);
|
||||
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, itemHeight));
|
||||
textView.setMinHeight(itemHeight);
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
textView.setPadding(15, 0, 0, 0);
|
||||
return textView;
|
||||
}
|
||||
|
||||
private int getItemHeight(Context context) {
|
||||
TypedValue value = new TypedValue();
|
||||
DisplayMetrics metrics = new DisplayMetrics();
|
||||
context.getTheme().resolveAttribute(android.R.attr.rowHeight, value, true);
|
||||
getDefaultDisplay(context).getMetrics(metrics);
|
||||
return (int)TypedValue.complexToDimension(value.data, metrics);
|
||||
}
|
||||
|
||||
public int getTextWidth(String text, Paint paint) {
|
||||
Rect bounds = new Rect();
|
||||
paint.getTextBounds(text, 0, text.length(), bounds);
|
||||
return bounds.left + bounds.width() + 80;
|
||||
}
|
||||
|
||||
private void changeTitle() {
|
||||
String titleText = currentPath;
|
||||
int screenWidth = getScreenSize(getContext()).x;
|
||||
int maxWidth = (int) (screenWidth * 0.99);
|
||||
if (getTextWidth(titleText, title.getPaint()) > maxWidth) {
|
||||
while (getTextWidth("..." + titleText, title.getPaint()) > maxWidth)
|
||||
{
|
||||
int start = titleText.indexOf("/", 2);
|
||||
if (start > 0)
|
||||
titleText = titleText.substring(start);
|
||||
else
|
||||
titleText = titleText.substring(2);
|
||||
}
|
||||
title.setText("..." + titleText);
|
||||
} else {
|
||||
title.setText(titleText);
|
||||
}
|
||||
}
|
||||
|
||||
private TextView createTitle(Context context) {
|
||||
TextView textView = new TextView(context);
|
||||
textView.setTextAppearance(context, android.R.style.TextAppearance_DeviceDefault_DialogWindowTitle);
|
||||
int itemHeight = getItemHeight(context);
|
||||
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, itemHeight));
|
||||
textView.setMinHeight(itemHeight);
|
||||
textView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
textView.setPadding(15, 0, 0, 0);
|
||||
textView.setText(currentPath);
|
||||
return textView;
|
||||
}
|
||||
|
||||
private void RebuildFiles(ArrayAdapter<File> adapter) {
|
||||
try{
|
||||
List<File> fileList = getFiles(currentPath);
|
||||
files.clear();
|
||||
selectedIndex = -1;
|
||||
files.addAll(fileList);
|
||||
adapter.notifyDataSetChanged();
|
||||
changeTitle();
|
||||
} catch (NullPointerException e){
|
||||
Toast.makeText(getContext(), android.R.string.unknownName, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public OpenFileDialog setFilter(final String filter) {
|
||||
filenameFilter = (file, fileName) -> {
|
||||
File tempFile = new File(String.format("%s/%s", file.getPath(), fileName));
|
||||
if (tempFile.isFile())
|
||||
return tempFile.getName().matches(filter);
|
||||
return true;
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
private ListView createListView(Context context) {
|
||||
ListView listView = new ListView(context);
|
||||
listView.setOnItemClickListener((adapterView, view, index, l) -> {
|
||||
FileAdapter adapter = (FileAdapter) adapterView.getAdapter();
|
||||
File file = adapter.getItem(index);
|
||||
if (file.isDirectory()) {
|
||||
currentPath = file.getPath();
|
||||
RebuildFiles(adapter);
|
||||
} else {
|
||||
if (index != selectedIndex)
|
||||
selectedIndex = index;
|
||||
else
|
||||
selectedIndex = -1;
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
return listView;
|
||||
}
|
||||
|
||||
private static Display getDefaultDisplay(Context context) {
|
||||
return ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||
}
|
||||
|
||||
private static Point getScreenSize(Context context) {
|
||||
Point screeSize = new Point();
|
||||
getDefaultDisplay(context).getSize(screeSize);
|
||||
return screeSize;
|
||||
}
|
||||
|
||||
private LinearLayout createMainLayout(Context context) {
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
linearLayout.setMinimumHeight(750);
|
||||
return linearLayout;
|
||||
}
|
||||
|
||||
private TextView createBackItem(Context context) {
|
||||
TextView textView = createTextView(context, android.R.style.TextAppearance_DeviceDefault_Small);
|
||||
Drawable drawable = getContext().getResources().getDrawable(android.R.drawable.ic_menu_directions);
|
||||
drawable.setBounds(0, 0, 60, 60);
|
||||
textView.setCompoundDrawables(drawable, null, null, null);
|
||||
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
textView.setOnClickListener(view -> {
|
||||
File file = new File(currentPath);
|
||||
File parentDirectory = file.getParentFile();
|
||||
if (parentDirectory != null) {
|
||||
currentPath = parentDirectory.getPath();
|
||||
RebuildFiles(((FileAdapter) listView.getAdapter()));
|
||||
}
|
||||
});
|
||||
return textView;
|
||||
}
|
||||
|
||||
class FileAdapter extends ArrayAdapter<File> {
|
||||
|
||||
public FileAdapter(Context context, List files) {
|
||||
super(context, android.R.layout.simple_list_item_1, files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView view = (TextView) super.getView(position, convertView, parent);
|
||||
File file = getItem(position);
|
||||
view.setText(file.getName());
|
||||
if (selectedIndex == position)
|
||||
view.setBackgroundColor(getContext().getResources().getColor(android.R.color.holo_blue_light));
|
||||
else
|
||||
view.setBackgroundColor(getContext().getResources().getColor(android.R.color.background_dark));
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OpenDialogListener{
|
||||
void OnSelectedFile(String fileName);
|
||||
}
|
||||
private OpenDialogListener listener;
|
||||
|
||||
public OpenFileDialog setOpenDialogListener(OpenDialogListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.devmenu.util.SaveManager;
|
||||
import com.ea.ironmonkey.devmenu.util.UtilitiesAndData;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Диалог для содания бандлов
|
||||
* Сам умеет их создавать
|
||||
*/
|
||||
public class SvmwCreatorDialog extends AlertDialog {
|
||||
|
||||
private EditText nameEdit;
|
||||
private EditText desEdit;
|
||||
private CheckBox isUseCurSaveBox;
|
||||
private View mainView;
|
||||
|
||||
private boolean useCurrentSave;
|
||||
|
||||
private SaveManager manager;
|
||||
private Context context;
|
||||
|
||||
private File svmwPath;
|
||||
|
||||
public SvmwCreatorDialog(Activity activity) {
|
||||
super(activity);
|
||||
context = activity.getApplicationContext();
|
||||
svmwPath = new File(UtilitiesAndData.getExternalStorage() + File.separator + "svmw");
|
||||
svmwPath.mkdir();
|
||||
setTitle("Создание SVMW");
|
||||
ImageButton a;
|
||||
|
||||
Button s;
|
||||
mainView = LayoutInflater
|
||||
.from(context)
|
||||
.inflate(R.layout.saves, null, false);
|
||||
|
||||
nameEdit = (EditText) mainView.findViewById(R.id.name_svmw);
|
||||
desEdit = (EditText) mainView.findViewById(R.id.des_svmw);
|
||||
|
||||
isUseCurSaveBox = (CheckBox) mainView.findViewById(R.id.isUseCurrentSave);
|
||||
manager = new SaveManager(context);
|
||||
|
||||
//Конпка создания
|
||||
setButton(context.getText(R.string.create_svmw_file_title), (dialog, witch) -> {
|
||||
String name = getTextFrom(nameEdit);
|
||||
String des = getTextFrom(desEdit);
|
||||
if(name.isEmpty() | des.isEmpty()){
|
||||
Toast.makeText(context, context.getText(R.string.toast_strings_must_be_entered), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
File to = new File(svmwPath.getAbsolutePath() + File.separator + name + ".svmw");
|
||||
try {
|
||||
to.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
manager.createBundleFile(des, to, UtilitiesAndData.getSaveFile());
|
||||
});
|
||||
//Кнопка отмены
|
||||
setButton2(context.getText(R.string.cancel_title), (OnClickListener) null);
|
||||
//Кнопка выбора отдельного файла
|
||||
setButton3(context.getString(R.string.choose_svmw_file_title), (dialog, witch) -> {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("file/*");
|
||||
getOwnerActivity().startActivityForResult(intent, 228);
|
||||
});
|
||||
|
||||
isUseCurSaveBox.setOnCheckedChangeListener((buttonView, isChecked) -> getButton(AlertDialog.BUTTON3).setEnabled(!isChecked));
|
||||
|
||||
|
||||
// Если включена опция "Использовать текущее сохранение" то заюлокировтаь кнопку выбора файла сохранения
|
||||
|
||||
setView(mainView);
|
||||
}
|
||||
|
||||
private String getTextFrom(EditText editText){
|
||||
return editText.getText().toString();
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.dialog;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ea.games.nfs13_na.R;
|
||||
import com.ea.ironmonkey.devmenu.util.SaveManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Диалог выбора и просмотра информации об svmw файле
|
||||
*/
|
||||
public class SvmwInspectorDialog extends AlertDialog {
|
||||
|
||||
private SaveManager manager;
|
||||
private View mainView;
|
||||
private boolean isWork;
|
||||
private TextView description;
|
||||
private TextView time;
|
||||
|
||||
public SvmwInspectorDialog(Context context, File svmw) {
|
||||
super(context);
|
||||
manager = new SaveManager(context);
|
||||
//Если пришедший файл - svmw иницализируем работу с ним если нет
|
||||
// то выходим
|
||||
// и ничего интересного не показываем((
|
||||
isWork = manager.isSvmwFile(svmw);
|
||||
if(isWork){
|
||||
|
||||
setTitle("Файл - " + svmw.getName());
|
||||
|
||||
mainView = LayoutInflater
|
||||
.from(context)
|
||||
.inflate(R.layout.inspector, null, false);
|
||||
|
||||
description = (TextView) mainView.findViewById(R.id.description);
|
||||
description.setText(manager.getDescriptionOf(svmw));
|
||||
|
||||
time = (TextView) mainView.findViewById(R.id.date);
|
||||
Date dateOfCreate = manager.getDateOfCreateOf(svmw);
|
||||
String format = SaveManager.dateFormat.format(dateOfCreate);
|
||||
time.setText(time.getText() + ": " + format);
|
||||
|
||||
setButton(context.getString(R.string.title_load_svmw), (dialog, which) -> {
|
||||
manager.loadBundleFile(svmw);
|
||||
});
|
||||
setButton2(context.getString(R.string.cancel_title), (OnClickListener) null);
|
||||
|
||||
setView(mainView);
|
||||
|
||||
|
||||
}else Toast.makeText(context, "Это не svmw!", Toast.LENGTH_LONG).show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(isWork) super.show();
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.util;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class Observer {
|
||||
|
||||
private static final String LOG_TAG = "Observer";
|
||||
|
||||
public static void onCallingMethod(Method... states){
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
|
||||
Log.i(LOG_TAG, "info{");
|
||||
if(states.length != 0){
|
||||
Log.i(LOG_TAG, "States of method:");
|
||||
for(Method mthd : states){
|
||||
Log.i(LOG_TAG, "\t" + mthd.title);
|
||||
}
|
||||
Log.i(LOG_TAG, "\n");
|
||||
}
|
||||
for(int i = 1; i < stackTrace.length; i++) {
|
||||
Log.i(LOG_TAG, "\t" + stackTrace[i]);
|
||||
}
|
||||
Log.i(LOG_TAG, "}");
|
||||
}
|
||||
|
||||
private interface MethodCallingCounter{
|
||||
|
||||
|
||||
void call();
|
||||
|
||||
}
|
||||
|
||||
/** Перечисление состояний методов при из анализе и изменении, доработке */
|
||||
public enum Method implements MethodCallingCounter{
|
||||
/** Состояние невозможгости декомпиляции */
|
||||
IMPOSSIBLE_TO_DECOMPILE("Impossible to decompile"){
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/** Уровни подозртельности работы методов при их воостановлении после
|
||||
декомпиляции, или их доработке и изменеии.
|
||||
|
||||
/** Зеленая зона. Небольшие подозрения */
|
||||
SUSPICIOUS_METHOD("Suspicious method"){
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/** Желтая зона. уже более подозрительны метод, что ставит под вопрос корректоность отрработки некторого функционала */
|
||||
VERY_SUSPICIOUS_METHOD("Very suspicious Method") {
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/** Красная зона. Опасный метод который может привести к фатальным ошибкам */
|
||||
HAZARD_METHOD("Hazard method") {
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/** Уровни воостонавливаемости кода */
|
||||
HARD_TO_RECOVER_LOGIC("Hard to recover logic of method") {
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
ON_CATCHING_EXCEPTION("on catching exception") {
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
RETURN_NULL("Method returns null") {
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
SOME_PACKAGE_IS_DELETED("Some package is deleted"){
|
||||
@Override
|
||||
public void call() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
private String title;
|
||||
|
||||
Method(String title) {
|
||||
this.title = title;
|
||||
//this.call();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class ReplacementDataBaseHelper extends SQLiteOpenHelper {
|
||||
|
||||
public static final String MAIN_TABLE_NAME = "Replacements";
|
||||
public static final String PATH_TO_REPLACED_ELEMENT = "Path";
|
||||
public static final String NAME_OF_BACKUPED_ELEMENT = "Original_element";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
public SQLiteDatabase getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
private SQLiteDatabase database;
|
||||
|
||||
|
||||
public ReplacementDataBaseHelper(Context context) {
|
||||
super(context, MAIN_TABLE_NAME + ".db", (SQLiteDatabase.CursorFactory) (db, masterQuery, editTable, query) -> null, DATABASE_VERSION);
|
||||
database = context.openOrCreateDatabase(MAIN_TABLE_NAME + ".db", Context.MODE_PRIVATE, null);
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS " + MAIN_TABLE_NAME + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
+ PATH_TO_REPLACED_ELEMENT + " TEXT,"
|
||||
+ NAME_OF_BACKUPED_ELEMENT + " TEXT);");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.util;
|
||||
|
||||
public interface ResultListener {
|
||||
|
||||
default void onResult(Object data){}
|
||||
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Менедженер создания и загрузки сохранений в игру<br/>
|
||||
* Создает bundle-файлы .svmw и загружает их<br/>
|
||||
* Умеет загружать обчные .sb сохранения в игру
|
||||
*/
|
||||
public class SaveManager {
|
||||
|
||||
private Context context;
|
||||
private static final String LOG_TAG = "SaveManager";
|
||||
private static final byte[] svmw_header = "SVMW".getBytes(StandardCharsets.UTF_8);
|
||||
private static final byte[] save_header = "SBIN".getBytes(StandardCharsets.UTF_8);
|
||||
public static final String dateFormatStr = "dd.MM.yy:hh:mm:ss";
|
||||
public static final SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatStr);
|
||||
|
||||
public SaveManager(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public File createBundleFile(String description, File fileToSave, File save) {
|
||||
|
||||
if (fileToSave.exists()) fileToSave.delete();
|
||||
|
||||
try {
|
||||
fileToSave.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(fileToSave);
|
||||
|
||||
Date date = new Date();
|
||||
|
||||
Long time = date.getTime();
|
||||
|
||||
ByteBuffer bb = ByteBuffer.allocate(Long.SIZE);
|
||||
bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
bb.putLong(time);
|
||||
bb.flip();
|
||||
//bb.
|
||||
String curDate = dateFormat.format(new Date());
|
||||
|
||||
fos.write(svmw_header);
|
||||
fos.write(curDate.getBytes(StandardCharsets.UTF_8));
|
||||
fos.write(description.getBytes(StandardCharsets.UTF_8));
|
||||
fos.write(UtilitiesAndData.fileAsByteArray(save));
|
||||
} catch (IOException e) {
|
||||
Log.i("lol", fileToSave.getAbsolutePath());
|
||||
//fileToSave.getAbsolutePath()
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return fileToSave;
|
||||
}
|
||||
|
||||
public void loadBundleFile(File svmw) {
|
||||
|
||||
if(isSvmwFile(svmw)){
|
||||
byte[] byteFile = UtilitiesAndData.fileAsByteArray(svmw);
|
||||
int headerInByteFile = UtilitiesAndData.findHeaderInByteFile(byteFile, save_header);
|
||||
byte[] result = new byte[byteFile.length - headerInByteFile];
|
||||
System.arraycopy(byteFile, headerInByteFile, result, 0, result.length);
|
||||
File dest = new File("/data/data/" + context.getPackageName() + "/files/var/nfstr_save.sb");
|
||||
if(!dest.exists()) {
|
||||
try {
|
||||
dest.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(dest);
|
||||
fos.write(result);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getDescriptionOf(File svmw){
|
||||
if(isSvmwFile(svmw)){
|
||||
int offset = svmw_header.length + dateFormatStr.length();
|
||||
byte[] byteFile = UtilitiesAndData.fileAsByteArray(svmw);
|
||||
int headerInByteFile = UtilitiesAndData.findHeaderInByteFile(byteFile, save_header);
|
||||
return new String(byteFile, offset, headerInByteFile - offset, StandardCharsets.UTF_8);
|
||||
}
|
||||
Log.i(LOG_TAG, "getDescription(), this is not a svmw file((( Return empty description(((");
|
||||
return "";
|
||||
}
|
||||
|
||||
public Date getDateOfCreateOf(File svmw){
|
||||
if(isSvmwFile(svmw)){
|
||||
int offset = svmw_header.length;
|
||||
byte[] byteFile = UtilitiesAndData.fileAsByteArray(svmw);
|
||||
|
||||
String s = new String(byteFile, offset, dateFormatStr.length(), StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
return dateFormat.parse(s);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Log.i(LOG_TAG, "getDateOfCreateOf, this is not a svmw file((( Return null date(((");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void loadSaveFile(File save) {
|
||||
if(isSaveFile(save)){
|
||||
copySave(save);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSaveFile(File save) {
|
||||
if(!save.exists() | isEmptyFile(save)) return false;
|
||||
byte[] arr = UtilitiesAndData.fileAsByteArray(save);
|
||||
for (int i = 0; i < save_header.length; i++)
|
||||
if (save_header[i] != arr[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isSvmwFile(File svmw) {
|
||||
if(!svmw.exists() | isEmptyFile(svmw)) return false;
|
||||
byte[] arr = UtilitiesAndData.fileAsByteArray(svmw);
|
||||
for (int i = 0; i < svmw_header.length; i++)
|
||||
if (svmw_header[i] != arr[i]) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean isEmptyFile(File file){
|
||||
return UtilitiesAndData.fileAsByteArray(file).length == 0;
|
||||
}
|
||||
|
||||
|
||||
public void copySave(File save){
|
||||
|
||||
File source = save;
|
||||
|
||||
File dest = new File("/data/data/" + context.getPackageName() + "/files/var/nfstr_save.sb");
|
||||
|
||||
|
||||
if(!dest.exists()) {
|
||||
try {
|
||||
dest.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
try {
|
||||
is = new FileInputStream(source);
|
||||
os = new FileOutputStream(dest);
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = is.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, length);
|
||||
}
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,290 +0,0 @@
|
||||
package com.ea.ironmonkey.devmenu.util;
|
||||
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.MAIN_TABLE_NAME;
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.NAME_OF_BACKUPED_ELEMENT;
|
||||
import static com.ea.ironmonkey.devmenu.util.ReplacementDataBaseHelper.PATH_TO_REPLACED_ELEMENT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class UtilitiesAndData {
|
||||
|
||||
private static Context context;
|
||||
private static FileOutputStream stream;
|
||||
public static final int OPEN_FILE_ON_REPLACE_REQUEST = 100;
|
||||
public static final int READ_FILE_REQUEST_CODE = 101;
|
||||
|
||||
private static final String LOG_TAG = "UtilitiesAndData";
|
||||
|
||||
public static void init(Context context){
|
||||
UtilitiesAndData.context = context;
|
||||
}
|
||||
|
||||
public static void setLogger(File file){
|
||||
if(file.exists()){
|
||||
try {
|
||||
stream = new FileOutputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.wtf(LOG_TAG, "cant create out stream(((");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteRecursive(File fileOrDirectory) {
|
||||
if (fileOrDirectory.isDirectory())
|
||||
for (File child : fileOrDirectory.listFiles())
|
||||
deleteRecursive(child);
|
||||
|
||||
fileOrDirectory.delete();
|
||||
}
|
||||
|
||||
public static boolean isLoggerEnabled(){
|
||||
return stream != null;
|
||||
}
|
||||
|
||||
public static void printLog(String msg){
|
||||
try{
|
||||
if(isLoggerEnabled())
|
||||
stream.write(msg.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IOException e) {
|
||||
Log.wtf(LOG_TAG, "cant write to stream(((");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getInternalStorage(){
|
||||
return "/data/data/" + context.getPackageName();
|
||||
}
|
||||
|
||||
public static String getExternalStorage(){
|
||||
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + context.getPackageName() + "/files";
|
||||
}
|
||||
|
||||
public static File getDevMenuSwitcher(){
|
||||
return new File(UtilitiesAndData.getExternalStorage() + File.separator + "DevMenu");
|
||||
}
|
||||
|
||||
public static File getSaveFile(){
|
||||
File save = new File(getInternalStorage() + File.separator + "files" + File.separator + "var" + File.separator + "nfstr_save.sb");
|
||||
if(!save.exists()) {
|
||||
try {
|
||||
save.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return save;
|
||||
}
|
||||
|
||||
public static String getReplacementsStorage(){
|
||||
return getInternalStorage() + File.separator + "replace";
|
||||
}
|
||||
|
||||
public static boolean isFirstRun(){
|
||||
File temp = new File(getInternalStorage() + File.separator + "load");
|
||||
try {
|
||||
if(!temp.exists()){
|
||||
temp.createNewFile();
|
||||
return true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final String[] exclusionNamesArr = {
|
||||
|
||||
"replace",
|
||||
"lib",
|
||||
"databases"
|
||||
|
||||
};
|
||||
|
||||
public static void copy(File from, File to){
|
||||
copy(from.getAbsolutePath(), to.getAbsolutePath());
|
||||
}
|
||||
|
||||
public static void copy(String from, String to) {
|
||||
File source = new File(from);
|
||||
|
||||
File dest = new File(to);
|
||||
|
||||
|
||||
if (!dest.exists()) {
|
||||
try {
|
||||
dest.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
try {
|
||||
is = new FileInputStream(source);
|
||||
os = new FileOutputStream(dest);
|
||||
Math.max(getFileSize(source), getFileSize(dest));
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = is.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, length);
|
||||
}
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e("lol", e.toString());
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
Log.e("lol1", e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static long getFileSize(final File file) {
|
||||
if (file == null || !file.exists())
|
||||
return 0;
|
||||
if (!file.isDirectory())
|
||||
return file.length();
|
||||
final List<File> dirs = new LinkedList<>();
|
||||
dirs.add(file);
|
||||
long result = 0;
|
||||
while (!dirs.isEmpty()) {
|
||||
final File dir = dirs.remove(0);
|
||||
if (!dir.exists())
|
||||
continue;
|
||||
final File[] listFiles = dir.listFiles();
|
||||
if (listFiles == null || listFiles.length == 0)
|
||||
continue;
|
||||
for (final File child : listFiles) {
|
||||
result += child.length();
|
||||
if (child.isDirectory())
|
||||
dirs.add(child);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final Set<String> exclusionNames = new HashSet<>(Arrays.asList(exclusionNamesArr));
|
||||
|
||||
public static boolean isExclusionName(String name){
|
||||
return exclusionNames.contains(name);
|
||||
}
|
||||
|
||||
|
||||
public static void recoverFile(String path){
|
||||
ReplacementDataBaseHelper dataBaseHelper = new ReplacementDataBaseHelper(context);
|
||||
SQLiteDatabase writableDatabase = dataBaseHelper.getDatabase();
|
||||
Cursor query = writableDatabase.rawQuery("SELECT " + PATH_TO_REPLACED_ELEMENT + " , " + NAME_OF_BACKUPED_ELEMENT + " FROM " + MAIN_TABLE_NAME + " WHERE " + PATH_TO_REPLACED_ELEMENT + " = \"" + path + "\"", null);
|
||||
if(query.getCount() == 1) {
|
||||
query.moveToFirst();
|
||||
//Путь к заменяемому файлу
|
||||
String pathToReplace = query.getString(query.getColumnIndex(PATH_TO_REPLACED_ELEMENT));
|
||||
//Имя бэкапа
|
||||
String nameFile = query.getString(query.getColumnIndex(NAME_OF_BACKUPED_ELEMENT));
|
||||
|
||||
//Файл замены
|
||||
File toReplace = new File(pathToReplace);
|
||||
|
||||
//Файл бэкапа
|
||||
File backup = new File(UtilitiesAndData.getReplacementsStorage() + File.separator + nameFile);
|
||||
|
||||
copy(backup, toReplace);
|
||||
|
||||
writableDatabase.delete(MAIN_TABLE_NAME, PATH_TO_REPLACED_ELEMENT + " = ?", new String[]{path});
|
||||
backup.delete();
|
||||
}
|
||||
|
||||
query.close();
|
||||
}
|
||||
|
||||
public static byte[] generateMD5(File file){
|
||||
try {
|
||||
return DigestUtils.md5(new FileInputStream(file));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new byte[1];
|
||||
}
|
||||
|
||||
public static void getInfoAboutFile(File file){
|
||||
Log.i(LOG_TAG, "Info about File -> " + file.getAbsolutePath());
|
||||
if(file.exists()){
|
||||
if(file.isFile()) {
|
||||
Log.i(LOG_TAG, "isCanRead = " + file.canRead());
|
||||
Log.i(LOG_TAG, "isCanWrite = " + file.canWrite());
|
||||
Log.i(LOG_TAG, "isCanExecute = " + file.canExecute());
|
||||
}else
|
||||
Log.i(LOG_TAG, "its dir!");
|
||||
}else
|
||||
Log.wtf(LOG_TAG, "it does not exists!");
|
||||
}
|
||||
|
||||
public static byte[] fileAsByteArray(File file){
|
||||
byte[] b = new byte[(int) file.length()];
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
fileInputStream.read(b);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void saveBytesToFile(byte[] bytes, File saveTo){
|
||||
try{
|
||||
saveTo.createNewFile();
|
||||
FileOutputStream outputStream = new FileOutputStream(saveTo);
|
||||
outputStream.write(bytes);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static int findHeaderInByteFile(byte[] byteFile, byte[] header){
|
||||
int[] pf = prefix(header);
|
||||
int index = 0;
|
||||
for (int i = 0; i < byteFile.length; i++){
|
||||
while (index > 0 && header[index] != byteFile[i]) index = pf[index - 1];
|
||||
if (header[index] == byteFile[i]) index++;
|
||||
if (index == header.length) return i - index + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Префикс функция для алгоритма КМП
|
||||
*/
|
||||
private static int[] prefix(byte[] s) {
|
||||
int[] result = new int[s.length];
|
||||
result[0] = 0;
|
||||
int index = 0;
|
||||
|
||||
for (int i = 1; i < s.length; i++) {
|
||||
while (index >= 0 && s[index] != s[i]) { index--; }
|
||||
index++;
|
||||
result[i] = index;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.app.Activity
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.ea.nimble.ApplicationEnvironmentImpl;
|
||||
import com.ea.nimble.BaseCore;
|
||||
import com.ea.nimble.IApplicationEnvironment;
|
||||
|
||||
public class ApplicationEnvironment {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.applicationEnvironment";
|
||||
public static final String NOTIFICATION_AGE_COMPLIANCE_REFRESHED = "nimble.notification.age_compliance_refreshed";
|
||||
|
||||
public static IApplicationEnvironment getComponent() {
|
||||
return BaseCore.getInstance().getApplicationEnvironment();
|
||||
}
|
||||
|
||||
public static Activity getCurrentActivity() {
|
||||
return ApplicationEnvironmentImpl.getCurrentActivity();
|
||||
}
|
||||
|
||||
public static boolean isMainApplicationRunning() {
|
||||
return ApplicationEnvironmentImpl.isMainApplicationRunning();
|
||||
}
|
||||
|
||||
public static void setCurrentActivity(Activity activity) {
|
||||
ApplicationEnvironmentImpl.setCurrentActivity(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
|
||||
import com.ea.nimble.Log.Helper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ApplicationEnvironmentImpl
|
||||
extends Component
|
||||
implements IApplicationEnvironment,
|
||||
LogSource {
|
||||
private static final int MILLIS_IN_AN_HOUR = 3600000;
|
||||
private static final String NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID = "nimble_applicationenvironment_game_specified_id";
|
||||
private static final String PERSISTENCE_AGE_REQUIREMENTS = "ageRequirement";
|
||||
private static final String PERSISTENCE_LANGUAGE = "language";
|
||||
private static final String PERSISTENCE_TIME_RETRIEVED = "timeRetrieved";
|
||||
private static final String SYNERGY_API_GET_AGE_REQUIREMENTS = "/rest/agerequirements/ip";
|
||||
private static boolean isMainApplicationRunning = false;
|
||||
private static Activity s_currentActivity = null;
|
||||
private Context m_context;
|
||||
private BaseCore m_core;
|
||||
private String m_gameSpecifiedPlayerId;
|
||||
private boolean m_googleAdvertiserInfoLoaded;
|
||||
private String m_googleAdvertisingId;
|
||||
private boolean m_googleLimitAdTrackingEnabled;
|
||||
private String m_language;
|
||||
private String m_packageId;
|
||||
private String m_version;
|
||||
|
||||
ApplicationEnvironmentImpl(BaseCore fileArray) {
|
||||
int n2 = 0;
|
||||
this.m_googleAdvertisingId = "";
|
||||
this.m_googleLimitAdTrackingEnabled = true;
|
||||
this.m_googleAdvertiserInfoLoaded = false;
|
||||
if (s_currentActivity == null) {
|
||||
throw new AssertionError("Cannot create a ApplicationEnvironment without a valid current activity");
|
||||
}
|
||||
this.m_core = fileArray;
|
||||
this.m_context = s_currentActivity.getApplicationContext();
|
||||
this.m_language = null;
|
||||
File documentPath = new File(this.getDocumentPath());
|
||||
File tempPath = new File(this.getTempPath());
|
||||
if (!documentPath.exists()) {
|
||||
if (!documentPath.mkdirs()) throw new AssertionError("APP_ENV: Cannot create necessary folder");
|
||||
}
|
||||
Log.i("lol", tempPath.getAbsolutePath());
|
||||
if (!tempPath.exists() && !tempPath.mkdirs()) {
|
||||
throw new AssertionError("APP_ENV: Cannot create necessary folder");
|
||||
}
|
||||
File[] files = tempPath.listFiles();
|
||||
int n3 = files.length;
|
||||
while (n2 < n3) {
|
||||
tempPath = files[n2];
|
||||
tempPath.delete();
|
||||
Log.d("Nimble", "APP_ENV: Delete temp file " + tempPath.getName());
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ String access$002(ApplicationEnvironmentImpl applicationEnvironmentImpl, String string2) {
|
||||
applicationEnvironmentImpl.m_googleAdvertisingId = string2;
|
||||
return string2;
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean access$102(ApplicationEnvironmentImpl applicationEnvironmentImpl, boolean bl2) {
|
||||
applicationEnvironmentImpl.m_googleLimitAdTrackingEnabled = bl2;
|
||||
return bl2;
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean access$202(ApplicationEnvironmentImpl applicationEnvironmentImpl, boolean bl2) {
|
||||
applicationEnvironmentImpl.m_googleAdvertiserInfoLoaded = bl2;
|
||||
return bl2;
|
||||
}
|
||||
|
||||
private static boolean commandExists(String string2) {
|
||||
String path = System.getenv("PATH");
|
||||
if (path == null) {
|
||||
return false;
|
||||
}
|
||||
String[] split = path.split(Pattern.quote(File.pathSeparator));
|
||||
int n2 = split.length;
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
if (new File(split[n3], string2).exists()) {
|
||||
return true;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Activity getCurrentActivity() {
|
||||
return s_currentActivity;
|
||||
}
|
||||
|
||||
private String getDeviceLanguage() {
|
||||
return Locale.getDefault().toString();
|
||||
}
|
||||
|
||||
public static boolean isMainApplicationRunning() {
|
||||
return isMainApplicationRunning;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private void retrieveGoogleAdvertiserId() {
|
||||
|
||||
}
|
||||
|
||||
private void setApplicationLanguageCode(String object, boolean bl2) {
|
||||
if ((object = this.validatedLanguageCode((String)object, bl2)) == null) {
|
||||
return;
|
||||
}
|
||||
if (this.m_language != null && this.m_language.equals(object)) {
|
||||
if (bl2) {
|
||||
Helper.LOGD(this, "Setting the same language %s, skipping assignment", this.m_language);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.m_language = object;
|
||||
Helper.LOGI(this, "Successfully set language to %s.", this.m_language);
|
||||
Utility.sendBroadcast("nimble.notification.LanguageChanged", null);
|
||||
}
|
||||
if (bl2) return;
|
||||
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.applicationEnvironment", Persistence.Storage.DOCUMENT);
|
||||
if (persistenceForNimbleComponent != null) {
|
||||
Helper.LOGD(this, "Saving language data to persistence.");
|
||||
persistenceForNimbleComponent.setValue(PERSISTENCE_LANGUAGE, (Serializable)((Object)this.m_language));
|
||||
return;
|
||||
}
|
||||
Helper.LOGE(this, "Could not get application environment persistence object to save to.");
|
||||
}
|
||||
|
||||
public static void setCurrentActivity(Activity activity) {
|
||||
isMainApplicationRunning = true;
|
||||
s_currentActivity = activity;
|
||||
}
|
||||
|
||||
private String validatedLanguageCode(String string2, boolean bl2) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Helper.LOGI(this, "AppEnv: Language parameter is null or empty; keeping language at previous value.");
|
||||
return null;
|
||||
}
|
||||
string2 = string2.replace('_', '-');
|
||||
Object object = Pattern.compile("^([a-z]{2,3})?(-([A-Z][a-z]{3}))?(-([A-Z]{2}))?(-.*)*$").matcher(string2);
|
||||
if (!((Matcher)object).find()) {
|
||||
Helper.LOGE(this, "Malformed language code " + string2 + " cannot be validated; backend system will likely treat it as en-US.");
|
||||
return string2;
|
||||
}
|
||||
String string3 = ((Matcher)object).group(1);
|
||||
if (Utility.validString(string3) && !Arrays.asList(Locale.getISOLanguages()).contains(string3)) {
|
||||
Helper.LOGE(this, "Unknown language code " + string3 + " in language code " + string2 + "; backend system will likely treat it as en-US.");
|
||||
}
|
||||
if (!Utility.validString((String)(object = ((Matcher)object).group(5)))) return string2;
|
||||
if (Arrays.asList(Locale.getISOCountries()).contains(object)) return string2;
|
||||
Helper.LOGE(this, "Unknown region code " + (String)object + " in language code " + string2 + "; backend system will likely treat it as en-US.");
|
||||
return string2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAgeCompliance() {
|
||||
Persistence persistence = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.applicationEnvironment", Persistence.Storage.CACHE);
|
||||
Serializable serializable = persistence.getValue(PERSISTENCE_TIME_RETRIEVED);
|
||||
if (serializable != null) {
|
||||
if ((int)(new Date().getTime() - (Long)serializable) / 3600000 <= 24) return (Integer)persistence.getValue(PERSISTENCE_AGE_REQUIREMENTS);
|
||||
Helper.LOGI(this, "getAgeCompliance- Stored value is older than 24 hours. Call refreshAgeCompliance to retrieve minAgeCompliance", new Object[]{null});
|
||||
return -1;
|
||||
}
|
||||
Helper.LOGI(this, "getAgeCompliance- No stored value in persistance. Call refreshAgeCompliance to retrieve minAgeCompliance.", new Object[]{null});
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApplicationBundleId() {
|
||||
if (this.m_packageId != null) return this.m_packageId;
|
||||
Context context = this.getApplicationContext();
|
||||
if (context == null) return this.m_packageId;
|
||||
this.m_packageId = context.getPackageName();
|
||||
return this.m_packageId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context getApplicationContext() {
|
||||
return this.m_context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApplicationLanguageCode() {
|
||||
return this.m_language;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApplicationName() {
|
||||
Context context = this.getApplicationContext();
|
||||
if (context != null) return context.getPackageManager().getApplicationLabel(context.getApplicationInfo()).toString();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApplicationVersion() {
|
||||
if (this.m_version != null) return this.m_version;
|
||||
Context context = this.getApplicationContext();
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
this.m_version = context.getPackageManager().getPackageInfo((String)context.getPackageName(), (int)0).versionName;
|
||||
return this.m_version;
|
||||
}
|
||||
catch (PackageManager.NameNotFoundException nameNotFoundException) {
|
||||
Helper.LOGE(this, "Package name %s not found", context.getPackageName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCachePath() {
|
||||
return "/data/data/" + m_context.getPackageName() + File.separator + "cache" + File.separator + "Nimble" + File.separator + this.m_core.getConfiguration().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCarrier() {
|
||||
Context context = this.getApplicationContext();
|
||||
if (context != null) return ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getNetworkOperator();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.applicationEnvironment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceBrand() {
|
||||
return Build.BRAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceCodename() {
|
||||
return Build.DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceFingerprint() {
|
||||
return Build.FINGERPRINT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceManufacturer() {
|
||||
return Build.MANUFACTURER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceModel() {
|
||||
return Build.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeviceString() {
|
||||
return Build.MANUFACTURER + Build.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDocumentPath() {
|
||||
Context object = this.getApplicationContext();
|
||||
if (object == null) {
|
||||
String s = System.getProperty("user.dir") + File.separator + "doc";
|
||||
return s + File.separator + "Nimble" + File.separator + this.m_core.getConfiguration().toString();
|
||||
}
|
||||
String path = object.getFilesDir().getPath();
|
||||
return path + File.separator + "Nimble" + File.separator + this.m_core.getConfiguration().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGameSpecifiedPlayerId() {
|
||||
return this.m_gameSpecifiedPlayerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGoogleAdvertisingId() {
|
||||
long l2 = System.currentTimeMillis();
|
||||
while (!this.m_googleAdvertiserInfoLoaded) {
|
||||
if (System.currentTimeMillis() - l2 > 5000L) {
|
||||
this.m_googleAdvertiserInfoLoaded = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
catch (InterruptedException interruptedException) {
|
||||
Helper.LOGI(this, "Blocking call to getGoogleAdvertisingId was interrupted prematurely.");
|
||||
}
|
||||
}
|
||||
return this.m_googleAdvertisingId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGoogleEmail() {
|
||||
int n2 = 0;
|
||||
AccountManager accountArray = AccountManager.get(this.getApplicationContext());
|
||||
Account[] accountsByType = accountArray.getAccountsByType("com.google");
|
||||
if (accountsByType.length > 0) {
|
||||
return accountsByType[0].name;
|
||||
}
|
||||
Pattern emailAddress = Patterns.EMAIL_ADDRESS;
|
||||
Account[] accounts = accountArray.getAccounts();
|
||||
int n3 = accounts.length;
|
||||
while (n2 < n3) {
|
||||
Account account = accounts[n2];
|
||||
if (emailAddress.matcher(account.name).matches()) {
|
||||
return account.name;
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIadAttribution() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "AppEnv";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMACAddress() {
|
||||
Context context = this.getApplicationContext();
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
WifiInfo wifi = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo();
|
||||
if ( null != wifi ) return wifi.getMacAddress();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOsVersion() {
|
||||
return String.valueOf(Build.VERSION.SDK_INT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortApplicationLanguageCode() {
|
||||
if (this.m_language == null) return this.m_language;
|
||||
int n2 = this.m_language.indexOf(45);
|
||||
if (n2 == -1) return this.m_language;
|
||||
return this.m_language.substring(0, n2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTempPath() {
|
||||
return this.getCachePath() + File.separator + "temp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAppCracked() {
|
||||
Helper.LOGDS("FraudDetection", "Returning false for isAppCracked() since it hasn't been implemented yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeviceRooted() {
|
||||
String string2 = Build.TAGS;
|
||||
if (string2 != null && string2.contains("test-keys")) {
|
||||
return true;
|
||||
}
|
||||
if (new File("/system/app/Superuser.apk").exists()) return true;
|
||||
if (ApplicationEnvironmentImpl.commandExists("su")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimitAdTrackingEnabled() {
|
||||
return this.m_googleLimitAdTrackingEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshAgeCompliance() {
|
||||
if (Network.getComponent().getStatus() != Network.Status.OK) {
|
||||
Error error = new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, Min Age cannot update.");
|
||||
HashMap<String, Serializable> hashMap = new HashMap<String, Serializable>();
|
||||
hashMap.put("result", (Serializable)((Object)"0"));
|
||||
hashMap.put("error", error);
|
||||
Utility.sendBroadcastSerializable("nimble.notification.age_compliance_refreshed", hashMap);
|
||||
return;
|
||||
}
|
||||
Object object = (SynergyRequest.SynergyRequestPreparingCallback) synergyRequest -> {
|
||||
synergyRequest.baseUrl = SynergyEnvironment.getComponent().getServerUrlWithKey("geoip.url");
|
||||
synergyRequest.send();
|
||||
};
|
||||
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback(){
|
||||
|
||||
@Override
|
||||
public void callback(SynergyNetworkConnectionHandle object) {
|
||||
HashMap<String, Serializable> hashMap = new HashMap<>();
|
||||
if (object.getResponse().getError() == null) {
|
||||
Integer n2 = (Integer)object.getResponse().getJsonData().get("code");
|
||||
|
||||
} else {
|
||||
Helper.LOGD(this, "LOG_CALLBACK_ERROR : %s", object.getResponse().getError().getMessage());
|
||||
hashMap.put("result", (Serializable)((Object)"0"));
|
||||
hashMap.put("error", object.getResponse().getError());
|
||||
}
|
||||
Utility.sendBroadcastSerializable("nimble.notification.age_compliance_refreshed", hashMap);
|
||||
}
|
||||
};
|
||||
object = new SynergyRequest(SYNERGY_API_GET_AGE_REQUIREMENTS, IHttpRequest.Method.GET, (SynergyRequest.SynergyRequestPreparingCallback)object);
|
||||
SynergyNetwork.getComponent().sendRequest((SynergyRequest)object, synergyNetworkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void restore() {
|
||||
Object object = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.applicationEnvironment", Persistence.Storage.DOCUMENT);
|
||||
if (object == null) {
|
||||
this.setApplicationLanguageCode(this.getDeviceLanguage(), true);
|
||||
Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't read Game Specified Player ID or Language from Persistence");
|
||||
return;
|
||||
}
|
||||
if (!Utility.validString(this.m_gameSpecifiedPlayerId)) {
|
||||
Helper.LOGDS("ApplicationEnvironment", "Current game specified player ID is empty, reload from persistence");
|
||||
this.m_gameSpecifiedPlayerId = ((Persistence)object).getStringValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID);
|
||||
}
|
||||
if (Utility.validString((String)(object = ((Persistence)object).getStringValue(PERSISTENCE_LANGUAGE)))) {
|
||||
Helper.LOGD(this, "Restored language %s from persistence.", this.m_language);
|
||||
return;
|
||||
}
|
||||
Helper.LOGD(this, "Unable to restore language from persistence. Setting language to device language.");
|
||||
this.setApplicationLanguageCode(this.getDeviceLanguage(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resume() {
|
||||
try {
|
||||
this.retrieveGoogleAdvertiserId();
|
||||
return;
|
||||
}
|
||||
catch (VerifyError verifyError) {}
|
||||
finally {
|
||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationBundleId(String string2) {
|
||||
this.m_packageId = string2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationLanguageCode(String string2) {
|
||||
this.setApplicationLanguageCode(string2, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameSpecifiedPlayerId(String object) {
|
||||
this.m_gameSpecifiedPlayerId = object;
|
||||
Persistence persistenceForNimbleComponent = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.applicationEnvironment", Persistence.Storage.DOCUMENT);
|
||||
if (object == null) {
|
||||
Helper.LOGWS("ApplicationEnvironment", "Persistence is null - Couldn't save Game Specified Player ID to Persistence");
|
||||
return;
|
||||
}
|
||||
persistenceForNimbleComponent.setValue(NIMBLE_APPLICATIONENVIRONMENT_PERSISTENCE_GAME_SPECIFIED_ID, (Serializable)((Object)this.m_gameSpecifiedPlayerId));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setup() {
|
||||
this.m_context = s_currentActivity.getApplicationContext();
|
||||
try {
|
||||
this.retrieveGoogleAdvertiserId();
|
||||
}
|
||||
catch (VerifyError verifyError) {}
|
||||
finally {
|
||||
Helper.LOGW(this, "APP_ENV: Cannot get Google Advertising ID because this device is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void teardown() {
|
||||
this.m_context = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.app.Activity
|
||||
* android.content.Intent
|
||||
* android.os.Bundle
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import com.ea.nimble.ApplicationEnvironment;
|
||||
import com.ea.nimble.BaseCore;
|
||||
import com.ea.nimble.IApplicationLifecycle;
|
||||
|
||||
public class ApplicationLifecycle {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.applicationlifecycle";
|
||||
|
||||
public static IApplicationLifecycle getComponent() {
|
||||
return BaseCore.getInstance().getApplicationLifecycle();
|
||||
}
|
||||
|
||||
public static void onActivityCreate(Bundle bundle, Activity activity) {
|
||||
ApplicationEnvironment.setCurrentActivity(activity);
|
||||
ApplicationLifecycle.getComponent().notifyActivityCreate(bundle, activity);
|
||||
}
|
||||
|
||||
public static void onActivityDestroy(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityDestroy(activity);
|
||||
}
|
||||
|
||||
public static void onActivityPause(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityPause(activity);
|
||||
}
|
||||
|
||||
public static void onActivityRestart(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityRestart(activity);
|
||||
}
|
||||
|
||||
public static void onActivityRestoreInstanceState(Bundle bundle, Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityRestoreInstanceState(bundle, activity);
|
||||
}
|
||||
|
||||
public static void onActivityResult(int n2, int n3, Intent intent, Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityResult(n2, n3, intent, activity);
|
||||
}
|
||||
|
||||
public static void onActivityResume(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityResume(activity);
|
||||
}
|
||||
|
||||
public static void onActivityRetainNonConfigurationInstance() {
|
||||
ApplicationLifecycle.getComponent().notifyActivityRetainNonConfigurationInstance();
|
||||
}
|
||||
|
||||
public static void onActivitySaveInstanceState(Bundle bundle, Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivitySaveInstanceState(bundle, activity);
|
||||
}
|
||||
|
||||
public static void onActivityStart(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityStart(activity);
|
||||
}
|
||||
|
||||
public static void onActivityStop(Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityStop(activity);
|
||||
}
|
||||
|
||||
public static void onActivityWindowFocusChanged(boolean bl2, Activity activity) {
|
||||
ApplicationLifecycle.getComponent().notifyActivityWindowFocusChanged(bl2, activity);
|
||||
}
|
||||
|
||||
public static boolean onBackPressed() {
|
||||
return ApplicationLifecycle.getComponent().handleBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,392 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.annotation.SuppressLint
|
||||
* android.app.Activity
|
||||
* android.content.Intent
|
||||
* android.os.Build$VERSION
|
||||
* android.os.Bundle
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
class ApplicationLifecycleImpl
|
||||
extends Component
|
||||
implements IApplicationLifecycle,
|
||||
LogSource {
|
||||
private static final boolean RESTART_ON_CONFIG_CHANGE;
|
||||
private ArrayList<IApplicationLifecycle.ActivityEventCallbacks> m_activityEventCallbacks;
|
||||
private ArrayList<IApplicationLifecycle.ActivityLifecycleCallbacks> m_activityLifecycleCallbacks;
|
||||
private ArrayList<IApplicationLifecycle.ApplicationLifecycleCallbacks> m_applicationLifecycleCallbacks;
|
||||
private BaseCore m_core;
|
||||
private int m_createdActivityCount;
|
||||
private int m_runningActivityCount;
|
||||
private State m_state;
|
||||
|
||||
static {
|
||||
boolean bl2 = Build.VERSION.SDK_INT < 11;
|
||||
RESTART_ON_CONFIG_CHANGE = bl2;
|
||||
}
|
||||
|
||||
ApplicationLifecycleImpl(BaseCore baseCore) {
|
||||
this.m_core = baseCore;
|
||||
this.m_state = State.INIT;
|
||||
this.m_createdActivityCount = 0;
|
||||
this.m_runningActivityCount = 0;
|
||||
this.m_activityLifecycleCallbacks = new ArrayList();
|
||||
this.m_activityEventCallbacks = new ArrayList();
|
||||
this.m_applicationLifecycleCallbacks = new ArrayList();
|
||||
}
|
||||
|
||||
private void notifyApplicationLaunch(Intent intent) {
|
||||
Log.Helper.LOGD(this, "Application launch");
|
||||
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> iterator = this.m_applicationLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onApplicationLaunch(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyApplicationQuit() {
|
||||
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> iterator = this.m_applicationLifecycleCallbacks.iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
Log.Helper.LOGD(this, "Application quit");
|
||||
return;
|
||||
}
|
||||
iterator.next().onApplicationQuit();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyApplicationResume() {
|
||||
Log.Helper.LOGD(this, "Application resume");
|
||||
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> iterator = this.m_applicationLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onApplicationResume();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyApplicationSuspend() {
|
||||
Iterator<IApplicationLifecycle.ApplicationLifecycleCallbacks> iterator = this.m_applicationLifecycleCallbacks.iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
Log.Helper.LOGD(this, "Application suspend");
|
||||
return;
|
||||
}
|
||||
iterator.next().onApplicationSuspend();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.applicationlifecycle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "AppLifecycle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBackPressed() {
|
||||
boolean bl2 = true;
|
||||
for (ActivityEventCallbacks m_activityEventCallback : this.m_activityEventCallbacks) {
|
||||
if (m_activityEventCallback.onBackPressed()) continue;
|
||||
bl2 = false;
|
||||
}
|
||||
return bl2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityCreate(Bundle bundle, Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s CREATE", activity.getLocalClassName());
|
||||
if (this.m_state == State.INIT || this.m_state == State.QUIT) {
|
||||
Log.Helper.LOGD(this, "Activity created clearly with state %s", this.m_state.toString());
|
||||
this.m_core.onApplicationLaunch(activity.getIntent());
|
||||
for (ActivityLifecycleCallbacks m_activityLifecycleCallback : this.m_activityLifecycleCallbacks) {
|
||||
m_activityLifecycleCallback.onActivityCreated(activity, bundle);
|
||||
}
|
||||
this.notifyApplicationLaunch(activity.getIntent());
|
||||
this.m_createdActivityCount = 1;
|
||||
this.m_state = State.LAUNCH;
|
||||
if (this.m_runningActivityCount != 0) {
|
||||
Log.Helper.LOGE(this, "Invalid running acitivity count %d", this.m_runningActivityCount);
|
||||
this.m_runningActivityCount = 0;
|
||||
}
|
||||
} else if (this.m_state == State.CONFIG_CHANGE) {
|
||||
if (ApplicationEnvironment.getCurrentActivity() != activity) {
|
||||
Log.Helper.LOGE(this, "Activity created with state CONFIG_CHANGE but different activity %s and %s", ApplicationEnvironment.getCurrentActivity().getLocalClassName(), activity.getLocalClassName());
|
||||
} else {
|
||||
Log.Helper.LOGD(this, "Activity created from CONFIG_CHANGE, activity configuration changed");
|
||||
}
|
||||
if (RESTART_ON_CONFIG_CHANGE) {
|
||||
this.m_core.onApplicationResume();
|
||||
}
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityCreated(activity, bundle);
|
||||
}
|
||||
if (this.m_runningActivityCount != 0) {
|
||||
Log.Helper.LOGE(this, "Invalid running acitivity count %d", this.m_runningActivityCount);
|
||||
this.m_runningActivityCount = 0;
|
||||
}
|
||||
} else if (this.m_state == State.PAUSE) {
|
||||
Log.Helper.LOGD(this, "Activity created from PAUSE, normal activity switch");
|
||||
for (ActivityLifecycleCallbacks m_activityLifecycleCallback : this.m_activityLifecycleCallbacks) {
|
||||
m_activityLifecycleCallback.onActivityCreated(activity, bundle);
|
||||
}
|
||||
++this.m_createdActivityCount;
|
||||
} else if (this.m_state == State.SUSPEND) {
|
||||
Log.Helper.LOGD(this, "Activity created from SUSPEND, external activity switch; (new) app restart");
|
||||
this.m_core.onApplicationResume();
|
||||
this.m_state = State.RESUME;
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityCreated(activity, bundle);
|
||||
}
|
||||
++this.m_createdActivityCount;
|
||||
if (this.m_runningActivityCount != 0) {
|
||||
Log.Helper.LOGE(this, "Invalid running acitivity count %d", this.m_runningActivityCount);
|
||||
this.m_runningActivityCount = 0;
|
||||
}
|
||||
} else {
|
||||
Log.Helper.LOGE(this, "Activity created with %s state, shouldn't happen", this.m_state.toString());
|
||||
}
|
||||
Log.Helper.LOGV(this, "State after created %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityDestroy(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s DESTROY", activity.getLocalClassName());
|
||||
for (ActivityLifecycleCallbacks m_activityLifecycleCallback : this.m_activityLifecycleCallbacks) {
|
||||
m_activityLifecycleCallback.onActivityDestroyed(activity);
|
||||
}
|
||||
if (this.m_state != State.CONFIG_CHANGE) {
|
||||
if (this.m_state != State.SUSPEND && this.m_state != State.RUN) {
|
||||
Log.Helper.LOGE(this, "Activity destroy on invalid state %s", this.m_state.toString());
|
||||
}
|
||||
--this.m_createdActivityCount;
|
||||
if (this.m_createdActivityCount == 0) {
|
||||
this.m_state = State.QUIT;
|
||||
this.notifyApplicationQuit();
|
||||
this.m_core.onApplicationQuit();
|
||||
}
|
||||
}
|
||||
Log.Helper.LOGV(this, "State after destroy %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityPause(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s PAUSE", activity.getLocalClassName());
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityPaused(activity);
|
||||
}
|
||||
if (this.m_state != State.RUN) {
|
||||
Log.Helper.LOGE(this, "Activity pause on invalid state %s", activity.getLocalClassName());
|
||||
}
|
||||
this.m_state = State.PAUSE;
|
||||
Log.Helper.LOGV(this, "State after pause %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityRestart(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s RESTART", activity.getLocalClassName());
|
||||
ApplicationEnvironment.setCurrentActivity(activity);
|
||||
if (this.m_state == State.PAUSE) {
|
||||
Log.Helper.LOGD(this, "Activity restart from PAUSE, normal activity switch");
|
||||
} else if (this.m_state == State.SUSPEND) {
|
||||
this.m_core.onApplicationResume();
|
||||
this.m_state = State.RESUME;
|
||||
Log.Helper.LOGD(this, "Activity restart from SUSPEND, external activity switch; (new) app restart");
|
||||
} else {
|
||||
Log.Helper.LOGE(this, "Activity restart with invalid state %s", this.m_state.toString());
|
||||
}
|
||||
Log.Helper.LOGV(this, "State after restart %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityRestoreInstanceState(Bundle bundle, Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s RESTORE_STATE", activity.getLocalClassName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityResult(int n2, int n3, Intent intent, Activity activity) {
|
||||
Iterator<IApplicationLifecycle.ActivityEventCallbacks> iterator = this.m_activityEventCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityResult(activity, n2, n3, intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityResume(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s RESUME", activity.getLocalClassName());
|
||||
ApplicationEnvironment.setCurrentActivity(activity);
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityResumed(activity);
|
||||
}
|
||||
if (this.m_state != State.PAUSE) {
|
||||
Log.Helper.LOGE(this, "Activity resume on invalid state %s", this.m_state.toString());
|
||||
Log.Helper.LOGE(this, "<NOTE>Please double check if the game's activity hooks ApplicationLifecycle.onActivityRestart() correctly.");
|
||||
}
|
||||
this.m_state = State.RUN;
|
||||
Log.Helper.LOGV(this, "State after resume %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityRetainNonConfigurationInstance() {
|
||||
if (!RESTART_ON_CONFIG_CHANGE) return;
|
||||
if (this.m_state != State.SUSPEND) {
|
||||
Log.Helper.LOGW(this, "configuration change should happen between onStop() and onDestroy(), but state is %s", this.m_state.toString());
|
||||
}
|
||||
this.m_state = State.CONFIG_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivitySaveInstanceState(Bundle bundle, Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s SAVE_STATE", activity.getLocalClassName());
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivitySaveInstanceState(activity, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityStart(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s START", activity.getLocalClassName());
|
||||
ApplicationEnvironment.setCurrentActivity(activity);
|
||||
if (this.m_state == State.LAUNCH) {
|
||||
this.m_state = State.PAUSE;
|
||||
Log.Helper.LOGD(this, "Activity start with LAUNCH state, normal app start");
|
||||
} else if (this.m_state == State.RESUME) {
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityStarted(activity);
|
||||
}
|
||||
this.notifyApplicationResume();
|
||||
this.m_state = State.PAUSE;
|
||||
Log.Helper.LOGD(this, "Activity start with RESUME state, set to PAUSE");
|
||||
} else if (this.m_state == State.CONFIG_CHANGE) {
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityStarted(activity);
|
||||
}
|
||||
if (RESTART_ON_CONFIG_CHANGE) {
|
||||
this.notifyApplicationResume();
|
||||
}
|
||||
this.m_state = State.PAUSE;
|
||||
Log.Helper.LOGD(this, "Activity start with CONFIG_CHANGE state, set to PAUSE");
|
||||
} else if (this.m_state == State.PAUSE) {
|
||||
Log.Helper.LOGD(this, "Activity start with PAUSE state, normal activity switch");
|
||||
} else {
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityStarted(activity);
|
||||
}
|
||||
Log.Helper.LOGE(this, "Activity start with invalid state %s", this.m_state.toString());
|
||||
}
|
||||
++this.m_runningActivityCount;
|
||||
Log.Helper.LOGV(this, "State after start %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint(value={"NewApi"})
|
||||
public void notifyActivityStop(Activity activity) {
|
||||
Log.Helper.LOGV(this, "Activity %s STOP", activity.getLocalClassName());
|
||||
Iterator<IApplicationLifecycle.ActivityLifecycleCallbacks> iterator = this.m_activityLifecycleCallbacks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next().onActivityStopped(activity);
|
||||
}
|
||||
--this.m_runningActivityCount;
|
||||
if (!RESTART_ON_CONFIG_CHANGE && activity.isChangingConfigurations()) {
|
||||
this.m_state = State.CONFIG_CHANGE;
|
||||
} else {
|
||||
if (this.m_runningActivityCount == 0) {
|
||||
if (this.m_state != State.PAUSE && this.m_state != State.SUSPEND) {
|
||||
Log.Helper.LOGW(this, "Interesting case %s, HIGHLIGHT!!", new Object[]{this.m_state});
|
||||
}
|
||||
this.m_state = State.SUSPEND;
|
||||
if (!activity.isFinishing()) {
|
||||
this.notifyApplicationSuspend();
|
||||
this.m_core.onApplicationSuspend();
|
||||
}
|
||||
} else if (this.m_state == State.PAUSE) {
|
||||
this.m_state = State.SUSPEND;
|
||||
if (!activity.isFinishing()) {
|
||||
Log.Helper.LOGW(this, "running activity count may be messed");
|
||||
this.notifyApplicationSuspend();
|
||||
this.m_core.onApplicationSuspend();
|
||||
}
|
||||
} else if (this.m_state != State.RUN) {
|
||||
Log.Helper.LOGE(this, "Activity stop on invalid state %s", this.m_state.toString());
|
||||
}
|
||||
if (ApplicationEnvironment.getCurrentActivity() == activity) {
|
||||
ApplicationEnvironment.setCurrentActivity(null);
|
||||
}
|
||||
}
|
||||
Log.Helper.LOGV(this, "State after stop %s (%d, %d)", this.m_state.toString(), this.m_createdActivityCount, this.m_runningActivityCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyActivityWindowFocusChanged(boolean bl2, Activity object) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) {
|
||||
this.m_activityEventCallbacks.add(activityEventCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) {
|
||||
this.m_activityLifecycleCallbacks.add(activityLifecycleCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) {
|
||||
this.m_applicationLifecycleCallbacks.add(applicationLifecycleCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void teardown() {
|
||||
this.m_activityLifecycleCallbacks.clear();
|
||||
this.m_activityEventCallbacks.clear();
|
||||
this.m_applicationLifecycleCallbacks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterActivityEventCallbacks(IApplicationLifecycle.ActivityEventCallbacks activityEventCallbacks) {
|
||||
this.m_activityEventCallbacks.remove(activityEventCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterActivityLifecycleCallbacks(IApplicationLifecycle.ActivityLifecycleCallbacks activityLifecycleCallbacks) {
|
||||
this.m_activityLifecycleCallbacks.remove(activityLifecycleCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterApplicationLifecycleCallbacks(IApplicationLifecycle.ApplicationLifecycleCallbacks applicationLifecycleCallbacks) {
|
||||
this.m_applicationLifecycleCallbacks.remove(applicationLifecycleCallbacks);
|
||||
}
|
||||
|
||||
private static enum State {
|
||||
INIT,
|
||||
LAUNCH,
|
||||
RESUME,
|
||||
RUN,
|
||||
PAUSE,
|
||||
SUSPEND,
|
||||
QUIT,
|
||||
CONFIG_CHANGE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public class BackgroundNetworkConnection
|
||||
extends NetworkConnection {
|
||||
public BackgroundNetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) {
|
||||
super(networkImpl, httpRequest, iOperationalTelemetryDispatch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelForAppSuspend() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.BaseCore;
|
||||
import com.ea.nimble.Component;
|
||||
import com.ea.nimble.NimbleConfiguration;
|
||||
|
||||
public class Base {
|
||||
public static Component getComponent(String string2) {
|
||||
return BaseCore.getInstance().activeValidate().getComponentManager().getComponent(string2);
|
||||
}
|
||||
|
||||
public static Component[] getComponentList(String string2) {
|
||||
return BaseCore.getInstance().activeValidate().getComponentManager().getComponentList(string2);
|
||||
}
|
||||
|
||||
public static NimbleConfiguration getConfiguration() {
|
||||
return BaseCore.getInstance().getConfiguration();
|
||||
}
|
||||
|
||||
public static void registerComponent(Component component, String string2) {
|
||||
BaseCore.getInstance().getComponentManager().registerComponent(component, string2);
|
||||
}
|
||||
|
||||
public static void restartWithConfiguration(NimbleConfiguration nimbleConfiguration) {
|
||||
BaseCore.getInstance().activeValidate().restartWithConfiguration(nimbleConfiguration);
|
||||
}
|
||||
|
||||
public static void setupNimble() {
|
||||
BaseCore.getInstance().setup();
|
||||
}
|
||||
|
||||
public static void teardownNimble() {
|
||||
BaseCore.getInstance().teardown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,371 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
public class BaseCore implements IApplicationLifecycle.ApplicationLifecycleCallbacks {
|
||||
public static final String NIMBLE_COMPONENT_LIST = "setting::components";
|
||||
public static final String NIMBLE_LOG_SETTING = "setting::log";
|
||||
public static final String NIMBLE_SERVER_CONFIG = "com.ea.nimble.configuration";
|
||||
protected static BaseCore s_core;
|
||||
protected static boolean s_coreDestroyed = false;
|
||||
protected ApplicationEnvironmentImpl m_applicationEnvironment;
|
||||
protected IApplicationLifecycle m_applicationLifecycle;
|
||||
protected ComponentManager m_componentManager;
|
||||
protected NimbleConfiguration m_configuration;
|
||||
protected LogImpl m_log;
|
||||
protected PersistenceServiceImpl m_persistenceService;
|
||||
protected State m_state;
|
||||
|
||||
public static class AnonymousClass2 {
|
||||
static final int[] $SwitchMap$com$ea$nimble$BaseCore$State = new int[State.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.INACTIVE.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError e) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.MANUAL_TEARDOWN.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError e2) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.DESTROY.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError e3) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.AUTO_SETUP.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError e4) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.MANUAL_SETUP.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError e5) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$BaseCore$State[State.QUITTING.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError e6) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/BaseCore$State.class */
|
||||
public enum State {
|
||||
INACTIVE,
|
||||
AUTO_SETUP,
|
||||
MANUAL_SETUP,
|
||||
MANUAL_TEARDOWN,
|
||||
QUITTING,
|
||||
DESTROY
|
||||
}
|
||||
|
||||
BaseCore() {
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
Log.Helper.LOGD(this, "NIMBLE DESTROY for Android will keep Core and Static components alive", new Object[0]);
|
||||
}
|
||||
|
||||
public static BaseCore getInstance() {
|
||||
if (s_core == null) {
|
||||
if (s_coreDestroyed) {
|
||||
throw new AssertionError("Cannot revive destroyed BaseCore, please utilizesetupNimble() and tearDownNimble() explicitly to extend longevity to match your expectation.");
|
||||
}
|
||||
android.util.Log.d(Global.NIMBLE_ID, String.format("NIMBLE VERSION %s (Build %s)", "1.23.14.1217", "1.23.14.1217"));
|
||||
s_core = new BaseCore();
|
||||
s_core.initialize();
|
||||
}
|
||||
return s_core;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
this.m_state = State.INACTIVE;
|
||||
loadConfiguration();
|
||||
this.m_componentManager = new ComponentManager();
|
||||
this.m_applicationLifecycle = new ApplicationLifecycleImpl(this);
|
||||
this.m_applicationEnvironment = new ApplicationEnvironmentImpl(this);
|
||||
this.m_log = (LogImpl) Log.getComponent();
|
||||
this.m_log.connectToCore(this);
|
||||
this.m_persistenceService = new PersistenceServiceImpl();
|
||||
NetworkImpl networkImpl = new NetworkImpl();
|
||||
SynergyEnvironmentImpl synergyEnvironmentImpl = new SynergyEnvironmentImpl(this);
|
||||
SynergyNetworkImpl synergyNetworkImpl = new SynergyNetworkImpl();
|
||||
SynergyIdManagerImpl synergyIdManagerImpl = new SynergyIdManagerImpl();
|
||||
OperationalTelemetryDispatchImpl operationalTelemetryDispatchImpl = new OperationalTelemetryDispatchImpl();
|
||||
this.m_componentManager.registerComponent(this.m_applicationEnvironment, ApplicationEnvironment.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(this.m_log, Log.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(this.m_persistenceService, PersistenceService.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(networkImpl, "com.ea.nimble.network");
|
||||
this.m_componentManager.registerComponent(synergyIdManagerImpl, SynergyIdManager.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(synergyEnvironmentImpl, SynergyEnvironment.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(synergyNetworkImpl, SynergyNetwork.COMPONENT_ID);
|
||||
this.m_componentManager.registerComponent(operationalTelemetryDispatchImpl, OperationalTelemetryDispatch.COMPONENT_ID);
|
||||
for (String str : getSettings(NIMBLE_COMPONENT_LIST).values()) {
|
||||
try {
|
||||
Method declaredMethod = Class.forName(str).getDeclaredMethod("initialize", new Class[0]);
|
||||
declaredMethod.setAccessible(true);
|
||||
declaredMethod.invoke(null, new Object[0]);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.Helper.LOGD(this, "Component " + str + " not found", new Object[0]);
|
||||
} catch (IllegalAccessException e2) {
|
||||
Log.Helper.LOGE(this, "Method " + str + ".initialize() is not accessible", new Object[0]);
|
||||
} catch (IllegalArgumentException e3) {
|
||||
Log.Helper.LOGE(this, "Method " + str + ".initialize() should take no arguments", new Object[0]);
|
||||
} catch (NoSuchMethodException e4) {
|
||||
Log.Helper.LOGE(this, "No method " + str + ".initialize()", new Object[0]);
|
||||
} catch (NullPointerException e5) {
|
||||
Log.Helper.LOGE(this, "Method " + str + ".initialize() should be static", new Object[0]);
|
||||
} catch (InvocationTargetException e6) {
|
||||
Log.Helper.LOGE(this, "Method " + str + ".initialize() threw an exception", new Object[0]);
|
||||
e6.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!isAppSigned(ApplicationEnvironment.getComponent().getApplicationContext())) {
|
||||
android.util.Log.e(Global.NIMBLE_ID, "This application is NOT signed with a valid certificate. MTX may not work correctly with this application");
|
||||
} else {
|
||||
android.util.Log.i(Global.NIMBLE_ID, "This application is signed with a valid certificate.");
|
||||
}
|
||||
} catch (Exception e7) {
|
||||
android.util.Log.e(Global.NIMBLE_ID, String.format("Unable to verify application signature. Message: %s", e7.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
protected static void injectMock(BaseCore baseCore) {
|
||||
if (baseCore == null) {
|
||||
s_core = null;
|
||||
s_coreDestroyed = false;
|
||||
return;
|
||||
}
|
||||
s_core = baseCore;
|
||||
s_coreDestroyed = false;
|
||||
}
|
||||
|
||||
private boolean isAppSigned(Context context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadConfiguration() {
|
||||
try {
|
||||
String string = ApplicationEnvironment.getCurrentActivity().getPackageManager().getApplicationInfo(ApplicationEnvironment.getCurrentActivity().getPackageName(), 128).metaData.getString(NIMBLE_SERVER_CONFIG);
|
||||
if (Utility.validString(string)) {
|
||||
this.m_configuration = NimbleConfiguration.fromName(string);
|
||||
if (this.m_configuration != NimbleConfiguration.UNKNOWN) {
|
||||
if (this.m_configuration != NimbleConfiguration.CUSTOMIZED) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
android.util.Log.e(Global.NIMBLE_ID, "WARNING! Cannot find valid NimbleConfiguration from AndroidManifest.xml");
|
||||
this.m_configuration = NimbleConfiguration.LIVE;
|
||||
}
|
||||
|
||||
public BaseCore activeValidate() {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
|
||||
case 1:
|
||||
Log.Helper.LOGF(this, "Access NimbleBaseCore before setup, call setupNimble() explicitly to activate it.", new Object[0]);
|
||||
return null;
|
||||
case 2:
|
||||
Log.Helper.LOGF(this, "Access NimbleBaseCore after clean up, call setupNimble() explicitly again to activate it.", new Object[0]);
|
||||
return null;
|
||||
case 3:
|
||||
Log.Helper.LOGF(this, "Accessing component after destroy, only static components are available right now.", new Object[0]);
|
||||
return null;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public IApplicationEnvironment getApplicationEnvironment() {
|
||||
return this.m_applicationEnvironment;
|
||||
}
|
||||
|
||||
public IApplicationLifecycle getApplicationLifecycle() {
|
||||
return this.m_applicationLifecycle;
|
||||
}
|
||||
|
||||
public ComponentManager getComponentManager() {
|
||||
return this.m_componentManager;
|
||||
}
|
||||
|
||||
public NimbleConfiguration getConfiguration() {
|
||||
return this.m_configuration;
|
||||
}
|
||||
|
||||
public ILog getLog() {
|
||||
return this.m_log;
|
||||
}
|
||||
|
||||
public IPersistenceService getPersistenceService() {
|
||||
return this.m_persistenceService;
|
||||
}
|
||||
|
||||
public Map<String, String> getSettings(String str) {
|
||||
int identifier;
|
||||
if (str == NIMBLE_LOG_SETTING) {
|
||||
int identifier2 = ApplicationEnvironment.getComponent().getApplicationContext().getResources().getIdentifier("nimble_log", "xml", ApplicationEnvironment.getCurrentActivity().getPackageName());
|
||||
if (identifier2 == 0) {
|
||||
return null;
|
||||
}
|
||||
return Utility.parseXmlFile(identifier2);
|
||||
} else if (str != NIMBLE_COMPONENT_LIST || (identifier = ApplicationEnvironment.getComponent().getApplicationContext().getResources().getIdentifier("components", "xml", ApplicationEnvironment.getCurrentActivity().getPackageName())) == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return Utility.parseXmlFile(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.m_state == State.AUTO_SETUP || this.m_state == State.MANUAL_SETUP;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
||||
public void onApplicationLaunch(Intent intent) {
|
||||
if (this.m_state == State.INACTIVE || this.m_state == State.DESTROY) {
|
||||
this.m_componentManager.setup();
|
||||
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED, null);
|
||||
this.m_state = State.AUTO_SETUP;
|
||||
try {
|
||||
this.m_componentManager.restore();
|
||||
} catch (AssertionError e) {
|
||||
this.m_state = State.INACTIVE;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
||||
public void onApplicationQuit() {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
|
||||
case 1:
|
||||
Log.Helper.LOGF(this, "No app start before app quit, something must be wrong.", new Object[0]);
|
||||
return;
|
||||
case 2:
|
||||
default:
|
||||
return;
|
||||
case 3:
|
||||
case 6:
|
||||
Log.Helper.LOGF(this, "Double app quit, something must be wrong.", new Object[0]);
|
||||
return;
|
||||
case 4:
|
||||
this.m_componentManager.suspend();
|
||||
return;
|
||||
case 5:
|
||||
this.m_componentManager.suspend();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
||||
public void onApplicationResume() {
|
||||
if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) {
|
||||
this.m_componentManager.resume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ApplicationLifecycleCallbacks
|
||||
public void onApplicationSuspend() {
|
||||
if (this.m_state == State.MANUAL_SETUP || this.m_state == State.AUTO_SETUP) {
|
||||
this.m_componentManager.suspend();
|
||||
}
|
||||
}
|
||||
|
||||
public void restartWithConfiguration(final NimbleConfiguration nimbleConfiguration) {
|
||||
Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]);
|
||||
Log.Helper.LOGE(this, "restartWithConfiguration should not be used in an integration. This function is for QA testing purposes.", new Object[0]);
|
||||
Log.Helper.LOGE(this, ">>>>>>>>>>>>>>>>>>>>>>", new Object[0]);
|
||||
if (nimbleConfiguration == NimbleConfiguration.UNKNOWN) {
|
||||
Log.Helper.LOGE(this, "Cannot restart nimble with unknown configuration", new Object[0]);
|
||||
} else {
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: com.ea.nimble.BaseCore.1
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[BaseCore.this.m_state.ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
Log.Helper.LOGF(this, "Should not happen, getInstance should ensure active instance", new Object[0]);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
BaseCore.this.m_componentManager.cleanup();
|
||||
BaseCore.this.m_componentManager.teardown();
|
||||
BaseCore.this.m_configuration = nimbleConfiguration;
|
||||
BaseCore.this.m_componentManager.setup();
|
||||
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED, null);
|
||||
BaseCore.this.m_componentManager.restore();
|
||||
return;
|
||||
case 6:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGF(this, "Cannot restart Nimble when app is quiting", new Object[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
this.m_componentManager.setup();
|
||||
this.m_state = State.MANUAL_SETUP;
|
||||
Utility.sendBroadcast(Global.NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED, null);
|
||||
this.m_componentManager.restore();
|
||||
return;
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
Log.Helper.LOGF(this, "Multiple setupNimble() calls without teardownNimble().", new Object[0]);
|
||||
return;
|
||||
case 4:
|
||||
this.m_state = State.MANUAL_SETUP;
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
public void teardown() {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$BaseCore$State[this.m_state.ordinal()]) {
|
||||
case 1:
|
||||
case 4:
|
||||
Log.Helper.LOGF(this, "Cannot teardownNimble() before setupNimble().", new Object[0]);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
case 5:
|
||||
this.m_componentManager.cleanup();
|
||||
this.m_state = State.MANUAL_TEARDOWN;
|
||||
this.m_componentManager.teardown();
|
||||
return;
|
||||
case 6:
|
||||
this.m_state = State.DESTROY;
|
||||
destroy();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGF(this, "Multiple teardownNimble() calls without setupNibmle().", new Object[0]);
|
||||
}
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class ByteBufferIOStream {
|
||||
protected static final int SEGMENT_SIZE = 4096;
|
||||
protected int m_availableSegment = 0;
|
||||
protected LinkedList<byte[]> m_buffer = new LinkedList<>();
|
||||
protected boolean m_closed = false;
|
||||
protected ByteBufferInputStream m_input = new ByteBufferInputStream();
|
||||
protected ByteBufferOutputStream m_output = new ByteBufferOutputStream();
|
||||
protected int m_readPosition = 0;
|
||||
protected int m_writePosition = 0;
|
||||
|
||||
public ByteBufferIOStream() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public ByteBufferIOStream(int n2) {
|
||||
int n3 = n2;
|
||||
if (n2 <= 0) {
|
||||
n3 = 1;
|
||||
}
|
||||
n3 = (n3 - 1) / 4096;
|
||||
n2 = 0;
|
||||
while (n2 < n3 + 1) {
|
||||
this.m_buffer.add(new byte[4096]);
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
public void appendSegmentToBuffer(byte[] byArray, int n2) throws IOException {
|
||||
if (this.m_writePosition == 0 && byArray.length == 4096) {
|
||||
ListIterator<byte[]> listIterator = this.m_buffer.listIterator();
|
||||
for (int i2 = 0; i2 < this.m_availableSegment; ++i2) {
|
||||
listIterator.next();
|
||||
}
|
||||
listIterator.add(byArray);
|
||||
if (n2 != 4096) {
|
||||
this.m_writePosition = n2;
|
||||
return;
|
||||
}
|
||||
++this.m_availableSegment;
|
||||
return;
|
||||
}
|
||||
this.getOutputStream().write(byArray, 0, n2);
|
||||
}
|
||||
|
||||
public int available() throws IOException {
|
||||
return this.m_input.available();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.m_closed = false;
|
||||
this.m_availableSegment = 0;
|
||||
this.m_writePosition = 0;
|
||||
this.m_readPosition = 0;
|
||||
}
|
||||
|
||||
protected void closeIOStream() {
|
||||
this.m_closed = true;
|
||||
}
|
||||
|
||||
public InputStream getInputStream() {
|
||||
return this.m_input;
|
||||
}
|
||||
|
||||
public OutputStream getOutputStream() {
|
||||
return this.m_output;
|
||||
}
|
||||
|
||||
public byte[] growBufferBySegment() throws IOException {
|
||||
if (this.m_writePosition != 0) {
|
||||
throw new IOException("Bad location to grow buffer");
|
||||
}
|
||||
ListIterator<byte[]> listIterator = this.m_buffer.listIterator();
|
||||
int n2 = 0;
|
||||
while (true) {
|
||||
if (n2 >= this.m_availableSegment) {
|
||||
byte[] byArray = new byte[4096];
|
||||
listIterator.add(byArray);
|
||||
++this.m_availableSegment;
|
||||
return byArray;
|
||||
}
|
||||
listIterator.next();
|
||||
++n2;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] prepareSegment() {
|
||||
if (this.m_availableSegment + 1 >= this.m_buffer.size()) {
|
||||
return new byte[4096];
|
||||
}
|
||||
if (this.m_buffer.size() != 0) return this.m_buffer.removeLast();
|
||||
return null;
|
||||
}
|
||||
|
||||
protected class ByteBufferInputStream
|
||||
extends InputStream {
|
||||
protected ByteBufferInputStream() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
if (!ByteBufferIOStream.this.m_closed) return ByteBufferIOStream.this.m_availableSegment * 4096 + ByteBufferIOStream.this.m_writePosition - ByteBufferIOStream.this.m_readPosition;
|
||||
throw new IOException("ByteBufferIOStream is closed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
ByteBufferIOStream.this.closeIOStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (this.available() <= 0) {
|
||||
throw new IOException("Nothing to read in ByteBufferIOStream");
|
||||
}
|
||||
byte by2 = ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_readPosition];
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
++byteBufferIOStream.m_readPosition;
|
||||
if (ByteBufferIOStream.this.m_readPosition < 4096) return by2;
|
||||
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
|
||||
ByteBufferIOStream.this.m_readPosition = 0;
|
||||
byteBufferIOStream = ByteBufferIOStream.this;
|
||||
--byteBufferIOStream.m_availableSegment;
|
||||
return by2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] byArray) throws IOException {
|
||||
return this.read(byArray, 0, byArray.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] object, int n2, int n3) throws IOException {
|
||||
if (n2 < 0) throw new IndexOutOfBoundsException("The reading range of out of buffer boundary.");
|
||||
if (n3 < 0) throw new IndexOutOfBoundsException("The reading range of out of buffer boundary.");
|
||||
if (n2 + n3 > ((byte[])object).length) {
|
||||
throw new IndexOutOfBoundsException("The reading range of out of buffer boundary.");
|
||||
}
|
||||
int n4 = this.available();
|
||||
if (n4 <= 0) {
|
||||
return -1;
|
||||
}
|
||||
int n5 = n3;
|
||||
if (n3 > n4) {
|
||||
n5 = n4;
|
||||
}
|
||||
if (n5 < (n3 = 4096 - ByteBufferIOStream.this.m_readPosition)) {
|
||||
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, object, n2, n5);
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
byteBufferIOStream.m_readPosition += n5;
|
||||
return n5;
|
||||
}
|
||||
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), ByteBufferIOStream.this.m_readPosition, object, n2, n3);
|
||||
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
|
||||
n4 = n5 - n3;
|
||||
n2 += n3;
|
||||
int n6 = n4 / 4096;
|
||||
n3 = 0;
|
||||
while (true) {
|
||||
if (n3 >= n6) {
|
||||
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, object, n2, n4);
|
||||
ByteBufferIOStream.this.m_readPosition = n4;
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
byteBufferIOStream.m_availableSegment -= n6 + 1;
|
||||
return n5;
|
||||
}
|
||||
System.arraycopy(ByteBufferIOStream.this.m_buffer.getFirst(), 0, object, n2, 4096);
|
||||
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
|
||||
n4 -= 4096;
|
||||
n2 += 4096;
|
||||
++n3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long l2) throws IOException {
|
||||
int n2;
|
||||
int n3 = this.available();
|
||||
if (n3 <= 0) {
|
||||
return 0L;
|
||||
}
|
||||
long l3 = l2;
|
||||
if (l2 > (long)n3) {
|
||||
l3 = n3;
|
||||
}
|
||||
if ((n3 = (int)l3) < (n2 = 4096 - ByteBufferIOStream.this.m_readPosition)) {
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
byteBufferIOStream.m_readPosition += n3;
|
||||
return l3;
|
||||
}
|
||||
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
|
||||
n2 = n3 - n2;
|
||||
int n4 = n2 / 4096;
|
||||
n3 = 0;
|
||||
while (true) {
|
||||
if (n3 >= n4) {
|
||||
ByteBufferIOStream.this.m_readPosition = n2;
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
byteBufferIOStream.m_availableSegment -= n4 + 1;
|
||||
return l3;
|
||||
}
|
||||
ByteBufferIOStream.this.m_buffer.add(ByteBufferIOStream.this.m_buffer.poll());
|
||||
n2 -= 4096;
|
||||
++n3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected class ByteBufferOutputStream
|
||||
extends OutputStream {
|
||||
protected ByteBufferOutputStream() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
ByteBufferIOStream.this.closeIOStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int n2) throws IOException {
|
||||
if (ByteBufferIOStream.this.m_closed) {
|
||||
throw new IOException("ByteBufferIOStream is closed");
|
||||
}
|
||||
ByteBufferIOStream.this.m_buffer.getFirst()[ByteBufferIOStream.this.m_writePosition] = (byte)n2;
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
++byteBufferIOStream.m_writePosition;
|
||||
if (ByteBufferIOStream.this.m_writePosition != 4096) return;
|
||||
ByteBufferIOStream.this.m_writePosition = 0;
|
||||
byteBufferIOStream = ByteBufferIOStream.this;
|
||||
++byteBufferIOStream.m_availableSegment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] byArray) throws IOException {
|
||||
this.write(byArray, 0, byArray.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] object, int n2, int n3) throws IOException {
|
||||
int n4;
|
||||
if (n2 < 0) throw new IndexOutOfBoundsException("The writing range is out of buffer boundary.");
|
||||
if (n3 < 0) throw new IndexOutOfBoundsException("The writing range is out of buffer boundary.");
|
||||
if (n2 + n3 > ((byte[])object).length) {
|
||||
throw new IndexOutOfBoundsException("The writing range is out of buffer boundary.");
|
||||
}
|
||||
if (ByteBufferIOStream.this.m_closed) {
|
||||
throw new IOException("ByteBufferIOStream is closed");
|
||||
}
|
||||
int n5 = 4096 - ByteBufferIOStream.this.m_writePosition;
|
||||
Iterator iterator = ByteBufferIOStream.this.m_buffer.iterator();
|
||||
for (n4 = 0; n4 < ByteBufferIOStream.this.m_availableSegment; ++n4) {
|
||||
iterator.next();
|
||||
}
|
||||
if (n3 < n5) {
|
||||
System.arraycopy(object, n2, iterator.next(), ByteBufferIOStream.this.m_writePosition, n3);
|
||||
ByteBufferIOStream byteBufferIOStream = ByteBufferIOStream.this;
|
||||
byteBufferIOStream.m_writePosition += n3;
|
||||
return;
|
||||
}
|
||||
System.arraycopy(object, n2, iterator.next(), ByteBufferIOStream.this.m_writePosition, n5);
|
||||
n4 = n2 + n5;
|
||||
Object object2 = ByteBufferIOStream.this;
|
||||
++((ByteBufferIOStream)object2).m_availableSegment;
|
||||
ByteBufferIOStream.this.m_writePosition = 0;
|
||||
n2 = n3 -= n5;
|
||||
n3 = n4;
|
||||
while (n2 > 0) {
|
||||
if (iterator.hasNext()) {
|
||||
object2 = (byte[])iterator.next();
|
||||
} else {
|
||||
object2 = new byte[4096];
|
||||
ByteBufferIOStream.this.m_buffer.add((byte[])object2);
|
||||
}
|
||||
if (n2 < 4096) {
|
||||
System.arraycopy(object, n3, object2, 0, n2);
|
||||
ByteBufferIOStream.this.m_writePosition = n2;
|
||||
n2 = 0;
|
||||
continue;
|
||||
}
|
||||
System.arraycopy(object, n3, object2, 0, 4096);
|
||||
n2 -= 4096;
|
||||
n3 += 4096;
|
||||
object2 = ByteBufferIOStream.this;
|
||||
++((ByteBufferIOStream)object2).m_availableSegment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public abstract class Component {
|
||||
protected void cleanup() {
|
||||
}
|
||||
|
||||
public abstract String getComponentId();
|
||||
|
||||
protected void restore() {
|
||||
}
|
||||
|
||||
protected void resume() {
|
||||
}
|
||||
|
||||
protected void setup() {
|
||||
}
|
||||
|
||||
protected void suspend() {
|
||||
}
|
||||
|
||||
protected void teardown() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Component;
|
||||
import com.ea.nimble.Log;
|
||||
import com.ea.nimble.LogSource;
|
||||
import com.ea.nimble.Utility;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
|
||||
class ComponentManager
|
||||
implements LogSource {
|
||||
private Map<String, Component> m_components = new LinkedHashMap<String, Component>();
|
||||
private Stage m_stage = Stage.CREATE;
|
||||
|
||||
ComponentManager() {
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
ListIterator<Component> listIterator = new ArrayList<Component>(this.m_components.values()).listIterator(this.m_components.size());
|
||||
while (true) {
|
||||
if (!listIterator.hasPrevious()) {
|
||||
this.m_stage = Stage.CREATE;
|
||||
return;
|
||||
}
|
||||
listIterator.previous().cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
Component getComponent(String string2) {
|
||||
return this.m_components.get(string2);
|
||||
}
|
||||
|
||||
Component[] getComponentList(String string2) {
|
||||
ArrayList<Component> arrayList = new ArrayList<Component>(this.m_components.size());
|
||||
Iterator<Map.Entry<String, Component>> iterator = this.m_components.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Component> entry = iterator.next();
|
||||
if (!entry.getKey().startsWith(string2)) continue;
|
||||
arrayList.add(entry.getValue());
|
||||
}
|
||||
return arrayList.toArray(new Component[arrayList.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "Component";
|
||||
}
|
||||
|
||||
void registerComponent(Component component, String string2) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGF(this, "Cannot register component without valid componentId", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (component == null) {
|
||||
Log.Helper.LOGF(this, "Try to register invalid component with id: " + string2, new Object[0]);
|
||||
return;
|
||||
}
|
||||
Component component2 = this.m_components.get(string2);
|
||||
if (component2 == null) {
|
||||
Log.Helper.LOGI(this, "Register module: " + string2, new Object[0]);
|
||||
} else {
|
||||
Log.Helper.LOGI(this, "Register module(overwrite): " + string2, new Object[0]);
|
||||
}
|
||||
this.m_components.put(string2, component);
|
||||
if (this.m_stage.compareTo(Stage.SETUP) < 0) return;
|
||||
if (component2 != null) {
|
||||
if (this.m_stage.compareTo(Stage.SETUP) >= 0) {
|
||||
if (this.m_stage.compareTo(Stage.SUSPEND) >= 0) {
|
||||
component2.resume();
|
||||
}
|
||||
component2.cleanup();
|
||||
}
|
||||
component2.teardown();
|
||||
}
|
||||
component.setup();
|
||||
if (this.m_stage.compareTo(Stage.READY) < 0) return;
|
||||
component.restore();
|
||||
if (this.m_stage.compareTo(Stage.SUSPEND) < 0) return;
|
||||
component.suspend();
|
||||
}
|
||||
|
||||
void restore() {
|
||||
Iterator<Component> iterator = this.m_components.values().iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
this.m_stage = Stage.READY;
|
||||
return;
|
||||
}
|
||||
iterator.next().restore();
|
||||
}
|
||||
}
|
||||
|
||||
void resume() {
|
||||
Iterator<Component> iterator = this.m_components.values().iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
this.m_stage = Stage.READY;
|
||||
return;
|
||||
}
|
||||
iterator.next().resume();
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Iterator<Component> iterator = this.m_components.values().iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
this.m_stage = Stage.SETUP;
|
||||
return;
|
||||
}
|
||||
iterator.next().setup();
|
||||
}
|
||||
}
|
||||
|
||||
void suspend() {
|
||||
ListIterator<Component> listIterator = new ArrayList<Component>(this.m_components.values()).listIterator(this.m_components.size());
|
||||
while (true) {
|
||||
if (!listIterator.hasPrevious()) {
|
||||
this.m_stage = Stage.SUSPEND;
|
||||
return;
|
||||
}
|
||||
listIterator.previous().suspend();
|
||||
}
|
||||
}
|
||||
|
||||
void teardown() {
|
||||
ListIterator<Component> listIterator = new ArrayList<Component>(this.m_components.values()).listIterator(this.m_components.size());
|
||||
while (true) {
|
||||
if (!listIterator.hasPrevious()) {
|
||||
this.m_stage = Stage.CREATE;
|
||||
return;
|
||||
}
|
||||
listIterator.previous().teardown();
|
||||
}
|
||||
}
|
||||
|
||||
private static enum Stage {
|
||||
CREATE,
|
||||
SETUP,
|
||||
READY,
|
||||
SUSPEND;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/EASPDataLoader.class */
|
||||
public class EASPDataLoader {
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/EASPDataLoader$EASPDataBuffer.class */
|
||||
public static class EASPDataBuffer {
|
||||
public ByteBuffer m_decryptedByteBuffer;
|
||||
public String m_version;
|
||||
|
||||
public EASPDataBuffer(String str, ByteBuffer byteBuffer) {
|
||||
this.m_version = str;
|
||||
this.m_decryptedByteBuffer = byteBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/EASPDataLoader$LogEvent.class */
|
||||
public static class LogEvent {
|
||||
public int m_EAUID;
|
||||
public long m_dateTimeInNanoseconds;
|
||||
public int m_indexInsideSession;
|
||||
public int m_keyType01;
|
||||
public int m_keyType02;
|
||||
public int m_keyType03;
|
||||
public String m_randomPart;
|
||||
public long m_timestamp;
|
||||
public int m_type;
|
||||
public int m_userLevel;
|
||||
public String m_value01;
|
||||
public String m_value02;
|
||||
public String m_value03;
|
||||
}
|
||||
|
||||
public static boolean deleteDatFile(String str) {
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
return true;
|
||||
}
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
public static String getTrackingDatFilePath() {
|
||||
Context applicationContext = ApplicationEnvironment.getComponent().getApplicationContext();
|
||||
return (applicationContext == null ? System.getProperty("user.dir") + File.separator + "doc" : applicationContext.getFilesDir().getPath()) + File.separator + "EASP" + File.separator + "Tracking" + File.separator + "tracking.dat";
|
||||
}
|
||||
|
||||
public static EASPDataBuffer loadDatFile(String str) throws Exception {
|
||||
Throwable th;
|
||||
Exception e;
|
||||
if (str == null || str.length() == 0) {
|
||||
Log.Helper.LOGDS("Legacy", "Empty path passed to loadLegacyEASPDatFile");
|
||||
throw new NullPointerException();
|
||||
}
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
Log.Helper.LOGDS("Legacy", "Couldn't find EASP data file, " + str);
|
||||
throw new FileNotFoundException("Non-existent or empty file, " + str + ".");
|
||||
}
|
||||
Log.Helper.LOGDS("Legacy", "Attempt to read EASP data file, %s, size %d.", str, file.length());
|
||||
FileInputStream fileInputStream = null;
|
||||
BufferedInputStream bufferedInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
bufferedInputStream = new BufferedInputStream(fileInputStream);
|
||||
byte[] bArr = new byte[(int) file.length()];
|
||||
int read = bufferedInputStream.read(bArr);
|
||||
Cipher instance = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
instance.init(2, new SecretKeySpec(new byte[]{-25, -17, -122, 91, 109, -87, 10, 61, 57, 50, 14, -5, -108, 24, -28, -25, -58, 20, 24, Byte.MAX_VALUE, 59, -107, -123, -38, 101, 43, -82, 117, 27, -62, -102, 55}, "AES"), new IvParameterSpec(bArr, 8, 16));
|
||||
ByteBuffer wrap = ByteBuffer.wrap(instance.doFinal(bArr, 24, read - 24));
|
||||
wrap.order(ByteOrder.LITTLE_ENDIAN);
|
||||
EASPDataBuffer eASPDataBuffer = new EASPDataBuffer(readString(wrap), wrap.slice().order(ByteOrder.LITTLE_ENDIAN));
|
||||
try {
|
||||
fileInputStream.close();
|
||||
bufferedInputStream.close();
|
||||
} catch (IOException e2) {
|
||||
Log.Helper.LOGES("Legacy", "Exception closing file stream, for file, %s.", str);
|
||||
}
|
||||
return eASPDataBuffer;
|
||||
|
||||
} catch (Exception e4) {
|
||||
Log.Helper.LOGES("Legacy", "Exception reading EASP data file, %s: %s", str, e4.toString());
|
||||
e4.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static String loadEADeviceId() {
|
||||
try {
|
||||
EASPDataBuffer loadDatFile = loadDatFile(ApplicationEnvironment.getComponent().getApplicationContext().getFilesDir().getPath() + "/EASP/commoninfo.dat");
|
||||
if (!loadDatFile.m_version.equals("1.00.02")) {
|
||||
return null;
|
||||
}
|
||||
ByteBuffer byteBuffer = loadDatFile.m_decryptedByteBuffer;
|
||||
readString(byteBuffer);
|
||||
readBooleanByte(byteBuffer);
|
||||
return readString(byteBuffer);
|
||||
} catch (Exception e) {
|
||||
Log.Helper.LOGES("Legacy", "Exception when trying to load EASP data: %s", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean readBooleanByte(ByteBuffer byteBuffer) {
|
||||
return byteBuffer.get() != 0;
|
||||
}
|
||||
|
||||
public static LogEvent readLogEvent(ByteBuffer byteBuffer) throws IOException {
|
||||
LogEvent logEvent = new LogEvent();
|
||||
try {
|
||||
if (!readBooleanByte(byteBuffer)) {
|
||||
return null;
|
||||
}
|
||||
logEvent.m_type = byteBuffer.getInt();
|
||||
logEvent.m_indexInsideSession = byteBuffer.getInt();
|
||||
logEvent.m_dateTimeInNanoseconds = byteBuffer.getLong();
|
||||
logEvent.m_EAUID = byteBuffer.getInt();
|
||||
logEvent.m_randomPart = readString(byteBuffer);
|
||||
logEvent.m_keyType01 = byteBuffer.getInt();
|
||||
logEvent.m_value01 = readString(byteBuffer);
|
||||
logEvent.m_keyType02 = byteBuffer.getInt();
|
||||
logEvent.m_value02 = readString(byteBuffer);
|
||||
logEvent.m_timestamp = byteBuffer.getLong();
|
||||
logEvent.m_keyType03 = byteBuffer.getInt();
|
||||
logEvent.m_value03 = readString(byteBuffer);
|
||||
logEvent.m_userLevel = byteBuffer.getInt();
|
||||
return logEvent;
|
||||
} catch (IOException e) {
|
||||
Log.Helper.LOGES("Legacy", "Exception reading LogEvent: " + e, new Object[0]);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String readString(ByteBuffer byteBuffer) throws IOException {
|
||||
Exception e;
|
||||
int i = byteBuffer.getInt();
|
||||
if (i <= 0) {
|
||||
return null;
|
||||
}
|
||||
if (i > byteBuffer.remaining()) {
|
||||
Log.Helper.LOGES("Legacy", "String length greater than buffer remaining bytes.", new Object[0]);
|
||||
throw new IOException("String length uint32 corrupt, longer than remaining bytes.");
|
||||
}
|
||||
byte[] bArr = new byte[i];
|
||||
byteBuffer.get(bArr, 0, i);
|
||||
String str = null;
|
||||
try {
|
||||
String str2 = new String(bArr, "UTF-8");
|
||||
try {
|
||||
Log.Helper.LOGDS("Legacy", "Read string (%s)", str2);
|
||||
return str2;
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
str = str2;
|
||||
Log.Helper.LOGES("Legacy", "Read string exception: " + e);
|
||||
return str;
|
||||
}
|
||||
} catch (Exception e3) {
|
||||
e = e3;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.annotation.SuppressLint
|
||||
* android.os.Build$VERSION
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.ea.ironmonkey.devmenu.util.Observer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.CipherOutputStream;
|
||||
|
||||
class Encryptor {
|
||||
private static int ENCRYPTION_KEY_LENGHT = 128;
|
||||
private static int ENCRYPTION_KEY_ROUND = 997;
|
||||
private Cipher m_decryptor;
|
||||
private Cipher m_encryptor;
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Could not resolve type clashes
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
@SuppressLint(value={"NewApi"})
|
||||
private void initialize() throws GeneralSecurityException {
|
||||
Observer.onCallingMethod();
|
||||
}
|
||||
|
||||
public ObjectInputStream encryptInputStream(InputStream inputStream) throws IOException, GeneralSecurityException {
|
||||
if (this.m_encryptor != null) {
|
||||
if (this.m_encryptor != null) return new ObjectInputStream(new CipherInputStream(inputStream, this.m_decryptor));
|
||||
}
|
||||
this.initialize();
|
||||
return new ObjectInputStream(new CipherInputStream(inputStream, this.m_decryptor));
|
||||
}
|
||||
|
||||
public ObjectOutputStream encryptOutputStream(OutputStream outputStream) throws IOException, GeneralSecurityException {
|
||||
if (this.m_encryptor != null) {
|
||||
if (this.m_encryptor != null) return new ObjectOutputStream(new CipherOutputStream(outputStream, this.m_encryptor));
|
||||
}
|
||||
this.initialize();
|
||||
return new ObjectOutputStream(new CipherOutputStream(outputStream, this.m_encryptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,325 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.io.Externalizable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectOutput;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
class EnvironmentDataContainer
|
||||
implements ISynergyEnvironment,
|
||||
LogSource,
|
||||
Externalizable {
|
||||
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_OK = 0;
|
||||
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_RECOMMENDED = 1;
|
||||
private static final int SYNERGY_DIRECTOR_RESPONSE_APP_VERSION_UPGRADE_REQUIRED = 2;
|
||||
private String m_applicationLanguageCode = "en";
|
||||
private String m_eaDeviceId;
|
||||
private Map<String, Object> m_getDirectionResponseDictionary = new HashMap<String, Object>();
|
||||
private Long m_lastDirectorResponseTimestamp;
|
||||
private Map<String, String> m_serverUrls;
|
||||
private String m_synergyAnonymousId;
|
||||
|
||||
@Override
|
||||
public Error checkAndInitiateSynergyEnvironmentUpdate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEADeviceId() {
|
||||
return this.m_eaDeviceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEAHardwareId() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("hwId");
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, Object> getGetDirectionResponseDictionary() {
|
||||
return this.m_getDirectionResponseDictionary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGosMdmAppKey() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("mdmAppKey");
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
public Set<String> getKeysOfDifferences(ISynergyEnvironment var1_1) {
|
||||
HashSet<String> var2_3 = new HashSet<String>();
|
||||
if (var1_1 == null) {
|
||||
|
||||
if (Utility.stringsAreEquivalent(this.getEADeviceId(), var1_1.getEADeviceId())){
|
||||
var2_3.add("ENVIRONMENT_KEY_EADEVICEID");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getEAHardwareId(), var1_1.getEAHardwareId())) {
|
||||
var2_3.add("ENVIRONMENT_KEY_EAHARDWAREID");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getSynergyId(), var1_1.getSynergyId())) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SYNERGYID");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getSellId(), var1_1.getSellId())) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SELLID");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getProductId(), var1_1.getProductId())) {
|
||||
var2_3.add("ENVIRONMENT_KEY_PRODUCTID");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.drm"), var1_1.getServerUrlWithKey("synergy.drm"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_DRM");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.director"), var1_1.getServerUrlWithKey("synergy.director"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_DIRECTOR");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.m2u"), var1_1.getServerUrlWithKey("synergy.m2u"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_MESSAGE_TO_USER");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.product"), var1_1.getServerUrlWithKey("synergy.product"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_PRODUCT");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.tracking"), var1_1.getServerUrlWithKey("synergy.tracking"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_TRACKING");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.user"), var1_1.getServerUrlWithKey("synergy.user"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_USER");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("geoip.url"), var1_1.getServerUrlWithKey("geoip.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_CENTRAL_IP_GEOLOCATION");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("synergy.s2s"), var1_1.getServerUrlWithKey("synergy.s2s"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_SYNERGY_S2S");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("friends.url"), var1_1.getServerUrlWithKey("friends.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_ORIGIN_FRIENDS");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("eadp.friends.host"), var1_1.getServerUrlWithKey("eadp.friends.host"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_EADP_FRIENDS_HOST");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("avatars.url"), var1_1.getServerUrlWithKey("avatars.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_ORIGIN_AVATAR");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("origincasualapp.url"), var1_1.getServerUrlWithKey("origincasualapp.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_ORIGIN_CASUAL_APP");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("origincasualserver.url"), var1_1.getServerUrlWithKey("origincasualserver.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_ORIGIN_CASUAL_SERVER");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("akamai.url"), var1_1.getServerUrlWithKey("akamai.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_AKAMAI");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("dmg.url"), var1_1.getServerUrlWithKey("dmg.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_DYNAMIC_MORE_GAMES");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("mayhem.url"), var1_1.getServerUrlWithKey("mayhem.url"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_MAYHEM");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("nexus.connect"), var1_1.getServerUrlWithKey("nexus.connect"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_KEY_IDENTITY_CONNECT");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("nexus.proxy"), var1_1.getServerUrlWithKey("nexus.proxy"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_KEY_IDENTITY_PROXY");
|
||||
}
|
||||
if (!Utility.stringsAreEquivalent(this.getServerUrlWithKey("nexus.portal"), var1_1.getServerUrlWithKey("nexus.portal"))) {
|
||||
var2_3.add("ENVIRONMENT_KEY_SERVER_URL_KEY_IDENTITY_PORTAL");
|
||||
}
|
||||
if (this.getLatestAppVersionCheckResult() != var1_1.getLatestAppVersionCheckResult()) {
|
||||
var2_3.add("ENVIRONMENT_KEY_APP_VERSION_CHECK_RESULT");
|
||||
}
|
||||
}
|
||||
|
||||
if (var2_3.size() <= 0) return null;
|
||||
return var2_3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLatestAppVersionCheckResult() {
|
||||
int n2 = 0;
|
||||
if (this.m_getDirectionResponseDictionary == null) return -1;
|
||||
if (this.m_getDirectionResponseDictionary.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
Object object = this.m_getDirectionResponseDictionary.get("appUpgrade");
|
||||
if (object instanceof Integer) {
|
||||
n2 = (Integer)object;
|
||||
} else if (object instanceof String) {
|
||||
n2 = Integer.parseInt((String)object);
|
||||
}
|
||||
switch (n2) {
|
||||
default: {
|
||||
return 0;
|
||||
}
|
||||
case 0: {
|
||||
return 0;
|
||||
}
|
||||
case 1: {
|
||||
return 1;
|
||||
}
|
||||
case 2:
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "SynergyEnv";
|
||||
}
|
||||
|
||||
Long getMostRecentDirectorResponseTimestamp() {
|
||||
return this.m_lastDirectorResponseTimestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNexusClientId() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("clientId");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNexusClientSecret() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("clientSecret");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductId() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("productId");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSellId() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return null;
|
||||
if (!this.m_getDirectionResponseDictionary.isEmpty()) return (String)this.m_getDirectionResponseDictionary.get("sellId");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerUrlWithKey(String string2) {
|
||||
if (this.m_serverUrls != null) return this.m_serverUrls.get(string2);
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, String> getServerUrls() {
|
||||
return this.m_serverUrls;
|
||||
}
|
||||
|
||||
String getSynergyAnonymousId() {
|
||||
return this.m_synergyAnonymousId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) {
|
||||
return SynergyEnvironment.getComponent().getSynergyDirectorServerUrl(nimbleConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSynergyId() {
|
||||
return this.m_synergyAnonymousId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTrackingPostInterval() {
|
||||
if (this.m_getDirectionResponseDictionary == null) return -1;
|
||||
if (this.m_getDirectionResponseDictionary.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
Integer n2 = (Integer)this.m_getDirectionResponseDictionary.get("telemetryFreq");
|
||||
if (n2 == null) return -1;
|
||||
return n2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpdateInProgress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
|
||||
this.m_getDirectionResponseDictionary = (Map)objectInput.readObject();
|
||||
if (this.m_getDirectionResponseDictionary.isEmpty()) {
|
||||
this.m_getDirectionResponseDictionary = null;
|
||||
}
|
||||
this.m_serverUrls = (Map)objectInput.readObject();
|
||||
if (this.m_serverUrls.isEmpty()) {
|
||||
this.m_serverUrls = null;
|
||||
}
|
||||
this.m_eaDeviceId = (String)objectInput.readObject();
|
||||
if (this.m_eaDeviceId.length() == 0) {
|
||||
this.m_eaDeviceId = null;
|
||||
}
|
||||
this.m_synergyAnonymousId = (String)objectInput.readObject();
|
||||
if (this.m_synergyAnonymousId.length() == 0) {
|
||||
this.m_synergyAnonymousId = null;
|
||||
}
|
||||
this.m_lastDirectorResponseTimestamp = objectInput.readLong();
|
||||
if (this.m_lastDirectorResponseTimestamp == 0L) {
|
||||
this.m_lastDirectorResponseTimestamp = null;
|
||||
}
|
||||
this.m_applicationLanguageCode = (String)objectInput.readObject();
|
||||
if (this.m_applicationLanguageCode.length() != 0) return;
|
||||
this.m_applicationLanguageCode = null;
|
||||
}
|
||||
|
||||
void setEADeviceId(String string2) {
|
||||
this.m_eaDeviceId = string2;
|
||||
}
|
||||
|
||||
void setGetDirectionResponseDictionary(Map<String, Object> map) {
|
||||
if (map != null) {
|
||||
map.put("sellId", ((Integer)map.get("sellId")).toString());
|
||||
map.put("productId", ((Integer)map.get("productId")).toString());
|
||||
map.put("hwId", ((Integer)map.get("hwId")).toString());
|
||||
this.m_getDirectionResponseDictionary = map;
|
||||
return;
|
||||
}
|
||||
this.m_getDirectionResponseDictionary = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
void setMostRecentDirectorResponseTimestamp(Long l2) {
|
||||
this.m_lastDirectorResponseTimestamp = l2;
|
||||
}
|
||||
|
||||
void setServerUrls(Map<String, String> map) {
|
||||
this.m_serverUrls = map;
|
||||
}
|
||||
|
||||
void setSynergyAnonymousId(String string2) {
|
||||
this.m_synergyAnonymousId = string2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(ObjectOutput objectOutput) throws IOException {
|
||||
Object object = this.m_getDirectionResponseDictionary == null ? new HashMap<String, Object>() : this.m_getDirectionResponseDictionary;
|
||||
objectOutput.writeObject(object);
|
||||
object = this.m_serverUrls == null ? new HashMap<String, Object>() : this.m_serverUrls;
|
||||
objectOutput.writeObject(object);
|
||||
object = this.m_eaDeviceId == null ? "" : this.m_eaDeviceId;
|
||||
objectOutput.writeObject(object);
|
||||
object = this.m_synergyAnonymousId == null ? "" : this.m_synergyAnonymousId;
|
||||
objectOutput.writeObject(object);
|
||||
long l2 = this.m_lastDirectorResponseTimestamp == null ? 0L : this.m_lastDirectorResponseTimestamp;
|
||||
objectOutput.writeLong(l2);
|
||||
object = this.m_applicationLanguageCode == null ? "" : this.m_applicationLanguageCode;
|
||||
objectOutput.writeObject(object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.os.Parcel
|
||||
* android.os.Parcelable
|
||||
* android.os.Parcelable$Creator
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import java.io.Externalizable;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectOutput;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
|
||||
public class Error
|
||||
extends Exception
|
||||
implements Parcelable,
|
||||
Externalizable {
|
||||
public static final Parcelable.Creator<Error> CREATOR = new Parcelable.Creator<Error>(){
|
||||
|
||||
public Error createFromParcel(Parcel parcel) {
|
||||
return new Error(parcel);
|
||||
}
|
||||
|
||||
public Error[] newArray(int n2) {
|
||||
return new Error[n2];
|
||||
}
|
||||
};
|
||||
public static final String ERROR_DOMAIN = "NimbleError";
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int m_code;
|
||||
private String m_domain;
|
||||
|
||||
public Error() {
|
||||
}
|
||||
|
||||
public Error(Parcel parcel) {
|
||||
this.readFromParcel(parcel);
|
||||
}
|
||||
|
||||
public Error(Code code, String string2) {
|
||||
this(code, string2, null);
|
||||
}
|
||||
|
||||
public Error(Code code, String string2, Throwable throwable) {
|
||||
this(ERROR_DOMAIN, code.intValue(), string2, throwable);
|
||||
}
|
||||
|
||||
public Error(String string2, int n2, String string3) {
|
||||
this(string2, n2, string3, null);
|
||||
}
|
||||
|
||||
public Error(String string2, int n2, String string3, Throwable throwable) {
|
||||
super(string3, throwable);
|
||||
this.m_domain = string2;
|
||||
this.m_code = n2;
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.m_code;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.m_domain;
|
||||
}
|
||||
|
||||
public boolean isError(Code code) {
|
||||
if (this.m_code != code.intValue()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
|
||||
this.m_domain = objectInput.readUTF();
|
||||
this.m_code = objectInput.readInt();
|
||||
this.initCause((Throwable)objectInput.readObject());
|
||||
}
|
||||
|
||||
public void readFromParcel(Parcel parcel) {
|
||||
this.m_domain = parcel.readString();
|
||||
this.m_code = parcel.readInt();
|
||||
this.initCause((Throwable)parcel.readSerializable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (this.m_domain != null && this.m_domain.length() > 0) {
|
||||
stringBuilder.append(this.m_domain).append("(");
|
||||
} else {
|
||||
stringBuilder.append("Error").append("(");
|
||||
}
|
||||
stringBuilder.append(this.m_code).append(")");
|
||||
Object object = this.getLocalizedMessage();
|
||||
if (object != null && ((String)object).length() > 0) {
|
||||
stringBuilder.append(": ").append((String)object);
|
||||
}
|
||||
if ((object = this.getCause()) == null) return stringBuilder.toString();
|
||||
stringBuilder.append("\nCaused by: ");
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
((Throwable)object).printStackTrace(new PrintWriter(stringWriter));
|
||||
stringBuilder.append(stringWriter.toString());
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(ObjectOutput objectOutput) throws IOException {
|
||||
if (this.m_domain != null && this.m_domain.length() > 0) {
|
||||
objectOutput.writeUTF(this.m_domain);
|
||||
} else {
|
||||
objectOutput.writeUTF("");
|
||||
}
|
||||
objectOutput.writeInt(this.m_code);
|
||||
objectOutput.writeObject(this.getCause());
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel parcel, int n2) {
|
||||
if (this.m_domain != null && this.m_domain.length() > 0) {
|
||||
parcel.writeString(this.m_domain);
|
||||
} else {
|
||||
parcel.writeString("");
|
||||
}
|
||||
parcel.writeInt(this.m_code);
|
||||
Throwable throwable = this.getCause();
|
||||
if (throwable != null) {
|
||||
parcel.writeSerializable((Serializable)throwable);
|
||||
return;
|
||||
}
|
||||
parcel.writeSerializable((Serializable)((Object)""));
|
||||
}
|
||||
|
||||
public static enum Code {
|
||||
UNKNOWN(0),
|
||||
SYSTEM_UNEXPECTED(100),
|
||||
NOT_READY(101),
|
||||
UNSUPPORTED(102),
|
||||
NOT_AVAILABLE(103),
|
||||
NOT_IMPLEMENTED(104),
|
||||
INVALID_ARGUMENT(301),
|
||||
MISSING_CALLBACK(300),
|
||||
NETWORK_UNSUPPORTED_CONNECTION_TYPE(1001),
|
||||
NETWORK_NO_CONNECTION(1002),
|
||||
NETWORK_UNREACHABLE(1003),
|
||||
NETWORK_OVERSIZE_DATA(1004),
|
||||
NETWORK_OPERATION_CANCELLED(1005),
|
||||
NETWORK_INVALID_SERVER_RESPONSE(1006),
|
||||
NETWORK_TIMEOUT(1007),
|
||||
NETWORK_CONNECTION_ERROR(1010),
|
||||
SYNERGY_SERVER_FULL(2001),
|
||||
SYNERGY_GET_DIRECTION_TIMEOUT(2002),
|
||||
SYNERGY_GET_EA_DEVICE_ID_FAILURE(2003),
|
||||
SYNERGY_VALIDATE_EA_DEVICE_ID_FAILURE(2004),
|
||||
SYNERGY_GET_ANONYMOUS_ID_FAILURE(2005),
|
||||
SYNERGY_ENVIRONMENT_UPDATE_FAILURE(2006),
|
||||
SYNERGY_PURCHASE_VERIFICATION_FAILURE(2007),
|
||||
SYNERGY_GET_NONCE_FAILURE(2008),
|
||||
SYNERGY_GET_AGE_COMPLIANCE_FAILURE(2009);
|
||||
|
||||
private int m_value;
|
||||
|
||||
private Code(int n3) {
|
||||
this.m_value = n3;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return this.m_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Base;
|
||||
import com.ea.nimble.FacebookImpl;
|
||||
import com.ea.nimble.IFacebook;
|
||||
|
||||
public class Facebook {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.facebook";
|
||||
|
||||
public static IFacebook getComponent() {
|
||||
return (IFacebook)((Object)Base.getComponent(COMPONENT_ID));
|
||||
}
|
||||
|
||||
private static void initialize() {
|
||||
Base.registerComponent(new FacebookImpl(), COMPONENT_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.IFacebook;
|
||||
|
||||
public interface FacebookCallback {
|
||||
public void callback(IFacebook var1, boolean var2, Exception var3);
|
||||
}
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
class FacebookImpl extends Component implements IApplicationLifecycle.ActivityEventCallbacks, IApplicationLifecycle.ActivityLifecycleCallbacks, IFacebook, LogSource {
|
||||
static boolean bHasSeenOpening;
|
||||
private static String TAG = "Facebook";
|
||||
private static List<IFacebook.FacebookCallback> m_callbackQueue = new ArrayList();
|
||||
private Map<String, Object> userInfo = null;
|
||||
private AtomicBoolean isUserGraphReady = new AtomicBoolean(true);
|
||||
|
||||
private String getFacebookSDKVersion() {
|
||||
try {
|
||||
return String.valueOf(getClass().getClassLoader().loadClass("com.facebook.FacebookSdkVersion").getField("BUILD").get(null));
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.Helper.LOGW(TAG, "Unable to get FB SDK version.");
|
||||
return null;
|
||||
} catch (IllegalAccessException e2) {
|
||||
Log.Helper.LOGW(TAG, "Unable to get FB SDK version.");
|
||||
return null;
|
||||
} catch (IllegalArgumentException e3) {
|
||||
Log.Helper.LOGW(TAG, "Unable to get FB SDK version.");
|
||||
return null;
|
||||
} catch (NoSuchFieldException e4) {
|
||||
Log.Helper.LOGW(TAG, "Unable to get FB SDK version.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.ea.nimble.Component
|
||||
public void cleanup() {
|
||||
ApplicationLifecycle.getComponent().unregisterActivityLifecycleCallbacks(this);
|
||||
ApplicationLifecycle.getComponent().unregisterActivityEventCallbacks(this);
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public String getAccessToken() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public String getApplicationId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public String getComponentId() {
|
||||
return Facebook.COMPONENT_ID;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public Date getExpirationDate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public Map<String, Object> getGraphUser() {
|
||||
if (this.isUserGraphReady.get()) {
|
||||
return this.userInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.LogSource
|
||||
public String getLogSourceTitle() {
|
||||
return "Facebook";
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public boolean hasOpenSession() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public void login(List<String> list, IFacebook.FacebookCallback facebookCallback) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public void logout() {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityPaused(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
||||
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityResumed(Activity activity) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityStarted(Activity activity) {
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityLifecycleCallbacks
|
||||
public void onActivityStopped(Activity activity) {
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
||||
public boolean onBackPressed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IApplicationLifecycle.ActivityEventCallbacks
|
||||
public void onWindowFocusChanged(boolean z) {
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public void refreshSession(final String str, Date date) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore() {
|
||||
ApplicationLifecycle.getComponent().registerActivityEventCallbacks(this);
|
||||
ApplicationLifecycle.getComponent().registerActivityLifecycleCallbacks(this);
|
||||
}
|
||||
|
||||
public void retrieveCurrentUserProfile(IFacebook.FacebookFriendsCallback facebookFriendsCallback) {
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public void retrieveFriends(final int i, final int i2, final IFacebook.FacebookFriendsCallback facebookFriendsCallback) {
|
||||
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.IFacebook
|
||||
public void sendAppRequest(final String str, final String str2, final String str3, final IFacebook.FacebookCallback facebookCallback) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void setup() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public class Global {
|
||||
public static final String NIMBLE_AUTHENTICATOR_ANONYMOUS = "anonymous";
|
||||
public static final String NIMBLE_AUTHENTICATOR_FACEBOOK = "facebook";
|
||||
public static final String NIMBLE_AUTHENTICATOR_ORIGIN = "origin";
|
||||
public static final String NIMBLE_DOMAIN = "com.ea.nimble";
|
||||
public static final String NIMBLE_ID = "Nimble";
|
||||
public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_AUTHENTICATOR_ID = "authenticatorId";
|
||||
public static final String NIMBLE_IDENTITY_DICTIONARY_KEY_PIDMAP_ID = "pidMapId";
|
||||
public static final String NIMBLE_NOTIFICATION_IDENTITY_AUTHENTICATION_UPDATE = "nimble.notification.identity.authentication.update";
|
||||
public static final String NIMBLE_NOTIFICATION_IDENTITY_MAIN_AUTHENTICATOR_CHANGE = "nimble.notification.identity.main.authenticator.change";
|
||||
public static final String NIMBLE_NOTIFICATION_IDENTITY_PERSONA_INFO_UPDATE = "nimble.notification.identity.authenticator.persona.info.update";
|
||||
public static final String NIMBLE_NOTIFICATION_IDENTITY_PID_INFO_UPDATE = "nimble.notification.identity.authenticator.pid.info.update";
|
||||
public static final String NIMBLE_NOTIFICATION_IDENTITY_USER_INFO_UPDATE = "nimble.notification.identity.authenticator.user.info.update";
|
||||
public static final String NIMBLE_RELEASE_VERSION = "1.23.14.1217";
|
||||
public static final String NIMBLE_SDK_VERSION = "1.23.14.1217";
|
||||
public static final String NOTIFICATION_COMPONENT_INDEPENDENT_SETUP_FINISHED = "nimble.notification.componentIndependentSetupFinished";
|
||||
public static final String NOTIFICATION_DICTIONARY_KEY_DETAIL_ERROR = "detailError";
|
||||
public static final String NOTIFICATION_DICTIONARY_KEY_ERROR = "error";
|
||||
public static final String NOTIFICATION_DICTIONARY_KEY_RESULT = "result";
|
||||
public static final String NOTIFICATION_DICTIONARY_RESULT_FAIL = "0";
|
||||
public static final String NOTIFICATION_DICTIONARY_RESULT_SUCCESS = "1";
|
||||
public static final String NOTIFICATION_LANGUAGE_CHANGE = "nimble.notification.LanguageChanged";
|
||||
public static final String NOTIFICATION_LOGIN_STATUS_CHANGE = "nimble.notification.LoginStatusChanged";
|
||||
public static final String NOTIFICATION_NETWORK_STATUS_CHANGE = "nimble.notification.networkStatusChanged";
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
|
||||
class HttpError
|
||||
extends Error {
|
||||
public static final String ERROR_DOMAIN = "HttpError";
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public HttpError(int n2, String string2) {
|
||||
super(ERROR_DOMAIN, n2, string2, null);
|
||||
}
|
||||
|
||||
public HttpError(int n2, String string2, Throwable throwable) {
|
||||
super(ERROR_DOMAIN, n2, string2, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.IHttpRequest;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.net.URL;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class HttpRequest
|
||||
implements IHttpRequest {
|
||||
private static int DEFAULT_NETWORK_TIMEOUT = 30;
|
||||
public ByteArrayOutputStream data;
|
||||
public HashMap<String, String> headers;
|
||||
public IHttpRequest.Method method = IHttpRequest.Method.GET;
|
||||
public EnumSet<IHttpRequest.OverwritePolicy> overwritePolicy;
|
||||
public boolean runInBackground;
|
||||
public String targetFilePath;
|
||||
public double timeout;
|
||||
public URL url = null;
|
||||
|
||||
public HttpRequest() {
|
||||
this.data = new ByteArrayOutputStream();
|
||||
this.headers = new HashMap();
|
||||
this.overwritePolicy = IHttpRequest.OverwritePolicy.SMART;
|
||||
this.timeout = DEFAULT_NETWORK_TIMEOUT;
|
||||
}
|
||||
|
||||
public HttpRequest(URL uRL) {
|
||||
this();
|
||||
this.url = uRL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getData() {
|
||||
return this.data.toByteArray();
|
||||
}
|
||||
|
||||
public HashMap<String, String> getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHttpRequest.Method getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<IHttpRequest.OverwritePolicy> getOverwritePolicy() {
|
||||
return this.overwritePolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getRunInBackground() {
|
||||
return this.runInBackground;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTargetFilePath() {
|
||||
return this.targetFilePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTimeout() {
|
||||
return this.timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.ByteBufferIOStream;
|
||||
import com.ea.nimble.IHttpResponse;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpResponse
|
||||
implements IHttpResponse {
|
||||
public ByteBufferIOStream data;
|
||||
public long downloadedContentLength = 0L;
|
||||
public Exception error;
|
||||
public long expectedContentLength = 0L;
|
||||
public HashMap<String, String> headers = new HashMap();
|
||||
public boolean isCompleted = false;
|
||||
public long lastModified = -1L;
|
||||
public int statusCode = 0;
|
||||
public URL url = null;
|
||||
|
||||
public HttpResponse() {
|
||||
this.data = new ByteBufferIOStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getDataStream() {
|
||||
return this.data.getInputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDownloadedContentLength() {
|
||||
return this.downloadedContentLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Exception getError() {
|
||||
return this.error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getExpectedContentLength() {
|
||||
return this.expectedContentLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getLastModified() {
|
||||
if (this.lastModified == 0L) {
|
||||
return new Date();
|
||||
}
|
||||
if (this.lastModified <= 0L) return null;
|
||||
return new Date(this.lastModified);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted() {
|
||||
return this.isCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.Context
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public interface IApplicationEnvironment {
|
||||
public int getAgeCompliance();
|
||||
|
||||
public String getApplicationBundleId();
|
||||
|
||||
public Context getApplicationContext();
|
||||
|
||||
public String getApplicationLanguageCode();
|
||||
|
||||
public String getApplicationName();
|
||||
|
||||
public String getApplicationVersion();
|
||||
|
||||
public String getCachePath();
|
||||
|
||||
public String getCarrier();
|
||||
|
||||
public String getDeviceBrand();
|
||||
|
||||
public String getDeviceCodename();
|
||||
|
||||
public String getDeviceFingerprint();
|
||||
|
||||
public String getDeviceManufacturer();
|
||||
|
||||
public String getDeviceModel();
|
||||
|
||||
public String getDeviceString();
|
||||
|
||||
public String getDocumentPath();
|
||||
|
||||
public String getGameSpecifiedPlayerId();
|
||||
|
||||
public String getGoogleAdvertisingId();
|
||||
|
||||
public String getGoogleEmail();
|
||||
|
||||
public boolean getIadAttribution();
|
||||
|
||||
public String getMACAddress();
|
||||
|
||||
public String getOsVersion();
|
||||
|
||||
public String getShortApplicationLanguageCode();
|
||||
|
||||
public String getTempPath();
|
||||
|
||||
public boolean isAppCracked();
|
||||
|
||||
public boolean isDeviceRooted();
|
||||
|
||||
public boolean isLimitAdTrackingEnabled();
|
||||
|
||||
public void refreshAgeCompliance();
|
||||
|
||||
public void setApplicationBundleId(String var1);
|
||||
|
||||
public void setApplicationLanguageCode(String var1);
|
||||
|
||||
public void setGameSpecifiedPlayerId(String var1);
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.app.Activity
|
||||
* android.content.Intent
|
||||
* android.os.Bundle
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
public interface IApplicationLifecycle {
|
||||
boolean handleBackPressed();
|
||||
|
||||
void notifyActivityCreate(Bundle var1, Activity var2);
|
||||
|
||||
void notifyActivityDestroy(Activity var1);
|
||||
|
||||
void notifyActivityPause(Activity var1);
|
||||
|
||||
void notifyActivityRestart(Activity var1);
|
||||
|
||||
void notifyActivityRestoreInstanceState(Bundle var1, Activity var2);
|
||||
|
||||
void notifyActivityResult(int var1, int var2, Intent var3, Activity var4);
|
||||
|
||||
void notifyActivityResume(Activity var1);
|
||||
|
||||
void notifyActivityRetainNonConfigurationInstance();
|
||||
|
||||
void notifyActivitySaveInstanceState(Bundle var1, Activity var2);
|
||||
|
||||
void notifyActivityStart(Activity var1);
|
||||
|
||||
void notifyActivityStop(Activity var1);
|
||||
|
||||
void notifyActivityWindowFocusChanged(boolean var1, Activity var2);
|
||||
|
||||
void registerActivityEventCallbacks(ActivityEventCallbacks var1);
|
||||
|
||||
void registerActivityLifecycleCallbacks(ActivityLifecycleCallbacks var1);
|
||||
|
||||
void registerApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks var1);
|
||||
|
||||
void unregisterActivityEventCallbacks(ActivityEventCallbacks var1);
|
||||
|
||||
void unregisterActivityLifecycleCallbacks(ActivityLifecycleCallbacks var1);
|
||||
|
||||
void unregisterApplicationLifecycleCallbacks(ApplicationLifecycleCallbacks var1);
|
||||
|
||||
interface ActivityEventCallbacks {
|
||||
void onActivityResult(Activity var1, int var2, int var3, Intent var4);
|
||||
|
||||
boolean onBackPressed();
|
||||
|
||||
void onWindowFocusChanged(boolean var1);
|
||||
}
|
||||
|
||||
interface ActivityLifecycleCallbacks {
|
||||
void onActivityCreated(Activity var1, Bundle var2);
|
||||
|
||||
void onActivityDestroyed(Activity var1);
|
||||
|
||||
void onActivityPaused(Activity var1);
|
||||
|
||||
void onActivityResumed(Activity var1);
|
||||
|
||||
void onActivitySaveInstanceState(Activity var1, Bundle var2);
|
||||
|
||||
void onActivityStarted(Activity var1);
|
||||
|
||||
void onActivityStopped(Activity var1);
|
||||
}
|
||||
|
||||
interface ApplicationLifecycleCallbacks {
|
||||
void onApplicationLaunch(Intent var1);
|
||||
|
||||
void onApplicationQuit();
|
||||
|
||||
void onApplicationResume();
|
||||
|
||||
void onApplicationSuspend();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* org.json.JSONArray
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.json.JSONArray;
|
||||
|
||||
public interface IFacebook {
|
||||
public static final String NIMBLE_NOTIFICATION_FACEBOOK_STATUS_CHANGED = "nimble.notification.facebook.statuschanged";
|
||||
|
||||
public String getAccessToken();
|
||||
|
||||
public String getApplicationId();
|
||||
|
||||
public Date getExpirationDate();
|
||||
|
||||
public Map<String, Object> getGraphUser();
|
||||
|
||||
public boolean hasOpenSession();
|
||||
|
||||
public void login(List<String> var1, FacebookCallback var2);
|
||||
|
||||
public void logout();
|
||||
|
||||
public void refreshSession(String var1, Date var2);
|
||||
|
||||
public void retrieveFriends(int var1, int var2, FacebookFriendsCallback var3);
|
||||
|
||||
public void sendAppRequest(String var1, String var2, String var3, FacebookCallback var4);
|
||||
|
||||
public static interface FacebookCallback {
|
||||
public void callback(IFacebook var1, boolean var2, Exception var3);
|
||||
}
|
||||
|
||||
public static interface FacebookFriendsCallback {
|
||||
public void callback(IFacebook var1, JSONArray var2, Error var3);
|
||||
}
|
||||
|
||||
public static interface FqlRequestCallBack {
|
||||
public void requestComplete(JSONArray var1, Error var2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IHttpRequest {
|
||||
byte[] getData();
|
||||
|
||||
Map<String, String> getHeaders();
|
||||
|
||||
Method getMethod();
|
||||
|
||||
EnumSet<OverwritePolicy> getOverwritePolicy();
|
||||
|
||||
boolean getRunInBackground();
|
||||
|
||||
String getTargetFilePath();
|
||||
|
||||
double getTimeout();
|
||||
|
||||
URL getUrl();
|
||||
|
||||
static enum Method {
|
||||
GET("GET"),
|
||||
HEAD("HEAD"),
|
||||
POST("POST"),
|
||||
PUT("PUT"),
|
||||
DELETE("DELETE"),
|
||||
UNRECOGNIZED("UNRECOGNIZED");
|
||||
|
||||
private String title;
|
||||
|
||||
Method(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
enum OverwritePolicy {
|
||||
RESUME_DOWNLOAD,
|
||||
DATE_CHECK,
|
||||
LENGTH_CHECK;
|
||||
|
||||
static final EnumSet<OverwritePolicy> OVERWRITE;
|
||||
static final EnumSet<OverwritePolicy> SMART;
|
||||
|
||||
static {
|
||||
OVERWRITE = EnumSet.noneOf(OverwritePolicy.class);
|
||||
SMART = EnumSet.allOf(OverwritePolicy.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IHttpResponse {
|
||||
public InputStream getDataStream();
|
||||
|
||||
public long getDownloadedContentLength();
|
||||
|
||||
public Exception getError();
|
||||
|
||||
public long getExpectedContentLength();
|
||||
|
||||
public Map<String, String> getHeaders();
|
||||
|
||||
public Date getLastModified();
|
||||
|
||||
public int getStatusCode();
|
||||
|
||||
public URL getUrl();
|
||||
|
||||
public boolean isCompleted();
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public interface ILog {
|
||||
String getLogFilePath();
|
||||
|
||||
int getThresholdLevel();
|
||||
|
||||
void setThresholdLevel(int var1);
|
||||
|
||||
void writeWithSource(int var1, Object var2, String var3, Object ... var4);
|
||||
|
||||
void writeWithTitle(int var1, String var2, String var3, Object ... var4);
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.HttpRequest;
|
||||
import com.ea.nimble.IOperationalTelemetryDispatch;
|
||||
import com.ea.nimble.Network;
|
||||
import com.ea.nimble.NetworkConnectionCallback;
|
||||
import com.ea.nimble.NetworkConnectionHandle;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
|
||||
public interface INetwork {
|
||||
public void forceRedetectNetworkStatus();
|
||||
|
||||
public Network.Status getStatus();
|
||||
|
||||
public boolean isNetworkWifi();
|
||||
|
||||
public NetworkConnectionHandle sendDeleteRequest(URL var1, HashMap<String, String> var2, NetworkConnectionCallback var3);
|
||||
|
||||
public NetworkConnectionHandle sendGetRequest(URL var1, HashMap<String, String> var2, NetworkConnectionCallback var3);
|
||||
|
||||
public NetworkConnectionHandle sendPostRequest(URL var1, HashMap<String, String> var2, byte[] var3, NetworkConnectionCallback var4);
|
||||
|
||||
public NetworkConnectionHandle sendRequest(HttpRequest var1, NetworkConnectionCallback var2);
|
||||
|
||||
public NetworkConnectionHandle sendRequest(HttpRequest var1, NetworkConnectionCallback var2, IOperationalTelemetryDispatch var3);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.OperationalTelemetryEvent;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IOperationalTelemetryDispatch {
|
||||
public static final String EVENTTYPE_NETWORK_METRICS = "com.ea.nimble.network";
|
||||
public static final String EVENTTYPE_TRACKING_SYNERGY_PAYLOADS = "com.ea.nimble.trackingimpl.synergy";
|
||||
public static final int NIMBLE_DEFAULT_MAX_OT_EVENT_COUNT = 100;
|
||||
public static final String NOTIFICATION_OT_EVENT_THRESHOLD_WARNING = "nimble.notification.ot.eventthresholdwarning";
|
||||
|
||||
public List<OperationalTelemetryEvent> getEvents(String var1);
|
||||
|
||||
public int getMaxEventCount(String var1);
|
||||
|
||||
public void logEvent(String var1, Map<String, String> var2);
|
||||
|
||||
public void setMaxEventCount(String var1, int var2);
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Persistence;
|
||||
import com.ea.nimble.PersistenceService;
|
||||
|
||||
public interface IPersistenceService {
|
||||
public void cleanPersistenceReference(String var1, Persistence.Storage var2);
|
||||
|
||||
public Persistence getPersistence(String var1, Persistence.Storage var2);
|
||||
|
||||
public void migratePersistence(String var1, Persistence.Storage var2, String var3, PersistenceService.PersistenceMergePolicy var4);
|
||||
|
||||
public void removePersistence(String var1, Persistence.Storage var2);
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
import com.ea.nimble.NimbleConfiguration;
|
||||
|
||||
public interface ISynergyEnvironment {
|
||||
public static final int NETWORK_CONNECTION_NONE = 1;
|
||||
public static final int NETWORK_CONNECTION_UNKNOWN = 0;
|
||||
public static final int NETWORK_CONNECTION_WIFI = 2;
|
||||
public static final int NETWORK_CONNECTION_WIRELESS = 3;
|
||||
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;
|
||||
|
||||
public Error checkAndInitiateSynergyEnvironmentUpdate();
|
||||
|
||||
public String getEADeviceId();
|
||||
|
||||
public String getEAHardwareId();
|
||||
|
||||
public String getGosMdmAppKey();
|
||||
|
||||
public int getLatestAppVersionCheckResult();
|
||||
|
||||
public String getNexusClientId();
|
||||
|
||||
public String getNexusClientSecret();
|
||||
|
||||
public String getProductId();
|
||||
|
||||
public String getSellId();
|
||||
|
||||
public String getServerUrlWithKey(String var1);
|
||||
|
||||
public String getSynergyDirectorServerUrl(NimbleConfiguration var1);
|
||||
|
||||
public String getSynergyId();
|
||||
|
||||
public int getTrackingPostInterval();
|
||||
|
||||
public boolean isDataAvailable();
|
||||
|
||||
public boolean isUpdateInProgress();
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.SynergyIdManagerError;
|
||||
|
||||
public interface ISynergyIdManager {
|
||||
public String getAnonymousSynergyId();
|
||||
|
||||
public String getSynergyId();
|
||||
|
||||
public SynergyIdManagerError login(String var1, String var2);
|
||||
|
||||
public SynergyIdManagerError logout(String var1);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.SynergyNetworkConnectionCallback;
|
||||
import com.ea.nimble.SynergyNetworkConnectionHandle;
|
||||
import com.ea.nimble.SynergyRequest;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISynergyNetwork {
|
||||
public SynergyNetworkConnectionHandle sendGetRequest(String var1, String var2, Map<String, String> var3, SynergyNetworkConnectionCallback var4);
|
||||
|
||||
public SynergyNetworkConnectionHandle sendPostRequest(String var1, String var2, Map<String, String> var3, Map<String, Object> var4, SynergyNetworkConnectionCallback var5);
|
||||
|
||||
public SynergyNetworkConnectionHandle sendPostRequest(String var1, String var2, Map<String, String> var3, Map<String, Object> var4, SynergyNetworkConnectionCallback var5, Map<String, String> var6);
|
||||
|
||||
public void sendRequest(SynergyRequest var1, SynergyNetworkConnectionCallback var2);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.IHttpRequest;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISynergyRequest {
|
||||
public String getApi();
|
||||
|
||||
public String getBaseUrl();
|
||||
|
||||
public IHttpRequest getHttpRequest();
|
||||
|
||||
public Map<String, Object> getJsonData();
|
||||
|
||||
public Map<String, String> getUrlParameters();
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.IHttpResponse;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ISynergyResponse {
|
||||
public Exception getError();
|
||||
|
||||
public IHttpResponse getHttpResponse();
|
||||
|
||||
public Map<String, Object> getJsonData();
|
||||
|
||||
public boolean isCompleted();
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.ILog;
|
||||
import com.ea.nimble.LogImpl;
|
||||
|
||||
public class Log {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.NimbleLog";
|
||||
public static final int LEVEL_DEBUG = 200;
|
||||
public static final int LEVEL_ERROR = 500;
|
||||
public static final int LEVEL_FATAL = 600;
|
||||
public static final int LEVEL_INFO = 300;
|
||||
public static final int LEVEL_SILENT = 700;
|
||||
public static final int LEVEL_VERBOSE = 100;
|
||||
public static final int LEVEL_WARN = 400;
|
||||
private static ILog s_instance;
|
||||
|
||||
public static ILog getComponent() {
|
||||
synchronized (Log.class) {
|
||||
if (s_instance == null) {
|
||||
s_instance = new LogImpl();
|
||||
}
|
||||
ILog iLog = s_instance;
|
||||
return iLog;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Helper {
|
||||
public static void LOG(int n2, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(n2, null, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGD(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(200, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGDS(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(200, string2, string3, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGE(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(500, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGES(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(500, string2, string3, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGF(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(600, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGFS(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(600, string2, string3, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGI(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(300, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGIS(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(300, string2, string3, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGV(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(100, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGVS(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(100, string2, string3, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGW(Object object, String string2, Object ... objectArray) {
|
||||
Log.getComponent().writeWithSource(400, object, string2, objectArray);
|
||||
}
|
||||
|
||||
public static void LOGWS(String string2, String string3, Object ... objectArray) {
|
||||
Log.getComponent().writeWithTitle(400, string2, string3, objectArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,473 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.os.Environment
|
||||
* android.util.Log
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class LogImpl
|
||||
extends Component
|
||||
implements ILog {
|
||||
private static final int DEFAULT_CHECK_INTERVAL = 3600;
|
||||
private static final int DEFAULT_CONSOLE_OUTPUT_LIMIT = 4000;
|
||||
private static final int DEFAULT_MESSAGE_LENGTH_LIMIT = 1000;
|
||||
private static final int DEFAULT_SIZE_LIMIT = 1024;
|
||||
private ArrayList<LogRecord> m_cache = new ArrayList();
|
||||
private BaseCore m_core;
|
||||
private File m_filePath = null;
|
||||
private DateFormat m_format = null;
|
||||
private Timer m_guardTimer = null;
|
||||
private int m_interval = 0;
|
||||
private int m_level = 0;
|
||||
private FileOutputStream m_logFileStream = null;
|
||||
private int m_messageLengthLimit;
|
||||
private int m_sizeLimit;
|
||||
|
||||
LogImpl() {
|
||||
}
|
||||
|
||||
private void clearLog() {
|
||||
try {
|
||||
this.m_logFileStream.close();
|
||||
this.m_logFileStream = new FileOutputStream(this.m_filePath, false);
|
||||
return;
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
Log.e((String)"Nimble", (String)"LOG: Can't clear log file");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void configure() {
|
||||
boolean z = this.m_level == 0;
|
||||
Map<String, String> settings = this.m_core.getSettings(BaseCore.NIMBLE_LOG_SETTING);
|
||||
if (settings == null) {
|
||||
int parseLevel = parseLevel(null);
|
||||
if (parseLevel != this.m_level) {
|
||||
this.m_level = parseLevel;
|
||||
Log.i(Global.NIMBLE_ID, String.format("LOG: Default Log level(%d) without log configuration file", Integer.valueOf(this.m_level)));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int parseLevel2 = parseLevel(settings.get("Level"));
|
||||
if (parseLevel2 != this.m_level) {
|
||||
this.m_level = parseLevel2;
|
||||
Log.i(Global.NIMBLE_ID, String.format("LOG: Log level(%d)", Integer.valueOf(this.m_level)));
|
||||
}
|
||||
if (this.m_level <= 100) {
|
||||
this.m_messageLengthLimit = 0;
|
||||
} else {
|
||||
String str = settings.get("MessageLengthLimit");
|
||||
if (str == null) {
|
||||
this.m_messageLengthLimit = 1000;
|
||||
} else {
|
||||
try {
|
||||
this.m_messageLengthLimit = Integer.parseInt(str);
|
||||
if (this.m_messageLengthLimit < 0) {
|
||||
this.m_messageLengthLimit = 1000;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.m_messageLengthLimit = 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
String str2 = settings.get("File");
|
||||
if (Utility.validString(str2)) {
|
||||
String str3 = settings.get("Location");
|
||||
String str4 = ApplicationEnvironment.getComponent().getCachePath() + File.separator + str2;
|
||||
String str5 = str4;
|
||||
if (Utility.validString(str3)) {
|
||||
str5 = str4;
|
||||
if (str3.equalsIgnoreCase("external")) {
|
||||
str5 = str4;
|
||||
if (Environment.getExternalStorageState().equals("mounted")) {
|
||||
String name = ApplicationEnvironment.getCurrentActivity().getClass().getPackage().getName();
|
||||
try {
|
||||
name = ApplicationEnvironment.getCurrentActivity().getPackageManager().getPackageInfo(ApplicationEnvironment.getCurrentActivity().getPackageName(), 0).packageName;
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
File file = new File(Environment.getExternalStorageDirectory(), name);
|
||||
boolean exists = file.exists();
|
||||
boolean z2 = exists;
|
||||
if (!exists) {
|
||||
z2 = file.mkdir();
|
||||
}
|
||||
str5 = str4;
|
||||
if (z2) {
|
||||
str5 = file + File.separator + str2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File file2 = new File(str5);
|
||||
if (file2 != this.m_filePath) {
|
||||
this.m_filePath = file2;
|
||||
try {
|
||||
this.m_logFileStream = new FileOutputStream(this.m_filePath, true);
|
||||
Log.d(Global.NIMBLE_ID, "LOG: File path: " + this.m_filePath.toString());
|
||||
} catch (FileNotFoundException e3) {
|
||||
Log.e(Global.NIMBLE_ID, "LOG: Can't create log file at " + str5);
|
||||
this.m_filePath = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
String str6 = settings.get("DateFormat");
|
||||
if (str6 == null || str6.length() <= 0) {
|
||||
this.m_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
|
||||
} else {
|
||||
this.m_format = new SimpleDateFormat(str6, Locale.getDefault());
|
||||
}
|
||||
try {
|
||||
this.m_interval = Integer.parseInt(settings.get("FileCheckInterval"));
|
||||
if (this.m_interval <= 0) {
|
||||
this.m_interval = DEFAULT_CHECK_INTERVAL;
|
||||
}
|
||||
} catch (NumberFormatException e4) {
|
||||
this.m_interval = DEFAULT_CHECK_INTERVAL;
|
||||
}
|
||||
try {
|
||||
this.m_sizeLimit = Integer.parseInt(settings.get("MaxFileSize"));
|
||||
if (this.m_sizeLimit <= 0) {
|
||||
this.m_sizeLimit = DEFAULT_SIZE_LIMIT;
|
||||
}
|
||||
} catch (NumberFormatException e5) {
|
||||
this.m_sizeLimit = DEFAULT_SIZE_LIMIT;
|
||||
}
|
||||
GuardTask guardTask = new GuardTask();
|
||||
guardTask.run();
|
||||
this.m_guardTimer = new Timer(guardTask);
|
||||
this.m_guardTimer.schedule((double) this.m_interval, true);
|
||||
} else if (z || this.m_filePath != null) {
|
||||
this.m_filePath = null;
|
||||
this.m_logFileStream = null;
|
||||
this.m_interval = 0;
|
||||
Log.i(Global.NIMBLE_ID, "LOG: Disable log to file since no filename provided");
|
||||
}
|
||||
}
|
||||
|
||||
private void flushCache() {
|
||||
Iterator<LogRecord> iterator = this.m_cache.iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
this.m_cache = null;
|
||||
return;
|
||||
}
|
||||
LogRecord logRecord = iterator.next();
|
||||
this.writeLine(logRecord.level, logRecord.message);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] formatLine(String string2, String stringArray) {
|
||||
int n2;
|
||||
stringArray = string2 + ">" + (String)stringArray;
|
||||
int n3 = n2 = stringArray.length();
|
||||
string2 = stringArray;
|
||||
if (n2 > this.m_messageLengthLimit) {
|
||||
n3 = n2;
|
||||
string2 = stringArray;
|
||||
if (this.m_messageLengthLimit != 0) {
|
||||
n3 = n2 - this.m_messageLengthLimit;
|
||||
string2 = stringArray.substring(0, this.m_messageLengthLimit) + String.format("... and %d chars more", n3);
|
||||
}
|
||||
}
|
||||
String[] strings = new String[(int) Math.ceil((double) n3 / 4000.0)];
|
||||
n2 = 0;
|
||||
while (n2 < n3) {
|
||||
strings[n2 / 4000] = n2 + 4000 < n3 ? string2.substring(n2, n2 + 4000) : string2.substring(n2);
|
||||
n2 += 4000;
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
||||
private void outputMessageToFile(String string2) {
|
||||
String string3 = System.getProperty("line.separator");
|
||||
if (this.m_logFileStream == null) return;
|
||||
try {
|
||||
string2 = this.m_format.format(new Date()) + " " + string2 + string3;
|
||||
this.m_logFileStream.write(string2.getBytes());
|
||||
this.m_logFileStream.flush();
|
||||
return;
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
Log.e((String)"Nimble", (String)("Error writing to log file: " + iOException.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private int parseLevel(String string2) {
|
||||
block9: {
|
||||
try {
|
||||
int n2;
|
||||
if (Utility.validString(string2) && (n2 = Integer.parseInt(string2)) != 0) {
|
||||
return n2;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException numberFormatException) {
|
||||
if (string2.equalsIgnoreCase("verbose")) {
|
||||
return 100;
|
||||
}
|
||||
if (string2.equalsIgnoreCase("debug")) {
|
||||
return 200;
|
||||
}
|
||||
if (string2.equalsIgnoreCase("info")) {
|
||||
return 300;
|
||||
}
|
||||
if (string2.equalsIgnoreCase("warn")) {
|
||||
return 400;
|
||||
}
|
||||
if (string2.equalsIgnoreCase("error")) {
|
||||
return 500;
|
||||
}
|
||||
if (string2.equalsIgnoreCase("fatal")) {
|
||||
return 600;
|
||||
}
|
||||
if (!string2.equalsIgnoreCase("silent")) break block9;
|
||||
return 700;
|
||||
}
|
||||
}
|
||||
if (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION) return 100;
|
||||
if (this.m_core.getConfiguration() != NimbleConfiguration.STAGE) return 500;
|
||||
return 100;
|
||||
}
|
||||
|
||||
private void write(int n2, String string2, String object) {
|
||||
string2 = Utility.validString(string2) ? string2 + "> " + object : " " + object;
|
||||
if (this.m_cache != null) {
|
||||
LogRecord logRecord = new LogRecord();//object
|
||||
logRecord.level = n2;
|
||||
logRecord.message = string2;
|
||||
this.m_cache.add(logRecord);
|
||||
return;
|
||||
}
|
||||
this.writeLine(n2, string2);
|
||||
}
|
||||
|
||||
private void writeLine(int n2, String string2) {
|
||||
block15: {
|
||||
String string3;
|
||||
int n3 = 0;
|
||||
int n4 = 0;
|
||||
int n5 = 0;
|
||||
int n6 = 0;
|
||||
switch (n2) {
|
||||
default: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine(String.format("NIM(%d)", n2), string2);
|
||||
string3 = stringArray[0];
|
||||
for (n7 = 0; n7 < stringArray.length - 1; ++n7) {
|
||||
Log.e((String)"Nimble", (String)string3);
|
||||
this.outputMessageToFile(string3);
|
||||
string3 = stringArray[n7 + 1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100: {
|
||||
for (String string4 : this.formatLine("NIM_VERBOSE", string2)) {
|
||||
Log.v((String)"Nimble", (String)string4);
|
||||
this.outputMessageToFile(string4);
|
||||
}
|
||||
break block15;
|
||||
}
|
||||
case 200: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine("NIM_DEBUG", string2);
|
||||
n4 = stringArray.length;
|
||||
for (n7 = n3; n7 < n4; ++n7) {
|
||||
String string5 = stringArray[n7];
|
||||
Log.d((String)"Nimble", (String)string5);
|
||||
this.outputMessageToFile(string5);
|
||||
}
|
||||
break block15;
|
||||
}
|
||||
case 300: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine("NIM_INFO", string2);
|
||||
n3 = stringArray.length;
|
||||
for (n7 = n4; n7 < n3; ++n7) {
|
||||
String string6 = stringArray[n7];
|
||||
Log.i((String)"Nimble", (String)string6);
|
||||
this.outputMessageToFile(string6);
|
||||
}
|
||||
break block15;
|
||||
}
|
||||
case 400: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine("NIM_WARN", string2);
|
||||
n3 = stringArray.length;
|
||||
for (n7 = n5; n7 < n3; ++n7) {
|
||||
String string7 = stringArray[n7];
|
||||
Log.w((String)"Nimble", (String)string7);
|
||||
this.outputMessageToFile(string7);
|
||||
}
|
||||
break block15;
|
||||
}
|
||||
case 500: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine("NIM_ERROR", string2);
|
||||
n3 = stringArray.length;
|
||||
for (n7 = n6; n7 < n3; ++n7) {
|
||||
String string8 = stringArray[n7];
|
||||
Log.e((String)"Nimble", (String)string8);
|
||||
this.outputMessageToFile(string8);
|
||||
}
|
||||
break block15;
|
||||
}
|
||||
case 600: {
|
||||
int n7;
|
||||
String[] stringArray = this.formatLine("NIM_FATAL", string2);
|
||||
String string9 = stringArray[0];
|
||||
for (n7 = 0; n7 < stringArray.length - 1; ++n7) {
|
||||
Log.e((String)"Nimble", (String)string9);
|
||||
this.outputMessageToFile(string9);
|
||||
string9 = stringArray[n7 + 1];
|
||||
}
|
||||
Log.wtf((String)"Nimble", (String)string9);
|
||||
this.outputMessageToFile(string9);
|
||||
break block15;
|
||||
}
|
||||
}
|
||||
Log.wtf((String)"Nimble", (String)string3);
|
||||
this.outputMessageToFile(string3);
|
||||
}
|
||||
if (n2 < 600) return;
|
||||
if (this.m_core.getConfiguration() == NimbleConfiguration.INTEGRATION) throw new AssertionError((Object)string2);
|
||||
if (this.m_core.getConfiguration() != NimbleConfiguration.STAGE) return;
|
||||
throw new AssertionError((Object)string2);
|
||||
}
|
||||
|
||||
protected void connectToCore(BaseCore baseCore) {
|
||||
this.m_core = baseCore;
|
||||
this.configure();
|
||||
this.flushCache();
|
||||
}
|
||||
|
||||
protected void disconnectFromCore() {
|
||||
this.m_core = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.NimbleLog";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogFilePath() {
|
||||
return this.m_filePath.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThresholdLevel() {
|
||||
return this.m_level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (this.m_guardTimer == null) return;
|
||||
this.m_guardTimer.fire();
|
||||
this.m_guardTimer.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThresholdLevel(int n2) {
|
||||
this.m_level = n2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
this.configure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspend() {
|
||||
if (this.m_guardTimer == null) return;
|
||||
this.m_guardTimer.pause();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void teardown() {
|
||||
if (this.m_guardTimer != null) {
|
||||
this.m_guardTimer.cancel();
|
||||
this.m_guardTimer = null;
|
||||
}
|
||||
if (this.m_logFileStream != null) {
|
||||
try {
|
||||
this.m_logFileStream.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(Global.NIMBLE_ID, "LOG: Can't close log file");
|
||||
}
|
||||
this.m_logFileStream = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeWithSource(int n2, Object object, String string2, Object ... objectArray) {
|
||||
if (n2 < this.m_level) return;
|
||||
if (!Utility.validString(string2)) {
|
||||
return;
|
||||
}
|
||||
if (objectArray.length > 0) {
|
||||
string2 = String.format(string2, objectArray);
|
||||
}
|
||||
if (object instanceof LogSource) {
|
||||
this.write(n2, ((LogSource)object).getLogSourceTitle(), string2);
|
||||
return;
|
||||
}
|
||||
if (this.m_level <= 100 && object != null) {
|
||||
this.write(n2, object.getClass().getName(), string2);
|
||||
return;
|
||||
}
|
||||
this.write(n2, null, string2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeWithTitle(int n2, String string2, String string3, Object ... objectArray) {
|
||||
if (n2 < this.m_level) return;
|
||||
if (!Utility.validString(string3)) {
|
||||
return;
|
||||
}
|
||||
if (objectArray.length > 0) {
|
||||
string3 = String.format(string3, objectArray);
|
||||
}
|
||||
this.write(n2, string2, string3);
|
||||
}
|
||||
|
||||
private class GuardTask
|
||||
implements Runnable {
|
||||
private GuardTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (LogImpl.this.m_filePath == null) return;
|
||||
if (LogImpl.this.m_filePath.length() <= (long)(LogImpl.this.m_sizeLimit * 1024)) return;
|
||||
LogImpl.this.clearLog();
|
||||
}
|
||||
}
|
||||
|
||||
private class LogRecord {
|
||||
public int level;
|
||||
public String message;
|
||||
|
||||
private LogRecord() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public interface LogSource {
|
||||
public String getLogSourceTitle();
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class Network {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.network";
|
||||
|
||||
public static String generateParameterString(Map<String, String> object) {
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
if (object.size() == 0) return null;
|
||||
String string2 = "";
|
||||
Iterator<Map.Entry<String, String>> iterator = object.entrySet().iterator();
|
||||
return "";
|
||||
}
|
||||
|
||||
public static URL generateURL(String string2, Map<String, String> object) {
|
||||
if ("".equals(string2)) {
|
||||
Log.Helper.LOGWS("Network", "Base url is blank, return null");
|
||||
return null;
|
||||
}
|
||||
if (Network.generateParameterString(object) == null) {
|
||||
Log.Helper.LOGWS("Network", "Generated URL with only base url = %s", string2);
|
||||
} else {
|
||||
string2 = string2 + "?" + object;
|
||||
Log.Helper.LOGVS("Network", "Generated URL = %s", string2);
|
||||
}
|
||||
try {
|
||||
return new URL(string2);
|
||||
}
|
||||
catch (MalformedURLException malformedURLException) {
|
||||
Log.Helper.LOGFS("Network", "Malformed URL from %s", string2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static INetwork getComponent() {
|
||||
return (INetwork)((Object)Base.getComponent(COMPONENT_ID));
|
||||
}
|
||||
|
||||
public enum Status {
|
||||
UNKNOWN,
|
||||
NONE,
|
||||
DEAD,
|
||||
OK;
|
||||
|
||||
|
||||
public String toString() {
|
||||
switch (this.ordinal()) {
|
||||
default: {
|
||||
return "NET UNKNOWN";
|
||||
}
|
||||
case 1: {
|
||||
return "NET NONE";
|
||||
}
|
||||
case 2: {
|
||||
return "NET DEAD";
|
||||
}
|
||||
case 3:
|
||||
}
|
||||
return "NET OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,830 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.ea.ironmonkey.devmenu.util.Observer;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
public class NetworkConnection implements LogSource, NetworkConnectionHandle, Runnable {
|
||||
private static int MAXIMUM_RAW_DATA_LENGTH = 1048576;
|
||||
static int s_loggingIdCount = 100;
|
||||
private NetworkConnectionCallback m_completionCallback;
|
||||
private Date m_connectionStartTimestamp;
|
||||
private NetworkConnectionCallback m_headerCallback;
|
||||
private String m_loggingId;
|
||||
private NetworkImpl m_manager;
|
||||
private IOperationalTelemetryDispatch m_otDispatch;
|
||||
private NetworkConnectionCallback m_progressCallback;
|
||||
private HttpRequest m_request;
|
||||
private String m_requestDataForLog;
|
||||
private HttpResponse m_response;
|
||||
private StringBuilder m_responseDataForLog;
|
||||
private Thread m_thread;
|
||||
|
||||
public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest) {
|
||||
this(networkImpl, httpRequest, null);
|
||||
}
|
||||
|
||||
public NetworkConnection(NetworkImpl networkImpl, HttpRequest httpRequest, IOperationalTelemetryDispatch iOperationalTelemetryDispatch) {
|
||||
this.m_manager = networkImpl;
|
||||
this.m_thread = null;
|
||||
this.m_request = httpRequest;
|
||||
this.m_response = new HttpResponse();
|
||||
this.m_headerCallback = null;
|
||||
this.m_progressCallback = null;
|
||||
this.m_completionCallback = null;
|
||||
this.m_connectionStartTimestamp = null;
|
||||
this.m_otDispatch = iOperationalTelemetryDispatch;
|
||||
this.m_loggingId = String.valueOf(s_loggingIdCount);
|
||||
int i = s_loggingIdCount;
|
||||
s_loggingIdCount = i + 1;
|
||||
if (i >= 1000) {
|
||||
s_loggingIdCount = 100;
|
||||
}
|
||||
}
|
||||
|
||||
private String beautifyJSONString(String jsonString) {
|
||||
try {
|
||||
JSONTokener tokener = new JSONTokener(jsonString);
|
||||
JSONObject jsonObject = new JSONObject(tokener);
|
||||
return jsonObject.toString(4);
|
||||
} catch (JSONException e) {
|
||||
return jsonString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void downloadToBuffer(java.net.HttpURLConnection r7) throws java.io.IOException {
|
||||
Observer.onCallingMethod();
|
||||
}
|
||||
|
||||
private void downloadToBufferWithError(java.net.HttpURLConnection r7) {
|
||||
Observer.onCallingMethod();
|
||||
}
|
||||
|
||||
/* JADX WARN: Finally extract failed */
|
||||
private void downloadToFile(HttpURLConnection httpURLConnection) throws IOException {
|
||||
if (!skipDownloadForOverwritePolicy(httpURLConnection)) {
|
||||
File file = new File(this.m_request.targetFilePath);
|
||||
File file2 = new File(ApplicationEnvironment.getComponent().getCachePath() + File.separator + file.getName());
|
||||
boolean z = file2.exists() && this.m_request.overwritePolicy.contains(IHttpRequest.OverwritePolicy.RESUME_DOWNLOAD);
|
||||
InputStream inputStream = httpURLConnection.getInputStream();
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file2, z);
|
||||
byte[] bArr = new byte[65536];
|
||||
Log.Helper.LOGI(this, "Started File Download for " + file.toString());
|
||||
while (true) {
|
||||
try {
|
||||
int read = inputStream.read(bArr);
|
||||
if (read < 0) {
|
||||
break;
|
||||
} else if (read == 0) {
|
||||
Thread.yield();
|
||||
} else {
|
||||
fileOutputStream.write(bArr, 0, read);
|
||||
this.m_response.downloadedContentLength += (long) read;
|
||||
if (this.m_progressCallback != null) {
|
||||
this.m_progressCallback.callback(this);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
inputStream.close();
|
||||
fileOutputStream.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
inputStream.close();
|
||||
fileOutputStream.close();
|
||||
if (file.exists() && !file.delete()) {
|
||||
Log.Helper.LOGE(this, "Failed to delete existed target file " + file);
|
||||
}
|
||||
if (!file2.renameTo(file)) {
|
||||
Log.Helper.LOGI(this, "Failed to move temp file " + file2 + " to target file " + file);
|
||||
Log.Helper.LOGI(this, "Using fallback, and copying file instead " + file2 + "to target file " + file);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
FileChannel fileChannel = null;
|
||||
FileChannel fileChannel2 = null;
|
||||
FileChannel fileChannel3 = null;
|
||||
FileChannel fileChannel4 = null;
|
||||
try {
|
||||
try {
|
||||
FileChannel channel = new FileInputStream(file2).getChannel();
|
||||
FileChannel channel2 = new FileOutputStream(file).getChannel();
|
||||
fileChannel4 = channel2;
|
||||
fileChannel2 = channel;
|
||||
fileChannel3 = channel2;
|
||||
fileChannel = channel;
|
||||
channel2.transferFrom(channel, 0, channel.size());
|
||||
if (channel != null) {
|
||||
channel.close();
|
||||
}
|
||||
if (channel2 != null) {
|
||||
channel2.close();
|
||||
}
|
||||
if (file2.exists()) {
|
||||
file2.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
fileChannel3 = fileChannel4;
|
||||
fileChannel = fileChannel2;
|
||||
Log.Helper.LOGE(this, "ERROR while copying file, " + e);
|
||||
if (fileChannel2 != null) {
|
||||
fileChannel2.close();
|
||||
}
|
||||
if (fileChannel4 != null) {
|
||||
fileChannel4.close();
|
||||
}
|
||||
if (file2.exists()) {
|
||||
file2.delete();
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
if (fileChannel != null) {
|
||||
fileChannel.close();
|
||||
}
|
||||
if (fileChannel3 != null) {
|
||||
fileChannel3.close();
|
||||
}
|
||||
if (file2.exists()) {
|
||||
file2.delete();
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
this.m_response.isCompleted = true;
|
||||
logOperationalTelemetryResponse();
|
||||
if (this.m_completionCallback != null) {
|
||||
this.m_completionCallback.callback(this);
|
||||
}
|
||||
synchronized (this) {
|
||||
notifyAll();
|
||||
}
|
||||
this.m_manager.removeConnection(this);
|
||||
}
|
||||
|
||||
private void httpRecv(HttpURLConnection httpURLConnection) throws IOException, Error {
|
||||
InputStream errorStream;
|
||||
try {
|
||||
errorStream = httpURLConnection.getInputStream();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
errorStream = httpURLConnection.getErrorStream();
|
||||
} catch (Exception e2) {
|
||||
throw new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Exception when getting error stream from HTTP connection.", e2);
|
||||
}
|
||||
}
|
||||
this.m_response.url = httpURLConnection.getURL();
|
||||
try {
|
||||
this.m_response.statusCode = httpURLConnection.getResponseCode();
|
||||
this.m_response.expectedContentLength = (long) httpURLConnection.getContentLength();
|
||||
this.m_response.lastModified = httpURLConnection.getLastModified();
|
||||
for (Map.Entry<String, List<String>> entry : httpURLConnection.getHeaderFields().entrySet()) {
|
||||
this.m_response.headers.put(entry.getKey(), TextUtils.join(", ", entry.getValue()));
|
||||
}
|
||||
boolean z = this.m_response.expectedContentLength > ((long) MAXIMUM_RAW_DATA_LENGTH);
|
||||
boolean validString = Utility.validString(this.m_request.targetFilePath);
|
||||
if (!z || validString) {
|
||||
this.m_response.downloadedContentLength = 0;
|
||||
if (this.m_headerCallback != null) {
|
||||
this.m_headerCallback.callback(this);
|
||||
}
|
||||
if (validString && errorStream != null) {
|
||||
downloadToFile(httpURLConnection);
|
||||
} else if (this.m_response.expectedContentLength != 0) {
|
||||
if (this.m_response.data == null) {
|
||||
this.m_response.data = new ByteBufferIOStream((int) this.m_response.expectedContentLength);
|
||||
} else {
|
||||
this.m_response.data.clear();
|
||||
}
|
||||
if (this.m_response.statusCode == 200) {
|
||||
downloadToBuffer(httpURLConnection);
|
||||
} else {
|
||||
downloadToBufferWithError(httpURLConnection);
|
||||
}
|
||||
}
|
||||
if (!(this.m_response.statusCode == 200 || (validString && this.m_response.statusCode == 206))) {
|
||||
throw new HttpError(this.m_response.statusCode, "Request " + this + " failed for HTTP error");
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new Error(Error.Code.NETWORK_OVERSIZE_DATA, "Request " + this + " is oversize, please provide a local file path to download it as file.");
|
||||
} finally {
|
||||
if (errorStream != null) {
|
||||
errorStream.close();
|
||||
}
|
||||
logCommunication();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r6v0, types: [java.net.HttpURLConnection] */
|
||||
/* JADX WARN: Type inference failed for: r8v1, types: [java.io.OutputStream] */
|
||||
/* JADX WARN: Type inference failed for: r8v10, types: [java.lang.Object, java.lang.String] */
|
||||
/* JADX WARN: Type inference failed for: r8v11 */
|
||||
/* JADX WARN: Type inference failed for: r8v2 */
|
||||
/* JADX WARN: Type inference failed for: r8v3 */
|
||||
/* JADX WARN: Type inference failed for: r8v7 */
|
||||
/* JADX WARN: Type inference failed for: r8v8 */
|
||||
private void httpSend(HttpURLConnection httpURLConnection) throws IOException {
|
||||
String str;
|
||||
this.m_connectionStartTimestamp = new Date();
|
||||
if (this.m_request.headers != null) {
|
||||
Iterator<String> it = this.m_request.headers.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
str = it.next();
|
||||
httpURLConnection.setRequestProperty(str, this.m_request.headers.get(str));
|
||||
}
|
||||
}
|
||||
if (this.m_request.getMethod() == IHttpRequest.Method.POST || this.m_request.getMethod() == IHttpRequest.Method.PUT) {
|
||||
byte[] byteArray = this.m_request.data.toByteArray();
|
||||
if (byteArray == null || byteArray.length <= 0) {
|
||||
logRequest();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
prepareRequestLog(byteArray);
|
||||
logRequest();
|
||||
httpURLConnection.setDoOutput(true);
|
||||
httpURLConnection.setFixedLengthStreamingMode(byteArray.length);
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
OutputStream outputStream2 = httpURLConnection.getOutputStream();
|
||||
outputStream = outputStream2;
|
||||
outputStream2.write(byteArray);
|
||||
if (outputStream2 != null) {
|
||||
outputStream2.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
e.printStackTrace(new PrintWriter(stringWriter));
|
||||
Log.Helper.LOGE(this, "Exception in network connection:" + stringWriter.toString());
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
}
|
||||
} else {
|
||||
logRequest();
|
||||
}
|
||||
}
|
||||
|
||||
private void logCommunication() {
|
||||
if (Log.getComponent().getThresholdLevel() <= 100) {
|
||||
int i = 4096;
|
||||
if (this.m_requestDataForLog != null) {
|
||||
i = 4096 + this.m_requestDataForLog.length();
|
||||
}
|
||||
int i2 = i;
|
||||
if (this.m_responseDataForLog != null) {
|
||||
i2 = i + this.m_responseDataForLog.length();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(i2);
|
||||
sb.append(String.format("\n>>>> CONNECTION ID %s FINISHED >>>>>>>>>>>>>>\n", this.m_loggingId));
|
||||
sb.append("\n>>>> REQUEST >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
sb.append("REQUEST: ").append(this.m_request.method.toString());
|
||||
sb.append(' ').append(this.m_request.url.toString()).append('\n');
|
||||
boolean z = false;
|
||||
boolean z2 = false;
|
||||
if (this.m_request.headers != null) {
|
||||
z2 = false;
|
||||
if (this.m_request.headers.size() > 0) {
|
||||
Iterator<String> it = this.m_request.headers.keySet().iterator();
|
||||
while (true) {
|
||||
z2 = z;
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
String next = it.next();
|
||||
if (next != null) {
|
||||
sb.append("REQ HEADER: ").append(next);
|
||||
String safeString = Utility.safeString(this.m_request.headers.get(next));
|
||||
sb.append(" VALUE: ").append(safeString).append('\n');
|
||||
if (next.equals("Content-Type") && (safeString.contains("application/json") || safeString.contains("text/json"))) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.m_requestDataForLog != null && this.m_requestDataForLog.length() > 0) {
|
||||
sb.append("REQ BODY:\n");
|
||||
String str = this.m_requestDataForLog.toString();
|
||||
String str2 = str;
|
||||
if (z2) {
|
||||
str2 = beautifyJSONString(str);
|
||||
}
|
||||
sb.append(str2).append('\n');
|
||||
}
|
||||
sb.append("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
|
||||
sb.append(">>>> RESPONSE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
|
||||
sb.append("RESP URL: ").append(this.m_response.url.toString()).append('\n');
|
||||
sb.append("RESP STATUS: ").append(this.m_response.statusCode).append('\n');
|
||||
boolean z3 = false;
|
||||
boolean z4 = false;
|
||||
if (this.m_response.headers != null) {
|
||||
z4 = false;
|
||||
if (this.m_response.headers.size() > 0) {
|
||||
Iterator<String> it2 = this.m_response.headers.keySet().iterator();
|
||||
while (true) {
|
||||
z4 = z3;
|
||||
if (!it2.hasNext()) {
|
||||
break;
|
||||
}
|
||||
String next2 = it2.next();
|
||||
if (next2 != null) {
|
||||
sb.append("RESP HEADER: ").append(next2);
|
||||
String safeString2 = Utility.safeString(this.m_response.headers.get(next2));
|
||||
sb.append(" VALUE: ").append(safeString2).append('\n');
|
||||
if (next2.equals("Content-Type") && (safeString2.contains("application/json") || safeString2.contains("text/json"))) {
|
||||
z3 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append("RESP BODY:\n");
|
||||
String str3 = "<Empty>: there is no response body for this call";
|
||||
try {
|
||||
if (this.m_responseDataForLog != null) {
|
||||
str3 = this.m_responseDataForLog.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.Helper.LOGE(this, "Attempting to process the response body failed.");
|
||||
str3 = "<Empty>: there is no response body for this call";
|
||||
if (this.m_response != null) {
|
||||
str3 = "<Empty>: there is no response body for this call";
|
||||
if (this.m_response.getError() != null) {
|
||||
str3 = "<Empty>: there is no response body for this call";
|
||||
if (this.m_response.getError().getMessage() != null) {
|
||||
str3 = this.m_response.getError().getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String str4 = str3;
|
||||
if (z4) {
|
||||
str4 = beautifyJSONString(str3);
|
||||
}
|
||||
sb.append(str4).append('\n');
|
||||
sb.append("<<<< CONNECTION FINISHED <<<<<<<<<<<<<<<<<<<<<");
|
||||
Log.Helper.LOGV(this, sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void logRequest() {
|
||||
if (Log.getComponent().getThresholdLevel() <= 100) {
|
||||
int i = 2048;
|
||||
if (this.m_requestDataForLog != null) {
|
||||
i = 2048 + this.m_requestDataForLog.length();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(i);
|
||||
sb.append(String.format("\n>>>> CONNECTION ID %s BEGIN >>>>>>>>>>>>>>>>>\n", this.m_loggingId));
|
||||
sb.append("REQUEST: ").append(this.m_request.method.toString());
|
||||
sb.append(' ').append(this.m_request.url.toString()).append('\n');
|
||||
boolean z = false;
|
||||
boolean z2 = false;
|
||||
if (this.m_request.headers != null) {
|
||||
z2 = false;
|
||||
if (this.m_request.headers.size() > 0) {
|
||||
Iterator<String> it = this.m_request.headers.keySet().iterator();
|
||||
while (true) {
|
||||
z2 = z;
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
String next = it.next();
|
||||
sb.append("REQ HEADER: ").append(next);
|
||||
String str = this.m_request.headers.get(next);
|
||||
sb.append(" VALUE: ").append(str).append('\n');
|
||||
if (next.equals("Content-Type") && (str.contains("application/json") || str.contains("text/json"))) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.m_requestDataForLog != null && this.m_requestDataForLog.length() > 0) {
|
||||
sb.append("REQ BODY:\n");
|
||||
String str2 = this.m_requestDataForLog.toString();
|
||||
String str3 = str2;
|
||||
if (z2) {
|
||||
str3 = beautifyJSONString(str2);
|
||||
}
|
||||
sb.append(str3).append('\n');
|
||||
}
|
||||
sb.append("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
Log.Helper.LOGV(this, sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private String multiplyStringNTimes(String str, int i) {
|
||||
StringBuilder sb = new StringBuilder(str.length() * i);
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
sb.append(str);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void prepareRequestLog(byte[] bArr) {
|
||||
if (Log.getComponent().getThresholdLevel() <= 100) {
|
||||
try {
|
||||
this.m_requestDataForLog = new String(bArr, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
this.m_requestDataForLog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareResponseLog() {
|
||||
if (Log.getComponent().getThresholdLevel() <= 100) {
|
||||
this.m_responseDataForLog = new StringBuilder(this.m_response.expectedContentLength > 0 ? (int) this.m_response.expectedContentLength : 4096);
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareResponseLog(byte[] bArr, int i, int i2) {
|
||||
if (Log.getComponent().getThresholdLevel() <= 100 && this.m_responseDataForLog != null) {
|
||||
try {
|
||||
this.m_responseDataForLog.append(new String(bArr, i, i2, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
this.m_responseDataForLog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:10:0x003a, code lost:
|
||||
if (r5.m_request.overwritePolicy.contains(com.ea.nimble.IHttpRequest.OverwritePolicy.LENGTH_CHECK) == false) goto L_0x003d;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private boolean skipDownloadForOverwritePolicy(java.net.HttpURLConnection r6) {
|
||||
/*
|
||||
r5 = this;
|
||||
r0 = 1
|
||||
r8 = r0
|
||||
java.io.File r0 = new java.io.File
|
||||
r1 = r0
|
||||
r2 = r5
|
||||
com.ea.nimble.HttpRequest r2 = r2.m_request
|
||||
java.lang.String r2 = r2.targetFilePath
|
||||
r1.<init>(r2)
|
||||
r6 = r0
|
||||
r0 = r6
|
||||
boolean r0 = r0.exists()
|
||||
if (r0 != 0) goto L_0x001c
|
||||
r0 = 0
|
||||
r7 = r0
|
||||
L_0x001a:
|
||||
r0 = r7
|
||||
return r0
|
||||
L_0x001c:
|
||||
r0 = r6
|
||||
long r0 = r0.length()
|
||||
r1 = r5
|
||||
com.ea.nimble.HttpResponse r1 = r1.m_response
|
||||
long r1 = r1.expectedContentLength
|
||||
int r0 = (r0 > r1 ? 1 : (r0 == r1 ? 0 : -1))
|
||||
if (r0 == 0) goto L_0x003d
|
||||
r0 = r8
|
||||
r7 = r0
|
||||
r0 = r5
|
||||
com.ea.nimble.HttpRequest r0 = r0.m_request
|
||||
java.util.EnumSet<com.ea.nimble.IHttpRequest$OverwritePolicy> r0 = r0.overwritePolicy
|
||||
com.ea.nimble.IHttpRequest$OverwritePolicy r1 = com.ea.nimble.IHttpRequest.OverwritePolicy.LENGTH_CHECK
|
||||
boolean r0 = r0.contains(r1)
|
||||
if (r0 != 0) goto L_0x001a
|
||||
L_0x003d:
|
||||
r0 = r8
|
||||
r7 = r0
|
||||
r0 = r6
|
||||
long r0 = r0.lastModified()
|
||||
r1 = r5
|
||||
com.ea.nimble.HttpResponse r1 = r1.m_response
|
||||
long r1 = r1.lastModified
|
||||
int r0 = (r0 > r1 ? 1 : (r0 == r1 ? 0 : -1))
|
||||
if (r0 < 0) goto L_0x001a
|
||||
r0 = r8
|
||||
r7 = r0
|
||||
r0 = r5
|
||||
com.ea.nimble.HttpRequest r0 = r0.m_request
|
||||
java.util.EnumSet<com.ea.nimble.IHttpRequest$OverwritePolicy> r0 = r0.overwritePolicy
|
||||
com.ea.nimble.IHttpRequest$OverwritePolicy r1 = com.ea.nimble.IHttpRequest.OverwritePolicy.DATE_CHECK
|
||||
boolean r0 = r0.contains(r1)
|
||||
if (r0 == 0) goto L_0x001a
|
||||
r0 = 1
|
||||
return r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.NetworkConnection.skipDownloadForOverwritePolicy(java.net.HttpURLConnection):boolean");
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public void cancel() {
|
||||
synchronized (this) {
|
||||
if (this.m_thread != null) {
|
||||
this.m_thread.interrupt();
|
||||
} else {
|
||||
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Network connection " + toString() + " is cancelled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public void cancelForAppSuspend() {
|
||||
cancel();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public void finishWithError(Exception exc) {
|
||||
if (this.m_response.isCompleted) {
|
||||
Log.Helper.LOGI(this, "Finished connection %s skipped an error %s", toString(), exc.toString());
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGW(this, "Running connection number %s with name %s failed for error %s", this.m_loggingId, toString(), exc.toString());
|
||||
this.m_response.error = exc;
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public NetworkConnectionCallback getCompletionCallback() {
|
||||
return this.m_completionCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public NetworkConnectionCallback getHeaderCallback() {
|
||||
return this.m_headerCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.LogSource
|
||||
public String getLogSourceTitle() {
|
||||
return "Network";
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public NetworkConnectionCallback getProgressCallback() {
|
||||
return this.m_progressCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public HttpRequest getRequest() {
|
||||
return this.m_request;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public HttpResponse getResponse() {
|
||||
return this.m_response;
|
||||
}
|
||||
|
||||
void logOperationalTelemetryResponse() {
|
||||
if (this.m_request == null || this.m_request.url == null) {
|
||||
Log.Helper.LOGE(this, "Empty request object and/or request URL for OT logging.");
|
||||
} else if (this.m_response == null) {
|
||||
Log.Helper.LOGE(this, "Empty response object for OT logging.");
|
||||
} else if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.");
|
||||
} else {
|
||||
if (this.m_otDispatch == null) {
|
||||
this.m_otDispatch = OperationalTelemetryDispatch.getComponent();
|
||||
if (this.m_otDispatch == null) {
|
||||
Log.Helper.LOGV(this, "OperationalTelemetry Component not active for operational telemetry logging.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
HashMap hashMap = new HashMap();
|
||||
String protocol = this.m_request.url.getProtocol();
|
||||
String path = this.m_request.url.getPath();
|
||||
String query = this.m_request.url.getQuery();
|
||||
String host = this.m_request.url.getHost();
|
||||
int i = this.m_response.statusCode;
|
||||
String url = this.m_request.url.toString();
|
||||
String str = Global.NOTIFICATION_DICTIONARY_RESULT_FAIL;
|
||||
if (this.m_connectionStartTimestamp != null) {
|
||||
try {
|
||||
Date date = new Date();
|
||||
str = Global.NOTIFICATION_DICTIONARY_RESULT_FAIL;
|
||||
if (date != null) {
|
||||
str = String.valueOf(date.getTime() - this.m_connectionStartTimestamp.getTime());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.Helper.LOGE(this, "Unable to allocate new Date object to calculate response time.");
|
||||
str = Global.NOTIFICATION_DICTIONARY_RESULT_FAIL;
|
||||
}
|
||||
}
|
||||
Exception error = this.m_response.getError();
|
||||
boolean z = false;
|
||||
if (error != null) {
|
||||
if (error instanceof Error) {
|
||||
Error error2 = (Error) error;
|
||||
int code = error2.getCode();
|
||||
hashMap.put("NIMBLE_ERROR_DOMAIN", error2.getDomain());
|
||||
hashMap.put("NIMBLE_ERROR_CODE", String.valueOf(code));
|
||||
z = error2.getDomain().equals(Error.ERROR_DOMAIN) && code == Error.Code.NETWORK_TIMEOUT.intValue();
|
||||
} else {
|
||||
hashMap.put("NIMBLE_ERROR_DOMAIN", error.getClass().getName());
|
||||
z = false;
|
||||
}
|
||||
}
|
||||
hashMap.put("CONNECTIONID", this.m_loggingId);
|
||||
hashMap.put("URL_ABSOLUTE", url);
|
||||
hashMap.put("URL_PROTOCOL", protocol);
|
||||
hashMap.put("URL_PATH", path);
|
||||
hashMap.put("URL_QUERY", query);
|
||||
hashMap.put("URL_HOST", host);
|
||||
hashMap.put("RESPONSE_TIME_MS", str);
|
||||
hashMap.put("HTTP_STATUS_CODE", String.valueOf(i));
|
||||
hashMap.put("REQUEST_TIMED_OUT", String.valueOf(z));
|
||||
this.m_otDispatch.logEvent("com.ea.nimble.network", hashMap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
if (this.m_response.isCompleted) {
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
} else if (Thread.interrupted()) {
|
||||
throw new InterruptedIOException();
|
||||
} else {
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = Thread.currentThread();
|
||||
} catch (Throwable th2) {
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) this.m_request.getUrl().openConnection();
|
||||
httpURLConnection.setRequestMethod(this.m_request.method.toString());
|
||||
httpURLConnection.setConnectTimeout((int) (this.m_request.timeout * 1000.0d));
|
||||
httpURLConnection.setReadTimeout((int) (this.m_request.timeout * 1000.0d));
|
||||
httpURLConnection.setRequestProperty("Connection", "close");
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedIOException();
|
||||
}
|
||||
httpSend(httpURLConnection);
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedIOException();
|
||||
}
|
||||
httpRecv(httpURLConnection);
|
||||
finish();
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th3) {
|
||||
throw th3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th4) {
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
throw th4;
|
||||
} catch (Throwable th5) {
|
||||
throw th5;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InterruptedIOException e) {
|
||||
finishWithError(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Connection " + toString() + " is cancelled", e));
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th6) {
|
||||
throw th6;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Error e2) {
|
||||
finishWithError(e2);
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th7) {
|
||||
throw th7;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketTimeoutException e3) {
|
||||
finishWithError(new Error(Error.Code.NETWORK_TIMEOUT, "Connection " + toString() + " timed out", e3));
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th8) {
|
||||
throw th8;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e4) {
|
||||
finishWithError(new Error(Error.Code.NETWORK_UNSUPPORTED_CONNECTION_TYPE, "Request " + toString() + " failed for unsupported connection type" + this.m_request.getUrl().getProtocol(), e4));
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th9) {
|
||||
throw th9;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnknownHostException e5) {
|
||||
Network.Status status = this.m_manager.getStatus();
|
||||
if (status != Network.Status.OK) {
|
||||
finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + status.toString(), e5));
|
||||
} else {
|
||||
finishWithError(new Error(Error.Code.NETWORK_UNREACHABLE, "Request " + toString() + " failed for unreachable host", e5));
|
||||
}
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th10) {
|
||||
throw th10;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e6) {
|
||||
finishWithError(new Error(Error.Code.NETWORK_CONNECTION_ERROR, "Connection " + toString() + " failed with I/O exception", e6));
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th11) {
|
||||
throw th11;
|
||||
}
|
||||
}
|
||||
} catch (Exception e7) {
|
||||
finishWithError(new Error(Error.Code.SYSTEM_UNEXPECTED, "Unexpected error.", e7));
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.m_thread = null;
|
||||
} catch (Throwable th12) {
|
||||
throw th12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public void setCompletionCallback(NetworkConnectionCallback networkConnectionCallback) {
|
||||
this.m_completionCallback = networkConnectionCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public void setHeaderCallback(NetworkConnectionCallback networkConnectionCallback) {
|
||||
this.m_headerCallback = networkConnectionCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public void setProgressCallback(NetworkConnectionCallback networkConnectionCallback) {
|
||||
this.m_progressCallback = networkConnectionCallback;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.NetworkConnectionHandle
|
||||
public void waitOn() {
|
||||
synchronized (this) {
|
||||
while (!this.m_response.isCompleted) {
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.NetworkConnectionHandle;
|
||||
|
||||
public interface NetworkConnectionCallback {
|
||||
public void callback(NetworkConnectionHandle var1);
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.IHttpRequest;
|
||||
import com.ea.nimble.IHttpResponse;
|
||||
import com.ea.nimble.NetworkConnectionCallback;
|
||||
|
||||
public interface NetworkConnectionHandle {
|
||||
public void cancel();
|
||||
|
||||
public NetworkConnectionCallback getCompletionCallback();
|
||||
|
||||
public NetworkConnectionCallback getHeaderCallback();
|
||||
|
||||
public NetworkConnectionCallback getProgressCallback();
|
||||
|
||||
public IHttpRequest getRequest();
|
||||
|
||||
public IHttpResponse getResponse();
|
||||
|
||||
public void setCompletionCallback(NetworkConnectionCallback var1);
|
||||
|
||||
public void setHeaderCallback(NetworkConnectionCallback var1);
|
||||
|
||||
public void setProgressCallback(NetworkConnectionCallback var1);
|
||||
|
||||
public void waitOn();
|
||||
}
|
||||
|
||||
@@ -1,486 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.BroadcastReceiver
|
||||
* android.content.Context
|
||||
* android.content.Intent
|
||||
* android.content.IntentFilter
|
||||
* android.net.ConnectivityManager
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class NetworkImpl
|
||||
extends Component
|
||||
implements INetwork,
|
||||
LogSource {
|
||||
private static final String BACKUP_NETWORK_REACHABILITY_CHECK_URL = "http://www.ea.com";
|
||||
private static final int DETECTION_TIMEOUT = 30;
|
||||
private static final String MAIN_NETWORK_REACHABILITY_CHECK_URL = "http://cdn.skum.eamobile.com";
|
||||
private static final int[] PING_INTERVAL = new int[]{5, 10, 30, 60};
|
||||
private static final int QUICK_DETECTION_TIMEOUT = 5;
|
||||
private final int MAX_CONCURRENT_THREADS;
|
||||
private ExecutorService m_asyncTaskManager;
|
||||
private ConnectivityReceiver m_connectivityReceiver;
|
||||
private NetworkConnection m_detectionConnection;
|
||||
private boolean m_isWifi;
|
||||
private DetectionState m_networkDetectionState;
|
||||
private int m_pingIndex;
|
||||
private List<NetworkConnection> m_queue;
|
||||
private Network.Status m_status;
|
||||
private Timer m_timer;
|
||||
private LinkedList<NetworkConnection> m_waitingToExecuteQueue;
|
||||
|
||||
public NetworkImpl() {
|
||||
this.MAX_CONCURRENT_THREADS = 4;
|
||||
Log.Helper.LOGV(this, "constructor, start task manager and monitor the connectivity");
|
||||
this.m_connectivityReceiver = null;
|
||||
this.m_status = Network.Status.UNKNOWN;
|
||||
this.m_detectionConnection = null;
|
||||
this.m_networkDetectionState = DetectionState.NONE;
|
||||
this.m_pingIndex = 0;
|
||||
this.m_queue = new ArrayList<NetworkConnection>();
|
||||
this.startWork();
|
||||
}
|
||||
|
||||
static /* synthetic */ Timer access$302(NetworkImpl networkImpl, Timer timer) {
|
||||
networkImpl.m_timer = timer;
|
||||
return timer;
|
||||
}
|
||||
|
||||
private void detect(boolean bl2) {
|
||||
if (this.m_detectionConnection != null) {
|
||||
if (!bl2) {
|
||||
return;
|
||||
}
|
||||
NetworkConnection networkConnection = this.m_detectionConnection;
|
||||
this.m_detectionConnection = null;
|
||||
networkConnection.cancel();
|
||||
}
|
||||
this.stopPing();
|
||||
if (this.reachabilityCheck()) {
|
||||
if (this.m_status != Network.Status.DEAD) {
|
||||
this.setStatus(Network.Status.OK);
|
||||
}
|
||||
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_MAIN;
|
||||
} else {
|
||||
if (this.m_status == Network.Status.UNKNOWN) {
|
||||
this.setStatus(Network.Status.NONE);
|
||||
}
|
||||
this.m_networkDetectionState = DetectionState.VERIFY_UNREACHABLE_MAIN;
|
||||
}
|
||||
this.verifyReachability(MAIN_NETWORK_REACHABILITY_CHECK_URL, 5.0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private void onReachabilityVerification(NetworkConnectionHandle object) {
|
||||
synchronized (this) {
|
||||
Exception exception = object.getResponse().getError();
|
||||
if (exception == null) {
|
||||
Log.Helper.LOGD(this, "network verified reachable.");
|
||||
this.setStatus(Network.Status.OK);
|
||||
this.m_detectionConnection = null;
|
||||
} else {
|
||||
if (object != this.m_detectionConnection) return;
|
||||
this.m_detectionConnection = null;
|
||||
Log.Helper.LOGD(this, "network verified unreachable, ERROR %s for detection state %s", object.getResponse().getError(), this.m_networkDetectionState);
|
||||
if (
|
||||
//TODO В этом месте ложится при targetSdk 30
|
||||
exception instanceof Error/* &&
|
||||
((Error)((Error)exception)).getDomain().equals("NimbleError") &&
|
||||
((Error)object).isError(Error.Code.NETWORK_OPERATION_CANCELLED)*/) {
|
||||
Log.Helper.LOGW(this, "Network detection verification connection get cancelled for unknown reason (maybe reasonable for Android)");
|
||||
}
|
||||
switch (this.m_networkDetectionState.ordinal()) {
|
||||
case 1: {
|
||||
this.m_networkDetectionState = DetectionState.VERIFY_REACHABLE_BACKUP;
|
||||
this.verifyReachability(BACKUP_NETWORK_REACHABILITY_CHECK_URL, 30.0);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
this.setStatus(Network.Status.NONE);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
this.m_networkDetectionState = DetectionState.PING;
|
||||
if (this.m_status == Network.Status.DEAD) {
|
||||
this.startPing();
|
||||
break;
|
||||
}
|
||||
this.setStatus(Network.Status.DEAD);
|
||||
this.m_pingIndex = 0;
|
||||
this.startPing();
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
++this.m_pingIndex;
|
||||
this.startPing();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean reachabilityCheck() {
|
||||
this.m_isWifi = false;
|
||||
Context context = ApplicationEnvironment.getComponent().getApplicationContext();
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
if ((context.getSystemService(Context.CONNECTIVITY_SERVICE)) == null) return false;
|
||||
if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGD(this, "BaseCore not active yet. Postpone reachability check.");
|
||||
return false;
|
||||
}
|
||||
this.m_isWifi = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void registerNetworkListener() {
|
||||
if (this.m_connectivityReceiver != null) return;
|
||||
Log.Helper.LOGD(this, "Register network reachability listener.");
|
||||
this.m_connectivityReceiver = new ConnectivityReceiver();
|
||||
IntentFilter intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
|
||||
ApplicationEnvironment.getComponent().getApplicationContext().registerReceiver((BroadcastReceiver)this.m_connectivityReceiver, intentFilter);
|
||||
}
|
||||
|
||||
private void setStatus(Network.Status status) {
|
||||
Log.Helper.LOGI(this, "Status change %s -> %s", this.m_status, status);
|
||||
if (status == this.m_status) return;
|
||||
this.m_status = status;
|
||||
Utility.sendBroadcast("nimble.notification.networkStatusChanged", null);
|
||||
}
|
||||
|
||||
private void startPing() {
|
||||
if (this.m_pingIndex >= PING_INTERVAL.length) {
|
||||
this.m_pingIndex = PING_INTERVAL.length - 1;
|
||||
}
|
||||
this.m_timer = new Timer(new TimerTask());
|
||||
this.m_timer.schedule(PING_INTERVAL[this.m_pingIndex], false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private void startWork() {
|
||||
synchronized (this) {
|
||||
Object object = this.m_asyncTaskManager;
|
||||
if (object != null) {
|
||||
return;
|
||||
}
|
||||
this.detect(true);
|
||||
this.registerNetworkListener();
|
||||
this.m_asyncTaskManager = Executors.newFixedThreadPool(4);
|
||||
if (this.m_waitingToExecuteQueue == null) return;
|
||||
if (this.m_waitingToExecuteQueue.isEmpty()) return;
|
||||
Log.Helper.LOGW(this, "NetworkConnections waiting to execute on new AsyncTaskManager. Executing.");
|
||||
while (!this.m_waitingToExecuteQueue.isEmpty()) {
|
||||
object = this.m_waitingToExecuteQueue.poll();
|
||||
Log.Helper.LOGW(this, "Executing request URL: " + ((NetworkConnection)object).getRequest().url.toString());
|
||||
this.m_asyncTaskManager.execute((Runnable)object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void stopPing() {
|
||||
if (this.m_timer == null) return;
|
||||
this.m_timer.cancel();
|
||||
this.m_timer = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
* Converted monitor instructions to comments
|
||||
*/
|
||||
private void stopWork() {
|
||||
// MONITORENTER : this
|
||||
this.m_detectionConnection = null;
|
||||
this.stopPing();
|
||||
this.unregisterNetworkListener();
|
||||
// MONITOREXIT : this
|
||||
if (this.m_asyncTaskManager == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Iterator<Runnable> iterator = this.m_asyncTaskManager.shutdownNow().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
((NetworkConnection)iterator.next()).cancelForAppSuspend();
|
||||
}
|
||||
this.m_asyncTaskManager.awaitTermination(60L, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (InterruptedException interruptedException) {
|
||||
this.m_asyncTaskManager.shutdownNow();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
this.m_asyncTaskManager = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unable to fully structure code
|
||||
*/
|
||||
private void unregisterNetworkListener() {
|
||||
if (this.m_connectivityReceiver == null) return;
|
||||
try {
|
||||
ApplicationEnvironment.getComponent().getApplicationContext().unregisterReceiver((BroadcastReceiver)this.m_connectivityReceiver);
|
||||
lbl4:
|
||||
// 2 sources
|
||||
|
||||
while (true) {
|
||||
this.m_connectivityReceiver = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException var1_1) {
|
||||
Log.Helper.LOGE(this, "Unable to unregister network reachability listener even it does exists");
|
||||
}
|
||||
}
|
||||
|
||||
private void verifyReachability(String string2, double d2) {
|
||||
block3: {
|
||||
try {
|
||||
HttpRequest httpRequest = new HttpRequest(new URL(string2));
|
||||
httpRequest.timeout = d2;
|
||||
httpRequest.method = IHttpRequest.Method.GET;
|
||||
this.m_detectionConnection = new NetworkConnection(this, httpRequest);
|
||||
this.m_detectionConnection.setCompletionCallback(new NetworkConnectionCallback(){
|
||||
|
||||
@Override
|
||||
public void callback(NetworkConnectionHandle networkConnectionHandle) {
|
||||
NetworkImpl.this.onReachabilityVerification(networkConnectionHandle);
|
||||
}
|
||||
});
|
||||
if (this.m_asyncTaskManager != null && !this.m_asyncTaskManager.isShutdown()) break block3;
|
||||
}
|
||||
catch (MalformedURLException malformedURLException) {
|
||||
Log.Helper.LOGE(this, "Invalid url: " + string2);
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection until AsyncTaskManager is started.");
|
||||
if (this.m_waitingToExecuteQueue == null) {
|
||||
this.m_waitingToExecuteQueue = new LinkedList();
|
||||
}
|
||||
this.m_waitingToExecuteQueue.addFirst(this.m_detectionConnection);
|
||||
return;
|
||||
}
|
||||
this.m_asyncTaskManager.execute(this.m_detectionConnection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
this.stopWork();
|
||||
Log.Helper.LOGV(this, "cleanup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRedetectNetworkStatus() {
|
||||
synchronized (this) {
|
||||
this.detect(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.network";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "Network";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network.Status getStatus() {
|
||||
return this.m_status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkWifi() {
|
||||
return this.m_isWifi;
|
||||
}
|
||||
|
||||
void removeConnection(NetworkConnection networkConnection) {
|
||||
synchronized (this) {
|
||||
this.m_queue.remove(networkConnection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
Log.Helper.LOGV(this, "resume");
|
||||
synchronized (this) {
|
||||
this.detect(true);
|
||||
this.registerNetworkListener();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkConnectionHandle sendDeleteRequest(URL object, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback) {
|
||||
HttpRequest httpRequest = new HttpRequest(object);
|
||||
httpRequest.method = IHttpRequest.Method.DELETE;
|
||||
httpRequest.headers = hashMap;
|
||||
return this.sendRequest(httpRequest, networkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkConnectionHandle sendGetRequest(URL object, HashMap<String, String> hashMap, NetworkConnectionCallback networkConnectionCallback) {
|
||||
HttpRequest httpRequest = new HttpRequest(object);
|
||||
httpRequest.method = IHttpRequest.Method.GET;
|
||||
httpRequest.headers = hashMap;
|
||||
return this.sendRequest(httpRequest, networkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkConnectionHandle sendPostRequest(URL object, HashMap<String, String> hashMap, byte[] byArray, NetworkConnectionCallback networkConnectionCallback) {
|
||||
HttpRequest httpRequest = new HttpRequest(object);
|
||||
httpRequest.method = IHttpRequest.Method.POST;
|
||||
httpRequest.headers = hashMap;
|
||||
try {
|
||||
httpRequest.data.write(byArray);
|
||||
return this.sendRequest(httpRequest, networkConnectionCallback);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return this.sendRequest(httpRequest, networkConnectionCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkConnectionHandle sendRequest(HttpRequest httpRequest, NetworkConnectionCallback networkConnectionCallback) {
|
||||
return this.sendRequest(httpRequest, networkConnectionCallback, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
* Converted monitor instructions to comments
|
||||
*/
|
||||
@Override
|
||||
public NetworkConnectionHandle sendRequest(
|
||||
HttpRequest httpRequest,
|
||||
NetworkConnectionCallback networkConnectionCallback,
|
||||
IOperationalTelemetryDispatch object) {
|
||||
|
||||
NetworkConnection networkConnection =
|
||||
httpRequest.runInBackground ?
|
||||
new BackgroundNetworkConnection(this, httpRequest, (IOperationalTelemetryDispatch) object) :
|
||||
new NetworkConnection(this, httpRequest, (IOperationalTelemetryDispatch) object);
|
||||
|
||||
networkConnection.setCompletionCallback(networkConnectionCallback);
|
||||
if (httpRequest.url == null || !Utility.validString(httpRequest.url.toString())) {
|
||||
networkConnection.finishWithError(new Error(Error.Code.INVALID_ARGUMENT, "Sending request without valid url"));
|
||||
return networkConnection;
|
||||
}
|
||||
if (this.m_status != Network.Status.OK) {
|
||||
networkConnection.finishWithError(new Error(Error.Code.NETWORK_NO_CONNECTION, "No network connection, network status " + this.m_status.toString()));
|
||||
return networkConnection;
|
||||
}
|
||||
// MONITORENTER : this
|
||||
this.m_queue.add(networkConnection);
|
||||
// MONITOREXIT : this
|
||||
if (this.m_asyncTaskManager != null && !this.m_asyncTaskManager.isShutdown()) {
|
||||
this.m_asyncTaskManager.execute(networkConnection);
|
||||
return networkConnection;
|
||||
}
|
||||
if (this.m_asyncTaskManager != null) {
|
||||
Log.Helper.LOGW(this, "AsyncTaskManager shutdown. Queueing networkconnection until AsyncTaskManager is started.");
|
||||
} else {
|
||||
Log.Helper.LOGW(this, "AsyncTaskManager is not ready. Queueing networkconnection until AsyncTaskManager is started.");
|
||||
}
|
||||
if (this.m_waitingToExecuteQueue == null) {
|
||||
this.m_waitingToExecuteQueue = new LinkedList();
|
||||
}
|
||||
this.m_waitingToExecuteQueue.add(networkConnection);
|
||||
return networkConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.Helper.LOGV(this, "setup");
|
||||
this.startWork();
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
@Override
|
||||
public void suspend() {
|
||||
synchronized (this) {
|
||||
this.stopPing();
|
||||
this.unregisterNetworkListener();
|
||||
synchronized (this) {
|
||||
Iterator iterator = new ArrayList<NetworkConnection>(this.m_queue).iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
// MONITOREXIT @DISABLED, blocks:[4, 6, 7] lbl8 : MonitorExitStatement: MONITOREXIT : this
|
||||
// MONITOREXIT @DISABLED, blocks:[4, 5, 6, 7] lbl9 : MonitorExitStatement: MONITOREXIT : this
|
||||
Log.Helper.LOGV(this, "suspend");
|
||||
return;
|
||||
}
|
||||
((NetworkConnection)iterator.next()).cancelForAppSuspend();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ConnectivityReceiver
|
||||
extends BroadcastReceiver {
|
||||
private ConnectivityReceiver() {
|
||||
}
|
||||
|
||||
public void onReceive(Context object, Intent intent) {
|
||||
Log.Helper.LOGD((Object)this, "Network reachability changed!");
|
||||
|
||||
synchronized (new Object()) {
|
||||
NetworkImpl.this.detect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static enum DetectionState {
|
||||
NONE,
|
||||
VERIFY_REACHABLE_MAIN,
|
||||
VERIFY_UNREACHABLE_MAIN,
|
||||
VERIFY_REACHABLE_BACKUP,
|
||||
PING;
|
||||
|
||||
}
|
||||
|
||||
private class TimerTask
|
||||
implements Runnable {
|
||||
private TimerTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
NetworkImpl networkImpl = NetworkImpl.this;
|
||||
synchronized (networkImpl) {
|
||||
NetworkImpl.access$302(NetworkImpl.this, null);
|
||||
NetworkImpl.this.verifyReachability(NetworkImpl.MAIN_NETWORK_REACHABILITY_CHECK_URL, 30.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
public enum NimbleConfiguration {
|
||||
UNKNOWN,
|
||||
INTEGRATION,
|
||||
STAGE,
|
||||
LIVE,
|
||||
CUSTOMIZED;
|
||||
|
||||
|
||||
public static NimbleConfiguration fromName(String string2) {
|
||||
if (string2.equals("int")) {
|
||||
return INTEGRATION;
|
||||
}
|
||||
if (string2.equals("stage")) {
|
||||
return STAGE;
|
||||
}
|
||||
if (string2.equals("live")) {
|
||||
return LIVE;
|
||||
}
|
||||
if (!string2.equals("custom")) return UNKNOWN;
|
||||
return CUSTOMIZED;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
switch (this.ordinal()) {
|
||||
default: {
|
||||
return "unknown";
|
||||
}
|
||||
case 1: {
|
||||
return "int";
|
||||
}
|
||||
case 2: {
|
||||
return "stage";
|
||||
}
|
||||
case 3: {
|
||||
return "live";
|
||||
}
|
||||
case 4:
|
||||
}
|
||||
return "custom";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
|
||||
public class NimbleFacebookError
|
||||
extends Error {
|
||||
public static final String NIMBLE_FACEBOOK_ERROR_DOMAIN = "NimbleFacebookError";
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NimbleFacebookError(int n2, String string2) {
|
||||
super(NIMBLE_FACEBOOK_ERROR_DOMAIN, n2, string2, null);
|
||||
}
|
||||
|
||||
public NimbleFacebookError(int n2, String string2, Throwable throwable) {
|
||||
super(NIMBLE_FACEBOOK_ERROR_DOMAIN, n2, string2, throwable);
|
||||
}
|
||||
|
||||
public NimbleFacebookError(Code code, String string2) {
|
||||
super(NIMBLE_FACEBOOK_ERROR_DOMAIN, code.intValue(), string2, null);
|
||||
}
|
||||
|
||||
public boolean isError(int n2) {
|
||||
if (this.getCode() != n2) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum Code {
|
||||
FBSERVER_ERROR(90000),
|
||||
RESPONSE_PARSE_ERROR(90001);
|
||||
|
||||
private int m_value;
|
||||
|
||||
private Code(int n3) {
|
||||
this.m_value = n3;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return this.m_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Base;
|
||||
import com.ea.nimble.IOperationalTelemetryDispatch;
|
||||
|
||||
public class OperationalTelemetryDispatch {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.operationaltelemetrydispatch";
|
||||
public static final String LOG_TAG = "OTDispatch";
|
||||
|
||||
public static IOperationalTelemetryDispatch getComponent() {
|
||||
return (IOperationalTelemetryDispatch)((Object)Base.getComponent(COMPONENT_ID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class OperationalTelemetryDispatchImpl
|
||||
extends Component
|
||||
implements IOperationalTelemetryDispatch,
|
||||
LogSource {
|
||||
private Map<String, Integer> m_maxEventQueueSizeDict;
|
||||
private List<OperationalTelemetryEvent> m_networkMetricsArray = new ArrayList<OperationalTelemetryEvent>();
|
||||
private List<OperationalTelemetryEvent> m_networkPayloadsArray = new ArrayList<OperationalTelemetryEvent>();
|
||||
|
||||
public OperationalTelemetryDispatchImpl() {
|
||||
this.m_maxEventQueueSizeDict = new HashMap<String, Integer>();
|
||||
this.m_maxEventQueueSizeDict.put("com.ea.nimble.network", 100);
|
||||
this.m_maxEventQueueSizeDict.put("com.ea.nimble.trackingimpl.synergy", 100);
|
||||
}
|
||||
|
||||
private boolean canLogEvent(String list) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private void purgeOldestEvent(List<OperationalTelemetryEvent> list) {
|
||||
synchronized (this) {
|
||||
if (list.size() == 0) {
|
||||
Log.Helper.LOGD(this, "purgeOldestEvent called with empty event array.");
|
||||
return;
|
||||
}
|
||||
OperationalTelemetryEvent operationalTelemetryEvent = null;
|
||||
Iterator<OperationalTelemetryEvent> iterator = list.iterator();
|
||||
while (true) {
|
||||
if (!iterator.hasNext()) {
|
||||
if (operationalTelemetryEvent == null) return;
|
||||
list.remove(operationalTelemetryEvent);
|
||||
return;
|
||||
}
|
||||
OperationalTelemetryEvent operationalTelemetryEvent2 = iterator.next();
|
||||
if (operationalTelemetryEvent != null && !operationalTelemetryEvent2.getLoggedTime().before(operationalTelemetryEvent.getLoggedTime())) continue;
|
||||
operationalTelemetryEvent = operationalTelemetryEvent2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private void trimEventQueue(String list) {
|
||||
}
|
||||
|
||||
private void updateEventThresholdListeners() {
|
||||
HashMap<String, String> hashMap;
|
||||
int n2 = this.getMaxEventCount("com.ea.nimble.network");
|
||||
if (n2 > 0) {
|
||||
n2 = (int)((double)n2 * 0.75);
|
||||
if (this.m_networkMetricsArray.size() >= n2) {
|
||||
hashMap = new HashMap<String, String>();
|
||||
hashMap.put("eventType", "com.ea.nimble.network");
|
||||
Utility.sendBroadcast("nimble.notification.ot.eventthresholdwarning", hashMap);
|
||||
Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.");
|
||||
}
|
||||
}
|
||||
if ((n2 = this.getMaxEventCount("com.ea.nimble.trackingimpl.synergy")) <= 0) return;
|
||||
n2 = (int)((double)n2 * 0.75);
|
||||
if (this.m_networkPayloadsArray.size() < n2) return;
|
||||
hashMap = new HashMap();
|
||||
hashMap.put("eventType", "com.ea.nimble.trackingimpl.synergy");
|
||||
Utility.sendBroadcast("nimble.notification.ot.eventthresholdwarning", hashMap);
|
||||
Log.Helper.LOGV(this, "updateEventThresholdListeners, notifying listeners event queue is approaching threshold.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanup() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.operationaltelemetrydispatch";
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
@Override
|
||||
public List<OperationalTelemetryEvent> getEvents(String string2) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGE(this, "getEvents called with null or empty eventType.");
|
||||
return null;
|
||||
}
|
||||
List<OperationalTelemetryEvent> list = null;
|
||||
synchronized (this) {
|
||||
if (string2.equals("com.ea.nimble.network")) {
|
||||
list = this.m_networkMetricsArray;
|
||||
this.m_networkMetricsArray = new ArrayList<OperationalTelemetryEvent>();
|
||||
} else if (string2.equals("com.ea.nimble.trackingimpl.synergy")) {
|
||||
list = this.m_networkPayloadsArray;
|
||||
this.m_networkPayloadsArray = new ArrayList<OperationalTelemetryEvent>();
|
||||
}
|
||||
}
|
||||
if (list != null) return Collections.unmodifiableList(list);
|
||||
Log.Helper.LOGE(this, "getEvents, unsupported OT eventType, " + string2 + ".");
|
||||
return Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "OTDispatch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEventCount(String object) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
* Converted monitor instructions to comments
|
||||
*/
|
||||
@Override
|
||||
public void logEvent(String string2, Map<String, String> object) {}
|
||||
|
||||
@Override
|
||||
protected void restore() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resume() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxEventCount(String string2, int n2) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGE(this, "setMaxEventCount called with null or empty eventType.");
|
||||
return;
|
||||
}
|
||||
this.m_maxEventQueueSizeDict.put(string2, n2);
|
||||
this.trimEventQueue(string2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void suspend() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
public interface OperationalTelemetryEvent {
|
||||
public Map<String, String> getEventDictionary();
|
||||
|
||||
public String getEventType();
|
||||
|
||||
public Date getLoggedTime();
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.OperationalTelemetryEvent;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
class OperationalTelemetryEventImpl
|
||||
implements OperationalTelemetryEvent {
|
||||
private Map<String, String> m_eventDictionary;
|
||||
private String m_eventType;
|
||||
private Date m_loggedTime;
|
||||
|
||||
public OperationalTelemetryEventImpl(String string2, Map<String, String> map, Date date) {
|
||||
this.m_eventType = string2;
|
||||
this.m_eventDictionary = map;
|
||||
this.m_loggedTime = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEventDictionary() {
|
||||
return this.m_eventDictionary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return this.m_eventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getLoggedTime() {
|
||||
return this.m_loggedTime;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("OperationalTelemetryEvent(%s)-(%s) > %s", this.getEventType(), this.getLoggedTime(), this.getEventDictionary());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,405 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.app.backup.BackupManager;
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/Persistence.class */
|
||||
public class Persistence implements LogSource {
|
||||
private static int PERSISTENCE_VERSION = -1;
|
||||
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 Encryptor m_encryptor;
|
||||
private String m_identifier;
|
||||
private Storage m_storage;
|
||||
private Timer m_synchronizeTimer;
|
||||
|
||||
public static class AnonymousClass2 {
|
||||
static final int[] $SwitchMap$com$ea$nimble$Persistence$Storage = new int[Storage.values().length];
|
||||
static final int[] $SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy = new int[10];
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/Persistence$Storage.class */
|
||||
}
|
||||
|
||||
public enum Storage {
|
||||
DOCUMENT,
|
||||
CACHE,
|
||||
TEMP
|
||||
}
|
||||
|
||||
public Persistence(Persistence persistence, String str) {
|
||||
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Persistence.this.synchronize();
|
||||
}
|
||||
});
|
||||
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 Persistence(String str, Storage storage, Encryptor encryptor) {
|
||||
this.m_synchronizeTimer = new Timer(new Runnable() { // from class: com.ea.nimble.Persistence.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Persistence.this.synchronize();
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
private void clearSynchronizeTimer() {
|
||||
synchronized (s_dataLock) {
|
||||
this.m_synchronizeTimer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void flagChange() {
|
||||
this.m_changed = true;
|
||||
synchronized (s_dataLock) {
|
||||
clearSynchronizeTimer();
|
||||
this.m_synchronizeTimer.schedule(0.5d, false);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:10:0x0068 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
static java.io.File getPersistenceDirectory(com.ea.nimble.Persistence.Storage r7) {
|
||||
return new File("");
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:13:0x008f */
|
||||
/* JADX WARN: Removed duplicated region for block: B:16:0x00bb */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static java.io.File getPersistenceDirectory(com.ea.nimble.Persistence.Storage r7, android.content.Context r8) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 241
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.nimble.Persistence.getPersistenceDirectory(com.ea.nimble.Persistence$Storage, android.content.Context):java.io.File");
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
private void loadPersistenceData(boolean z, Context context) {
|
||||
Throwable th;
|
||||
FileInputStream fileInputStream = null;
|
||||
String persistencePath = context == null ? getPersistencePath(this.m_identifier, this.m_storage) : getPersistencePath(this.m_identifier, this.m_storage, context);
|
||||
if (persistencePath != null) {
|
||||
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;
|
||||
}
|
||||
try {
|
||||
Log.Helper.LOGD(this, "Loading persistence file size %d", file.length());
|
||||
fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
try {
|
||||
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
|
||||
if (objectInputStream.readInt() != PERSISTENCE_VERSION) {
|
||||
throw new InvalidClassException("com.ea.nimble.Persistence", "Persistence version doesn't match");
|
||||
}
|
||||
this.m_encryption = objectInputStream.readBoolean();
|
||||
this.m_backUp = objectInputStream.readBoolean();
|
||||
if (!z) {
|
||||
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
|
||||
ObjectInputStream encryptInputStream = this.m_encryption ? this.m_encryptor.encryptInputStream(bufferedInputStream) : new ObjectInputStream(bufferedInputStream);
|
||||
this.m_content = (Map) encryptInputStream.readObject();
|
||||
Log.Helper.LOGD(this, "Persistence file for id[%s] restored from storage %s", this.m_identifier, this.m_storage.toString());
|
||||
encryptInputStream.close();
|
||||
}
|
||||
objectInputStream.close();
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e2) {
|
||||
}
|
||||
}
|
||||
} catch (Exception e3) {
|
||||
Log.Helper.LOGE(this, "Can't read persistence (%s) file, %s: %s", this.m_identifier, persistencePath, e3.toString());
|
||||
e3.printStackTrace();
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e4) {
|
||||
}
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException e5) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void putValue(String str, Serializable serializable) throws IOException {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
||||
objectOutputStream.writeObject(serializable);
|
||||
objectOutputStream.close();
|
||||
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
||||
if (!byteArray.equals(this.m_content.get(str))) {
|
||||
this.m_content.put(str, byteArray);
|
||||
flagChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void savePersistenceData() {
|
||||
String persistencePath = getPersistencePath(this.m_identifier, this.m_storage);
|
||||
if (persistencePath != null) {
|
||||
File file = new File(persistencePath);
|
||||
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(
|
||||
this.m_encryption ? this.m_encryptor.encryptOutputStream(
|
||||
new BufferedOutputStream(fileOutputStream)) :
|
||||
new BufferedOutputStream(fileOutputStream))) {
|
||||
|
||||
objectOutputStream.writeInt(PERSISTENCE_VERSION);
|
||||
objectOutputStream.writeBoolean(this.m_encryption);
|
||||
objectOutputStream.writeBoolean(this.m_backUp);
|
||||
objectOutputStream.writeObject(this.m_content);
|
||||
|
||||
Log.Helper.LOGD(this, "Synchronize persistence for id[%s] in storage %s", this.m_identifier, this.m_storage.toString());
|
||||
Log.Helper.LOGD(this, "Saving persistence file size %d", file.length());
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.Helper.LOGE(this, "Fail to save persistence file for id[%s] in storage %s: %s", this.m_identifier, this.m_storage.toString(), e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addEntries(Object... objArr) {
|
||||
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 e) {
|
||||
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 e2) {
|
||||
Log.Helper.LOGF(this, "Invalid value in NimblePersistence.addEntries for key %s at index %d", str, Integer.valueOf(i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addEntriesFromMap(Map<String, Serializable> map) {
|
||||
synchronized (s_dataLock) {
|
||||
for (String str : map.keySet()) {
|
||||
if (!Utility.validString(str)) {
|
||||
Log.Helper.LOGE(this, "Invalid key %s in NimblePersistence.addEntriesInDictionary, not a string, skip it", str);
|
||||
} else {
|
||||
Serializable serializable = map.get(str);
|
||||
if (serializable != null) {
|
||||
try {
|
||||
putValue(str, serializable);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
Log.Helper.LOGE(this, "Invalid value in NimblePersistence.addEntries for key %s", str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
synchronized (s_dataLock) {
|
||||
File file = new File(getPersistencePath(this.m_identifier, this.m_storage));
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getBackUp() {
|
||||
return this.m_backUp;
|
||||
}
|
||||
|
||||
public boolean getEncryption() {
|
||||
return this.m_encryption;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return this.m_identifier;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.LogSource
|
||||
public String getLogSourceTitle() {
|
||||
return "Persistence";
|
||||
}
|
||||
|
||||
public Storage getStorage() {
|
||||
return this.m_storage;
|
||||
}
|
||||
|
||||
public String getStringValue(String str) {
|
||||
Serializable value = getValue(str);
|
||||
try {
|
||||
return (String) value;
|
||||
} catch (ClassCastException e) {
|
||||
Log.Helper.LOGF(this, "Invalid value type for getStringValueCall, value is " + value.getClass().getName());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Serializable getValue(String str) {
|
||||
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 + ":" + e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void merge(Persistence persistence, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
|
||||
switch (AnonymousClass2.$SwitchMap$com$ea$nimble$PersistenceService$PersistenceMergePolicy[persistenceMergePolicy.ordinal()]) {
|
||||
case 1:
|
||||
this.m_content = new HashMap(persistence.m_content);
|
||||
return;
|
||||
case 2:
|
||||
this.m_content.putAll(persistence.m_content);
|
||||
return;
|
||||
case 3:
|
||||
for (String str : persistence.m_content.keySet()) {
|
||||
if (this.m_content.get(str) == null) {
|
||||
this.m_content.put(str, persistence.m_content.get(str));
|
||||
}
|
||||
}
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void restore(boolean z, Context context) {
|
||||
synchronized (s_dataLock) {
|
||||
loadPersistenceData(z, context);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBackUp(boolean z) {
|
||||
if (this.m_storage != Storage.DOCUMENT) {
|
||||
Log.Helper.LOGF(this, "Error: Backup flag not supported for storage: " + this.m_storage);
|
||||
} else {
|
||||
this.m_backUp = z;
|
||||
}
|
||||
}
|
||||
|
||||
public void setEncryption(boolean z) {
|
||||
if (z != this.m_encryption) {
|
||||
this.m_encryption = z;
|
||||
flagChange();
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(String str, Serializable serializable) {
|
||||
synchronized (s_dataLock) {
|
||||
if (!Utility.validString(str)) {
|
||||
Log.Helper.LOGF(this, "NimblePersistence cannot accept an invalid string " + str + " as key");
|
||||
} else if (serializable == null) {
|
||||
if (this.m_content.get(str) != null) {
|
||||
this.m_content.remove(str);
|
||||
flagChange();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
putValue(str, serializable);
|
||||
} catch (IOException e) {
|
||||
Log.Helper.LOGF(this, "NimblePersistence cannot archive value " + serializable.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void synchronize() {
|
||||
synchronized (s_dataLock) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
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.ironmonkey.devmenu.util.Observer;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/PersistenceService.class */
|
||||
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";
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/PersistenceService$PersistenceBackupAgent.class */
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/PersistenceService$PersistenceMergePolicy.class */
|
||||
public enum PersistenceMergePolicy {
|
||||
OVERWRITE,
|
||||
SOURCE_FIRST,
|
||||
TARGET_FIRST
|
||||
}
|
||||
|
||||
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]);
|
||||
} else {
|
||||
getComponent().cleanPersistenceReference(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
|
||||
}
|
||||
}
|
||||
|
||||
public static Persistence getAppPersistence(Persistence.Storage storage) {
|
||||
return getComponent().getPersistence(APPLICATION_PERSISTENCE_ID, storage);
|
||||
}
|
||||
|
||||
public static IPersistenceService getComponent() {
|
||||
return BaseCore.getInstance().getPersistenceService();
|
||||
}
|
||||
|
||||
public static Persistence getPersistenceForNimbleComponent(String str, Persistence.Storage storage) {
|
||||
if (Utility.validString(str)) {
|
||||
return getComponent().getPersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
|
||||
}
|
||||
Log.Helper.LOGF("Persistence", "Invalid componentId " + str + " for component persistence", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
static void readBackup(BackupDataInput backupDataInput, int i, ParcelFileDescriptor parcelFileDescriptor, Context context) throws IOException {
|
||||
Throwable th;
|
||||
while (backupDataInput.readNextHeader()) {
|
||||
String key = backupDataInput.getKey();
|
||||
int dataSize = backupDataInput.getDataSize();
|
||||
byte[] bArr = new byte[dataSize];
|
||||
backupDataInput.readEntityData(bArr, 0, dataSize);
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(Persistence.getPersistencePath(key, Persistence.Storage.DOCUMENT, context));
|
||||
try {
|
||||
fileOutputStream2.write(bArr);
|
||||
if (fileOutputStream2 != null) {
|
||||
fileOutputStream2.close();
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
}
|
||||
}
|
||||
if (ApplicationEnvironment.isMainApplicationRunning()) {
|
||||
for (Persistence persistence : ((PersistenceServiceImpl) getComponent()).m_persistences.values()) {
|
||||
if (persistence.getBackUp()) {
|
||||
persistence.restore(false, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
} else {
|
||||
getComponent().removePersistence(String.format(NIMBLE_COMPONENT_PERSISTENCE_ID_TEMPLATE, str), storage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void writeBackup(android.os.ParcelFileDescriptor r6, android.app.backup.BackupDataOutput r7, android.os.ParcelFileDescriptor r8, android.content.Context r9) throws java.io.IOException {
|
||||
Observer.onCallingMethod();
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class PersistenceServiceImpl
|
||||
extends Component
|
||||
implements IPersistenceService,
|
||||
LogSource {
|
||||
private Encryptor m_encryptor;
|
||||
protected ConcurrentMap<String, Persistence> m_persistences;
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
private Persistence loadPersistenceById(String object, Persistence.Storage storage) {
|
||||
Object object2 = Persistence.s_dataLock;
|
||||
synchronized (object2) {
|
||||
String string2 = (String)object + "-" + storage.toString();
|
||||
Persistence persistence = (Persistence)this.m_persistences.get(string2);
|
||||
if (persistence != null) {
|
||||
return persistence;
|
||||
}
|
||||
if (!new File(Persistence.getPersistencePath(object, storage)).exists()) {
|
||||
return null;
|
||||
}
|
||||
Persistence persistence1 = new Persistence(object, storage, this.m_encryptor);
|
||||
persistence1.restore(false, null);
|
||||
this.m_persistences.put(string2, persistence1);
|
||||
return persistence1;
|
||||
}
|
||||
}
|
||||
|
||||
private void synchronize() {
|
||||
for (Persistence persistence : this.m_persistences.values()) {
|
||||
persistence.synchronize();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanPersistenceReference(String string2, Persistence.Storage storage) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGF(this, "Invalid identifier " + string2 + " for persistence");
|
||||
return;
|
||||
}
|
||||
Object object = Persistence.s_dataLock;
|
||||
synchronized (object) {
|
||||
this.m_persistences.remove(string2 + "-" + storage.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.persistence";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "Persistence";
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
@Override
|
||||
public Persistence getPersistence(String string2, Persistence.Storage storage) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGF(this, "Invalid identifier " + string2 + " for persistence");
|
||||
return null;
|
||||
}
|
||||
Object object = Persistence.s_dataLock;
|
||||
synchronized (object) {
|
||||
Persistence persistence = this.loadPersistenceById(string2, storage);
|
||||
if (persistence != null) {
|
||||
return persistence;
|
||||
}
|
||||
persistence = new Persistence(string2, storage, this.m_encryptor);
|
||||
this.m_persistences.put(string2 + "-" + storage.toString(), persistence);
|
||||
return persistence;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
@Override
|
||||
public void migratePersistence(String object, Persistence.Storage object2, String string2, PersistenceService.PersistenceMergePolicy persistenceMergePolicy) {
|
||||
if (!Utility.validString((String)object) || !Utility.validString(string2)) {
|
||||
Log.Helper.LOGF(this, "Invalid identifiers " + (String)object + " or " + string2 + " for component persistence");
|
||||
return;
|
||||
}
|
||||
Persistence.Storage object3 = (Persistence.Storage) Persistence.s_dataLock;
|
||||
synchronized (object3) {
|
||||
String string3 = string2 + "-" + ((Enum)object2).toString();
|
||||
Persistence persistence = this.loadPersistenceById(object, object2);
|
||||
if (persistence == null) {
|
||||
if (persistenceMergePolicy != PersistenceService.PersistenceMergePolicy.OVERWRITE) return;
|
||||
this.m_persistences.remove(string3);
|
||||
new File(Persistence.getPersistencePath(string2, object2)).delete();
|
||||
return;
|
||||
}
|
||||
Persistence persistence2 = this.loadPersistenceById(string2, object2);
|
||||
if (persistence2 == null) {
|
||||
Persistence persistence1 = new Persistence(persistence, string2);
|
||||
this.m_persistences.put(string3, persistence);
|
||||
persistence1.synchronize();
|
||||
} else {
|
||||
persistence2.merge(persistence, persistenceMergePolicy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePersistence(String string2, Persistence.Storage storage) {
|
||||
if (!Utility.validString(string2)) {
|
||||
Log.Helper.LOGF(this, "Invalid identifier " + string2 + " for persistence");
|
||||
return;
|
||||
}
|
||||
this.cleanPersistenceReference(string2, storage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
this.m_persistences = new ConcurrentHashMap<>();
|
||||
this.m_encryptor = new Encryptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspend() {
|
||||
this.synchronize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teardown() {
|
||||
this.synchronize();
|
||||
Object object = Persistence.s_dataLock;
|
||||
synchronized (object) {
|
||||
this.m_persistences = null;
|
||||
this.m_encryptor = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Persistence;
|
||||
|
||||
public class QA {
|
||||
static String getPersistencePath(String string2, Persistence.Storage storage) {
|
||||
return Persistence.getPersistencePath(string2, storage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Base;
|
||||
import com.ea.nimble.ISynergyEnvironment;
|
||||
|
||||
public class SynergyEnvironment {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.synergyEnvironment";
|
||||
public static final int INVALID_INT_VALUE = -1;
|
||||
public static final String NOTIFICATION_APP_VERSION_CHECK_FINISHED = "nimble.environment.notification.app_version_check_finished";
|
||||
public static final String NOTIFICATION_RESTORED_FROM_PERSISTENT = "nimble.environment.notification.restored_from_persistent";
|
||||
public static final String NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED = "nimble.environment.notification.startup_environment_data_changed";
|
||||
public static final String NOTIFICATION_STARTUP_REQUESTS_FINISHED = "nimble.environment.notification.startup_requests_finished";
|
||||
public static final String NOTIFICATION_STARTUP_REQUESTS_STARTED = "nimble.environment.notification.startup_requests_started";
|
||||
public static final String SERVER_URL_KEY_AKAMAI = "akamai.url";
|
||||
public static final String SERVER_URL_KEY_DYNAMIC_MORE_GAMES = "dmg.url";
|
||||
public static final String SERVER_URL_KEY_EADP_FRIENDS_HOST = "eadp.friends.host";
|
||||
public static final String SERVER_URL_KEY_ENS = "ens.url";
|
||||
public static final String SERVER_URL_KEY_IDENTITY_CONNECT = "nexus.connect";
|
||||
public static final String SERVER_URL_KEY_IDENTITY_PORTAL = "nexus.portal";
|
||||
public static final String SERVER_URL_KEY_IDENTITY_PROXY = "nexus.proxy";
|
||||
public static final String SERVER_URL_KEY_MAYHEM = "mayhem.url";
|
||||
public static final String SERVER_URL_KEY_ORIGIN_AVATAR = "avatars.url";
|
||||
public static final String SERVER_URL_KEY_ORIGIN_CASUAL_APP = "origincasualapp.url";
|
||||
public static final String SERVER_URL_KEY_ORIGIN_CASUAL_SERVER = "origincasualserver.url";
|
||||
public static final String SERVER_URL_KEY_ORIGIN_FRIENDS = "friends.url";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_CENTRAL_IP_GEOLOCATION = "geoip.url";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_DIRECTOR = "synergy.director";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_DRM = "synergy.drm";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_MESSAGE_TO_USER = "synergy.m2u";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_PRODUCT = "synergy.product";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_S2S = "synergy.s2s";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_TRACKING = "synergy.tracking";
|
||||
public static final String SERVER_URL_KEY_SYNERGY_USER = "synergy.user";
|
||||
|
||||
public static ISynergyEnvironment getComponent() {
|
||||
return (ISynergyEnvironment)((Object)Base.getComponent(COMPONENT_ID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,400 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/SynergyEnvironmentImpl.class */
|
||||
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;
|
||||
|
||||
/* renamed from: com.ea.nimble.SynergyEnvironmentImpl$3 reason: invalid class name */
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/SynergyEnvironmentImpl$3.class */
|
||||
static /* synthetic */ class AnonymousClass3 {
|
||||
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration = new int[NimbleConfiguration.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError e) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError e2) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError e3) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError e4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public SynergyEnvironmentImpl(BaseCore baseCore) {
|
||||
this.m_core = baseCore;
|
||||
}
|
||||
|
||||
private void clearSynergyEnvironmentUpdateRateLimiting() {
|
||||
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = null;
|
||||
}
|
||||
|
||||
private boolean isInSynergyEnvironmentUpdateRateLimitingPeriod() {
|
||||
return this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp != null && ((double) (System.currentTimeMillis() - this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp.longValue())) <= 60000.0d;
|
||||
}
|
||||
|
||||
private boolean restoreEnvironmentDataFromPersistent(boolean z) {
|
||||
boolean z2 = true;
|
||||
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 {
|
||||
this.m_environmentDataContainer = (EnvironmentDataContainer) value;
|
||||
Log.Helper.LOGD(this, "Restored environment data from persistent. Restored data timestamp, %s", this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp());
|
||||
if (this.m_environmentDataContainer.getEADeviceId() == null) {
|
||||
this.m_environmentDataContainer.setEADeviceId(EASPDataLoader.loadEADeviceId());
|
||||
}
|
||||
if (!z) {
|
||||
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT, null);
|
||||
return true;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
Log.Helper.LOGE(this, "Environment persistence data value is not the expected type.", new Object[0]);
|
||||
}
|
||||
return z2;
|
||||
}
|
||||
} else {
|
||||
Log.Helper.LOGE(this, "Could not get environment persistence object to restore from", new Object[0]);
|
||||
}
|
||||
this.m_environmentDataContainer = null;
|
||||
z2 = false;
|
||||
return z2;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void saveEnvironmentDataToPersistent() {
|
||||
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.synchronize();
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGE(this, "Could not get environment persistence object to save to.", new Object[0]);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void startSynergyEnvironmentUpdate() {
|
||||
if (isUpdateInProgress()) {
|
||||
Log.Helper.LOGD(this, "Attempt made to start Synergy environment update while a previous one is active. Exiting.", new Object[0]);
|
||||
} else if (Network.getComponent().getStatus() == Network.Status.OK) {
|
||||
this.m_synergyStartupObject = new SynergyEnvironmentUpdater(this.m_core);
|
||||
this.m_previousValidEnvironmentDataContainer = this.m_environmentDataContainer;
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, Global.NOTIFICATION_DICTIONARY_RESULT_SUCCESS);
|
||||
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_REQUESTS_STARTED, hashMap);
|
||||
this.m_synergyStartupObject.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) {
|
||||
Log.Helper.LOGE(this, "StartupError(%s)", exc);
|
||||
if (exc instanceof Error) {
|
||||
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();
|
||||
}
|
||||
} else if (SynergyEnvironmentImpl.this.m_synergyStartupObject == null || SynergyEnvironmentImpl.this.m_synergyStartupObject.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]);
|
||||
}
|
||||
HashMap hashMap2 = new HashMap();
|
||||
hashMap2.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, Global.NOTIFICATION_DICTIONARY_RESULT_FAIL);
|
||||
hashMap2.put("error", exc.toString());
|
||||
if (!ApplicationEnvironment.isMainApplicationRunning() || ApplicationEnvironment.getCurrentActivity() == null) {
|
||||
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
||||
} else {
|
||||
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 if (SynergyEnvironmentImpl.this.m_synergyStartupObject == null || SynergyEnvironmentImpl.this.m_synergyStartupObject.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 {
|
||||
SynergyEnvironmentImpl.this.m_environmentDataContainer = SynergyEnvironmentImpl.this.m_synergyStartupObject.getEnvironmentDataContainer();
|
||||
SynergyEnvironmentImpl.this.saveEnvironmentDataToPersistent();
|
||||
if (SynergyEnvironmentImpl.this.m_environmentDataContainer.getKeysOfDifferences(SynergyEnvironmentImpl.this.m_previousValidEnvironmentDataContainer) != null) {
|
||||
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_STARTUP_ENVIRONMENT_DATA_CHANGED, null);
|
||||
}
|
||||
HashMap hashMap3 = new HashMap();
|
||||
hashMap3.put(Global.NOTIFICATION_DICTIONARY_KEY_RESULT, Global.NOTIFICATION_DICTIONARY_RESULT_SUCCESS);
|
||||
if (!ApplicationEnvironment.isMainApplicationRunning() || ApplicationEnvironment.getCurrentActivity() == null) {
|
||||
Log.Helper.LOGI(this, "App is not running in forground, discard the NOTIFICATION_STARTUP_REQUESTS_FINISHED notification", new Object[0]);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
SynergyEnvironmentImpl.this.m_synergyStartupObject = null;
|
||||
}
|
||||
});
|
||||
} 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.this.startSynergyEnvironmentUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
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 startSynergyEnvironmentUpdateRateLimiting() {
|
||||
this.m_synergyEnvironmentUpdateRateLimitTriggerTimestamp = Long.valueOf(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public Error checkAndInitiateSynergyEnvironmentUpdate() {
|
||||
if (isUpdateInProgress()) {
|
||||
return new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Update in progress.");
|
||||
}
|
||||
if (this.m_environmentDataContainer != null && this.m_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 - (((double) (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.Component
|
||||
public void cleanup() {
|
||||
Log.Helper.LOGD(this, "cleanup", new Object[0]);
|
||||
if (this.m_synergyStartupObject != null) {
|
||||
this.m_synergyStartupObject.cancel();
|
||||
this.m_synergyStartupObject = null;
|
||||
}
|
||||
if (this.m_networkStatusChangeReceiver != null) {
|
||||
Utility.unregisterReceiver(this.m_networkStatusChangeReceiver);
|
||||
this.m_networkStatusChangeReceiver = null;
|
||||
}
|
||||
saveEnvironmentDataToPersistent();
|
||||
this.m_environmentDataContainer = null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public String getComponentId() {
|
||||
return SynergyEnvironment.COMPONENT_ID;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getEADeviceId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getEADeviceId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getEAHardwareId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getEAHardwareId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getGosMdmAppKey() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getGosMdmAppKey();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public int getLatestAppVersionCheckResult() {
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return 0;
|
||||
}
|
||||
return this.m_environmentDataContainer.getLatestAppVersionCheckResult();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.LogSource
|
||||
public String getLogSourceTitle() {
|
||||
return "SynergyEnv";
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getNexusClientId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getNexusClientId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getNexusClientSecret() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getNexusClientSecret();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getProductId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getProductId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getSellId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getSellId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getServerUrlWithKey(String str) {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getServerUrlWithKey(str);
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public String getSynergyDirectorServerUrl(NimbleConfiguration nimbleConfiguration) {
|
||||
switch (AnonymousClass3.$SwitchMap$com$ea$nimble$NimbleConfiguration[nimbleConfiguration.ordinal()]) {
|
||||
case 1:
|
||||
return SYNERGY_INT_SERVER_URL;
|
||||
case 2:
|
||||
return SYNERGY_STAGE_SERVER_URL;
|
||||
case 3:
|
||||
return SYNERGY_LIVE_SERVER_URL;
|
||||
case 4:
|
||||
return PreferenceManager.getDefaultSharedPreferences(ApplicationEnvironment.getComponent().getApplicationContext()).getString("NimbleCustomizedSynergyServerEndpointUrl", SYNERGY_LIVE_SERVER_URL);
|
||||
default:
|
||||
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 String getSynergyId() {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return this.m_environmentDataContainer.getSynergyId();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public int getTrackingPostInterval() {
|
||||
if (this.m_environmentDataContainer == null) {
|
||||
return -1;
|
||||
}
|
||||
return this.m_environmentDataContainer.getTrackingPostInterval();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public boolean isDataAvailable() {
|
||||
return this.m_environmentDataContainer != null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.ISynergyEnvironment
|
||||
public boolean isUpdateInProgress() {
|
||||
return this.m_synergyStartupObject != null;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void restore() {
|
||||
Log.Helper.LOGD(this, "restore", new Object[0]);
|
||||
if (this.m_dataLoadedOnComponentSetup) {
|
||||
this.m_dataLoadedOnComponentSetup = false;
|
||||
Utility.sendBroadcast(SynergyEnvironment.NOTIFICATION_RESTORED_FROM_PERSISTENT, null);
|
||||
} else {
|
||||
restoreEnvironmentDataFromPersistent(false);
|
||||
}
|
||||
if (this.m_environmentDataContainer == null || this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || ((double) (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue())) / 1000.0d > 300.0d) {
|
||||
startSynergyEnvironmentUpdate();
|
||||
} else {
|
||||
checkAndInitiateSynergyEnvironmentUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void resume() {
|
||||
Log.Helper.LOGD(this, "resume", new Object[0]);
|
||||
clearSynergyEnvironmentUpdateRateLimiting();
|
||||
if (this.m_environmentDataContainer == null || this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp() == null || ((double) (System.currentTimeMillis() - this.m_environmentDataContainer.getMostRecentDirectorResponseTimestamp().longValue())) / 1000.0d > 300.0d) {
|
||||
startSynergyEnvironmentUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void setup() {
|
||||
Log.Helper.LOGD(this, "setup", new Object[0]);
|
||||
this.m_dataLoadedOnComponentSetup = restoreEnvironmentDataFromPersistent(true);
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void suspend() {
|
||||
Log.Helper.LOGD(this, "suspend", new Object[0]);
|
||||
if (this.m_synergyStartupObject != null) {
|
||||
this.m_synergyStartupObject.cancel();
|
||||
this.m_synergyStartupObject = null;
|
||||
}
|
||||
if (this.m_networkStatusChangeReceiver != null) {
|
||||
Utility.unregisterReceiver(this.m_networkStatusChangeReceiver);
|
||||
this.m_networkStatusChangeReceiver = null;
|
||||
}
|
||||
saveEnvironmentDataToPersistent();
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.Component
|
||||
public void teardown() {
|
||||
this.m_environmentDataContainer = null;
|
||||
}
|
||||
}
|
||||
@@ -1,403 +0,0 @@
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/SynergyEnvironmentUpdater.class */
|
||||
public class SynergyEnvironmentUpdater implements LogSource {
|
||||
private static final int GET_ANONUID_MAX_RETRY_ATTEMPTS = 3;
|
||||
private static final int GET_DIRECTION_MAX_RETRY_ATTEMPTS = 3;
|
||||
private static final int GET_EADEVICEID_MAX_RETRY_ATTEMPTS = 3;
|
||||
private static final int SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL = -70002;
|
||||
private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID = -20094;
|
||||
private static final int SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED = -20093;
|
||||
private static final int VALIDATE_EADEVICEID_MAX_RETRY_ATTEMPTS = 3;
|
||||
private BaseCore m_core;
|
||||
private long m_getAnonUIDRetryCount;
|
||||
private long m_getDirectionRetryCount;
|
||||
private EnvironmentDataContainer m_environmentForSynergyStartUp = new EnvironmentDataContainer();
|
||||
private CompletionCallback m_completionCallback = null;
|
||||
private EnvironmentDataContainer m_previousValidEnvironmentData = null;
|
||||
private SynergyNetworkConnectionHandle m_synergyNetworkConnectionHandle = null;
|
||||
private long m_validateEADeviceIDRetryCount = 0;
|
||||
private long m_getEADeviceIDRetryCount = 0;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* renamed from: com.ea.nimble.SynergyEnvironmentUpdater$5 reason: invalid class name */
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/SynergyEnvironmentUpdater$5.class */
|
||||
public static /* synthetic */ class AnonymousClass5 {
|
||||
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$NimbleConfiguration = new int[NimbleConfiguration.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.INTEGRATION.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError e) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.STAGE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError e2) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.LIVE.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError e3) {
|
||||
}
|
||||
try {
|
||||
$SwitchMap$com$ea$nimble$NimbleConfiguration[NimbleConfiguration.CUSTOMIZED.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError e4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/SynergyEnvironmentUpdater$CompletionCallback.class */
|
||||
public interface CompletionCallback {
|
||||
void callback(Exception exc);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public SynergyEnvironmentUpdater(BaseCore baseCore) {
|
||||
this.m_core = baseCore;
|
||||
}
|
||||
|
||||
static /* synthetic */ long access$1008(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
|
||||
long j = synergyEnvironmentUpdater.m_getEADeviceIDRetryCount;
|
||||
synergyEnvironmentUpdater.m_getEADeviceIDRetryCount = 1 + j;
|
||||
return j;
|
||||
}
|
||||
|
||||
static /* synthetic */ long access$1108(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
|
||||
long j = synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount;
|
||||
synergyEnvironmentUpdater.m_validateEADeviceIDRetryCount = 1 + j;
|
||||
return j;
|
||||
}
|
||||
|
||||
static /* synthetic */ long access$1208(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
|
||||
long j = synergyEnvironmentUpdater.m_getAnonUIDRetryCount;
|
||||
synergyEnvironmentUpdater.m_getAnonUIDRetryCount = 1 + j;
|
||||
return j;
|
||||
}
|
||||
|
||||
static /* synthetic */ long access$708(SynergyEnvironmentUpdater synergyEnvironmentUpdater) {
|
||||
long j = synergyEnvironmentUpdater.m_getDirectionRetryCount;
|
||||
synergyEnvironmentUpdater.m_getDirectionRetryCount = 1 + j;
|
||||
return j;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void callSynergyGetAnonUid() {
|
||||
String anonymousSynergyId = SynergyIdManager.getComponent().getAnonymousSynergyId();
|
||||
if (anonymousSynergyId != null) {
|
||||
Log.Helper.LOGD(this, "Not getting anonymous ID from Synergy since it was loaded from persistence");
|
||||
this.m_environmentForSynergyStartUp.setSynergyAnonymousId(anonymousSynergyId);
|
||||
onStartUpSequenceFinished(null);
|
||||
return;
|
||||
}
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("apiVer", "1.0.0");
|
||||
hashMap.put("updatePriority", "false");
|
||||
hashMap.put("hwId", this.m_environmentForSynergyStartUp.getEAHardwareId());
|
||||
if (Utility.validString(this.m_environmentForSynergyStartUp.getEADeviceId())) {
|
||||
hashMap.put("eadeviceid", this.m_environmentForSynergyStartUp.getEADeviceId());
|
||||
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getAnonUid", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.4
|
||||
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
|
||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
|
||||
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
|
||||
if (error == null) {
|
||||
Log.Helper.LOGD(this, "GETANON Success");
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setSynergyAnonymousId(synergyNetworkConnectionHandle.getResponse().getJsonData().get("uid").toString());
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(null);
|
||||
} else if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount >= 3) {
|
||||
SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount = 0;
|
||||
Log.Helper.LOGD(this, "GETANON Error, (%s)", synergyNetworkConnectionHandle.getResponse().getError().toString());
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_ANONYMOUS_ID_FAILURE, "Synergy \"get anonymous id\" call failed.", error));
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.access$1208(SynergyEnvironmentUpdater.this);
|
||||
Log.Helper.LOGD(this, "GetAnonUid, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getAnonUIDRetryCount));
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGE(this, "getAnonUid got an invalid EA Device ID.");
|
||||
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "EA Device ID is invalid"));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void callSynergyGetDirection() {
|
||||
String applicationBundleId = ApplicationEnvironment.getComponent().getApplicationBundleId();
|
||||
String deviceString = ApplicationEnvironment.getComponent().getDeviceString();
|
||||
String deviceCodename = ApplicationEnvironment.getComponent().getDeviceCodename();
|
||||
String deviceManufacturer = ApplicationEnvironment.getComponent().getDeviceManufacturer();
|
||||
String deviceModel = ApplicationEnvironment.getComponent().getDeviceModel();
|
||||
String deviceBrand = ApplicationEnvironment.getComponent().getDeviceBrand();
|
||||
String deviceFingerprint = ApplicationEnvironment.getComponent().getDeviceFingerprint();
|
||||
if (!Utility.validString(applicationBundleId)) {
|
||||
Log.Helper.LOGE(this, "GETDIRECTION bundleId is invalid");
|
||||
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "bundleId is invalid"));
|
||||
} else if (!Utility.validString(deviceString)) {
|
||||
Log.Helper.LOGE(this, "GETDIRECTION deviceString is invalid");
|
||||
onStartUpSequenceFinished(new Error(Error.Code.INVALID_ARGUMENT, "deviceString is invalid"));
|
||||
} else {
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("packageId", applicationBundleId);
|
||||
hashMap.put("deviceString", deviceString);
|
||||
hashMap.put("deviceCodename", deviceCodename);
|
||||
hashMap.put("manufacturer", deviceManufacturer);
|
||||
hashMap.put("model", deviceModel);
|
||||
hashMap.put("brand", deviceBrand);
|
||||
hashMap.put("fingerprint", deviceFingerprint);
|
||||
hashMap.put("serverEnvironment", getSynergyServerEnvironmentName());
|
||||
hashMap.put("sdkVersion", "1.23.14.1217");
|
||||
hashMap.put("apiVer", "1.0.0");
|
||||
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getSynergyDirectorServerUrl(Base.getConfiguration()), "/director/api/android/getDirectionByPackage", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.1
|
||||
/* JADX WARN: Type inference failed for: r1v24, types: [java.lang.Object] */
|
||||
/* JADX WARN: Type inference failed for: r2v10, types: [java.lang.Object] */
|
||||
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
|
||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||
Log.Helper.LOGD(this, "GETDIRECTION FINISHED");
|
||||
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
|
||||
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
|
||||
if (error == null) {
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setMostRecentDirectorResponseTimestamp(System.currentTimeMillis());
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setGetDirectionResponseDictionary(synergyNetworkConnectionHandle.getResponse().getJsonData());
|
||||
List<Map> list = (List) SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.getGetDirectionResponseDictionary().get("serverData");
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setServerUrls(new HashMap());
|
||||
if (list != null) {
|
||||
for (Map map : list) {
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.getServerUrls().put((String) map.get("key"), (String)map.get("value"));
|
||||
}
|
||||
}
|
||||
if (SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.getServerUrls().size() == 0) {
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.NOT_AVAILABLE, "No Synergy server URLs available."));
|
||||
} else if (SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData == null || !Utility.validString(SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData.getEADeviceId())) {
|
||||
String loadEADeviceId = EASPDataLoader.loadEADeviceId();
|
||||
if (loadEADeviceId != null) {
|
||||
SynergyEnvironmentUpdater.this.callSynergyValidateEADeviceId(loadEADeviceId);
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
|
||||
}
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.this.callSynergyValidateEADeviceId(SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData.getEADeviceId());
|
||||
}
|
||||
} else if (!(error instanceof SynergyServerError)) {
|
||||
boolean isTimeoutError = SynergyEnvironmentUpdater.this.isTimeoutError(error);
|
||||
if (isTimeoutError || SynergyEnvironmentUpdater.this.m_getDirectionRetryCount >= 3) {
|
||||
SynergyEnvironmentUpdater.this.m_getDirectionRetryCount = 0;
|
||||
if (isTimeoutError) {
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_DIRECTION_TIMEOUT, "Synergy /getDirectionByPackage request timed out.", error));
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(error);
|
||||
}
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.access$708(SynergyEnvironmentUpdater.this);
|
||||
Log.Helper.LOGD(this, "GetDirection, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getDirectionRetryCount));
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetDirection();
|
||||
}
|
||||
} else if (((SynergyServerError) error).isError(SynergyEnvironmentUpdater.SYNERGY_DIRECTOR_RESPONSE_ERROR_CODE_SERVERS_FULL)) {
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_SERVER_FULL, "Synergy ServerUnavailable signal received.", error));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void callSynergyGetEADeviceId() {
|
||||
int phoneType;
|
||||
String string;
|
||||
String SHA256HashString;
|
||||
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("apiVer", "1.0.0");
|
||||
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
|
||||
String mACAddress = ApplicationEnvironment.getComponent().getMACAddress();
|
||||
if (Utility.validString(mACAddress) && (SHA256HashString = Utility.SHA256HashString(mACAddress)) != null) {
|
||||
hashMap.put("macHash", SHA256HashString);
|
||||
}
|
||||
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
|
||||
Context context = null;
|
||||
if (component != null) {
|
||||
context = component.getApplicationContext();
|
||||
}
|
||||
if (!(context == null || (string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id")) == null)) {
|
||||
hashMap.put("androidId", string);
|
||||
}
|
||||
if (context != null) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (!(telephonyManager == null || packageManager.checkPermission("android.permission.READ_PHONE_STATE", context.getPackageName()) != 0 || (phoneType = telephonyManager.getPhoneType()) == 0)) {
|
||||
String deviceId = telephonyManager.getDeviceId();
|
||||
if (Utility.validString(deviceId)) {
|
||||
String str = "imei";
|
||||
if (phoneType == 2) {
|
||||
str = "meid";
|
||||
}
|
||||
hashMap.put(str, deviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/getDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.2
|
||||
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
|
||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
|
||||
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
|
||||
if (error == null) {
|
||||
Log.Helper.LOGD(this, "GetEADeviceID Success");
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
|
||||
} else if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount >= 3) {
|
||||
SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount = 0;
|
||||
Log.Helper.LOGD(this, "GetEADeviceID Error (%s)", synergyNetworkConnectionHandle.getResponse().getError());
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "GetEADevideId call failed", synergyNetworkConnectionHandle.getResponse().getError()));
|
||||
} else {
|
||||
SynergyEnvironmentUpdater.access$1008(SynergyEnvironmentUpdater.this);
|
||||
Log.Helper.LOGD(this, "GetEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_getEADeviceIDRetryCount));
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void callSynergyValidateEADeviceId(final String str) {
|
||||
int phoneType;
|
||||
String string;
|
||||
String SHA256HashString;
|
||||
EnvironmentDataContainer environmentDataContainer = this.m_environmentForSynergyStartUp;
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("apiVer", "1.0.0");
|
||||
hashMap.put("hwId", environmentDataContainer.getEAHardwareId());
|
||||
hashMap.put("eadeviceid", str);
|
||||
String mACAddress = ApplicationEnvironment.getComponent().getMACAddress();
|
||||
if (Utility.validString(mACAddress) && (SHA256HashString = Utility.SHA256HashString(mACAddress)) != null) {
|
||||
hashMap.put("macHash", SHA256HashString);
|
||||
}
|
||||
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
|
||||
Context context = null;
|
||||
if (component != null) {
|
||||
context = component.getApplicationContext();
|
||||
}
|
||||
if (!(context == null || (string = Settings.Secure.getString(component.getApplicationContext().getContentResolver(), "android_id")) == null)) {
|
||||
hashMap.put("androidId", string);
|
||||
}
|
||||
if (context != null) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
if (!(telephonyManager == null || packageManager.checkPermission("android.permission.READ_PHONE_STATE", context.getPackageName()) != 0 || (phoneType = telephonyManager.getPhoneType()) == 0)) {
|
||||
String deviceId = telephonyManager.getDeviceId();
|
||||
if (Utility.validString(deviceId)) {
|
||||
String str2 = "imei";
|
||||
if (phoneType == 2) {
|
||||
str2 = "meid";
|
||||
}
|
||||
hashMap.put(str2, deviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.m_synergyNetworkConnectionHandle = SynergyNetwork.getComponent().sendGetRequest(this.m_environmentForSynergyStartUp.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_USER), "/user/api/android/validateDeviceID", hashMap, new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.SynergyEnvironmentUpdater.3
|
||||
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
|
||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||
SynergyEnvironmentUpdater.this.m_synergyNetworkConnectionHandle = null;
|
||||
Exception error = synergyNetworkConnectionHandle.getResponse().getError();
|
||||
if (error == null) {
|
||||
Log.Helper.LOGD(this, "ValidateEADeviceID Success");
|
||||
SynergyEnvironmentUpdater.this.m_environmentForSynergyStartUp.setEADeviceId((String) synergyNetworkConnectionHandle.getResponse().getJsonData().get("deviceId"));
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetAnonUid();
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGD(this, "ValidateEADeviceID Error (%s)", error);
|
||||
if (error instanceof SynergyServerError) {
|
||||
SynergyServerError synergyServerError = (SynergyServerError) error;
|
||||
if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_CLEAR_CLIENT_CACHED_EADEVICEID)) {
|
||||
if (SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData != null) {
|
||||
SynergyEnvironmentUpdater.this.m_previousValidEnvironmentData.setEADeviceId(null);
|
||||
}
|
||||
Log.Helper.LOGD(this, "ValidateEADeviceID, Server signal received to delete cached EA Device ID. Making request to get a new EA Device ID.");
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
|
||||
return;
|
||||
} else if (synergyServerError.isError(SynergyEnvironmentUpdater.SYNERGY_USER_VALIDATE_EADEVICEID_RESPONSE_ERROR_CODE_VALIDATION_FAILED)) {
|
||||
Log.Helper.LOGD(this, "ValidateEADeviceID, EADeviceID validation failed. Making request to get a new EA Device ID.");
|
||||
SynergyEnvironmentUpdater.this.callSynergyGetEADeviceId();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (SynergyEnvironmentUpdater.this.isTimeoutError(error) || SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount >= 3) {
|
||||
SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount = 0;
|
||||
SynergyEnvironmentUpdater.this.onStartUpSequenceFinished(new Error(Error.Code.SYNERGY_GET_EA_DEVICE_ID_FAILURE, "ValidateEADeviceId call failed", error));
|
||||
return;
|
||||
}
|
||||
SynergyEnvironmentUpdater.access$1108(SynergyEnvironmentUpdater.this);
|
||||
Log.Helper.LOGD(this, "ValidateEADeviceID, call failed. Making retry attempt number %d.", Long.valueOf(SynergyEnvironmentUpdater.this.m_validateEADeviceIDRetryCount));
|
||||
SynergyEnvironmentUpdater.this.callSynergyValidateEADeviceId(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getSynergyServerEnvironmentName() {
|
||||
switch (AnonymousClass5.$SwitchMap$com$ea$nimble$NimbleConfiguration[this.m_core.getConfiguration().ordinal()]) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return this.m_core.getConfiguration().toString();
|
||||
case 4:
|
||||
return PreferenceManager.getDefaultSharedPreferences(ApplicationEnvironment.getComponent().getApplicationContext()).getString("NimbleCustomizedSynergyServerEnvironmentName", "live");
|
||||
default:
|
||||
Log.Helper.LOGF(this, "Request for Synergy server environment name with unknown NimbleConfiguration %s", this.m_core.getConfiguration().toString());
|
||||
return "live";
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean isTimeoutError(Exception exc) {
|
||||
return (exc instanceof Error) && ((Error) exc).isError(Error.Code.NETWORK_TIMEOUT);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void onStartUpSequenceFinished(Exception exc) {
|
||||
if (this.m_completionCallback != null) {
|
||||
this.m_completionCallback.callback(exc);
|
||||
} else {
|
||||
Log.Helper.LOGW(this, "Startup sequence finished, but no completion callback set.");
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
SynergyNetworkConnectionHandle synergyNetworkConnectionHandle = this.m_synergyNetworkConnectionHandle;
|
||||
if (synergyNetworkConnectionHandle != null) {
|
||||
Log.Helper.LOGD(this, "Canceling network connection.");
|
||||
synergyNetworkConnectionHandle.cancel();
|
||||
this.m_synergyNetworkConnectionHandle = null;
|
||||
}
|
||||
onStartUpSequenceFinished(new Error(Error.Code.NETWORK_OPERATION_CANCELLED, "Synergy startup sequence canceled."));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public EnvironmentDataContainer getEnvironmentDataContainer() {
|
||||
return this.m_environmentForSynergyStartUp;
|
||||
}
|
||||
|
||||
@Override // com.ea.nimble.LogSource
|
||||
public String getLogSourceTitle() {
|
||||
return "SynergyEnv";
|
||||
}
|
||||
|
||||
public void startSynergyStartupSequence(EnvironmentDataContainer environmentDataContainer, CompletionCallback completionCallback) {
|
||||
this.m_completionCallback = completionCallback;
|
||||
this.m_previousValidEnvironmentData = environmentDataContainer;
|
||||
if (Network.getComponent().getStatus() != Network.Status.OK) {
|
||||
onStartUpSequenceFinished(new Error(Error.Code.NETWORK_NO_CONNECTION, "Device is not connected to Wifi or wireless."));
|
||||
} else {
|
||||
callSynergyGetDirection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.ISynergyIdManager;
|
||||
import com.ea.nimble.SynergyIdManagerImpl;
|
||||
|
||||
public class SynergyIdManager {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.synergyidmanager";
|
||||
public static final String LOG_TAG = "SynergyID";
|
||||
public static final String NOTIFICATION_ANONYMOUS_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.anonymous_synergy_id_changed";
|
||||
public static final String NOTIFICATION_SYNERGY_ID_CHANGED = "nimble.synergyidmanager.notification.synergy_id_changed";
|
||||
|
||||
public static ISynergyIdManager getComponent() {
|
||||
return SynergyIdManagerImpl.getComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
|
||||
public class SynergyIdManagerError
|
||||
extends Error {
|
||||
public static final String ERROR_DOMAIN = "NimbleSynergyIdManager";
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SynergyIdManagerError(int n2, String string2) {
|
||||
super(ERROR_DOMAIN, n2, string2, null);
|
||||
}
|
||||
|
||||
public SynergyIdManagerError(int n2, String string2, Throwable throwable) {
|
||||
super(ERROR_DOMAIN, n2, string2, throwable);
|
||||
}
|
||||
|
||||
public static enum Code {
|
||||
AUTHENTICATOR_CONFLICT(5000),
|
||||
UNEXPECTED_LOGIN_STATE(5001),
|
||||
INVALID_ID(5002),
|
||||
MISSING_AUTHENTICATOR(5003);
|
||||
|
||||
private int m_value;
|
||||
|
||||
private Code(int n3) {
|
||||
this.m_value = n3;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return this.m_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.BroadcastReceiver
|
||||
* android.content.Context
|
||||
* android.content.Intent
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
class SynergyIdManagerImpl
|
||||
extends Component
|
||||
implements ISynergyIdManager,
|
||||
LogSource {
|
||||
private static final String ANONYMOUS_ID_PERSISTENCE_DATA_ID = "anonymousId";
|
||||
private static final String AUTHENTICATOR_PERSISTENCE_DATA_ID = "authenticator";
|
||||
private static final String CURRENT_ID_PERSISTENCE_DATA_ID = "currentId";
|
||||
private static final String SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID = "com.ea.nimble.synergyidmanager.anonymousId";
|
||||
private static final String VERSION_PERSISTENCE_DATA_ID = "dataVersion";
|
||||
private String m_anonymousSynergyId;
|
||||
private String m_authenticatorIdentifier;
|
||||
private String m_currentSynergyId;
|
||||
private BroadcastReceiver m_receiver = new SynergyIdManagerReceiver();
|
||||
|
||||
SynergyIdManagerImpl() {
|
||||
}
|
||||
|
||||
public static ISynergyIdManager getComponent() {
|
||||
return (ISynergyIdManager)((Object)Base.getComponent("com.ea.nimble.synergyidmanager"));
|
||||
}
|
||||
|
||||
private void onSynergyEnvironmentStartupRequestsFinished() {
|
||||
if (SynergyEnvironment.getComponent() != null) {
|
||||
Log.Helper.LOGD(this, "onSynergyEnvironmentStartupRequestsFinished - Process the notification, everything looks okay");
|
||||
this.setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId());
|
||||
if (Utility.validString(this.m_currentSynergyId)) return;
|
||||
this.setCurrentSynergyId(this.m_anonymousSynergyId);
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGI(this, "onSynergyEnvironmentStartupRequestsFinished - Aborted because we were unable to get SynergyEnvironment");
|
||||
}
|
||||
|
||||
private void restoreFromPersistent() {
|
||||
Persistence persistence = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.synergyidmanager", Persistence.Storage.CACHE);
|
||||
if (persistence != null) {
|
||||
Log.Helper.LOGD("Loaded persistence data version, %s.", persistence.getStringValue(VERSION_PERSISTENCE_DATA_ID));
|
||||
this.m_currentSynergyId = persistence.getStringValue(CURRENT_ID_PERSISTENCE_DATA_ID);
|
||||
this.m_authenticatorIdentifier = persistence.getStringValue(AUTHENTICATOR_PERSISTENCE_DATA_ID);
|
||||
Log.Helper.LOGD(this, "Loaded Synergy ID, %s, with authenticator, %s.", this.m_currentSynergyId, this.m_authenticatorIdentifier);
|
||||
} else {
|
||||
Log.Helper.LOGE(this, "Could not get persistence object to load from.");
|
||||
}
|
||||
if ((persistence = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT)) != null) {
|
||||
Log.Helper.LOGD(this, "Loaded persistence data version, %s.", Utility.safeString(persistence.getStringValue(VERSION_PERSISTENCE_DATA_ID)));
|
||||
this.m_anonymousSynergyId = persistence.getStringValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID);
|
||||
Log.Helper.LOGD(this, "Loaded anonymous Synergy ID, %s.", Utility.safeString(this.m_anonymousSynergyId));
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to load from.");
|
||||
}
|
||||
|
||||
private void saveDataToPersistent() {
|
||||
Persistence persistence = PersistenceService.getPersistenceForNimbleComponent(SYNERGY_ID_MANAGER_ANONYMOUS_ID_PERSISTENCE_ID, Persistence.Storage.DOCUMENT);
|
||||
if (persistence != null) {
|
||||
Log.Helper.LOGD("Saving anonymous Synergy ID, %s, to persistent.", this.m_anonymousSynergyId);
|
||||
persistence.setValue(VERSION_PERSISTENCE_DATA_ID, (Serializable)((Object)"1.0.0"));
|
||||
persistence.setValue(ANONYMOUS_ID_PERSISTENCE_DATA_ID, (Serializable)((Object)this.m_anonymousSynergyId));
|
||||
persistence.setBackUp(true);
|
||||
persistence.synchronize();
|
||||
} else {
|
||||
Log.Helper.LOGE(this, "Could not get anonymous Synergy ID persistence object to save to.");
|
||||
}
|
||||
if ((persistence = PersistenceService.getPersistenceForNimbleComponent("com.ea.nimble.synergyidmanager", Persistence.Storage.CACHE)) != null) {
|
||||
Log.Helper.LOGD(this, "Saving current Synergy ID, %s, and authenticator, %s, to persistent.", this.m_currentSynergyId, this.m_authenticatorIdentifier);
|
||||
persistence.setValue(VERSION_PERSISTENCE_DATA_ID, (Serializable)((Object)"1.0.0"));
|
||||
persistence.setValue(CURRENT_ID_PERSISTENCE_DATA_ID, (Serializable)((Object)this.m_currentSynergyId));
|
||||
persistence.setValue(AUTHENTICATOR_PERSISTENCE_DATA_ID, (Serializable)((Object)this.m_authenticatorIdentifier));
|
||||
persistence.synchronize();
|
||||
return;
|
||||
}
|
||||
Log.Helper.LOGE(this, "Could not get persistence object to save to.");
|
||||
}
|
||||
|
||||
private void setAnonymousSynergyId(String object) {
|
||||
if (Utility.validString(this.m_anonymousSynergyId) && !Utility.validString((String)object)) {
|
||||
Log.Helper.LOGE(this, "Attempt to set invalid anonymous Synergy ID over existing ID, %s. Ignoring attempt.", this.m_anonymousSynergyId);
|
||||
return;
|
||||
}
|
||||
String string2 = this.m_anonymousSynergyId;
|
||||
this.m_anonymousSynergyId = object;
|
||||
this.saveDataToPersistent();
|
||||
if (Utility.validString(string2) && (Utility.validString(string2) && !string2.equals(this.m_anonymousSynergyId) || Utility.validString(this.m_anonymousSynergyId) && !this.m_anonymousSynergyId.equals(string2))) {
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("previousSynergyId", Utility.safeString(string2));
|
||||
hashMap.put("currentSynergyId", Utility.safeString(this.m_anonymousSynergyId));
|
||||
Utility.sendBroadcast("nimble.synergyidmanager.notification.anonymous_synergy_id_changed", hashMap);
|
||||
}
|
||||
if (this.m_authenticatorIdentifier != null) return;
|
||||
this.setCurrentSynergyId(this.m_anonymousSynergyId);
|
||||
}
|
||||
|
||||
private void setCurrentSynergyId(String object) {
|
||||
if (Utility.validString(this.m_currentSynergyId) && !Utility.validString((String)object)) {
|
||||
Log.Helper.LOGE(this, "Attempt to set invalid current Synergy ID over existing ID, %s. Ignoring attempt.", this.m_currentSynergyId);
|
||||
return;
|
||||
}
|
||||
String string2 = this.m_currentSynergyId;
|
||||
this.m_currentSynergyId = object;
|
||||
this.saveDataToPersistent();
|
||||
if (!Utility.validString(string2)) return;
|
||||
if (!Utility.validString(string2) || string2.equals(this.m_currentSynergyId)) {
|
||||
if (!Utility.validString(this.m_currentSynergyId)) return;
|
||||
if (this.m_currentSynergyId.equals(string2)) return;
|
||||
}
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("previousSynergyId", Utility.safeString(string2));
|
||||
hashMap.put("currentSynergyId", Utility.safeString(this.m_currentSynergyId));
|
||||
Utility.sendBroadcast("nimble.synergyidmanager.notification.synergy_id_changed", hashMap);
|
||||
}
|
||||
|
||||
private void sleep() {
|
||||
Utility.unregisterReceiver(this.m_receiver);
|
||||
this.saveDataToPersistent();
|
||||
}
|
||||
|
||||
private void wakeup() {
|
||||
this.restoreFromPersistent();
|
||||
if (!Utility.validString(this.m_anonymousSynergyId)) {
|
||||
this.setAnonymousSynergyId(SynergyEnvironment.getComponent().getSynergyId());
|
||||
}
|
||||
if (!Utility.validString(this.m_currentSynergyId)) {
|
||||
this.setCurrentSynergyId(this.m_anonymousSynergyId);
|
||||
}
|
||||
Utility.registerReceiver("nimble.environment.notification.startup_requests_finished", this.m_receiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanup() {
|
||||
this.sleep();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAnonymousSynergyId() {
|
||||
if (!Utility.validString(this.m_anonymousSynergyId)) return SynergyEnvironment.getComponent().getSynergyId();
|
||||
return this.m_anonymousSynergyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.synergyidmanager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogSourceTitle() {
|
||||
return "SynergyId";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSynergyId() {
|
||||
if (!Utility.validString(this.m_currentSynergyId)) return this.getAnonymousSynergyId();
|
||||
return this.m_currentSynergyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyIdManagerError login(String string2, String string3) {
|
||||
if (this.m_authenticatorIdentifier != null) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE.intValue(), "Already logged in with authenticator, " + this.m_authenticatorIdentifier);
|
||||
}
|
||||
if (!Utility.validString(string2)) return new SynergyIdManagerError(SynergyIdManagerError.Code.INVALID_ID.intValue(), "Synergy ID must be numeric digits.");
|
||||
if (!Utility.isOnlyDecimalCharacters(string2)) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.INVALID_ID.intValue(), "Synergy ID must be numeric digits.");
|
||||
}
|
||||
if (!Utility.validString(string3)) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR.intValue(), "Authenticator string required for login API.");
|
||||
}
|
||||
this.m_authenticatorIdentifier = string3;
|
||||
this.setCurrentSynergyId(string2);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyIdManagerError logout(String string2) {
|
||||
if (this.m_authenticatorIdentifier == null) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.UNEXPECTED_LOGIN_STATE.intValue(), "Already logged out.");
|
||||
}
|
||||
if (!Utility.validString(string2)) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.MISSING_AUTHENTICATOR.intValue(), "Authenticator string required for logout API.");
|
||||
}
|
||||
if (!this.m_authenticatorIdentifier.equals(string2)) {
|
||||
return new SynergyIdManagerError(SynergyIdManagerError.Code.AUTHENTICATOR_CONFLICT.intValue(), "Logout must be performed by the same authenticator that logged in, " + this.m_authenticatorIdentifier);
|
||||
}
|
||||
this.setCurrentSynergyId(this.m_anonymousSynergyId);
|
||||
this.m_authenticatorIdentifier = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void restore() {
|
||||
this.wakeup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resume() {
|
||||
this.wakeup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void suspend() {
|
||||
this.sleep();
|
||||
}
|
||||
|
||||
private class SynergyIdManagerReceiver
|
||||
extends BroadcastReceiver {
|
||||
private SynergyIdManagerReceiver() {
|
||||
}
|
||||
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!ApplicationEnvironment.isMainApplicationRunning()) return;
|
||||
if (ApplicationEnvironment.getCurrentActivity() == null) return;
|
||||
SynergyIdManagerImpl.this.onSynergyEnvironmentStartupRequestsFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.ISynergyNetwork;
|
||||
import com.ea.nimble.SynergyNetworkImpl;
|
||||
|
||||
public class SynergyNetwork {
|
||||
public static final String COMPONENT_ID = "com.ea.nimble.synergynetwork";
|
||||
|
||||
public static ISynergyNetwork getComponent() {
|
||||
return SynergyNetworkImpl.getComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.BaseCore;
|
||||
import com.ea.nimble.HttpResponse;
|
||||
import com.ea.nimble.IOperationalTelemetryDispatch;
|
||||
import com.ea.nimble.ISynergyRequest;
|
||||
import com.ea.nimble.ISynergyResponse;
|
||||
import com.ea.nimble.Log;
|
||||
import com.ea.nimble.Network;
|
||||
import com.ea.nimble.NetworkConnectionCallback;
|
||||
import com.ea.nimble.NetworkConnectionHandle;
|
||||
import com.ea.nimble.OperationalTelemetryDispatch;
|
||||
import com.ea.nimble.OperationalTelemetryEvent;
|
||||
import com.ea.nimble.SynergyNetworkConnectionCallback;
|
||||
import com.ea.nimble.SynergyNetworkConnectionHandle;
|
||||
import com.ea.nimble.SynergyRequest;
|
||||
import com.ea.nimble.SynergyResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class SynergyNetworkConnection
|
||||
implements SynergyNetworkConnectionHandle {
|
||||
private SynergyNetworkConnectionCallback m_completionCallback;
|
||||
private SynergyNetworkConnectionCallback m_headerCallback;
|
||||
private NetworkConnectionHandle m_networkHandle = null;
|
||||
private SynergyOperationalTelemetryDispatch m_otDispatch;
|
||||
private SynergyNetworkConnectionCallback m_progressCallback;
|
||||
private SynergyRequest m_request;
|
||||
private SynergyResponse m_response;
|
||||
|
||||
public SynergyNetworkConnection(SynergyRequest synergyRequest, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
this.m_request = synergyRequest;
|
||||
this.m_response = new SynergyResponse();
|
||||
this.m_otDispatch = new SynergyOperationalTelemetryDispatch();
|
||||
this.m_headerCallback = null;
|
||||
this.m_progressCallback = null;
|
||||
this.m_completionCallback = synergyNetworkConnectionCallback;
|
||||
}
|
||||
|
||||
static /* synthetic */ NetworkConnectionHandle access$102(SynergyNetworkConnection synergyNetworkConnection, NetworkConnectionHandle networkConnectionHandle) {
|
||||
synergyNetworkConnection.m_networkHandle = networkConnectionHandle;
|
||||
return networkConnectionHandle;
|
||||
}
|
||||
|
||||
private void parseDataFromNetworkHandle() {
|
||||
if (this.m_networkHandle == null) return;
|
||||
this.m_response.httpResponse = this.m_networkHandle.getResponse();
|
||||
this.m_response.parseData();
|
||||
}
|
||||
|
||||
private void updateNetworkHeaderHandler() {
|
||||
if (this.m_headerCallback == null) {
|
||||
this.m_networkHandle.setHeaderCallback(null);
|
||||
return;
|
||||
}
|
||||
this.m_networkHandle.setHeaderCallback(new NetworkConnectionCallback(){
|
||||
|
||||
@Override
|
||||
public void callback(NetworkConnectionHandle networkConnectionHandle) {
|
||||
SynergyNetworkConnection.this.m_headerCallback.callback(SynergyNetworkConnection.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateNetworkProgressHandler() {
|
||||
if (this.m_progressCallback == null) {
|
||||
this.m_networkHandle.setProgressCallback(null);
|
||||
return;
|
||||
}
|
||||
this.m_networkHandle.setProgressCallback(new NetworkConnectionCallback(){
|
||||
|
||||
@Override
|
||||
public void callback(NetworkConnectionHandle networkConnectionHandle) {
|
||||
SynergyNetworkConnection.this.m_progressCallback.callback(SynergyNetworkConnection.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
if (this.m_networkHandle == null) return;
|
||||
this.m_networkHandle.cancel();
|
||||
}
|
||||
|
||||
public void errorPriorToSend(Exception exception) {
|
||||
HttpResponse httpResponse = new HttpResponse();
|
||||
httpResponse.error = exception;
|
||||
httpResponse.isCompleted = true;
|
||||
this.m_response.httpResponse = httpResponse;
|
||||
if (this.m_completionCallback == null) return;
|
||||
this.m_completionCallback.callback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionCallback getCompletionCallback() {
|
||||
return this.m_completionCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionCallback getHeaderCallback() {
|
||||
return this.m_headerCallback;
|
||||
}
|
||||
|
||||
public NetworkConnectionHandle getNetworkConnectionHandle() {
|
||||
return this.m_networkHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionCallback getProgressCallback() {
|
||||
return this.m_progressCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISynergyRequest getRequest() {
|
||||
return this.m_request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISynergyResponse getResponse() {
|
||||
return this.m_response;
|
||||
}
|
||||
|
||||
void send() {
|
||||
try {
|
||||
this.m_request.build();
|
||||
this.m_networkHandle = Network.getComponent().sendRequest(this.m_request.httpRequest, new NetworkConnectionCallback(){
|
||||
|
||||
@Override
|
||||
public void callback(NetworkConnectionHandle networkConnectionHandle) {
|
||||
if (SynergyNetworkConnection.this.m_networkHandle == null) {
|
||||
SynergyNetworkConnection.access$102(SynergyNetworkConnection.this, networkConnectionHandle);
|
||||
}
|
||||
SynergyNetworkConnection.this.parseDataFromNetworkHandle();
|
||||
networkConnectionHandle.setHeaderCallback(null);
|
||||
networkConnectionHandle.setProgressCallback(null);
|
||||
networkConnectionHandle.setCompletionCallback(null);
|
||||
if (SynergyNetworkConnection.this.m_completionCallback == null) return;
|
||||
SynergyNetworkConnection.this.m_completionCallback.callback(SynergyNetworkConnection.this);
|
||||
}
|
||||
}, this.m_otDispatch);
|
||||
this.m_response.httpResponse = this.m_networkHandle.getResponse();
|
||||
this.updateNetworkHeaderHandler();
|
||||
this.updateNetworkProgressHandler();
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.errorPriorToSend(exception);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompletionCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
this.m_completionCallback = synergyNetworkConnectionCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeaderCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
this.m_headerCallback = synergyNetworkConnectionCallback;
|
||||
if (this.m_networkHandle == null) return;
|
||||
this.updateNetworkHeaderHandler();
|
||||
}
|
||||
|
||||
public void setNetworkConnectionHandle(NetworkConnectionHandle networkConnectionHandle) {
|
||||
this.m_networkHandle = networkConnectionHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgressCallback(SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
this.m_progressCallback = synergyNetworkConnectionCallback;
|
||||
if (this.m_networkHandle == null) return;
|
||||
this.updateNetworkProgressHandler();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
this.m_request.prepare(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void waitOn() {
|
||||
if (this.m_networkHandle == null) return;
|
||||
this.m_networkHandle.waitOn();
|
||||
}
|
||||
|
||||
private class SynergyOperationalTelemetryDispatch
|
||||
implements IOperationalTelemetryDispatch {
|
||||
private SynergyOperationalTelemetryDispatch() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OperationalTelemetryEvent> getEvents(String string2) {
|
||||
if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
IOperationalTelemetryDispatch iOperationalTelemetryDispatch = OperationalTelemetryDispatch.getComponent();
|
||||
if (iOperationalTelemetryDispatch == null) return null;
|
||||
return iOperationalTelemetryDispatch.getEvents(string2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEventCount(String string2) {
|
||||
if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
|
||||
return -1;
|
||||
}
|
||||
IOperationalTelemetryDispatch iOperationalTelemetryDispatch = OperationalTelemetryDispatch.getComponent();
|
||||
if (iOperationalTelemetryDispatch == null) return -1;
|
||||
return iOperationalTelemetryDispatch.getMaxEventCount(string2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEvent(String string2, Map<String, String> map) {
|
||||
if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
IOperationalTelemetryDispatch iOperationalTelemetryDispatch = OperationalTelemetryDispatch.getComponent();
|
||||
if (iOperationalTelemetryDispatch == null) return;
|
||||
SynergyNetworkConnection.this.parseDataFromNetworkHandle();
|
||||
Map<String, Object> map2 = SynergyNetworkConnection.this.m_response.getJsonData();
|
||||
if (map2 != null && map2.containsKey("resultCode")) {
|
||||
map.put("SYNERGY_RESULT_CODE", ((Integer)map2.get("resultCode")).toString());
|
||||
}
|
||||
iOperationalTelemetryDispatch.logEvent(string2, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxEventCount(String string2, int n2) {
|
||||
if (!BaseCore.getInstance().isActive()) {
|
||||
Log.Helper.LOGV(this, "BaseCore not active for operational telemetry logging.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
IOperationalTelemetryDispatch iOperationalTelemetryDispatch = OperationalTelemetryDispatch.getComponent();
|
||||
if (iOperationalTelemetryDispatch == null) return;
|
||||
iOperationalTelemetryDispatch.setMaxEventCount(string2, n2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.SynergyNetworkConnectionHandle;
|
||||
|
||||
public interface SynergyNetworkConnectionCallback {
|
||||
public void callback(SynergyNetworkConnectionHandle var1);
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.ISynergyRequest;
|
||||
import com.ea.nimble.ISynergyResponse;
|
||||
import com.ea.nimble.SynergyNetworkConnectionCallback;
|
||||
|
||||
public interface SynergyNetworkConnectionHandle {
|
||||
public void cancel();
|
||||
|
||||
public SynergyNetworkConnectionCallback getCompletionCallback();
|
||||
|
||||
public SynergyNetworkConnectionCallback getHeaderCallback();
|
||||
|
||||
public SynergyNetworkConnectionCallback getProgressCallback();
|
||||
|
||||
public ISynergyRequest getRequest();
|
||||
|
||||
public ISynergyResponse getResponse();
|
||||
|
||||
public void setCompletionCallback(SynergyNetworkConnectionCallback var1);
|
||||
|
||||
public void setHeaderCallback(SynergyNetworkConnectionCallback var1);
|
||||
|
||||
public void setProgressCallback(SynergyNetworkConnectionCallback var1);
|
||||
|
||||
public void waitOn();
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.BroadcastReceiver
|
||||
* android.content.Context
|
||||
* android.content.Intent
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SynergyNetworkImpl
|
||||
extends Component
|
||||
implements ISynergyNetwork {
|
||||
private ArrayList<SynergyNetworkConnection> m_pendingRequests = null;
|
||||
private String m_sessionId;
|
||||
private BroadcastReceiver m_synergyEnvironmentNotifyReceiver = null;
|
||||
|
||||
SynergyNetworkImpl() {
|
||||
}
|
||||
|
||||
private String generateSessionId() {
|
||||
return UUID.randomUUID().toString().replace("-", "").toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
public static ISynergyNetwork getComponent() {
|
||||
return (ISynergyNetwork)(Base.getComponent("com.ea.nimble.synergynetwork"));
|
||||
}
|
||||
|
||||
private SynergyNetworkConnectionHandle sendSynergyRequest(SynergyRequest object, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(object, synergyNetworkConnectionCallback);
|
||||
synergyNetworkConnection.start();
|
||||
return synergyNetworkConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
if (this.m_synergyEnvironmentNotifyReceiver != null) {
|
||||
Utility.unregisterReceiver(this.m_synergyEnvironmentNotifyReceiver);
|
||||
this.m_synergyEnvironmentNotifyReceiver = null;
|
||||
}
|
||||
this.m_pendingRequests.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return "com.ea.nimble.synergynetwork";
|
||||
}
|
||||
|
||||
String getSessionId() {
|
||||
return this.m_sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore() {
|
||||
if (SynergyEnvironment.getComponent().isDataAvailable()) return;
|
||||
this.m_synergyEnvironmentNotifyReceiver = new BroadcastReceiver(){
|
||||
|
||||
public void onReceive(Context object, Intent intent) {
|
||||
|
||||
for (SynergyNetworkConnection m_pendingRequest : SynergyNetworkImpl.this.m_pendingRequests)
|
||||
if (intent.getStringExtra("result").equals("0"))
|
||||
m_pendingRequest.errorPriorToSend(new Error(Error.Code.SYNERGY_ENVIRONMENT_UPDATE_FAILURE, "Failed to retrieve Environment data from Synergy"));
|
||||
else
|
||||
m_pendingRequest.start();
|
||||
|
||||
SynergyNetworkImpl.this.m_pendingRequests.clear();
|
||||
}
|
||||
};
|
||||
Utility.registerReceiver("nimble.environment.notification.startup_requests_finished", this.m_synergyEnvironmentNotifyReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resume() {
|
||||
this.m_sessionId = this.generateSessionId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionHandle sendGetRequest(String string2, String object, Map<String, String> map, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
SynergyRequest synergyRequest = new SynergyRequest(object, IHttpRequest.Method.GET, null);
|
||||
synergyRequest.baseUrl = string2;
|
||||
synergyRequest.urlParameters = map;
|
||||
return this.sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionHandle sendPostRequest(String string2, String object, Map<String, String> map, Map<String, Object> map2, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback) {
|
||||
SynergyRequest synergyRequest = new SynergyRequest(object, IHttpRequest.Method.POST, null);
|
||||
synergyRequest.baseUrl = string2;
|
||||
synergyRequest.urlParameters = map;
|
||||
synergyRequest.jsonData = map2;
|
||||
return this.sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SynergyNetworkConnectionHandle sendPostRequest(String string2, String object, Map<String, String> map, Map<String, Object> map2, SynergyNetworkConnectionCallback synergyNetworkConnectionCallback, Map<String, String> map3) {
|
||||
SynergyRequest synergyRequest = new SynergyRequest((String) object, IHttpRequest.Method.POST, null);
|
||||
synergyRequest.baseUrl = string2;
|
||||
synergyRequest.urlParameters = map;
|
||||
synergyRequest.jsonData = map2;
|
||||
if (map3 == null) return this.sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
|
||||
synergyRequest.httpRequest.headers.putAll(map3);
|
||||
return this.sendSynergyRequest(synergyRequest, synergyNetworkConnectionCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRequest(SynergyRequest object, SynergyNetworkConnectionCallback object2) {
|
||||
ISynergyEnvironment iSynergyEnvironment = SynergyEnvironment.getComponent();
|
||||
if (iSynergyEnvironment.isDataAvailable()) {
|
||||
this.sendSynergyRequest(object, object2);
|
||||
return;
|
||||
}
|
||||
SynergyNetworkConnection synergyNetworkConnection = new SynergyNetworkConnection(object, object2);
|
||||
if (iSynergyEnvironment.isUpdateInProgress()) {
|
||||
this.m_pendingRequests.add(synergyNetworkConnection);
|
||||
return;
|
||||
}
|
||||
Error error = iSynergyEnvironment.checkAndInitiateSynergyEnvironmentUpdate();
|
||||
if (error == null) {
|
||||
this.m_pendingRequests.add(synergyNetworkConnection);
|
||||
return;
|
||||
}
|
||||
synergyNetworkConnection.errorPriorToSend((Exception)object2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
this.m_pendingRequests = new ArrayList();
|
||||
this.m_sessionId = this.generateSessionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class SynergyRequest
|
||||
implements ISynergyRequest {
|
||||
public String api;
|
||||
public String baseUrl;
|
||||
public HttpRequest httpRequest;
|
||||
public Map<String, Object> jsonData;
|
||||
private SynergyNetworkConnection m_connection;
|
||||
public SynergyRequestPreparingCallback prepareRequestCallback;
|
||||
public Map<String, String> urlParameters;
|
||||
|
||||
public SynergyRequest(String string2, IHttpRequest.Method method, SynergyRequestPreparingCallback synergyRequestPreparingCallback) {
|
||||
this.api = string2;
|
||||
this.httpRequest = new HttpRequest();
|
||||
this.prepareRequestCallback = synergyRequestPreparingCallback;
|
||||
this.urlParameters = null;
|
||||
this.jsonData = null;
|
||||
this.httpRequest.method = method;
|
||||
this.httpRequest.headers.put("Content-Type", "application/json");
|
||||
this.httpRequest.headers.put("SDK-VERSION", "1.23.14.1217");
|
||||
this.httpRequest.headers.put("SDK-TYPE", "Nimble");
|
||||
this.httpRequest.headers.put("EAM-USER-ID", SynergyIdManager.getComponent().getSynergyId());
|
||||
this.httpRequest.headers.put("EA-SELL-ID", SynergyEnvironment.getComponent().getSellId());
|
||||
this.httpRequest.headers.put("EAM-SESSION", ((SynergyNetworkImpl)SynergyNetwork.getComponent()).getSessionId());
|
||||
}
|
||||
|
||||
void build() throws Error {
|
||||
if (!Utility.validString(this.baseUrl) || !Utility.validString(this.api)) {
|
||||
throw new Error(Error.Code.INVALID_ARGUMENT, String.format("Invalid synergy request parameter (%s, %s) to build http request url", this.baseUrl, this.api));
|
||||
}
|
||||
IApplicationEnvironment object = ApplicationEnvironment.getComponent();
|
||||
HashMap<String, String> object2 = new HashMap<String, String>();
|
||||
object2.put("appVer", object.getApplicationVersion());
|
||||
object2.put("appLang", object.getShortApplicationLanguageCode());
|
||||
object2.put("localization", object.getApplicationLanguageCode());
|
||||
object2.put("deviceLanguage", Locale.getDefault().getLanguage());
|
||||
object2.put("deviceLocale", Locale.getDefault().toString());
|
||||
String eaHardwareId = SynergyEnvironment.getComponent().getEAHardwareId();
|
||||
if (Utility.validString(eaHardwareId)) {
|
||||
object2.put("hwId", eaHardwareId);
|
||||
}
|
||||
if (this.urlParameters != null) {
|
||||
object2.putAll(this.urlParameters);
|
||||
}
|
||||
this.httpRequest.url = Network.generateURL(this.baseUrl + this.api, object2);
|
||||
if (this.httpRequest.method != IHttpRequest.Method.POST) {
|
||||
if (this.httpRequest.method != IHttpRequest.Method.PUT) return;
|
||||
}
|
||||
if (this.jsonData == null) return;
|
||||
if (this.jsonData.size() <= 0) return;
|
||||
String s = Utility.convertObjectToJSONString(this.jsonData);
|
||||
this.httpRequest.data = new ByteArrayOutputStream();
|
||||
try {
|
||||
this.httpRequest.data.write(s.getBytes());
|
||||
}
|
||||
catch (IOException iOException) {
|
||||
throw new Error(Error.Code.INVALID_ARGUMENT, "Error converting jsonData in SynergyRequest to a data stream", iOException);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApi() {
|
||||
return this.api;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpRequest getHttpRequest() {
|
||||
return this.httpRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getJsonData() {
|
||||
return this.jsonData;
|
||||
}
|
||||
|
||||
public IHttpRequest.Method getMethod() {
|
||||
return this.httpRequest.getMethod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getUrlParameters() {
|
||||
return this.urlParameters;
|
||||
}
|
||||
|
||||
void prepare(SynergyNetworkConnection synergyNetworkConnection) {
|
||||
this.m_connection = synergyNetworkConnection;
|
||||
if (this.prepareRequestCallback != null) {
|
||||
this.prepareRequestCallback.prepareRequest(this);
|
||||
return;
|
||||
}
|
||||
this.send();
|
||||
}
|
||||
|
||||
public void send() {
|
||||
this.m_connection.send();
|
||||
}
|
||||
|
||||
public void setMethod(IHttpRequest.Method method) {
|
||||
this.httpRequest.method = method;
|
||||
}
|
||||
|
||||
public static interface SynergyRequestPreparingCallback {
|
||||
public void prepareRequest(SynergyRequest var1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* org.json.JSONObject
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
import com.ea.nimble.IHttpResponse;
|
||||
import com.ea.nimble.ISynergyResponse;
|
||||
import com.ea.nimble.SynergyServerError;
|
||||
import com.ea.nimble.Utility;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class SynergyResponse
|
||||
implements ISynergyResponse {
|
||||
public Error error = null;
|
||||
public IHttpResponse httpResponse = null;
|
||||
public Map<String, Object> jsonData = null;
|
||||
|
||||
@Override
|
||||
public Exception getError() {
|
||||
if (this.error != null) return this.error;
|
||||
if (this.httpResponse != null) return this.httpResponse.getError();
|
||||
return this.error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHttpResponse getHttpResponse() {
|
||||
return this.httpResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getJsonData() {
|
||||
return this.jsonData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompleted() {
|
||||
if (this.httpResponse != null) return this.httpResponse.isCompleted();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void parseData() {
|
||||
if (this.jsonData != null) {
|
||||
return;
|
||||
}
|
||||
if (this.httpResponse != null && this.httpResponse.getError() == null) {
|
||||
String string2 = "<empty>";
|
||||
try {
|
||||
String string3;
|
||||
string2 = string3 = Utility.readStringFromStream(this.httpResponse.getDataStream());
|
||||
this.jsonData = Utility.convertJSONObjectToMap(new JSONObject(string3));
|
||||
if (!this.jsonData.containsKey("resultCode")) return;
|
||||
int n2 = (Integer)this.jsonData.get("resultCode");
|
||||
if (n2 >= 0) return;
|
||||
this.error = new SynergyServerError(n2, (String)this.jsonData.get("message"));
|
||||
return;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.jsonData = null;
|
||||
this.error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Unparseable synergy json response " + string2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.jsonData = null;
|
||||
this.error = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
|
||||
public class SynergyServerError
|
||||
extends Error {
|
||||
public static final String ERROR_DOMAIN = "SynergyServerError";
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SynergyServerError() {
|
||||
}
|
||||
|
||||
public SynergyServerError(int n2, String string2) {
|
||||
super(ERROR_DOMAIN, n2, string2, null);
|
||||
}
|
||||
|
||||
public SynergyServerError(int n2, String string2, Throwable throwable) {
|
||||
super(ERROR_DOMAIN, n2, string2, throwable);
|
||||
}
|
||||
|
||||
public boolean isError(int n2) {
|
||||
if (this.getCode() != n2) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum Code {
|
||||
ERROR_NONCE_VERIFICATION(-30013),
|
||||
ERROR_SIGNATURE_VERIFICATION(-30014),
|
||||
ERROR_NOT_SUPPORTED_RECEIPT_TYPE(-30015),
|
||||
AMAZON_SERVER_CONNECTION_ERROR(-30016),
|
||||
APPLE_SERVER_CONNECTION_ERROR(10001);
|
||||
|
||||
private int m_value;
|
||||
|
||||
private Code(int n3) {
|
||||
this.m_value = n3;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return this.m_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.os.Handler
|
||||
* android.os.Looper
|
||||
* android.os.SystemClock
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import com.ea.nimble.Log;
|
||||
|
||||
public class Timer {
|
||||
private static Handler s_handler = new Handler(Looper.getMainLooper());
|
||||
private long m_fireTime;
|
||||
private long m_pauseTime;
|
||||
private boolean m_paused;
|
||||
private boolean m_running;
|
||||
private Runnable m_task;
|
||||
private Runnable m_taskToRun;
|
||||
private long m_timeInterval;
|
||||
|
||||
public Timer(Runnable runnable) {
|
||||
this.m_task = runnable;
|
||||
this.m_running = false;
|
||||
this.m_paused = false;
|
||||
}
|
||||
|
||||
static /* synthetic */ boolean access$102(Timer timer, boolean bl2) {
|
||||
timer.m_running = bl2;
|
||||
return bl2;
|
||||
}
|
||||
|
||||
static /* synthetic */ long access$302(Timer timer, long l2) {
|
||||
timer.m_fireTime = l2;
|
||||
return l2;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
if (!this.m_running) return;
|
||||
if (!this.m_paused) {
|
||||
s_handler.removeCallbacks(this.m_taskToRun);
|
||||
}
|
||||
this.m_running = false;
|
||||
}
|
||||
|
||||
public void fire() {
|
||||
this.cancel();
|
||||
this.m_task.run();
|
||||
if (!(this.m_taskToRun instanceof RepeatingTask)) return;
|
||||
if (this.m_paused) {
|
||||
this.m_fireTime = this.m_pauseTime + this.m_timeInterval;
|
||||
return;
|
||||
}
|
||||
this.m_fireTime = SystemClock.uptimeMillis() + this.m_timeInterval;
|
||||
s_handler.postDelayed(this.m_taskToRun, this.m_timeInterval);
|
||||
this.m_running = true;
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return this.m_paused;
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return this.m_running;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
if (this.m_paused) return;
|
||||
if (!this.m_running) return;
|
||||
this.m_pauseTime = SystemClock.uptimeMillis();
|
||||
s_handler.removeCallbacks(this.m_taskToRun);
|
||||
this.m_paused = true;
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
if (!this.m_paused) return;
|
||||
if (!this.m_running) return;
|
||||
this.m_fireTime += SystemClock.uptimeMillis() - this.m_pauseTime;
|
||||
s_handler.postAtTime(this.m_taskToRun, this.m_fireTime);
|
||||
this.m_paused = false;
|
||||
}
|
||||
|
||||
public void schedule(double d2, boolean bl2) {
|
||||
this.cancel();
|
||||
if (d2 < 0.1) {
|
||||
if (bl2) {
|
||||
Log.Helper.LOGES(null, "Timer scheduled to repeat for %.2f seconds, running only once", d2);
|
||||
}
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
this.m_task.run();
|
||||
return;
|
||||
}
|
||||
s_handler.post(this.m_task);
|
||||
return;
|
||||
}
|
||||
this.m_timeInterval = (long)(1000.0 * d2);
|
||||
this.m_fireTime = SystemClock.uptimeMillis() + this.m_timeInterval;
|
||||
this.m_taskToRun = bl2 ? new RepeatingTask() : new SingleRunTask();
|
||||
s_handler.postDelayed(this.m_taskToRun, this.m_timeInterval);
|
||||
this.m_running = true;
|
||||
}
|
||||
|
||||
private class RepeatingTask
|
||||
implements Runnable {
|
||||
private RepeatingTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (Timer.this.m_paused) return;
|
||||
if (!Timer.this.m_running) return;
|
||||
Timer.this.m_task.run();
|
||||
Timer.access$302(Timer.this, SystemClock.uptimeMillis() + Timer.this.m_fireTime);
|
||||
s_handler.postDelayed((Runnable)this, Timer.this.m_timeInterval);
|
||||
}
|
||||
}
|
||||
|
||||
private class SingleRunTask
|
||||
implements Runnable {
|
||||
private SingleRunTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (Timer.this.m_paused) return;
|
||||
if (!Timer.this.m_running) return;
|
||||
Timer.access$102(Timer.this, false);
|
||||
Timer.this.m_task.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.BroadcastReceiver
|
||||
* android.content.Context
|
||||
* android.content.Intent
|
||||
* android.content.IntentFilter
|
||||
* android.support.v4.content.LocalBroadcastManager
|
||||
* org.json.JSONArray
|
||||
* org.json.JSONException
|
||||
* org.json.JSONObject
|
||||
*/
|
||||
package com.ea.nimble;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
public final class Utility {
|
||||
private Utility() {
|
||||
}
|
||||
|
||||
public static String SHA256HashString(String object) {
|
||||
MessageDigest object2;
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
object2 = MessageDigest.getInstance("SHA-256");
|
||||
object2.reset();
|
||||
}
|
||||
catch (NoSuchAlgorithmException noSuchAlgorithmException) {
|
||||
Log.Helper.LOGES(null, "Can't find SHA-256 algorithm");
|
||||
return null;
|
||||
}
|
||||
byte[] digest = object2.digest(object.getBytes());
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n2 = 0;
|
||||
|
||||
while (n2 < digest.length) {
|
||||
stringBuffer.append(Integer.toString((digest[n2] & 0xFF) + 256, 16).substring(1));
|
||||
++n2;
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String bytesToHexString(byte[] byArray) {
|
||||
char[] cArray = "0123456789ABCDEF".toCharArray();
|
||||
char[] cArray2 = new char[byArray.length * 2];
|
||||
int n2 = 0;
|
||||
while (n2 < byArray.length) {
|
||||
int n3 = byArray[n2] & 0xFF;
|
||||
cArray2[n2 * 2] = cArray[n3 >> 4];
|
||||
cArray2[n2 * 2 + 1] = cArray[n3 & 0xF];
|
||||
++n2;
|
||||
}
|
||||
return new String(cArray2);
|
||||
}
|
||||
|
||||
public static List<Object> convertJSONArrayToList(JSONArray jSONArray) {
|
||||
ArrayList<Object> arrayList = new ArrayList<>();
|
||||
if (jSONArray != null)
|
||||
for (int i=0;i<jSONArray.length();i++)
|
||||
try {
|
||||
arrayList.add(jSONArray.get(i));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static Map<String, Object> convertJSONObjectStringToMap(String object) {
|
||||
try {
|
||||
return Utility.convertJSONObjectToMap(new JSONObject(object));
|
||||
}
|
||||
catch (JSONException jSONException) {
|
||||
jSONException.printStackTrace();
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, Object> convertJSONObjectToMap(JSONObject jSONObject) {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Iterator<String> keys = jSONObject.keys();
|
||||
while(keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
Object value = null;
|
||||
try {
|
||||
value = jSONObject.get(key);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
if (value instanceof JSONArray) {
|
||||
value = convertJSONArrayToList((JSONArray) value);
|
||||
} else if (value instanceof JSONObject) {
|
||||
value = convertJSONObjectToMap((JSONObject) value);
|
||||
}
|
||||
map.put(key, value);
|
||||
} return map;
|
||||
}
|
||||
|
||||
public static String convertObjectToJSONString(Object object) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static boolean getTestResult() {
|
||||
if (5 + 5 != 10) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String getUTCDateStringFormat(Date date) {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
|
||||
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
return simpleDateFormat.format(date);
|
||||
}
|
||||
|
||||
public static boolean isOnlyDecimalCharacters(String string2) {
|
||||
if (string2 == null) {
|
||||
return false;
|
||||
}
|
||||
int n2 = 0;
|
||||
while (n2 < string2.length()) {
|
||||
if (!Character.isDigit(string2.charAt(n2))) return false;
|
||||
++n2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled unnecessary exception pruning
|
||||
*/
|
||||
public static LinkedHashMap parseXmlFile(int i) {
|
||||
XmlResourceParser xmlResourceParser = null;
|
||||
LinkedHashMap linkedHashMap;
|
||||
try {
|
||||
xmlResourceParser = null;
|
||||
XmlResourceParser xmlResourceParser2 = null;
|
||||
try {
|
||||
XmlResourceParser xml = ApplicationEnvironment.getComponent().getApplicationContext().getResources().getXml(i);
|
||||
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
|
||||
String str = null;
|
||||
int eventType = xml.getEventType();
|
||||
while (eventType != 1) {
|
||||
if (eventType == 2) {
|
||||
str = xml.getName();
|
||||
} else {
|
||||
str = str;
|
||||
if (eventType == 4) {
|
||||
linkedHashMap2.put(str, xml.getText());
|
||||
str = str;
|
||||
}
|
||||
}
|
||||
eventType = xml.next();
|
||||
}
|
||||
xmlResourceParser2 = xml;
|
||||
xmlResourceParser = xml;
|
||||
xml.close();
|
||||
linkedHashMap = linkedHashMap2;
|
||||
xml.close();
|
||||
return linkedHashMap2;
|
||||
} catch (Exception e) {
|
||||
Log.Helper.LOGES(null, "Error reading xml file: " + e.toString());
|
||||
if (xmlResourceParser2 != null) {
|
||||
xmlResourceParser2.close();
|
||||
}
|
||||
linkedHashMap = null;
|
||||
}
|
||||
return linkedHashMap;
|
||||
} catch (Throwable th) {
|
||||
if (xmlResourceParser != null) {
|
||||
xmlResourceParser.close();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public static String readStringFromStream(InputStream closeable) throws IOException {
|
||||
int n2;
|
||||
byte[] cArray = new byte[8192];
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
while ((n2 = closeable.read(cArray, 0, 4096)) > 0) {
|
||||
stringWriter.write(Arrays.toString(cArray), 0, n2);
|
||||
}
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
public static void registerReceiver(String string2, BroadcastReceiver broadcastReceiver) {
|
||||
IntentFilter intentFilter = new IntentFilter(string2);
|
||||
LocalBroadcastManager
|
||||
.getInstance(
|
||||
ApplicationEnvironment
|
||||
.getComponent()
|
||||
.getApplicationContext()
|
||||
)
|
||||
.registerReceiver(broadcastReceiver, intentFilter);
|
||||
}
|
||||
|
||||
public static String safeString(String string2) {
|
||||
String string3 = string2;
|
||||
if (string2 != null) return string3;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void sendBroadcast(String string2, Map<String, String> map) {
|
||||
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
|
||||
Intent intent = new Intent(string2);
|
||||
if (map != null) {
|
||||
for (String string3 : map.keySet()) {
|
||||
intent.putExtra(string3, map.get(string3));
|
||||
}
|
||||
}
|
||||
localBroadcastManager.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public static void sendBroadcastSerializable(String string2, Map<String, Serializable> map) {
|
||||
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext());
|
||||
Intent intent = new Intent(string2);
|
||||
if (map != null) {
|
||||
for (String string3 : map.keySet()) {
|
||||
intent.putExtra(string3, map.get(string3));
|
||||
}
|
||||
}
|
||||
localBroadcastManager.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public static boolean stringsAreEquivalent(String string2, String string3) {
|
||||
if (string2 != null && string3 != null) {
|
||||
return string2.compareTo(string3) == 0;
|
||||
}
|
||||
if (string2 == string3) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void unregisterReceiver(BroadcastReceiver broadcastReceiver) {
|
||||
LocalBroadcastManager.getInstance(ApplicationEnvironment.getComponent().getApplicationContext()).unregisterReceiver(broadcastReceiver);
|
||||
}
|
||||
|
||||
public static boolean validString(String string2) {
|
||||
if (string2 == null) return false;
|
||||
if (string2.length() <= 0) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* android.content.BroadcastReceiver
|
||||
* android.content.Context
|
||||
* android.content.Intent
|
||||
* android.os.Bundle
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import com.ea.nimble.NetworkConnectionCallback;
|
||||
import com.ea.nimble.NetworkConnectionHandle;
|
||||
import com.ea.nimble.SynergyNetworkConnectionCallback;
|
||||
import com.ea.nimble.SynergyNetworkConnectionHandle;
|
||||
import com.ea.nimble.SynergyRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BaseNativeCallback
|
||||
extends BroadcastReceiver
|
||||
implements NetworkConnectionCallback,
|
||||
SynergyNetworkConnectionCallback,
|
||||
SynergyRequest.SynergyRequestPreparingCallback {
|
||||
private int m_id;
|
||||
|
||||
public BaseNativeCallback(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public static native void nativeCallback(int var0, Object ... var1);
|
||||
|
||||
public static native void nativeFinalize(int var0);
|
||||
|
||||
@Override
|
||||
public void callback(NetworkConnectionHandle networkConnectionHandle) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, networkConnectionHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, synergyNetworkConnectionHandle);
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
public void onReceive(Context object, Intent intent) {
|
||||
Map<String, Object> hashMap = new HashMap<>();
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle != null) {
|
||||
for (String string2 : bundle.keySet()) {
|
||||
hashMap.put(string2, bundle.get(string2));
|
||||
}
|
||||
}
|
||||
BaseNativeCallback.nativeCallback(this.m_id, intent.getAction(), hashMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareRequest(SynergyRequest synergyRequest) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, synergyRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.IFacebook;
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
|
||||
public class FacebookNativeCallback
|
||||
implements IFacebook.FacebookCallback {
|
||||
private int m_id;
|
||||
|
||||
public FacebookNativeCallback(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callback(IFacebook iFacebook, boolean bl2, Exception exception) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iFacebook, bl2, exception);
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
import com.ea.nimble.friends.INimbleOriginFriendsService;
|
||||
import com.ea.nimble.friends.NimbleFriendsList;
|
||||
import com.ea.nimble.friends.NimbleFriendsRefreshCallback;
|
||||
import com.ea.nimble.friends.NimbleFriendsRefreshResult;
|
||||
import com.ea.nimble.friends.NimbleFriendsRefreshScope;
|
||||
import com.ea.nimble.friends.NimbleUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FriendsNativeCallback
|
||||
implements INimbleOriginFriendsService.NimbleFriendInvitationCallback,
|
||||
INimbleOriginFriendsService.NimbleUserSearchCallback,
|
||||
NimbleFriendsRefreshCallback {
|
||||
private int m_id;
|
||||
|
||||
public FriendsNativeCallback(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(NimbleFriendsList nimbleFriendsList, NimbleFriendsRefreshScope nimbleFriendsRefreshScope, NimbleFriendsRefreshResult nimbleFriendsRefreshResult) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, nimbleFriendsList, nimbleFriendsRefreshScope, nimbleFriendsRefreshResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(ArrayList<NimbleUser> arrayList, Error error) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, arrayList, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(boolean bl2, Error error) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, bl2, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
import com.ea.nimble.identity.INimbleIdentityGenericAuthenticationConductor;
|
||||
import com.ea.nimble.identity.INimbleIdentityGenericLoginResolver;
|
||||
import com.ea.nimble.identity.INimbleIdentityGenericLogoutResolver;
|
||||
|
||||
public class IdentityGenericAuthenticationConductor
|
||||
implements INimbleIdentityGenericAuthenticationConductor {
|
||||
private int m_id;
|
||||
|
||||
public IdentityGenericAuthenticationConductor(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogin(INimbleIdentityGenericLoginResolver iNimbleIdentityGenericLoginResolver) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityGenericLoginResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogout(INimbleIdentityGenericLogoutResolver iNimbleIdentityGenericLogoutResolver) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityGenericLogoutResolver, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
import com.ea.nimble.identity.INimbleIdentityMigrationAuthenticationConductor;
|
||||
import com.ea.nimble.identity.INimbleIdentityMigrationLoginResolver;
|
||||
import com.ea.nimble.identity.INimbleIdentityPendingMigrationResolver;
|
||||
|
||||
public class IdentityMigrationAuthenticationConductor
|
||||
implements INimbleIdentityMigrationAuthenticationConductor {
|
||||
private int m_id;
|
||||
|
||||
public IdentityMigrationAuthenticationConductor(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogin(INimbleIdentityMigrationLoginResolver iNimbleIdentityMigrationLoginResolver) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityMigrationLoginResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogout() {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, new Object[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePendingMigration(INimbleIdentityPendingMigrationResolver iNimbleIdentityPendingMigrationResolver) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityPendingMigrationResolver, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* org.json.JSONObject
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.Error;
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
import com.ea.nimble.identity.INimbleIdentityAuthenticator;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class IdentityNativeCallback
|
||||
implements INimbleIdentityAuthenticator.NimbleIdentityAuthenticatorCallback,
|
||||
INimbleIdentityAuthenticator.NimbleIdentityFriendsIdentityInfoCallback,
|
||||
INimbleIdentityAuthenticator.NimbleIdentityServerAuthCodeCallback {
|
||||
private int m_id;
|
||||
|
||||
public IdentityNativeCallback(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, Error error) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityAuthenticator, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, String string2, String string3, String string4, Error error) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityAuthenticator, string2, string3, string4, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallback(INimbleIdentityAuthenticator iNimbleIdentityAuthenticator, JSONObject jSONObject, Error error) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, iNimbleIdentityAuthenticator, jSONObject, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
import com.ea.nimble.identity.INimbleIdentityPlainAuthenticationConductor;
|
||||
|
||||
public class IdentityPlainAuthenticationConductor
|
||||
implements INimbleIdentityPlainAuthenticationConductor {
|
||||
private int m_id;
|
||||
|
||||
public IdentityPlainAuthenticationConductor(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogin() {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, new Object[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleLogout() {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, new Object[]{null});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.ea.nimble.bridge;
|
||||
|
||||
import com.ea.nimble.bridge.BaseNativeCallback;
|
||||
import com.ea.nimble.mtx.INimbleMTX;
|
||||
import com.ea.nimble.mtx.NimbleMTXTransaction;
|
||||
|
||||
public class MTXNativeCallback
|
||||
implements INimbleMTX.FinalizeTransactionCallback,
|
||||
INimbleMTX.ItemGrantedCallback,
|
||||
INimbleMTX.PurchaseTransactionCallback {
|
||||
private int m_id;
|
||||
|
||||
public MTXNativeCallback(int n2) {
|
||||
this.m_id = n2;
|
||||
}
|
||||
|
||||
public void finalize() {
|
||||
BaseNativeCallback.nativeFinalize(this.m_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeComplete(NimbleMTXTransaction nimbleMTXTransaction) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, nimbleMTXTransaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void itemGrantedComplete(NimbleMTXTransaction nimbleMTXTransaction) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, nimbleMTXTransaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purchaseComplete(NimbleMTXTransaction nimbleMTXTransaction) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, nimbleMTXTransaction, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unverifiedReceiptReceived(NimbleMTXTransaction nimbleMTXTransaction) {
|
||||
BaseNativeCallback.nativeCallback(this.m_id, nimbleMTXTransaction, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.ea.nimble.friends;
|
||||
|
||||
/* loaded from: stdlib.jar:com/ea/nimble/friends/INimbleFriends.class */
|
||||
public interface INimbleFriends {
|
||||
public static final int IDENTITY_FRIEND_INFO_REQUEST_LIMIT = 20;
|
||||
public static final String NIMBLE_NOTIFICATION_FRIENDS_LIST_UPDATE = "nimble.notification.friends.update";
|
||||
|
||||
NimbleFriendsList getFriendsList(String str, boolean z);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user