CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 SystemManager.java 源代码,内容仅作参考
package com.mobile.auth.gatewayauth.manager;
import android.content.Context;
import android.os.Debug;
import android.os.Looper;
import android.text.TextUtils;
import com.mobile.auth.gatewayauth.Constant;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.gatewayauth.annotations.SafeProtector;
import com.mobile.auth.gatewayauth.manager.base.Cache;
import com.mobile.auth.gatewayauth.manager.base.CacheKey;
import com.mobile.auth.gatewayauth.manager.compat.ResultCodeProcessor;
import com.mobile.auth.gatewayauth.model.TokenRet;
import com.mobile.auth.gatewayauth.utils.Checker;
import com.mobile.auth.gatewayauth.utils.i;
import com.mobile.auth.gatewayauth.utils.security.CheckProxy;
import com.mobile.auth.gatewayauth.utils.security.CheckRoot;
import com.mobile.auth.gatewayauth.utils.security.EmulatorDetector;
import com.mobile.auth.gatewayauth.utils.security.PackageUtils;
import com.nirvana.tools.core.CryptUtil;
import com.nirvana.tools.core.ExecutorManager;
import com.nirvana.tools.requestqueue.Callback;
import com.nirvana.tools.requestqueue.strategy.ThreadStrategy;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
public class SystemManager {
private final Context a;
private String f13079b;
private String f13080c;
private final com.mobile.auth.q.a f13081d;
private volatile boolean f13082e = true;
private Future<?> f;
class AnonymousClass2 extends Callback<com.mobile.auth.w.d> {
final StringBuffer a;
final CountDownLatch f13084b;
AnonymousClass2(ThreadStrategy threadStrategy, long j, StringBuffer stringBuffer, CountDownLatch countDownLatch) {
super(threadStrategy, j);
this.a = stringBuffer;
this.f13084b = countDownLatch;
}
public void a(com.mobile.auth.w.d dVar) {
try {
if (dVar.a() != null) {
this.a.append(dVar.a());
}
this.f13084b.countDown();
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.d dVar) {
try {
a(dVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
static {
b.a.a.a.SLoad("pns-2.13.2.1-LogOnlineStandardCuumRelease_alijtca_plus");
}
public SystemManager(final Context context, com.mobile.auth.q.a aVar) {
this.a = context.getApplicationContext();
this.f = ExecutorManager.getInstance().scheduleFuture(new Runnable() {
@Override
public void run() {
try {
SystemManager.a(SystemManager.this, PackageUtils.getPackageName(context));
SystemManager.b(SystemManager.this, PackageUtils.getSign(context));
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
});
this.f13081d = aVar;
}
private TokenRet a(ResultCodeProcessor resultCodeProcessor, String str) {
try {
if (com.mobile.auth.gatewayauth.utils.c.f(this.a)) {
if (com.mobile.auth.gatewayauth.utils.c.e(this.a)) {
return null;
}
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_NO_MOBILE_NETWORK_FAIL, "移动网络未开启", str);
}
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_NO_SIM_FAIL, "SIM卡无法检测", str);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
static String a(SystemManager systemManager, String str) {
try {
systemManager.f13079b = str;
return str;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
static String b(SystemManager systemManager, String str) {
try {
systemManager.f13080c = str;
return str;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
@SafeProtector
private native String requestCellularIp();
public TokenRet a(ResultCodeProcessor resultCodeProcessor, boolean z, String str) {
try {
TokenRet checkEnvSafe = checkEnvSafe(resultCodeProcessor, str);
return (checkEnvSafe == null && z) ? a(resultCodeProcessor, str) : checkEnvSafe;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public synchronized String a() {
try {
Future<?> future = this.f;
if (future != null) {
try {
future.get();
this.f = null;
} catch (InterruptedException e2) {
e2.printStackTrace();
} catch (ExecutionException e3) {
e3.printStackTrace();
}
}
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
return this.f13079b;
}
public void a(String str) {
try {
if ((FeatureManager.getInstance().get("whiteFileCheck") == null || !"false".equals(FeatureManager.getInstance().get("whiteFileCheck").toString())) && !TextUtils.isEmpty(str)) {
InputStream inputStream = null;
try {
String md5Hex = CryptUtil.md5Hex(str);
if (TextUtils.isEmpty(md5Hex)) {
this.f13082e = true;
return;
}
InputStream open = this.a.getAssets().open(md5Hex);
this.f13082e = false;
if (open != null) {
try {
open.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
} catch (Exception unused) {
this.f13082e = true;
if (0 != 0) {
try {
inputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
}
}
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
protected synchronized <T> boolean a(String str, Cache<T> cache, long j) {
try {
long currentTimeMillis = System.currentTimeMillis();
if (cache == null || cache.getKey() == null || !cache.getKey().equals(str) || cache.getExpiredTime() - j <= currentTimeMillis) {
if (cache != null) {
this.f13081d.a("ExpiredTime:", String.valueOf(cache.getExpiredTime()), "|threshold:", String.valueOf(j), "|currTime:", String.valueOf(currentTimeMillis));
}
return false;
}
return true;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return false;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return false;
}
}
}
public synchronized String b() {
try {
Future<?> future = this.f;
if (future != null) {
try {
future.get();
this.f = null;
} catch (InterruptedException e2) {
e2.printStackTrace();
} catch (ExecutionException e3) {
e3.printStackTrace();
}
}
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
return this.f13080c;
}
public String b(String str) {
if (str == null) {
return "unknown";
}
char c2 = 65535;
try {
int hashCode = str.hashCode();
if (hashCode != -1350608857) {
if (hashCode != 95009260) {
if (hashCode == 880617272 && str.equals(Constant.VENDOR_CMCC)) {
c2 = 0;
}
} else if (str.equals(Constant.VENDOR_CUCC)) {
c2 = 1;
}
} else if (str.equals(Constant.VENDOR_CTCC)) {
c2 = 2;
}
return Constant.CMCC;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String c() {
try {
return com.mobile.auth.gatewayauth.utils.c.b(this.a);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String c(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_SDK_PRE_LOGIN_CODE;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
@SafeProtector
public TokenRet checkEnvSafe(ResultCodeProcessor resultCodeProcessor, String str) {
try {
try {
if (this.f13082e) {
String c2 = Checker.c();
if (!TextUtils.isEmpty(c2) && !"0".equals(c2)) {
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "手机终端不安全:the app is attached, please use safe phone!", str);
}
}
String isDeviceRooted = CheckRoot.isDeviceRooted();
if (!TextUtils.isEmpty(isDeviceRooted)) {
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "手机终端不安全:the phone is root, " + isDeviceRooted, str);
} else if (Thread.currentThread() == Looper.getMainLooper().getThread() && EmulatorDetector.isEmulator(this.a)) {
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "手机终端不安全:Emulator is detected, please use real phone!", str);
} else {
if (CheckProxy.isDevicedProxy(this.a)) {
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "手机终端不安全:the phone is proxy, please do not proxy!", str);
}
if (!Debug.isDebuggerConnected() || i.a()) {
return null;
}
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "手机终端不安全:the app is debuggerConnected, please do not debug!", str);
}
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
} catch (Exception e2) {
return resultCodeProcessor.convertErrorInfo(Constant.CODE_ERROR_PHONE_UNSAFE_FAIL, "无法判运营商: " + e2.getMessage(), str);
}
}
public String d() {
try {
return com.mobile.auth.gatewayauth.utils.c.c(this.a);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String d(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_SDK_PRE_AUTH_CODE;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
@SafeProtector
protected native synchronized String decryptContent(String str);
public Context e() {
try {
return this.a;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String e(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_SDK_LOGIN_CODE;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
@SafeProtector
public native synchronized String encryptContent(String str);
public String f(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_SDK_LOGIN_TOKEN;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String g(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_SDK_AUTH_TOKEN;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
@SafeProtector
public native CacheKey getSimCacheKey(boolean z, String str);
@SafeProtector
public native CacheKey getVendorCacheKey(String str);
public String h(String str) {
try {
return b(str).toLowerCase() + Constant.ACTION_AUTH_PAGE_LOGIN;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String i(String str) {
try {
return Constant.ACTION_SDK + b(str).toLowerCase() + Constant.ACTION_AUTH_PAGE_PRIVACYALERT;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String j(String str) {
try {
return b(str).toLowerCase() + Constant.ACTION_AUTH_PAGE_RETURN;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String k(String str) {
try {
return b(str).toLowerCase() + Constant.ACTION_CLICK_PRIVACYALERT_PRIVACY;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String l(String str) {
try {
return b(str).toLowerCase() + Constant.ACTION_AUTH_PAGE_PROTOCOL;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
public String m(String str) {
try {
return b(str).toLowerCase() + Constant.ACTION_AUTH_PAGE_START;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
}