正在查看: 管控平台 v5.2.3.0. 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 c.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.sunflower;
import android.content.Context;
import android.content.SharedPreferences;
import com.iflytek.sunflower.config.DataKeys;
import com.iflytek.sunflower.util.j;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import net.sqlcipher.BuildConfig;
import org.json.JSONException;
import org.json.JSONObject;
public class c {
public static SharedPreferences a(Context context) {
return context.getSharedPreferences("iflytek_state_" + context.getPackageName(), 0);
}
public static SharedPreferences b(Context context) {
return context.getSharedPreferences("iflytek_online_" + context.getPackageName(), 0);
}
public static String c(Context context) {
return "iflytek_cached_" + context.getPackageName();
}
public static String d(Context context) {
return "iflytek_log_" + context.getPackageName();
}
public static synchronized JSONObject e(Context context) {
synchronized (c.class) {
String c2 = c(context);
try {
try {
File file = new File(context.getFilesDir(), c2);
if (a(context, file)) {
file.delete();
j.b("Collector", "delete local file which beyond 2MB");
return null;
}
FileInputStream openFileInput = context.openFileInput(c2);
try {
InputStreamReader inputStreamReader = new InputStreamReader(openFileInput);
char[] cArr = new char[1024];
StringWriter stringWriter = new StringWriter();
while (true) {
int read = inputStreamReader.read(cArr);
if (-1 == read) {
break;
}
stringWriter.write(cArr, 0, read);
}
String stringWriter2 = stringWriter.toString();
openFileInput.close();
JSONObject jSONObject = new JSONObject(stringWriter2);
if (jSONObject.length() == 0) {
return null;
}
return jSONObject;
} catch (Throwable th) {
try {
j.d("Collector", "read from local file error. ", th);
return null;
} finally {
openFileInput.close();
}
}
} catch (FileNotFoundException unused) {
return null;
} catch (IOException e) {
j.d("Collector", "read file occured exception", e);
return null;
}
} catch (JSONException e2) {
g(context);
j.d("Collector", "local JSONObject error.", e2);
return null;
} catch (Throwable unused2) {
return null;
}
}
}
public static synchronized String f(Context context) {
synchronized (c.class) {
String d = d(context);
try {
File file = new File(context.getFilesDir(), d);
if (a(context, file)) {
file.delete();
j.b("Collector", "delete local file which beyond 2MB");
return null;
}
FileInputStream openFileInput = context.openFileInput(d);
try {
InputStreamReader inputStreamReader = new InputStreamReader(openFileInput);
char[] cArr = new char[1024];
StringWriter stringWriter = new StringWriter();
while (true) {
int read = inputStreamReader.read(cArr);
if (-1 == read) {
return stringWriter.toString();
}
stringWriter.write(cArr, 0, read);
}
} catch (Throwable th) {
try {
j.d("Collector", "read from local file error. ", th);
return null;
} finally {
openFileInput.close();
}
}
} catch (FileNotFoundException unused) {
return null;
} catch (IOException e) {
j.d("Collector", "read file occured exception", e);
return null;
} catch (Exception unused2) {
return null;
}
}
}
public static void g(Context context) {
context.deleteFile(c(context));
}
public static long a(Context context, String str) {
File file = new File(context.getFilesDir(), str);
if (file.exists()) {
return file.length();
}
return 0L;
}
private static boolean a(Context context, File file) {
long j;
long length = file.length();
try {
j = b(context).getInt(DataKeys.LOCAL_FILE_SIZE, 2) * 1024 * 1024;
} catch (Exception unused) {
j.c("Collector", "get online log_size failed");
j = 2097152;
}
return file.exists() && length > j;
}
public static synchronized void a(Context context, String str, String str2, int i) {
synchronized (c.class) {
if (str != null) {
if (!str.equals(BuildConfig.FLAVOR)) {
try {
String c2 = c(context);
if (str2 == null) {
str2 = c2;
}
if (i == 0) {
i = 0;
}
FileOutputStream openFileOutput = context.openFileOutput(str2, i);
openFileOutput.write(str.getBytes());
openFileOutput.flush();
openFileOutput.close();
j.a("Collector", "write to file success");
} catch (IOException unused) {
j.d("Collector", "write to file error.");
}
}
}
}
}
public static void a(Context context, String str, Long l) {
SharedPreferences.Editor edit = a(context).edit();
edit.putLong(str, l.longValue());
edit.commit();
}
}