CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05
以下内容为反编译后的 TokenMaskManager.java 源代码,内容仅作参考
package com.mobile.auth.gatewayauth.manager;
import android.text.TextUtils;
import android.util.LruCache;
import com.mobile.auth.gatewayauth.Constant;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.gatewayauth.ResultCode;
import com.mobile.auth.gatewayauth.annotations.SafeProtector;
import com.mobile.auth.gatewayauth.manager.a;
import com.mobile.auth.gatewayauth.manager.base.Cache;
import com.mobile.auth.gatewayauth.manager.base.CacheKey;
import com.mobile.auth.gatewayauth.model.LoginPhoneInfo;
import com.mobile.auth.gatewayauth.utils.TokenGenerator;
import com.mobile.auth.gatewayauth.utils.g;
import com.nirvana.tools.cache.CacheHandler;
import com.nirvana.tools.cache.CacheManager;
import com.nirvana.tools.jsoner.JsonType;
import com.nirvana.tools.requestqueue.Callback;
import com.nirvana.tools.requestqueue.strategy.ThreadStrategy;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
public class TokenMaskManager {
private b a;
private SystemManager f13086b;
private d f13087c;
private VendorSdkInfoManager f13088d;
private f f13089e;
private TokenGenerator f;
private com.mobile.auth.q.a g;
private volatile Map<String, LoginPhoneInfo> h = new ConcurrentHashMap();
private volatile Cache<LoginPhoneInfo> i = null;
private volatile LruCache<String, Cache<String>> j = new LruCache<>(10);
private volatile LruCache<String, Cache<String>> k = new LruCache<>(10);
private CacheHandler l;
private CacheHandler m;
private CacheHandler n;
private CacheHandler o;
private CacheManager p;
class AnonymousClass11 extends Callback<com.mobile.auth.w.e> {
final RequestCallback a;
AnonymousClass11(ThreadStrategy threadStrategy, long j, RequestCallback requestCallback) {
super(threadStrategy, j);
this.a = requestCallback;
}
public void a(com.mobile.auth.w.e eVar) {
try {
if (eVar.a()) {
this.a.onSuccess(eVar);
return;
}
com.mobile.auth.gatewayauth.manager.base.b b2 = eVar.b();
if (b2 == null) {
b2 = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
}
this.a.onError(b2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.e eVar) {
try {
a(eVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass12 extends com.mobile.auth.r.e {
final String a;
final String f13095b;
AnonymousClass12(f fVar, String str, long j, String str2, String str3, String str4) {
super(fVar, str, j, str2);
this.a = str3;
this.f13095b = str4;
}
@Override
public void a(RequestCallback requestCallback, a aVar) {
try {
aVar.a(requestCallback, a.b.a().a(this.a).b(this.f13095b).a());
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass13 extends Callback<com.mobile.auth.w.e> {
final String a;
final String f13097b;
final CacheKey f13098c;
final RequestCallback f13099d;
AnonymousClass13(ThreadStrategy threadStrategy, long j, String str, String str2, CacheKey cacheKey, RequestCallback requestCallback) {
super(threadStrategy, j);
this.a = str;
this.f13097b = str2;
this.f13098c = cacheKey;
this.f13099d = requestCallback;
}
public void a(com.mobile.auth.w.e eVar) {
try {
TokenMaskManager.d(TokenMaskManager.this).a("Update LoginToken from network!");
if (eVar.a()) {
eVar.b().a(Math.min(System.currentTimeMillis() + 86400000, eVar.b().f()));
TokenMaskManager.a(TokenMaskManager.this, this.a, this.f13097b, this.f13098c, eVar.b().d(), eVar.b().f());
this.f13099d.onSuccess("false");
return;
}
com.mobile.auth.gatewayauth.manager.base.b b2 = eVar.b();
if (b2 == null) {
b2 = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
}
this.f13099d.onError(b2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.e eVar) {
try {
a(eVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass14 extends com.mobile.auth.r.e {
final String a;
final String f13101b;
AnonymousClass14(f fVar, String str, long j, String str2, String str3, String str4) {
super(fVar, str, j, str2);
this.a = str3;
this.f13101b = str4;
}
@Override
public void a(RequestCallback requestCallback, a aVar) {
try {
aVar.b(requestCallback, a.b.a().a(this.a).b(this.f13101b).a());
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass15 extends Callback<com.mobile.auth.w.e> {
final String a;
final RequestCallback f13103b;
AnonymousClass15(ThreadStrategy threadStrategy, long j, String str, RequestCallback requestCallback) {
super(threadStrategy, j);
this.a = str;
this.f13103b = requestCallback;
}
public void a(com.mobile.auth.w.e eVar) {
try {
TokenMaskManager.d(TokenMaskManager.this).a("Update LoginToken from network!");
if (eVar.a()) {
eVar.b().a(TokenMaskManager.a(TokenMaskManager.this, eVar.b().d(), this.a, true));
this.f13103b.onSuccess(eVar.b());
return;
}
com.mobile.auth.gatewayauth.manager.base.b b2 = eVar.b();
if (b2 == null) {
b2 = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
}
this.f13103b.onError(b2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.e eVar) {
try {
a(eVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass16 extends com.mobile.auth.r.e {
final String a;
final String f13105b;
AnonymousClass16(f fVar, String str, long j, String str2, String str3, String str4) {
super(fVar, str, j, str2);
this.a = str3;
this.f13105b = str4;
}
@Override
public void a(RequestCallback requestCallback, a aVar) {
try {
aVar.b(requestCallback, a.b.a().a(this.a).b(this.f13105b).a());
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass2 extends Callback<com.mobile.auth.w.f> {
final String a;
final RequestCallback f13107b;
AnonymousClass2(ThreadStrategy threadStrategy, long j, String str, RequestCallback requestCallback) {
super(threadStrategy, j);
this.a = str;
this.f13107b = requestCallback;
}
public void a(com.mobile.auth.w.f fVar) {
try {
TokenMaskManager.d(TokenMaskManager.this).a("Update VerifyToken from network!");
if (fVar.a()) {
fVar.b().a(TokenMaskManager.a(TokenMaskManager.this, fVar.b().d(), this.a, false));
this.f13107b.onSuccess(fVar.b());
return;
}
com.mobile.auth.gatewayauth.manager.base.b b2 = fVar.b();
if (b2 == null) {
b2 = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
}
this.f13107b.onError(b2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.f fVar) {
try {
a(fVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass3 extends Callback<com.mobile.auth.w.f> {
final String a;
final String f13109b;
final CacheKey f13110c;
final RequestCallback f13111d;
AnonymousClass3(ThreadStrategy threadStrategy, long j, String str, String str2, CacheKey cacheKey, RequestCallback requestCallback) {
super(threadStrategy, j);
this.a = str;
this.f13109b = str2;
this.f13110c = cacheKey;
this.f13111d = requestCallback;
}
public void a(com.mobile.auth.w.f fVar) {
try {
TokenMaskManager.d(TokenMaskManager.this).a("Update VerifyToken from network!");
if (fVar.a()) {
fVar.b().a(Math.min(System.currentTimeMillis() + 86400000, fVar.b().f()));
TokenMaskManager.b(TokenMaskManager.this, this.a, this.f13109b, this.f13110c, fVar.b().d(), fVar.b().f());
this.f13111d.onSuccess("false");
return;
}
com.mobile.auth.gatewayauth.manager.base.b b2 = fVar.b();
if (b2 == null) {
b2 = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
}
this.f13111d.onError(b2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onResult(com.mobile.auth.w.f fVar) {
try {
a(fVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass4 extends JsonType<LoginPhoneInfo> {
AnonymousClass4() {
}
}
class AnonymousClass5 extends JsonType<String> {
AnonymousClass5() {
}
}
class AnonymousClass6 extends JsonType<String> {
AnonymousClass6() {
}
}
class AnonymousClass7 implements Runnable {
AnonymousClass7() {
}
@Override
public void run() {
try {
TokenMaskManager.g(TokenMaskManager.this).save(TokenMaskManager.f(TokenMaskManager.this).encryptContent(TokenMaskManager.e(TokenMaskManager.this).toJson().toString()));
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}
class AnonymousClass8 implements Runnable {
final JSONObject a;
AnonymousClass8(JSONObject jSONObject) {
this.a = jSONObject;
}
@Override
public void run() {
try {
TokenMaskManager.h(TokenMaskManager.this).save(TokenMaskManager.f(TokenMaskManager.this).encryptContent(this.a.toString()));
} 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 TokenMaskManager(b bVar, SystemManager systemManager, d dVar, f fVar, VendorSdkInfoManager vendorSdkInfoManager) {
this.a = bVar;
this.f13086b = systemManager;
this.f13087c = dVar;
this.g = dVar.a();
this.f13088d = vendorSdkInfoManager;
this.f13089e = fVar;
this.f = new TokenGenerator(this.g, this.f13086b, this.f13088d);
this.p = CacheManager.getInstance(this.f13086b.e());
b();
g.a(new Runnable() {
@Override
public void run() {
try {
TokenMaskManager.a(TokenMaskManager.this);
TokenMaskManager.b(TokenMaskManager.this);
TokenMaskManager.c(TokenMaskManager.this);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
});
}
static String a(TokenMaskManager tokenMaskManager, String str, String str2, boolean z) {
try {
return tokenMaskManager.a(str, str2, z);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native String a(String str, CacheKey cacheKey, long j);
private native String a(String str, String str2, CacheKey cacheKey, long j);
private native String a(String str, String str2, boolean z);
static void a(TokenMaskManager tokenMaskManager) {
try {
tokenMaskManager.c();
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
static void a(TokenMaskManager tokenMaskManager, CacheKey cacheKey, LoginPhoneInfo loginPhoneInfo, String str) {
try {
tokenMaskManager.a(cacheKey, loginPhoneInfo, str);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
static void a(TokenMaskManager tokenMaskManager, String str, String str2, CacheKey cacheKey, String str3, long j) {
try {
tokenMaskManager.b(str, str2, cacheKey, str3, j);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
private native synchronized void a(CacheKey cacheKey, LoginPhoneInfo loginPhoneInfo, String str);
private native synchronized void a(String str, String str2, CacheKey cacheKey, String str3, long j);
private native boolean a(String str, String str2, long j);
private native synchronized boolean a(String str, String str2, LruCache<String, Cache<String>> lruCache, long j);
private native void b();
static void b(TokenMaskManager tokenMaskManager) {
try {
tokenMaskManager.d();
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
static void b(TokenMaskManager tokenMaskManager, String str, String str2, CacheKey cacheKey, String str3, long j) {
try {
tokenMaskManager.a(str, str2, cacheKey, str3, j);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
private native synchronized void b(String str, String str2, CacheKey cacheKey, String str3, long j);
private native boolean b(CacheKey cacheKey);
private native boolean b(String str, String str2, long j);
private native synchronized void c();
static void c(TokenMaskManager tokenMaskManager) {
try {
tokenMaskManager.e();
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
static com.mobile.auth.q.a d(TokenMaskManager tokenMaskManager) {
try {
return tokenMaskManager.g;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native synchronized void d();
static Cache e(TokenMaskManager tokenMaskManager) {
try {
return tokenMaskManager.i;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native synchronized void e();
static SystemManager f(TokenMaskManager tokenMaskManager) {
try {
return tokenMaskManager.f13086b;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native synchronized void f();
static CacheHandler g(TokenMaskManager tokenMaskManager) {
try {
return tokenMaskManager.o;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native synchronized void g();
static CacheHandler h(TokenMaskManager tokenMaskManager) {
try {
return tokenMaskManager.n;
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return null;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return null;
}
}
}
private native synchronized void h();
@SafeProtector
private native synchronized String popToken(String str, CacheKey cacheKey, CacheHandler cacheHandler, LruCache<String, Cache<String>> lruCache, long j);
@SafeProtector
private native void requestMask(long j, String str, RequestCallback<com.mobile.auth.w.e, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, CacheKey cacheKey, String str2, int i, String str3, String str4);
public native LoginPhoneInfo a(CacheKey cacheKey);
public native synchronized void a();
public native void a(long j, String str, RequestCallback<com.mobile.auth.gatewayauth.manager.base.b, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, CacheKey cacheKey, long j2, String str2, String str3, String str4);
public native void a(long j, String str, RequestCallback<String, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, CacheKey cacheKey, String str2, long j2, int i, String str3, String str4);
public native void b(long j, String str, RequestCallback<String, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, CacheKey cacheKey, long j2, String str2, String str3, String str4);
public native void b(long j, String str, RequestCallback<com.mobile.auth.gatewayauth.manager.base.b, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, CacheKey cacheKey, String str2, long j2, int i, String str3, String str4);
@SafeProtector
public void updateMask(long j, final String str, final RequestCallback<com.mobile.auth.gatewayauth.manager.base.b, com.mobile.auth.gatewayauth.manager.base.b> requestCallback, final CacheKey cacheKey, int i, final String str2, String str3, String str4) {
if (requestCallback == null) {
return;
}
try {
if (this.a.c()) {
requestCallback.onError(com.mobile.auth.gatewayauth.manager.base.b.a(Constant.CODE_ERROR_FUNCTION_DEMOTE, "系统维护,功能不可用"));
return;
}
LoginPhoneInfo a = a(cacheKey);
com.mobile.auth.gatewayauth.utils.e.a().a(str3, "maskCache", System.currentTimeMillis());
final CacheKey vendorCacheKey = this.f13086b.getVendorCacheKey(str);
long a2 = c.a(str);
com.mobile.auth.q.a aVar = this.g;
String[] strArr = new String[3];
StringBuilder sb = new StringBuilder();
sb.append("HasMaskCache:");
sb.append(a != null);
strArr[0] = sb.toString();
strArr[1] = ", SimKey:";
strArr[2] = cacheKey.toString();
aVar.a(strArr);
if (a == null) {
requestMask(j, str, new RequestCallback<com.mobile.auth.w.e, com.mobile.auth.gatewayauth.manager.base.b>() {
public void a(com.mobile.auth.gatewayauth.manager.base.b bVar) {
if (bVar == null) {
try {
bVar = com.mobile.auth.gatewayauth.manager.base.b.a(ResultCode.CODE_ERROR_UNKNOWN_FAIL, "未知异常");
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
return;
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
return;
}
}
}
requestCallback.onError(bVar);
}
public void a(com.mobile.auth.w.e eVar) {
try {
LoginPhoneInfo build = LoginPhoneInfo.newLoginPhoneInfo().protocolName(eVar.c().e()).protocolUrl(eVar.c().f()).phoneNumber(eVar.c().b()).build();
TokenMaskManager.a(TokenMaskManager.this, cacheKey, build, str);
requestCallback.onSuccess(com.mobile.auth.gatewayauth.manager.base.b.a().a(false).a(build).a());
eVar.b().a(Math.min(System.currentTimeMillis() + 86400000, eVar.b().f()));
if (TextUtils.isEmpty(eVar.b().d())) {
return;
}
TokenMaskManager.a(TokenMaskManager.this, str2, str, vendorCacheKey, eVar.b().d(), eVar.b().f());
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onError(com.mobile.auth.gatewayauth.manager.base.b bVar) {
try {
a(bVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onSuccess(com.mobile.auth.w.e eVar) {
try {
a(eVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}, cacheKey, str2, i, str3, str4);
return;
}
requestCallback.onSuccess(com.mobile.auth.gatewayauth.manager.base.b.a().a(true).a(a).a());
if (Constant.VENDOR_CMCC.equals(str) || a(str2, vendorCacheKey.getKey(), a2)) {
return;
}
a(j, str, new RequestCallback<String, com.mobile.auth.gatewayauth.manager.base.b>() {
public void a(com.mobile.auth.gatewayauth.manager.base.b bVar) {
try {
com.mobile.auth.q.a d2 = TokenMaskManager.d(TokenMaskManager.this);
String[] strArr2 = new String[2];
strArr2[0] = "Update LoginToken failed when update mask!";
strArr2[1] = bVar == null ? "" : bVar.toString();
d2.e(strArr2);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
public void a(String str5) {
try {
TokenMaskManager.d(TokenMaskManager.this).a("Update LoginToken success when update mask!");
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onError(com.mobile.auth.gatewayauth.manager.base.b bVar) {
try {
a(bVar);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
@Override
public void onSuccess(String str5) {
try {
a(str5);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}, vendorCacheKey, str2, a2, i, str3, str4);
} catch (Throwable th) {
try {
ExceptionProcessor.processException(th);
} catch (Throwable th2) {
ExceptionProcessor.processException(th2);
}
}
}
}