OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 ProcessUtil.java 源代码,内容仅作参考
package com.excelliance.kxqp.process;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Process;
import android.os.StatFs;
import android.text.TextUtils;
import android.util.Log;
import com.excelliance.kxqp.GameUtilBuild;
import com.excelliance.kxqp.KXQPApplication;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.pay.util.HackUtil;
import com.excelliance.kxqp.sdk.staticslio.StaticSdk;
import com.tencent.connect.common.Constants;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import org.apache.http.cookie.ClientCookie;
public class ProcessUtil {
public static String f12807a = "opvm.jar";
private static boolean f12808b = true;
private static String[] c = {".odex", ".dex"};
private static Application d;
private static native void checkParentDir(String str);
private static native void cleanUpdateFlag(Context context, int i);
public static native void copyFile(File file, File file2) throws Exception;
public static native void enableManifestComponent(Context context, String str, boolean z);
public static native String getAppRootDir(Context context);
public static native Application getApplicationProxyInstance();
private static native String getCurProcessName(Context context);
public static native String getUserDataPath(Context context);
private static native int killRunningServiceProcess(Context context);
public static native boolean needDel(String str);
public static boolean a(Context context, int i, boolean z) {
boolean z2;
String str;
az.d("ProcessUtil", String.format("ProcessUtil/loadPlatform:thread(%s) type(%s) extract(%s)", Thread.currentThread().getName(), Integer.valueOf(i), Boolean.valueOf(z)));
ClassLoader classLoader = KXQPApplication.class.getClassLoader();
String str2 = f12807a;
String str3 = "tmp/vm";
GameUtilBuild intance = GameUtilBuild.getIntance();
intance.setContext(context);
switch (i) {
case 0:
case 2:
str3 = "tmp/main";
str2 = "main.jar";
z2 = intance.getMainVersion() < Integer.parseInt(intance.getCurrentMainVersion());
e(context);
cleanUpdateFlag(context, i);
break;
case 1:
str3 = "tmp/vm";
str2 = f12807a;
SharedPreferences sharedPreferences = context.getSharedPreferences(Constants.PARAM_PLATFORM, 4);
boolean z3 = intance.getCompVersion() < Integer.parseInt(intance.getCurrentCompVersion()) && Integer.parseInt(sharedPreferences.getString(ClientCookie.VERSION_ATTR, "-1")) < Integer.parseInt(intance.getCurrentCompVersion());
if (z) {
e(context);
}
cleanUpdateFlag(context, i);
int parseInt = Integer.parseInt(sharedPreferences.getString("update_info", "0"));
if (!f12808b || (parseInt & 4) == 0) {
z2 = z3;
break;
}
break;
default:
z2 = false;
break;
}
String str4 = getUserDataPath(context) + File.separatorChar + ".platformcache" + File.separatorChar + str2;
if (z2) {
String str5 = getUserDataPath(context) + File.separatorChar + ".platformcache" + File.separatorChar + str3 + File.separatorChar + str2;
if (!new File(str5).exists()) {
str5 = str4;
}
str4 = str5;
} else if (i == 0 || i == 2) {
return true;
}
File file = new File(str4);
if (file.exists()) {
String parent = file.getParent();
if (i == 1) {
str = parent + "/lib";
} else {
str = parent + "/lib_main";
}
String str6 = str;
File file2 = new File(str6);
if (!file2.exists() || !file2.isDirectory()) {
file2.mkdirs();
}
az.d("ProcessUtil", String.format("ProcessUtil/loadPlatform:thread(%s) add jarPath(%s) libDir(%s)", Thread.currentThread().getName(), str4, str6));
if (HackUtil.addJarToClassLoaderList(str4, parent, str6, classLoader, false, true) == null) {
classLoader = null;
}
return classLoader != null;
}
az.d(KXQPApplication.TAG, "load(" + str4 + ") not exist!");
return false;
}
private static void e(Context context) {
File file;
Throwable th;
boolean z;
File file2;
File file3;
File file4;
int parseInt;
File file5;
GameUtilBuild gameUtilBuild;
boolean z2;
int killRunningServiceProcess;
File file6;
boolean exists;
File file7;
File file8;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s)", Thread.currentThread().getName()));
String str = getUserDataPath(context) + File.separatorChar + ".platformcache";
if (!new File(str).exists()) {
new File(str).mkdirs();
}
File file9 = new File(str + File.separator + "dynamic_load");
checkParentDir(file9.getAbsolutePath());
com.excean.a.a.a.a().a(file9.getAbsolutePath());
try {
SharedPreferences sharedPreferences = context.getSharedPreferences("version_resource_modified_time", 4);
GameUtilBuild intance = GameUtilBuild.getIntance();
intance.setContext(context);
int platformType = GameUtilBuild.getPlatformType();
String str2 = str + File.separatorChar + f12807a;
SharedPreferences sharedPreferences2 = context.getSharedPreferences(Constants.PARAM_PLATFORM, 4);
int i = sharedPreferences2.getInt("ptype", -1);
if (i > 0 && platformType != i) {
try {
sharedPreferences2.edit().remove("ptype").remove(ClientCookie.VERSION_ATTR).remove("main_version").remove("share_version").remove("bd_version").commit();
} catch (Throwable th2) {
th = th2;
file = file9;
com.excean.a.a.a.a().b(file.getAbsolutePath());
throw th;
}
}
if (i < 0 || platformType != i) {
sharedPreferences2.edit().putInt("ptype", platformType).commit();
intance.saveCompVersionToFile(String.valueOf(intance.getCompVersion()));
intance.saveMainVersionToFile(String.valueOf(intance.getMainVersion()));
}
String string = sharedPreferences2.getString(ClientCookie.VERSION_ATTR, "-1");
String string2 = sharedPreferences2.getString("main_version", "-1");
int parseInt2 = Integer.parseInt(intance.getCurrentCompVersion());
int apkVersion = GameUtilBuild.getApkVersion(context, context.getPackageName());
long j = sharedPreferences.getLong(String.valueOf(apkVersion), 0L);
long lastModified = new File(context.getPackageResourcePath()).lastModified();
Object[] objArr = new Object[4];
objArr[0] = Thread.currentThread().getName();
objArr[1] = Integer.valueOf(apkVersion);
file = file9;
try {
objArr[2] = Long.valueOf(j);
objArr[3] = Long.valueOf(lastModified);
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) versionCode(%s) modifiedTimeCache(%s) lastModifiedTime(%s)", objArr));
if (j == 0) {
sharedPreferences.edit().clear().apply();
} else if (j == lastModified) {
z = false;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) needGenerateCoreJar according lastModifiedTime (%s)", Thread.currentThread().getName(), Boolean.valueOf(z)));
if (Integer.parseInt(string) >= intance.getCompVersion() && (!z || Integer.parseInt(string) > intance.getCompVersion())) {
if (Integer.parseInt(string) > intance.getCompVersion() && Integer.parseInt(string) > parseInt2) {
az.d("ProcessUtil", "ProcessUtil/extractSDK: pre version is newer version=" + string + ",getCompVersion = " + intance.getCompVersion() + ", version = " + string);
StringBuilder sb = new StringBuilder();
sb.append(getUserDataPath(context));
sb.append(File.separator);
sb.append(".platformcache/tmp/vm/lib_kxqpplatform");
file7 = new File(sb.toString());
if (file7.exists()) {
a(file7);
}
file8 = new File(getUserDataPath(context) + File.separator + ".platformcache/tmp/vm/" + f12807a);
if (file8.exists()) {
file8.delete();
}
}
parseInt = Integer.parseInt(intance.getCurrentMainVersion());
if (Integer.parseInt(string2) >= intance.getMainVersion() || z) {
file5 = new File(str + File.separatorChar + "main.jar");
if (file5.exists()) {
file5.delete();
}
}
sharedPreferences.edit().putLong(String.valueOf(apkVersion), lastModified).commit();
if (intance.getCompVersion() < parseInt2 && Integer.parseInt(string) < parseInt2) {
String appRootDir = getAppRootDir(context);
String str3 = getUserDataPath(context) + "/.platformcache/tmp/vm";
file6 = new File(str3);
if (file6.exists() || !file6.isDirectory()) {
file6.mkdirs();
}
File file10 = new File(str3 + "/" + f12807a);
exists = file10.exists();
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) platformFile(%s) exist(%s)", Thread.currentThread().getName(), file10.getAbsolutePath(), Boolean.valueOf(file10.exists())));
if (!exists) {
File file11 = new File(appRootDir + "apk/vm.zip");
if (!file11.exists()) {
file11 = new File(appRootDir + "apk/vm.zip.dload");
}
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) zipFile(%s) exist(%s)", Thread.currentThread().getName(), file11.getAbsolutePath(), Boolean.valueOf(file11.exists())));
if (file11.exists()) {
for (File file12 : file6.listFiles()) {
String absolutePath = file12.getAbsolutePath();
File file13 = new File(absolutePath);
if (file13.exists() && !file13.isDirectory() && needDel(absolutePath)) {
file13.delete();
}
}
try {
String str4 = getUserDataPath(context) + "/.platformcache/tmp/vm";
unZipFile(file11, str4 + "/");
String str5 = "chmod 755 " + str4 + "/" + f12807a;
Runtime runtime = Runtime.getRuntime();
try {
if (new File(str4 + "/" + f12807a).exists()) {
runtime.exec(str5);
}
String str6 = "chmod 755 " + str4 + "/libkxqpplatform.so";
if (new File(str4 + "/libkxqpplatform.so").exists()) {
runtime.exec(str6);
}
} catch (Exception e) {
e.printStackTrace();
}
File file14 = new File(str4 + "/libkxqpplatform.so");
if (file14.exists()) {
File file15 = new File(getUserDataPath(context) + "/.platformcache/libkxqpplatform.so");
if (file15.exists()) {
file15.delete();
}
copyFile(file14, file15);
}
String str7 = "chmod 755 " + getUserDataPath(context) + "/.platformcache/libkxqpplatform.so";
if (new File(getUserDataPath(context) + "/.platformcache/libkxqpplatform.so").exists()) {
runtime.exec(str7);
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
if (!new File(str3 + "/" + f12807a).exists()) {
gameUtilBuild = intance;
gameUtilBuild.saveCompVersionToFile(String.valueOf(intance.getCompVersion()));
if (gameUtilBuild.getMainVersion() < parseInt) {
String appRootDir2 = getAppRootDir(context);
String str8 = getUserDataPath(context) + File.separator + ".platformcache" + File.separator + GameUtilBuild.PLATFORM_DIR + File.separator + "main";
File file16 = new File(str8);
if (!file16.exists() || !file16.isDirectory()) {
file16.mkdirs();
}
if (!new File(str8 + "/main.jar").exists()) {
File file17 = new File(appRootDir2 + "apk/main.zip");
if (!file17.exists()) {
file17 = new File(appRootDir2 + "apk/main.zip.dload");
}
if (file17.exists()) {
for (File file18 : file16.listFiles()) {
String absolutePath2 = file18.getAbsolutePath();
File file19 = new File(absolutePath2);
if (file19.exists() && !file19.isDirectory() && needDel(absolutePath2)) {
file19.delete();
}
}
try {
String str9 = getUserDataPath(context) + "/.platformcache/tmp/main";
unZipFile(file17, str9 + "/");
String str10 = "chmod 755 " + str9 + "/main.jar";
Runtime runtime2 = Runtime.getRuntime();
if (new File(str9 + "/main.jar").exists()) {
runtime2.exec(str10);
}
} catch (Exception e3) {
e3.printStackTrace();
}
}
if (!new File(str8 + "/main.jar").exists()) {
gameUtilBuild.saveMainVersionToFile(String.valueOf(gameUtilBuild.getMainVersion()));
}
}
}
context.getAssets().open(f12807a);
z2 = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) hasjar(%s)", Thread.currentThread().getName(), Boolean.valueOf(z2)));
if (z2) {
loadFromAsset(context, str, gameUtilBuild, str2, sharedPreferences2);
} else {
a(context, str, gameUtilBuild, str2, sharedPreferences2);
}
com.excean.a.a.a.a().b(file.getAbsolutePath());
killRunningServiceProcess = killRunningServiceProcess(context);
if (killRunningServiceProcess > 0) {
Process.killProcess(killRunningServiceProcess);
return;
}
return;
}
}
}
gameUtilBuild = intance;
if (gameUtilBuild.getMainVersion() < parseInt) {
}
context.getAssets().open(f12807a);
z2 = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) hasjar(%s)", Thread.currentThread().getName(), Boolean.valueOf(z2)));
if (z2) {
}
com.excean.a.a.a.a().b(file.getAbsolutePath());
killRunningServiceProcess = killRunningServiceProcess(context);
if (killRunningServiceProcess > 0) {
}
}
file2 = new File(str2);
if (file2.exists()) {
file2.delete();
}
file3 = new File(getUserDataPath(context) + File.separator + ".platformcache/lib_kxqpplatform");
file4 = new File(getUserDataPath(context) + File.separator + ".platformcache/tmp/vm/lib_kxqpplatform");
if (file3.exists()) {
a(file3);
}
if (file4.exists()) {
a(file4);
}
parseInt = Integer.parseInt(intance.getCurrentMainVersion());
if (Integer.parseInt(string2) >= intance.getMainVersion()) {
}
file5 = new File(str + File.separatorChar + "main.jar");
if (file5.exists()) {
}
sharedPreferences.edit().putLong(String.valueOf(apkVersion), lastModified).commit();
if (intance.getCompVersion() < parseInt2) {
String appRootDir3 = getAppRootDir(context);
String str32 = getUserDataPath(context) + "/.platformcache/tmp/vm";
file6 = new File(str32);
if (file6.exists()) {
}
file6.mkdirs();
File file102 = new File(str32 + "/" + f12807a);
exists = file102.exists();
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) platformFile(%s) exist(%s)", Thread.currentThread().getName(), file102.getAbsolutePath(), Boolean.valueOf(file102.exists())));
if (!exists) {
}
}
gameUtilBuild = intance;
if (gameUtilBuild.getMainVersion() < parseInt) {
}
context.getAssets().open(f12807a);
z2 = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) hasjar(%s)", Thread.currentThread().getName(), Boolean.valueOf(z2)));
if (z2) {
}
com.excean.a.a.a.a().b(file.getAbsolutePath());
killRunningServiceProcess = killRunningServiceProcess(context);
if (killRunningServiceProcess > 0) {
}
}
z = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) needGenerateCoreJar according lastModifiedTime (%s)", Thread.currentThread().getName(), Boolean.valueOf(z)));
if (Integer.parseInt(string) >= intance.getCompVersion()) {
if (Integer.parseInt(string) > intance.getCompVersion()) {
az.d("ProcessUtil", "ProcessUtil/extractSDK: pre version is newer version=" + string + ",getCompVersion = " + intance.getCompVersion() + ", version = " + string);
StringBuilder sb2 = new StringBuilder();
sb2.append(getUserDataPath(context));
sb2.append(File.separator);
sb2.append(".platformcache/tmp/vm/lib_kxqpplatform");
file7 = new File(sb2.toString());
if (file7.exists()) {
}
file8 = new File(getUserDataPath(context) + File.separator + ".platformcache/tmp/vm/" + f12807a);
if (file8.exists()) {
}
}
parseInt = Integer.parseInt(intance.getCurrentMainVersion());
if (Integer.parseInt(string2) >= intance.getMainVersion()) {
}
file5 = new File(str + File.separatorChar + "main.jar");
if (file5.exists()) {
}
sharedPreferences.edit().putLong(String.valueOf(apkVersion), lastModified).commit();
if (intance.getCompVersion() < parseInt2) {
}
gameUtilBuild = intance;
if (gameUtilBuild.getMainVersion() < parseInt) {
}
context.getAssets().open(f12807a);
z2 = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) hasjar(%s)", Thread.currentThread().getName(), Boolean.valueOf(z2)));
if (z2) {
}
com.excean.a.a.a.a().b(file.getAbsolutePath());
killRunningServiceProcess = killRunningServiceProcess(context);
if (killRunningServiceProcess > 0) {
}
}
file2 = new File(str2);
if (file2.exists()) {
}
file3 = new File(getUserDataPath(context) + File.separator + ".platformcache/lib_kxqpplatform");
file4 = new File(getUserDataPath(context) + File.separator + ".platformcache/tmp/vm/lib_kxqpplatform");
if (file3.exists()) {
}
if (file4.exists()) {
}
parseInt = Integer.parseInt(intance.getCurrentMainVersion());
if (Integer.parseInt(string2) >= intance.getMainVersion()) {
}
file5 = new File(str + File.separatorChar + "main.jar");
if (file5.exists()) {
}
sharedPreferences.edit().putLong(String.valueOf(apkVersion), lastModified).commit();
if (intance.getCompVersion() < parseInt2) {
}
gameUtilBuild = intance;
if (gameUtilBuild.getMainVersion() < parseInt) {
}
context.getAssets().open(f12807a);
z2 = true;
az.d("ProcessUtil", String.format("ProcessUtil/extractSDK:thread(%s) hasjar(%s)", Thread.currentThread().getName(), Boolean.valueOf(z2)));
if (z2) {
}
com.excean.a.a.a.a().b(file.getAbsolutePath());
killRunningServiceProcess = killRunningServiceProcess(context);
if (killRunningServiceProcess > 0) {
}
} catch (Throwable th3) {
th = th3;
th = th;
com.excean.a.a.a.a().b(file.getAbsolutePath());
throw th;
}
} catch (Throwable th4) {
th = th4;
file = file9;
}
}
private static void a(File file) {
az.d("ProcessUtil", String.format("ProcessUtil/deleteDir:thread(%s) vmInternalFile(%s)", Thread.currentThread().getName(), file));
try {
org.apache.commons.b.b.d(file);
} catch (Throwable th) {
th.printStackTrace();
com.excelliance.kxqp.a.a.a(file.getAbsolutePath());
}
}
private static void loadFromAsset(Context context, String str, GameUtilBuild gameUtilBuild, String str2, SharedPreferences sharedPreferences) {
FileOutputStream fileOutputStream;
IOException e;
InputStream inputStream;
if (new File(str2).exists()) {
return;
}
try {
fileOutputStream = new FileOutputStream(str2);
try {
inputStream = context.getAssets().open(f12807a);
try {
byte[] bArr = new byte[1024];
for (int read = inputStream.read(bArr); read > 0; read = inputStream.read(bArr)) {
fileOutputStream.write(bArr, 0, read);
}
fileOutputStream.flush();
inputStream.close();
fileOutputStream.close();
try {
Runtime.getRuntime().exec("chmod 755 " + str2);
} catch (Exception e2) {
e2.printStackTrace();
}
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString(ClientCookie.VERSION_ATTR, String.valueOf(gameUtilBuild.getCompVersion()));
edit.commit();
} catch (IOException e3) {
e = e3;
e.printStackTrace();
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (Exception unused) {
return;
}
}
if (inputStream != null) {
inputStream.close();
}
}
} catch (IOException e4) {
e = e4;
inputStream = null;
}
} catch (IOException e5) {
fileOutputStream = null;
e = e5;
inputStream = null;
}
}
private static void a(Context context, String str, GameUtilBuild gameUtilBuild, String str2, SharedPreferences sharedPreferences) {
InputStream inputStream;
int i;
int i2;
int i3;
String str3 = str + File.separatorChar + "main.jar";
boolean exists = new File(str2).exists();
boolean exists2 = new File(str3).exists();
az.d("ProcessUtil", String.format("ProcessUtil/loadFromIconFile:thread(%s) vmPath(%s) vmExist(%s) mainJarPath(%s) mainJarExist(%s)", Thread.currentThread().getName(), str2, Boolean.valueOf(exists), str3, Boolean.valueOf(exists2)));
if (exists && exists2) {
return;
}
boolean z = Integer.parseInt(sharedPreferences.getString(ClientCookie.VERSION_ATTR, "-1")) <= gameUtilBuild.getCompVersion();
az.d("ProcessUtil", String.format("ProcessUtil/loadFromIconFile:thread(%s) generating...", Thread.currentThread().getName()));
try {
inputStream = context.getAssets().open("icon.png");
try {
inputStream.skip(926L);
byte[] bArr = new byte[4];
inputStream.read(bArr);
int byteArraytoInt = GameUtilBuild.byteArraytoInt(bArr);
byte[] bArr2 = new byte[1024];
if (z) {
i = inputStream.read(bArr2);
if (new File(str2).exists()) {
new File(str2).delete();
}
} else {
i = 0;
}
if (new File(str3).exists()) {
new File(str3).delete();
}
r3 = z ? new FileOutputStream(str2) : null;
byte[] bytes = "{&$%!5(h^#$<!#c*?@6@".getBytes();
int length = bytes.length;
if (z) {
int i4 = 0;
i3 = 0;
while (true) {
if (i <= 0) {
break;
}
int i5 = i3;
for (int i6 = 0; i6 < i; i6++) {
int i7 = i5 + 1;
bArr2[i6] = (byte) (bArr2[i6] ^ bytes[i5]);
i5 = i7 >= length ? 0 : i7;
}
r3.write(bArr2, 0, i);
i4 += i;
int i8 = byteArraytoInt - i4;
if (i8 <= 1024) {
byte[] bArr3 = new byte[i8];
int read = inputStream.read(bArr3);
for (int i9 = 0; i9 < read; i9++) {
int i10 = i5 + 1;
bArr3[i9] = (byte) (bArr3[i9] ^ bytes[i5]);
i5 = i10 >= length ? 0 : i10;
}
r3.write(bArr3, 0, read);
i3 = i5;
} else {
i = inputStream.read(bArr2);
i3 = i5;
}
}
i2 = 1024;
} else {
az.d("ProcessUtil", "ProcessUtil/loadFromIconFile:extractVm skipLen = " + inputStream.skip(byteArraytoInt) + ", firstLength = " + byteArraytoInt);
i2 = 1024;
i3 = 0;
}
byte[] bArr4 = new byte[i2];
FileOutputStream fileOutputStream = new FileOutputStream(str3);
for (int read2 = inputStream.read(bArr4); read2 > 0; read2 = inputStream.read(bArr4)) {
for (int i11 = 0; i11 < read2; i11++) {
try {
int i12 = i3 + 1;
bArr4[i11] = (byte) (bArr4[i11] ^ bytes[i3]);
i3 = i12 >= length ? 0 : i12;
} catch (Exception e) {
e = e;
r3 = fileOutputStream;
e.printStackTrace();
if (r3 != null) {
try {
r3.close();
} catch (Exception unused) {
Process.killProcess(Process.myPid());
az.d(KXQPApplication.TAG, "assets platform not exists");
printDirSizeInfo("/data");
return;
}
}
if (inputStream != null) {
inputStream.close();
}
Process.killProcess(Process.myPid());
az.d(KXQPApplication.TAG, "assets platform not exists");
printDirSizeInfo("/data");
return;
}
}
fileOutputStream.write(bArr4, 0, read2);
}
fileOutputStream.flush();
inputStream.close();
fileOutputStream.close();
try {
Runtime.getRuntime().exec("chmod 755 " + str2);
Runtime.getRuntime().exec("chmod 755 " + str3);
} catch (Exception e2) {
e2.printStackTrace();
}
SharedPreferences.Editor edit = sharedPreferences.edit();
if (z) {
edit.putString(ClientCookie.VERSION_ATTR, String.valueOf(gameUtilBuild.getCompVersion())).commit();
}
edit.putString("main_version", String.valueOf(gameUtilBuild.getMainVersion())).commit();
} catch (Exception e3) {
e = e3;
}
} catch (Exception e4) {
e = e4;
inputStream = null;
}
}
public static int unZipFile(File file, String str) throws ZipException, IOException {
az.d("ProcessUtil", String.format("ProcessUtil/unZipFile:thread(%s)", Thread.currentThread().getName()));
if (!str.endsWith(File.separator)) {
str = str + File.separator;
}
ZipFile zipFile = new ZipFile(file);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
byte[] bArr = new byte[1024];
while (entries.hasMoreElements()) {
ZipEntry nextElement = entries.nextElement();
String name = nextElement.getName();
if (name == null || !name.contains("../")) {
if (nextElement.isDirectory()) {
new File(str + name).mkdir();
} else {
new File(str + name).getParentFile().mkdirs();
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(str + name));
BufferedInputStream bufferedInputStream = new BufferedInputStream(zipFile.getInputStream(nextElement));
while (true) {
int read = bufferedInputStream.read(bArr, 0, 1024);
if (read == -1) {
break;
}
bufferedOutputStream.write(bArr, 0, read);
}
bufferedOutputStream.flush();
bufferedOutputStream.close();
bufferedInputStream.close();
}
}
}
zipFile.close();
return 0;
}
private static void printDirSizeInfo(String str) {
long j;
long j2;
File file = new File(str);
if (file.exists()) {
long j3 = 0;
if (Build.VERSION.SDK_INT >= 9) {
j3 = file.getTotalSpace();
j = file.getFreeSpace();
j2 = file.getUsableSpace();
} else {
try {
StatFs statFs = new StatFs(str);
int blockSize = statFs.getBlockSize();
j3 = statFs.getBlockCount() * blockSize;
long freeBlocks = statFs.getFreeBlocks() * blockSize;
long availableBlocks = blockSize * statFs.getAvailableBlocks();
j = freeBlocks;
j2 = availableBlocks;
} catch (Exception unused) {
j = 0;
j2 = 0;
}
}
az.d(KXQPApplication.TAG, "Path [" + str + "] info: total = " + j3 + ", free = " + j + ", usable = " + j2);
}
}
public static void a(Context context) {
f(context);
String packageName = context.getApplicationContext().getPackageName();
boolean z = context.getSharedPreferences("extractInfo", 0).getBoolean("gameCenterFirstStart", true);
StaticSdk.a(context).a(packageName, packageName + ".staticslioprovider", "200", z ? 1 : 0);
}
private static void f(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences("hello", 0);
String string = sharedPreferences.getString("statistics_cqid", "");
String infoFromFile = GameUtilBuild.getIntance().getInfoFromFile(context, "cqid");
if (TextUtils.isEmpty(string)) {
if (!TextUtils.isEmpty(infoFromFile)) {
sharedPreferences.edit().putString("statistics_cqid", infoFromFile).commit();
}
string = infoFromFile;
}
if (TextUtils.isEmpty(string)) {
String e = com.excelliance.kxqp.util.a.b.e(context);
if (e == null || e.length() <= 5) {
return;
}
StringBuilder sb = new StringBuilder();
String substring = e.substring(0, 3);
String substring2 = e.substring(e.length() - 3, e.length());
String valueOf = String.valueOf(System.currentTimeMillis());
String substring3 = valueOf.substring(valueOf.length() - 4, valueOf.length());
sb.append(substring);
sb.append(substring2);
sb.append(substring3);
Random random = new Random();
for (int i = 0; i < 10; i++) {
int nextInt = random.nextInt(36);
if (nextInt > 9) {
sb.append((char) ((nextInt - 10) + 97));
} else {
sb.append(nextInt);
}
}
sharedPreferences.edit().putString("statistics_cqid", sb.toString()).commit();
GameUtilBuild.getIntance().saveInfoToFile(context, "cqid", sb.toString());
return;
}
if (TextUtils.isEmpty(infoFromFile)) {
GameUtilBuild.getIntance().saveInfoToFile(context, "cqid", string);
}
}
public static void b(final Context context) {
tp.b(new Runnable() {
@Override
public void run() {
az.d("ProcessUtil", String.format("ProcessUtil/loadVmJar run:thread(%s)", Thread.currentThread().getName()));
try {
Class<?> cls = Class.forName("com.excelliance.kxqp.PlatSdk", false, context.getClassLoader());
cls.getDeclaredMethod("initVM", Application.class).invoke(cls.getDeclaredMethod("getInstance", new Class[0]).invoke(cls, new Object[0]), context);
az.d("ProcessUtil", "it's ok1");
} catch (Exception e) {
Log.e("ProcessUtil", "error1...: " + e.getMessage());
e.printStackTrace();
}
}
});
}
public static void c(final Context context) {
tp.f(new Runnable() {
@Override
public void run() {
try {
Class<?> cls = Class.forName("com.excelliance.kxqp.PlatSdk", false, context.getClassLoader());
cls.getDeclaredMethod("initProcess", Application.class).invoke(cls.getDeclaredMethod("getInstance", new Class[0]).invoke(cls, new Object[0]), context);
az.d("ProcessUtil", "it's ok2 initProcess");
} catch (Exception e) {
Log.e("ProcessUtil", "error2...: initProcess" + e.getMessage());
e.printStackTrace();
}
}
});
}
public static boolean d(Context context) {
return !by.a(context, "hello").b("nav", false).booleanValue();
}
}