360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0
以下内容为反编译后的 PermManager.java 源代码,内容仅作参考
package com.qihoo.permmgr;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import com.qihoo.rtservice.TempRoot;
import com.qihoo.speedometer.Config;
import com.qihoo.speedometer.HttpConst;
import com.qihoo.speedometer.TraceFileUtil;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.ParseException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class PermManager {
private static final int ACT_FAILBYSU = 3;
private static final int ACT_IGNORE = 1;
private static final int ACT_NOSU = 0;
private static final int ACT_SUCCESSBYSU = 2;
private static final String CHECKSUPPORTKEY = "checksupportlasttime";
private static final String CHECKSUPPORTRESULTFORPCKEY = "checksupportresultforpc";
private static final String CHECKSUPPORTRESULTKEY = "checksupportresult";
private static final String CHECKUPDATEKEY = "checklasttime";
private static final String CHECKUPDATE_CLIENT_KEY = "check_version_client";
private static final String CHECKUPDATE_LIBSUKEY = "check_version_libsu";
private static final String ERRKEY = "err";
protected static final String FAIL_3016TIME = "last3016time";
protected static final String FAIL_DONUM = "fail_donum";
protected static final String FAIL_SOLUTIONS = "fail_solutions";
protected static final String ISFIRSTKEY = "firstdolocalroot";
protected static final String LASTROOTTIMEKEY = "lastroottime";
private static final int NETERR = 1;
protected static final int NETERRCODE = 102;
protected static final int NONETCODE = 101;
protected static final int NORMALCODE = 100;
private static final int NO_NETERR = 0;
private static final int NO_SUPPORT = 0;
protected static final int OTHERERRCODE = 103;
private static final String OUTKEY = "out";
private static final int PHONE_SUPPORT = 1;
public static final String ROOT_VERSION = "1.2.8";
private static final int SOURCE_APPSTORE = 2;
private static final int SOURCE_MOBILESAFE = 1;
private static final int SOURCE_POWERCTL = 3;
private static final int SOURCE_UNKNOW = 0;
protected static final String SUPPMOKEY = "mobile";
protected static final String SUPPPCKEY = "pc";
private static final String s93F = "53b3a16759d31c1253e137e4";
private static final String s93FT = "53b22b96e4b0847d8a6d9fcc";
private static final String s94F = "53b2a92d59d31c1253e137e2";
private static final String s94FT = "53bbf2aae4b0dc36d1b8e0d7";
private static final String s96F = "53ba781759d3727902183a3f";
private static final String s96FT = "53c62d3fe4b0a822654c1792";
private Context mContext;
private SharedPreferences prefs;
private static PermManager mInstance = null;
private static final String logDirPath = String.valueOf(Environment.getExternalStorageDirectory().getAbsolutePath()) + "/360/";
public static String logFilePath = String.valueOf(Environment.getExternalStorageDirectory().getAbsolutePath()) + "/360/permmgr";
private PowerManager.WakeLock wakeLock = null;
private String mBaseLibcPath = "/permmgr/Libpermc.so";
private String mBaseLibiPath = "/permmgr/libsu.so";
private String mBaseLib360 = "/permmgr/lib360.so";
private boolean mIsSupport = true;
private boolean mIsSupportByPC = false;
private String mUpdateUrlString_Client = "http://api.shuaji.360.cn/r/getClient?pkg=com.qihoo.360.shuaji.root&type=RT_CLIENT";
private String mUpdateUrlString_Libsu = "http://api.shuaji.360.cn/r/getClient?pkg=com.qihoo.360.shuaji.root&type=RT_LIBSU";
private int mSourceType = 0;
private int mMyRealUid = -1;
Map mDoCommandArray = new HashMap();
private boolean isChecking = false;
private OutInfo mInfo = new OutInfo();
private int resultcode = -1;
private int outTime = 120;
boolean isHaveSu = true;
boolean isTest = false;
boolean mRefuseByUser = false;
String out = Config.INVALID_IP;
private final Handler mHandler = new Handler(Looper.getMainLooper());
class ConfigInfo {
String apkUrl;
int apkVersion;
private ConfigInfo() {
}
static ConfigInfo loadFromString(String str, Context context) {
if (TextUtils.isEmpty(str)) {
return null;
}
ConfigInfo configInfo = new ConfigInfo();
try {
JSONArray jSONArray = new JSONObject(str).getJSONArray("results");
if (jSONArray.length() > 0) {
JSONObject jSONObject = jSONArray.getJSONObject(0);
configInfo.apkUrl = jSONObject.getString("updateUrl");
configInfo.apkVersion = Integer.parseInt(jSONObject.getString("versionCode"));
}
return configInfo;
} catch (JSONException e) {
return null;
}
}
void clean(ConfigInfo configInfo) {
configInfo.apkUrl = Config.INVALID_IP;
configInfo.apkVersion = 0;
}
}
class OutInfo {
private int err;
private String out;
private int running;
private String version;
OutInfo() {
}
}
private PermManager(Context context) {
this.mContext = context;
try {
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + this.mBaseLibiPath);
if (file.exists()) {
file.delete();
}
} catch (Exception e) {
}
checkFiles();
this.prefs = context.getSharedPreferences("permmgr", 0);
}
private void changeUidToMyReal() {
int i = this.mMyRealUid;
if (b.f4664a) {
Log.d(b.f4665b, "changeUidToMyReal myRealUid:" + i);
}
if (i == -1 || i == 0) {
return;
}
try {
if (Process.myUid() == 0) {
com.qihoo.permmgr.util.b.a(new File("/data/data/" + this.mContext.getPackageName() + "/shared_prefs/"), "chown", i + TraceFileUtil.FILE_EXTENSION_SEPARATOR + i, "permmgr.xml");
}
} catch (Exception e) {
}
}
private boolean checkFileByPath(String str) {
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/" + str);
if (!file.exists() || !checkFileSize(str, file)) {
return false;
}
com.qihoo.permmgr.util.e.a("file is normal");
return true;
}
private void checkFileNum() {
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr");
if (file.exists()) {
File[] listFiles = file.listFiles();
if (listFiles.length > 15) {
for (File file2 : listFiles) {
file2.delete();
}
}
}
}
private boolean checkFileSize(String str, File file) {
InputStream open;
InputStream inputStream = null;
try {
try {
open = this.mContext.getAssets().open("permmgr/" + str);
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
if (0 != 0) {
try {
inputStream.close();
} catch (IOException e2) {
if (b.f4664a) {
e2.printStackTrace();
}
}
}
}
if (open == null || open.available() != ((int) file.length())) {
if (open != null) {
open.close();
}
if (open != null) {
try {
open.close();
} catch (IOException e3) {
if (b.f4664a) {
e3.printStackTrace();
}
}
}
return false;
}
com.qihoo.permmgr.util.e.a("true---" + str);
open.close();
if (open != null) {
try {
open.close();
} catch (IOException e4) {
if (b.f4664a) {
e4.printStackTrace();
}
}
}
return true;
} catch (Throwable th) {
if (0 != 0) {
try {
inputStream.close();
} catch (IOException e5) {
if (b.f4664a) {
e5.printStackTrace();
}
}
}
throw th;
}
}
private synchronized void checkFiles() {
String absolutePath = this.mContext.getFilesDir().getAbsolutePath();
File file = new File(String.valueOf(absolutePath) + "/permmgr");
if (!file.exists()) {
file.mkdir();
}
try {
com.qihoo.permmgr.util.b.b("chmod 755 " + file.getAbsolutePath());
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
}
File file2 = new File(String.valueOf(absolutePath) + this.mBaseLibiPath);
if (!file2.exists()) {
com.qihoo.permmgr.util.c.a(this.mContext, "libsu.so", file2);
try {
com.qihoo.permmgr.util.b.b("chmod 755 " + file2.getAbsolutePath());
} catch (Exception e2) {
if (b.f4664a) {
e2.printStackTrace();
}
}
} else if (!checkFileSize("libsu.so", file2)) {
file2.delete();
com.qihoo.permmgr.util.c.a(this.mContext, "libsu.so", file2);
try {
com.qihoo.permmgr.util.b.b("chmod 755 " + file2.getAbsolutePath());
} catch (Exception e3) {
if (b.f4664a) {
e3.printStackTrace();
}
}
}
}
private boolean checkRT_server(c cVar) {
if (cVar == null) {
return false;
}
for (int i = 0; i < 10; i++) {
try {
if (cVar.onCheckRootServerExist()) {
return true;
}
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
}
try {
try {
Thread.sleep(1000L);
} catch (InterruptedException e2) {
}
} catch (Exception e3) {
return false;
}
}
return false;
}
private void checkUpdate() {
new Thread(new Runnable() {
@Override
public void run() {
if (PermManager.this.prefs == null) {
PermManager.this.prefs = PermManager.this.mContext.getSharedPreferences("permmgr", 0);
}
if (System.currentTimeMillis() - PermManager.this.prefs.getLong(PermManager.CHECKUPDATEKEY, 0L) < Config.TASK_EXPIRATION_MSEC) {
return;
}
try {
if (PermManager.this.isChecking) {
return;
}
if (com.qihoo.permmgr.util.d.a(PermManager.this.mContext)) {
PermManager.this.isChecking = true;
String a2 = com.qihoo.permmgr.util.d.a(PermManager.this.mUpdateUrlString_Client, 10000);
com.qihoo.permmgr.util.e.a("updatabegin--vvv--" + a2);
ConfigInfo loadFromString = ConfigInfo.loadFromString(a2, PermManager.this.mContext);
if (loadFromString != null && loadFromString.apkVersion > PermManager.this.prefs.getInt(PermManager.CHECKUPDATE_CLIENT_KEY, 0)) {
String str = String.valueOf(PermManager.this.mContext.getFilesDir().getAbsolutePath()) + PermManager.this.mBaseLibcPath;
com.qihoo.permmgr.util.d.a(loadFromString.apkUrl, 60000, str);
com.qihoo.permmgr.util.b.b("chmod 755 " + str);
PermManager.this.prefs.edit().putInt(PermManager.CHECKUPDATE_CLIENT_KEY, loadFromString.apkVersion);
}
String a3 = com.qihoo.permmgr.util.d.a(PermManager.this.mUpdateUrlString_Libsu, 10000);
com.qihoo.permmgr.util.e.a("updatabegin--vvv--" + a3);
if (loadFromString != null) {
loadFromString.clean(loadFromString);
}
ConfigInfo loadFromString2 = ConfigInfo.loadFromString(a3, PermManager.this.mContext);
if (loadFromString2 != null && loadFromString2.apkVersion > PermManager.this.prefs.getInt(PermManager.CHECKUPDATE_LIBSUKEY, 0)) {
String str2 = String.valueOf(PermManager.this.mContext.getFilesDir().getAbsolutePath()) + PermManager.this.mBaseLibiPath;
com.qihoo.permmgr.util.d.a(loadFromString2.apkUrl, 60000, str2);
com.qihoo.permmgr.util.b.b("chmod 755 " + str2);
PermManager.this.prefs.edit().putInt(PermManager.CHECKUPDATE_LIBSUKEY, loadFromString2.apkVersion);
}
PermManager.this.prefs.edit().putLong(PermManager.CHECKUPDATEKEY, System.currentTimeMillis()).commit();
PermManager.this.isChecking = false;
}
} catch (IOException e) {
PermManager.this.isChecking = false;
if (b.f4664a) {
e.printStackTrace();
}
} catch (ParseException e2) {
PermManager.this.isChecking = false;
if (b.f4664a) {
e2.printStackTrace();
}
} catch (Exception e3) {
PermManager.this.isChecking = false;
if (b.f4664a) {
e3.printStackTrace();
}
} finally {
PermManager.this.isChecking = false;
}
}
}).start();
}
private void cleanFutext() {
File file;
String string = this.prefs.getString("successSolution", Config.INVALID_IP);
if (TextUtils.isEmpty(string)) {
return;
}
if ((string.equalsIgnoreCase(s93F) || string.equalsIgnoreCase(s94F) || string.equalsIgnoreCase(s96F) || string.equalsIgnoreCase(s93FT) || string.equalsIgnoreCase(s94FT) || string.equalsIgnoreCase(s96FT)) && (file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/" + string)) != null && file.exists()) {
this.prefs.edit().remove("successSolution").commit();
file.delete();
com.qihoo.permmgr.util.e.b("0__cleanFutext", new File(logFilePath));
com.qihoo.permmgr.util.e.a("cleanFutext");
}
}
private String doCommandNoErr(String str, String str2) {
checkUpdate();
return ((OutInfo) jdocommand(this.mInfo, str, 30)).out;
}
private int doRootByRootService(String str, c cVar) {
int i;
IOException e;
int i2;
com.qihoo.permmgr.shellservice.e eVar;
if (!com.qihoo.permmgr.shellservice.e.a()) {
return -1;
}
try {
com.qihoo.permmgr.shellservice.e a2 = com.qihoo.permmgr.shellservice.e.a(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/libsu.so > /dev/null 2>&1 &");
if (a2.b() == 0) {
eVar = a2;
i = 3000;
} else {
if (a2.b() == 9) {
String a3 = com.qihoo.permmgr.util.d.a("http://api.shuaji.360.cn/roms/root/getroot?keyword=rootsig", 20000);
String str2 = null;
if (a3 == null) {
i = 3009;
eVar = a2;
} else {
try {
str2 = parseJson(a3);
} catch (JSONException e2) {
if (b.f4664a) {
e2.printStackTrace();
}
}
if (!TextUtils.isEmpty(str2)) {
com.qihoo.permmgr.shellservice.e.b(com.qihoo.permmgr.util.d.a(str2, 20000));
a2 = com.qihoo.permmgr.shellservice.e.a(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/libsu.so > /dev/null 2>&1 &");
if (a2.b() == 0) {
eVar = a2;
i = 3000;
}
}
}
}
com.qihoo.permmgr.shellservice.e eVar2 = a2;
i = -1;
eVar = eVar2;
}
try {
eVar.c();
i2 = i;
} catch (IOException e3) {
e = e3;
if (b.f4664a) {
e.printStackTrace();
}
i2 = i;
if (i2 == 3000) {
i2 = 3046;
}
if (i2 == 3000) {
}
com.qihoo.permmgr.util.e.b("6__" + i2 + "_" + this.prefs.getString("report_successsolutong_id", Config.INVALID_IP), new File(logFilePath));
Thread.sleep(1000L);
return i2;
}
} catch (IOException e4) {
i = -1;
e = e4;
if (b.f4664a) {
}
i2 = i;
if (i2 == 3000) {
}
if (i2 == 3000) {
}
com.qihoo.permmgr.util.e.b("6__" + i2 + "_" + this.prefs.getString("report_successsolutong_id", Config.INVALID_IP), new File(logFilePath));
Thread.sleep(1000L);
return i2;
}
if (i2 == 3000 && !checkRT_server(cVar)) {
i2 = 3046;
}
if (i2 == 3000) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 22, TempRoot.ROOT_SUCCESS, 1, "0", 209, "root service success");
} else {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 20, TempRoot.ROOT_SUCCESS, 1, "0", 210, "root service fail");
}
com.qihoo.permmgr.util.e.b("6__" + i2 + "_" + this.prefs.getString("report_successsolutong_id", Config.INVALID_IP), new File(logFilePath));
Thread.sleep(1000L);
return i2;
}
private int doSolutionBySU(String str, c cVar) {
int i;
int i2 = 0;
if (cVar == null) {
return this.resultcode;
}
com.qihoo.permmgr.util.e.b("[*] try su");
if (this.isHaveSu) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, 0, -1, "0", 206, "start su");
}
this.isHaveSu = true;
this.mRefuseByUser = false;
this.out = Config.INVALID_IP;
new Thread(new Runnable() {
@Override
public void run() {
try {
PermManager.this.out = com.qihoo.permmgr.util.b.a(new File(String.valueOf(PermManager.this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/"), "chmod 755 " + PermManager.this.mContext.getFilesDir().getAbsolutePath() + "/permmgr/libsu.so;" + PermManager.this.mContext.getFilesDir().getAbsolutePath() + "/permmgr/libsu.so &");
com.qihoo.permmgr.util.e.a("su out----" + PermManager.this.out);
if (TextUtils.isEmpty(PermManager.this.out)) {
return;
}
if (PermManager.this.out.contains("denied") || PermManager.this.out.contains("unallowed")) {
PermManager.this.mRefuseByUser = true;
}
} catch (Exception e) {
PermManager.this.isHaveSu = false;
com.qihoo.permmgr.util.e.b("[-] su not exists");
}
}
}).start();
boolean z = false;
while (true) {
if (i2 < 35) {
try {
} catch (RemoteException e) {
e = e;
}
if (!this.isHaveSu || this.mRefuseByUser) {
break;
}
if (cVar.onCheckRootServerExist()) {
try {
this.resultcode = TempRoot.ROOT_SUCCESS;
z = true;
break;
} catch (RemoteException e2) {
e = e2;
z = true;
if (b.f4664a) {
e.printStackTrace();
}
i2++;
}
} else {
try {
Thread.sleep(1000L);
} catch (Exception e3) {
}
i2++;
}
} else {
break;
}
}
if (z) {
com.qihoo.permmgr.util.e.b("[+] success");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 22, TempRoot.ROOT_SUCCESS, 1, "0", 203, "su success");
} else if (!z && this.isHaveSu) {
com.qihoo.permmgr.util.e.b("[-] fail");
if (this.mRefuseByUser) {
com.qihoo.permmgr.util.e.a("[-] RefuseByUser");
i = 1001;
} else if (isSupersu()) {
com.qihoo.permmgr.util.e.a("su is supersu");
i = HttpConst.ERROR_CODE_FAIL_NO_PKG_INFO;
} else {
i = 3000;
}
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, i, 1, "0", 203, "su failed");
}
return this.resultcode;
}
private int doSolutionOnline(String str, c cVar) {
com.qihoo.permmgr.util.e.a("[*] online");
com.qihoo.permmgr.util.e.b("3", new File(logFilePath));
if (!com.qihoo.permmgr.util.d.a(this.mContext)) {
com.qihoo.permmgr.util.e.a("----doroot online net not conncet----");
return TempRoot.ROOT_FAILED_NETUNONLINE;
}
if (!this.mIsSupport && !this.mIsSupportByPC) {
return TempRoot.NOTSUPPORT;
}
if (!this.mIsSupport && this.mIsSupportByPC) {
return TempRoot.PCSUPPORT;
}
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, 0, -1, "0", 300, "do online solution");
this.resultcode = RootMan.a(this.mContext).a(cVar);
reportStat(this.resultcode, 2, 1000);
com.qihoo.permmgr.util.e.a("[*] end");
return this.resultcode;
}
private int doSuccessSolution(c cVar) {
cleanFutext();
String string = this.prefs.getString("successSolution", Config.INVALID_IP);
com.qihoo.permmgr.util.e.a("[*] do successSolution");
if (TextUtils.isEmpty(string)) {
com.qihoo.permmgr.util.e.a("[-] Solution not exists");
return -1;
}
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/" + string);
if (file == null || !file.exists()) {
com.qihoo.permmgr.util.e.a("[-] Solution error");
this.prefs.edit().remove("successSolution").commit();
return -1;
}
com.qihoo.permmgr.util.e.a("[+] Solution exists");
com.qihoo.permmgr.util.e.b("1", new File(logFilePath));
com.qihoo.permmgr.util.e.a("[*] execute");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, 0, -1, "0", 204, "start successSolution");
String str = String.valueOf(PermService.mPermmgrRootDir) + System.currentTimeMillis() + ".so";
com.qihoo.permmgr.util.c.a(String.valueOf(PermService.mPermmgrRootDir) + string, str);
com.qihoo.permmgr.util.e.a("[!]" + str + " " + new File(str).exists());
int a2 = RootMan.a(this.mContext).a(str);
if (a2 == 3000) {
com.qihoo.permmgr.util.e.b("1__" + a2 + "_" + this.prefs.getString("report_successsolutong_id", Config.INVALID_IP), new File(logFilePath));
}
if (a2 == 3000 && !checkRT_server(cVar)) {
a2 = 3046;
com.qihoo.permmgr.util.e.a("3000 but service not running");
com.qihoo.permmgr.util.e.b("1_0", new File(logFilePath));
}
if (a2 != 3000) {
com.qihoo.permmgr.util.e.a("[-] failed");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, a2, 1, this.prefs.getString("successSolution", Config.INVALID_IP), 201, "local cached solution failed");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, a2, this.prefs.getString("successSolution", Config.INVALID_IP));
File file2 = new File(str);
if (file2 != null && file2.exists()) {
file2.delete();
}
SharedPreferences.Editor edit = this.prefs.edit();
edit.remove("successSolution");
edit.remove("solutions_md5");
edit.remove("currentSolutionId");
edit.commit();
} else {
com.qihoo.permmgr.util.e.a("[+] success");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 22, a2, 1, this.prefs.getString("successSolution", Config.INVALID_IP), 201, "local cached solution success");
}
File file3 = new File(str);
if (file3 != null && file3.exists()) {
file3.delete();
}
return a2;
}
private String fingPkg(String str) {
String str2 = SystemProperties.get("ro.build.version.release");
String[] split = str.split("/");
return (TextUtils.isEmpty(str2) || !str2.startsWith("4")) ? ("data".equals(split[1]) && "data".equals(split[2])) ? split[3] : Config.INVALID_IP : ("data".equals(split[1]) && "data".equals(split[2])) ? split[3] : ("data".equals(split[1]) && "user".equals(split[2]) && Character.isDigit(split[3].charAt(0))) ? split[4] : Config.INVALID_IP;
}
public static PermManager getInstance(Context context) {
if (mInstance == null) {
mInstance = new PermManager(context);
}
return mInstance;
}
private void getRealMyUid() {
int myUid = Process.myUid();
if (b.f4664a) {
Log.d(b.f4665b, "getRealMyUid myRealUid:" + myUid);
}
if (myUid == 0 || this.mMyRealUid != -1) {
return;
}
this.mMyRealUid = myUid;
}
private void initLogFile(String str) {
File file = new File(logDirPath);
if (!file.exists()) {
file.mkdir();
}
if (!str.equalsIgnoreCase("3002")) {
logFilePath = String.valueOf(logFilePath) + str;
}
File file2 = new File(logFilePath);
if (!file2.exists() || file2.length() <= 102400) {
return;
}
file2.delete();
}
private boolean isIgnoreSDK7() {
return Build.VERSION.SDK_INT <= 8;
}
private boolean isSupersu() {
String str = null;
try {
str = com.qihoo.permmgr.util.b.a("su -v");
} catch (Exception e) {
e.printStackTrace();
}
return str.contains("SUPERSU");
}
private native Object jcheckdaemon(Object obj);
private native Object jdocommand(Object obj, String str, int i);
private native int jrestartdaemon(String str);
private String parseJson(String str) {
JSONObject jSONObject = new JSONObject(str);
if (!jSONObject.has("results")) {
return Config.INVALID_IP;
}
JSONArray jSONArray = jSONObject.getJSONArray("results");
if (jSONArray.length() <= 0) {
return Config.INVALID_IP;
}
JSONObject jSONObject2 = jSONArray.getJSONObject(0);
if (jSONObject2.getString("keyWord").equals("rootsig") && !jSONObject2.getString("md5Code").equalsIgnoreCase(this.prefs.getString("permmgrmd5", Config.INVALID_IP))) {
return jSONObject2.getString("rootFile");
}
return null;
}
private void receiverAndWriteDataMobilesafe(Bundle bundle) {
File file = new File(this.mContext.getFilesDir().getAbsoluteFile() + "/env_file");
if (file != null && file.exists()) {
file.delete();
}
int i = bundle.getInt("root_type", 0);
if (b.f4664a) {
Log.d(b.f4665b, "from bundel root_type :" + i);
}
int i2 = bundle.getInt("env_num", 0);
if (b.f4664a) {
Log.d(b.f4665b, "from bundel env_num :" + i2);
}
String[] strArr = new String[i2];
for (int i3 = 0; i3 < i2; i3++) {
strArr[i3] = bundle.getString("env_" + i3);
if (b.f4664a) {
Log.d(b.f4665b, "from bundel env " + i3 + ":" + strArr[i3]);
}
}
int i4 = bundle.getInt("arg_num", 0);
if (b.f4664a) {
Log.d(b.f4665b, "from bundel arg_num :" + i4);
}
String[] strArr2 = new String[i4];
for (int i5 = 0; i5 < i4; i5++) {
strArr2[i5] = bundle.getString("arg_" + i5);
if (b.f4664a) {
Log.d(b.f4665b, "from bundel arg " + i5 + ":" + strArr2[i5]);
}
}
StringBuilder sb = new StringBuilder();
sb.append("source=").append(this.mSourceType).append('\n');
sb.append('\n');
sb.append("root_type").append('\n');
sb.append(i).append('\n').append('\n');
sb.append("env").append('\n');
for (int i6 = 0; i6 < i2; i6++) {
sb.append(strArr[i6]).append('\n');
}
sb.append('\n');
sb.append("arg").append('\n');
for (int i7 = 0; i7 < i4; i7++) {
sb.append(strArr2[i7]).append('\n');
}
sb.append('\n');
writeFileData(file, sb.toString());
}
private void reportCrashList() {
String string = this.prefs.getString("workingFlag", Config.INVALID_IP);
if (TextUtils.isEmpty(string) || string.equals(SystemProperties.get("ro.runtime.firstboot"))) {
return;
}
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, TempRoot.ROOT_FAILED_CRASH_LAST_TIME, 0, this.prefs.getString("currentSolutionId", Config.INVALID_IP), 1000, "crash");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, TempRoot.ROOT_FAILED_CRASH_LAST_TIME, this.prefs.getString("currentSolutionId", Config.INVALID_IP));
String string2 = this.prefs.getString("currentSolutionId", Config.INVALID_IP);
String string3 = this.prefs.getString("crashList", Config.INVALID_IP);
if (!TextUtils.isEmpty(string3)) {
string2 = String.valueOf(string3) + ";" + string2;
}
this.prefs.edit().putString("crashList", string2).commit();
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/" + this.prefs.getString("successSolution", Config.INVALID_IP));
if (file != null && file.exists()) {
file.delete();
}
SharedPreferences.Editor edit = this.prefs.edit();
edit.remove("successSolution");
edit.remove("solutions_md5");
edit.remove("currentSolutionId");
edit.remove("workingFlag");
edit.commit();
}
private void reportStat(int i, int i2, int i3) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 3000 == i ? 22 : i >= 3040 ? 21 : 20, i, i2, this.mContext.getSharedPreferences("permmgr", 0).getString("currentSolutionId", Config.INVALID_IP), i3, "other");
}
private void rmEnv() {
try {
File file = new File(this.mContext.getFilesDir().getAbsoluteFile() + "/permmgr/env_file");
if (file == null || !file.exists()) {
return;
}
file.delete();
} catch (Exception e) {
}
}
private void saveEnv(Bundle bundle) {
File file = new File(this.mContext.getFilesDir().getAbsoluteFile() + "/permmgr/env_file");
if (file != null && file.exists()) {
file.delete();
}
bundle.getInt("root_type", 0);
int i = bundle.getInt("env_num", 0);
if (i == 0) {
return;
}
String[] strArr = new String[i];
for (int i2 = 0; i2 < i; i2++) {
strArr[i2] = bundle.getString("env_" + i2);
}
int i3 = bundle.getInt("arg_num", 0);
String[] strArr2 = new String[i3];
for (int i4 = 0; i4 < i3; i4++) {
strArr2[i4] = bundle.getString("arg_" + i4);
}
StringBuilder sb = new StringBuilder();
sb.append("#!/system/bin/sh");
sb.append('\n');
sb.append("echo \"4_1.2.8_0 \n \">> " + logFilePath);
sb.append('\n');
for (int i5 = 0; i5 < i; i5++) {
sb.append("export ");
sb.append(strArr[i5]);
sb.append('\n');
}
for (int i6 = 0; i6 < i3; i6++) {
sb.append(strArr2[i6]);
if (i6 != i3 - 1) {
sb.append(" ");
}
}
sb.append("&\n");
sb.append("rm " + file.getAbsolutePath());
sb.append("\n");
writeFileData(file, sb.toString());
com.qihoo.permmgr.util.b.b("chmod 755 " + file.getAbsolutePath());
}
private int startByRoot(Bundle bundle) {
int myUid = Process.myUid();
if (b.f4664a) {
Log.d(b.f4665b, "myuid:" + myUid);
}
if (myUid != 0) {
return -1;
}
if (!verifyFromData(bundle)) {
if (b.f4664a) {
Log.d(b.f4665b, "invalid data!!!!!!!");
}
reportStat(TempRoot.ROOT_FAILED_INVALID_SOURCE, 0, 1000);
return TempRoot.ROOT_FAILED_INVALID_SOURCE;
}
new Thread(new Runnable() {
@Override
public void run() {
com.qihoo.permmgr.util.b.a(new File("/"), "/data/data/" + PermManager.this.mContext.getPackageName() + "/lib/libsu.so");
}
}).start();
try {
Thread.sleep(500L);
} catch (InterruptedException e) {
}
reportStat(TempRoot.ROOT_SUCCESS, 1, 1000);
if (b.f4664a) {
Log.d(b.f4665b, "response intent com.qihoo.permmgr.getperm.RESPONSE:resultCode :3000");
}
return TempRoot.ROOT_SUCCESS;
}
private boolean verifyFromData(Bundle bundle) {
boolean z;
int myUid = Process.myUid();
if (b.f4664a) {
Log.d(b.f4665b, "source uid is : " + myUid);
}
String[] a2 = com.qihoo.permmgr.util.k.a(this.mContext, myUid);
if (a2 == null || a2.length != 1) {
return false;
}
if (b.f4664a) {
Log.d(b.f4665b, "source package iss : " + a2[0]);
}
if (!com.qihoo.permmgr.util.k.b(this.mContext, a2[0])) {
return false;
}
String[] a3 = com.qihoo.permmgr.util.j.a(this.mContext.getPackageManager(), a2[0]);
if (a3 != null) {
int length = a3.length;
int i = 0;
while (true) {
if (i >= length) {
z = false;
break;
}
String str = a3[i];
if (b.f4664a) {
Log.d(b.f4665b, "from app md5 is " + str);
}
if ("dc6dbd6e49682a57a8b82889043b93a8".equalsIgnoreCase(str) || "2731710b7b726b51ab58e8ccbcfeb586".equalsIgnoreCase(str)) {
break;
}
if ("CA45263BC938DA16EF1B069C95E61BA2".equalsIgnoreCase(str) || "85b6bfbb179f2467bd5e5e53577d8b15".equalsIgnoreCase(str) || "3093DC0F7CE2079D807D78A798231E9B".equalsIgnoreCase(str)) {
break;
}
if (Config.INVALID_IP.equalsIgnoreCase(str)) {
this.mSourceType = 3;
a.e = a.c;
z = true;
break;
}
i++;
}
} else {
z = false;
}
if (!z) {
return false;
}
switch (this.mSourceType) {
case 1:
if (bundle != null && !bundle.isEmpty()) {
receiverAndWriteDataMobilesafe(bundle);
break;
} else {
return false;
}
break;
case 2:
if (bundle != null && !bundle.isEmpty()) {
receiverAndWriteDataMobilesafe(bundle);
break;
} else {
return false;
}
case 3:
if (bundle != null && !bundle.isEmpty()) {
receiverAndWriteDataMobilesafe(bundle);
break;
} else {
return false;
}
}
return true;
}
public boolean checkDaemonIsRunning() {
return ((OutInfo) jcheckdaemon(this.mInfo)).running >= 0;
}
public boolean checkIsSupport(String str, int i) {
if (this.prefs == null) {
this.prefs = this.mContext.getSharedPreferences("permmgr", 0);
}
if (System.currentTimeMillis() - this.prefs.getLong(CHECKSUPPORTKEY, 0L) < 7200000) {
if (this.prefs.getInt(CHECKSUPPORTRESULTFORPCKEY, 0) == 1) {
this.mIsSupportByPC = true;
} else {
this.mIsSupportByPC = false;
}
return this.prefs.getInt(CHECKSUPPORTRESULTKEY, 0) == 1;
}
try {
String a2 = com.qihoo.permmgr.util.d.a(RootMan.a(this.mContext).a(str, i), 10000);
if (a2 == null) {
com.qihoo.permmgr.util.e.a("error jsonString is null");
return true;
}
JSONObject jSONObject = new JSONObject(a2);
int i2 = jSONObject.getInt(SUPPMOKEY);
int i3 = jSONObject.getInt(SUPPPCKEY);
if (i3 == 1) {
this.mIsSupportByPC = true;
} else {
this.mIsSupportByPC = false;
}
this.prefs.edit().putLong(CHECKSUPPORTKEY, System.currentTimeMillis()).commit();
this.prefs.edit().putInt(CHECKSUPPORTRESULTKEY, i2).commit();
this.prefs.edit().putInt(CHECKSUPPORTRESULTFORPCKEY, i3).commit();
return i2 == 1;
} catch (IOException e) {
if (!b.f4664a) {
return true;
}
e.printStackTrace();
return true;
} catch (ParseException e2) {
if (!b.f4664a) {
return true;
}
e2.printStackTrace();
return true;
} catch (JSONException e3) {
if (!b.f4664a) {
return true;
}
e3.printStackTrace();
return true;
}
}
public Map checkIsSupportForSafe(String str, boolean z) {
HashMap hashMap = new HashMap();
if (this.prefs == null) {
this.prefs = this.mContext.getSharedPreferences("permmgr", 0);
}
if (System.currentTimeMillis() - this.prefs.getLong(CHECKSUPPORTKEY, 0L) < 7200000 && !z) {
hashMap.clear();
hashMap.put(SUPPMOKEY, Integer.valueOf(this.prefs.getInt(CHECKSUPPORTRESULTKEY, 0)));
hashMap.put(SUPPPCKEY, Integer.valueOf(this.prefs.getInt(CHECKSUPPORTRESULTFORPCKEY, 0)));
hashMap.put(ERRKEY, 100);
} else if (com.qihoo.permmgr.util.d.a(this.mContext)) {
try {
String a2 = com.qihoo.permmgr.util.d.a(RootMan.a(this.mContext).a(str, 1), 10000);
if (a2 == null) {
hashMap.clear();
hashMap.put(SUPPMOKEY, 0);
hashMap.put(SUPPPCKEY, 0);
hashMap.put(ERRKEY, Integer.valueOf(NETERRCODE));
} else {
com.qihoo.permmgr.util.e.a("supp====" + a2);
JSONObject jSONObject = new JSONObject(a2);
int i = jSONObject.getInt(SUPPMOKEY);
int i2 = jSONObject.getInt(SUPPPCKEY);
this.prefs.edit().putLong(CHECKSUPPORTKEY, System.currentTimeMillis()).commit();
this.prefs.edit().putInt(CHECKSUPPORTRESULTKEY, i).commit();
this.prefs.edit().putInt(CHECKSUPPORTRESULTFORPCKEY, i2).commit();
hashMap.clear();
hashMap.put(SUPPMOKEY, Integer.valueOf(i));
hashMap.put(SUPPPCKEY, Integer.valueOf(i2));
hashMap.put(ERRKEY, 100);
}
} catch (IOException e) {
if (b.f4664a) {
e.printStackTrace();
}
hashMap.clear();
hashMap.put(SUPPMOKEY, 0);
hashMap.put(SUPPPCKEY, 0);
hashMap.put(ERRKEY, Integer.valueOf(OTHERERRCODE));
return hashMap;
} catch (ParseException e2) {
if (b.f4664a) {
e2.printStackTrace();
}
hashMap.clear();
hashMap.put(SUPPMOKEY, 0);
hashMap.put(SUPPPCKEY, 0);
hashMap.put(ERRKEY, Integer.valueOf(OTHERERRCODE));
return hashMap;
} catch (JSONException e3) {
if (b.f4664a) {
e3.printStackTrace();
}
hashMap.clear();
hashMap.put(SUPPMOKEY, 0);
hashMap.put(SUPPPCKEY, 0);
hashMap.put(ERRKEY, Integer.valueOf(OTHERERRCODE));
return hashMap;
}
} else {
hashMap.clear();
hashMap.put(SUPPMOKEY, 0);
hashMap.put(SUPPPCKEY, 0);
hashMap.put(ERRKEY, 101);
}
return hashMap;
}
public Map doCommand(String str, String str2) {
checkUpdate();
OutInfo outInfo = (OutInfo) jdocommand(this.mInfo, str, 30);
this.mDoCommandArray.clear();
this.mDoCommandArray.put(ERRKEY, new StringBuilder(String.valueOf(outInfo.err)).toString());
this.mDoCommandArray.put(OUTKEY, outInfo.out);
return this.mDoCommandArray;
}
public int doRoot_Local(c cVar) {
com.qihoo.permmgr.util.e.b("[*] execute usl solution");
com.qihoo.permmgr.util.e.b("2", new File(logFilePath));
if (new File(this.prefs.getString(LASTROOTTIMEKEY, Config.INVALID_IP)).exists()) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, 2000, -1, "0", 100, "58s crash");
return -2000;
}
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/" + System.currentTimeMillis() + ".so");
com.qihoo.permmgr.util.c.a(this.mContext, "lib360.so", file);
this.prefs.edit().putString(LASTROOTTIMEKEY, file.getAbsolutePath()).commit();
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, 0, -1, "0", 205, "start \tlocal Solution");
int doRoot = LocalRoot.getInstance().doRoot(file.getAbsolutePath(), this.prefs, cVar);
int i = this.prefs.getBoolean(ISFIRSTKEY, true) ? 2 : 1;
if (doRoot == 3000) {
com.qihoo.permmgr.util.e.b("2__" + doRoot + "_52d4b6a059d300a59efd2e75", new File(logFilePath));
}
if (doRoot == 3000 && !checkRT_server(cVar)) {
doRoot = 3046;
com.qihoo.permmgr.util.e.a("3000 but service not running");
com.qihoo.permmgr.util.e.b("2_0", new File(logFilePath));
}
if (doRoot == 3000) {
com.qihoo.permmgr.util.e.b("[+] success");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 22, TempRoot.ROOT_SUCCESS, i, "52d4b6a059d300a59efd2e75", 202, "usl solution success");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, TempRoot.ROOT_SUCCESS, "52d4b6a059d300a59efd2e75");
this.prefs.edit().putBoolean(ISFIRSTKEY, false).commit();
return doRoot;
}
com.qihoo.permmgr.util.e.b("[-] failed");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 21, doRoot, i, "52d4b6a059d300a59efd2e75", 202, "usl solution failed");
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, doRoot, "52d4b6a059d300a59efd2e75");
this.prefs.edit().putBoolean(ISFIRSTKEY, false).commit();
return doRoot;
}
public String getDaemonVersion() {
OutInfo outInfo = (OutInfo) jcheckdaemon(this.mInfo);
return TextUtils.isEmpty(outInfo.version) ? "0" : outInfo.version.split("\n")[0];
}
public String getErrKey() {
return ERRKEY;
}
public String getOutKey() {
return OUTKEY;
}
public int getPermission(Bundle bundle, String str, boolean z, c cVar) {
if (doRootByRootService(str, cVar) == 3000 || doSuccessSolution(cVar) == 3000) {
return TempRoot.ROOT_SUCCESS;
}
if (!this.isTest && doRoot_Local(cVar) == 3000) {
return TempRoot.ROOT_SUCCESS;
}
if (!z && doSolutionBySU(str, cVar) == 3000) {
return TempRoot.ROOT_SUCCESS;
}
if (b.f4664a) {
Log.d(b.f4665b, "on receive intent com.qihoo.permmgr.getperm.REQUEST");
}
if (startByRoot(bundle) == 3000) {
return TempRoot.ROOT_SUCCESS;
}
getRealMyUid();
reportCrashList();
if (!this.mIsSupport && !this.mIsSupportByPC) {
com.qihoo.permmgr.util.e.a("[!] end of root not support");
this.resultcode = TempRoot.NOTSUPPORT;
return this.resultcode;
}
if (this.mIsSupport || !this.mIsSupportByPC) {
this.resultcode = doSolutionOnline(str, cVar);
changeUidToMyReal();
return this.resultcode;
}
com.qihoo.permmgr.util.e.a("[!] end of root only pc support");
this.resultcode = TempRoot.PCSUPPORT;
return this.resultcode;
}
public int getRoot(final String str, final boolean z, Bundle bundle, final c cVar) {
if (com.qihoo.permmgr.util.k.a()) {
return TempRoot.NOTSUPPORT;
}
if (isIgnoreSDK7()) {
com.qihoo.permmgr.util.e.a("isIgnoreSDK7()");
return TempRoot.PCSUPPORT;
}
if (a.f) {
return TempRoot.ROOT_FAILED_PERMMGR_IS_BUSY;
}
a.f = true;
this.mContext.sendBroadcast(new Intent("com.qihoo.root.rooting"));
this.resultcode = -1;
try {
initLogFile(str);
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
}
if (TextUtils.isEmpty(str)) {
a.e = RootMan.a(this.mContext).a();
} else {
a.e = str;
}
try {
com.qihoo.permmgr.util.e.b("\n\n0__pkg-" + str + "__" + com.qihoo.permmgr.util.g.a(), new File(logFilePath));
com.qihoo.permmgr.util.e.a("root_version--1.2.8");
com.qihoo.permmgr.util.e.a("saveEnv");
saveEnv(bundle);
} catch (IOException e2) {
com.qihoo.permmgr.util.e.a("saveEnv IOException");
}
this.mIsSupport = true;
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
com.qihoo.permmgr.util.e.a("[*] start");
com.qihoo.permmgr.util.g.a(PermManager.this.mContext).a(PermManager.this.mContext, 21, 0, -1, "0", 100, "start");
com.qihoo.permmgr.util.e.a("[*] getsupport");
PermManager.this.mIsSupport = PermManager.this.checkIsSupport(str, 0);
com.qihoo.permmgr.util.e.a("[*] end");
if (PermManager.this.mIsSupport) {
com.qihoo.permmgr.util.e.a("[+] support, then stat");
com.qihoo.permmgr.util.g.a(PermManager.this.mContext).a(PermManager.this.mContext, 21, 0, -1, "0", 101, "support, then stat");
} else {
com.qihoo.permmgr.util.e.a("[-] not support");
com.qihoo.permmgr.util.g.a(PermManager.this.mContext).a(PermManager.this.mContext, 21, 0, -1, "0", PermManager.NETERRCODE, "not support, then stat");
}
com.qihoo.permmgr.util.e.a("[*] check su");
PermManager.this.isHaveSu = com.qihoo.permmgr.util.b.b();
if (PermManager.this.isHaveSu) {
com.qihoo.permmgr.util.e.a("[+] su exists");
com.qihoo.permmgr.util.g.a(PermManager.this.mContext).a(PermManager.this.mContext, 21, 0, -1, "0", PermManager.OTHERERRCODE, "su exists");
} else {
com.qihoo.permmgr.util.e.a("[-] su not exists");
com.qihoo.permmgr.util.g.a(PermManager.this.mContext).a(PermManager.this.mContext, 21, 0, -1, "0", 104, "su not exists");
}
PermManager.this.resultcode = PermManager.this.getPermission(null, str, z, cVar);
}
});
com.qihoo.permmgr.util.e.a("rooThread start");
thread.start();
for (int i = 0; i <= this.outTime; i++) {
try {
Thread.sleep(1000L);
} catch (InterruptedException e3) {
if (b.f4664a) {
e3.printStackTrace();
}
}
if (this.resultcode != -1) {
a.f = false;
this.mContext.sendBroadcast(new Intent("com.qihoo.root.rootover"));
com.qihoo.permmgr.util.e.b("9__" + this.resultcode, new File(logFilePath));
if (this.resultcode != 3000) {
rmEnv();
}
if (this.resultcode == 3000) {
if (com.qihoo.permmgr.shellservice.e.a()) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 20, TempRoot.ROOT_SUCCESS, 1, "0", 207, "root service start success");
com.qihoo.permmgr.shellservice.e.c(this.mContext.getPackageName());
} else {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, 20, TempRoot.ROOT_SUCCESS, 1, "0", 208, "root service start fail");
}
}
com.qihoo.permmgr.util.e.a("------root end and result----" + this.resultcode);
return this.resultcode;
}
}
thread.interrupt();
rmEnv();
a.f = false;
this.mContext.sendBroadcast(new Intent("com.qihoo.root.rootover"));
this.resultcode = TempRoot.ROOT_FAILED_OVER_TIME;
reportStat(TempRoot.ROOT_FAILED_OVER_TIME, 0, 1000);
com.qihoo.permmgr.util.e.a("------root outtime----");
com.qihoo.permmgr.util.e.b("4", new File(logFilePath));
return this.resultcode;
}
protected String getSupportMKey() {
return SUPPMOKEY;
}
protected String getSupportPCKey() {
return SUPPPCKEY;
}
public boolean restartDaemon(String str) {
return jrestartdaemon(str) >= 0;
}
public void safeReport(String str) {
com.qihoo.permmgr.util.g.a(this.mContext).a(this.mContext, str);
}
public int testLocalSolution(String str, Bundle bundle, c cVar) {
try {
initLogFile("3002");
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
}
com.qihoo.permmgr.util.e.b("testLocalSolution start", new File(logFilePath));
com.qihoo.permmgr.util.e.a("testLocalSolution start");
try {
saveEnv(bundle);
} catch (IOException e2) {
if (b.f4664a) {
e2.printStackTrace();
}
}
File file = new File(String.valueOf(this.mContext.getFilesDir().getAbsolutePath()) + "/permmgr/" + System.currentTimeMillis() + ".so");
com.qihoo.permmgr.util.c.a(str, file.getAbsolutePath());
com.qihoo.permmgr.util.e.a("testLocalSolution cpFile");
int doRoot = LocalRoot.getInstance().doRoot(file.getAbsolutePath(), this.prefs, cVar);
com.qihoo.permmgr.util.e.a("testLocalSolution resultCode---" + doRoot);
return doRoot;
}
public void writeFileData(File file, String str) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.write(str.getBytes());
fileOutputStream.close();
} catch (Exception e) {
if (b.f4664a) {
e.printStackTrace();
}
}
}
}