70 lines
2.2 KiB
Java
70 lines
2.2 KiB
Java
|
package com.huawei.hms.hwid;
|
||
|
|
||
|
import com.huawei.hms.support.account.request.AccountAuthParams;
|
||
|
import com.huawei.hms.support.account.result.AuthAccount;
|
||
|
import java.util.Map;
|
||
|
import java.util.concurrent.ConcurrentHashMap;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class g {
|
||
|
private static final g a = new g();
|
||
|
private Map<String, String> b = new ConcurrentHashMap();
|
||
|
|
||
|
private g() {
|
||
|
}
|
||
|
|
||
|
public void a(AuthAccount authAccount, AccountAuthParams accountAuthParams) {
|
||
|
String json;
|
||
|
as.b("[AccountSDK]AccountAuthMemCache", "saveDefaultAccountSignInAccount start.", true);
|
||
|
if (authAccount != null) {
|
||
|
try {
|
||
|
json = authAccount.toJson();
|
||
|
} catch (Throwable th) {
|
||
|
StringBuilder sb = new StringBuilder("store faild, exception:");
|
||
|
sb.append(th.getClass().getSimpleName());
|
||
|
as.d("[AccountSDK]AccountAuthMemCache", sb.toString(), true);
|
||
|
return;
|
||
|
}
|
||
|
} else {
|
||
|
json = null;
|
||
|
}
|
||
|
a(json, accountAuthParams != null ? accountAuthParams.toJson() : null);
|
||
|
}
|
||
|
|
||
|
private void a(String str, String str2) {
|
||
|
as.b("[AccountSDK]AccountAuthMemCache", "saveDefaultAccountSignInAccount start.", true);
|
||
|
this.b.remove("AccountAuth");
|
||
|
this.b.remove("AccountAuthParams");
|
||
|
if (str != null) {
|
||
|
this.b.put("AccountAuth", str);
|
||
|
}
|
||
|
if (str2 != null) {
|
||
|
this.b.put("AccountAuthParams", str2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final AuthAccount b() {
|
||
|
as.b("[AccountSDK]AccountAuthMemCache", "getSignInAccount start.", true);
|
||
|
try {
|
||
|
String str = this.b.get("AccountAuth");
|
||
|
if (str != null) {
|
||
|
return AuthAccount.fromJson(str);
|
||
|
}
|
||
|
return null;
|
||
|
} catch (Throwable th) {
|
||
|
StringBuilder sb = new StringBuilder("getSignInAccount faild, exception:");
|
||
|
sb.append(th.getClass().getSimpleName());
|
||
|
as.d("[AccountSDK]AccountAuthMemCache", sb.toString(), true);
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void c() {
|
||
|
this.b.clear();
|
||
|
}
|
||
|
|
||
|
public static g a() {
|
||
|
return a;
|
||
|
}
|
||
|
}
|