what-the-bank/sources/com/huawei/hms/hwid/f.java

161 lines
7.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.hwid;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import com.huawei.hms.account.internal.ui.activity.AccountSignInHubActivity;
import com.huawei.hms.support.account.request.AccountAuthParams;
import com.huawei.hms.support.account.request.AccountAuthParamsHelper;
import com.huawei.hms.support.account.result.AccountAuthResult;
import com.huawei.hms.support.account.result.AuthAccount;
import com.huawei.hms.support.api.entity.account.AccountSignInRequest;
import com.huawei.hms.support.api.entity.auth.Scope;
import com.huawei.hms.support.hwid.service.HuaweiIdAuthAPIService;
import com.huawei.hms.utils.Util;
import java.util.List;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class f {
public static Intent a(Context context, AccountAuthParams accountAuthParams, String str) {
as.b("[AccountSDK]AccountAuthUtil", "getSignInIntent", true);
return a(context, accountAuthParams, str, 0, "");
}
public static Intent a(Context context, AccountAuthParams accountAuthParams, String str, String str2) {
as.b("[AccountSDK]AccountAuthUtil", "getIndependentSignInIntent", true);
return a(context, accountAuthParams, str, 1, str2);
}
private static Intent a(Context context, AccountAuthParams accountAuthParams, String str, int i, String str2) {
JSONObject jSONObject;
Intent intent = new Intent(i == 1 ? "com.huawei.hms.account.picker.signIn" : "com.huawei.hms.account.signIn");
try {
intent.setPackage(context.getPackageName());
intent.setClass(context, AccountSignInHubActivity.class);
if (i == 1) {
intent.putExtra("ACCESS_TOKEN", str2);
intent.putExtra("INDEPENDENT_SIGN_IN_FLAG", i);
try {
String signInParams = accountAuthParams.getSignInParams();
if (TextUtils.isEmpty(signInParams)) {
jSONObject = new JSONObject();
} else {
jSONObject = new JSONObject(signInParams);
}
jSONObject.put("ACCESS_TOKEN", str2);
jSONObject.put("INDEPENDENT_SIGN_IN_FLAG", i);
accountAuthParams.setSignInParams(jSONObject.toString());
} catch (JSONException e) {
StringBuilder sb = new StringBuilder("JSONException:");
sb.append(e.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb.toString(), true);
}
}
String appId = Util.getAppId(context);
String packageName = context.getPackageName();
b bVar = new b();
bVar.b(appId);
bVar.c(packageName);
bVar.a(61100301L);
bVar.d(str);
AccountSignInRequest accountSignInRequest = new AccountSignInRequest();
accountSignInRequest.setAccountAuthParams(accountAuthParams);
try {
intent.putExtra("HUAWEIID_CP_CLIENTINFO", bVar.d());
intent.putExtra("HUAWEIID_SIGNIN_REQUEST", accountSignInRequest.toJson());
} catch (JSONException e2) {
StringBuilder sb2 = new StringBuilder("JSONException:");
sb2.append(e2.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb2.toString(), true);
}
} catch (Exception e3) {
StringBuilder sb3 = new StringBuilder("Exception:");
sb3.append(e3.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb3.toString(), true);
}
return intent;
}
public static AccountAuthResult a(Intent intent) {
as.b("[AccountSDK]AccountAuthUtil", "getSignInResultFromIntent", true);
if (intent == null || !intent.hasExtra(HuaweiIdAuthAPIService.EXTRA_AUTH_HUAWEI_ID)) {
as.d("[AccountSDK]AccountAuthUtil", "data or signInResult is null", true);
return null;
}
try {
return new AccountAuthResult().fromJson(intent.getStringExtra(HuaweiIdAuthAPIService.EXTRA_AUTH_HUAWEI_ID));
} catch (JSONException unused) {
as.d("[AccountSDK]AccountAuthUtil", "JSONException", true);
return null;
}
}
public static void a() {
g.a().c();
}
public static AuthAccount b() {
return g.a().b();
}
public static AccountAuthParams a(List<Scope> list) {
AccountAuthParamsHelper accountAuthParamsHelper = new AccountAuthParamsHelper();
if (ap.b(list).booleanValue()) {
accountAuthParamsHelper.setScopeList(list);
}
return accountAuthParamsHelper.createParams();
}
public static void a(Window window) {
if (window == null) {
return;
}
if (Build.VERSION.SDK_INT >= 28) {
as.b("[AccountSDK]AccountAuthUtil", "android version is Higher than 9.0", true);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.layoutInDisplayCutoutMode = 1;
window.setAttributes(attributes);
window.getDecorView().setSystemUiVisibility(5894);
return;
}
as.b("[AccountSDK]AccountAuthUtil", "android version is Below 9.0", true);
WindowManager.LayoutParams attributes2 = window.getAttributes();
try {
Class<?> cls = Class.forName("com.huawei.android.view.LayoutParamsEx");
cls.getMethod("addHwFlags", Integer.TYPE).invoke(cls.getConstructor(WindowManager.LayoutParams.class).newInstance(attributes2), 4096);
} catch (RuntimeException e) {
StringBuilder sb = new StringBuilder("Adapt to the digging screen occur RuntimeException");
sb.append(e.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb.toString(), true);
} catch (Exception e2) {
StringBuilder sb2 = new StringBuilder("Adapt to the digging screen occur exception");
sb2.append(e2.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb2.toString(), true);
}
}
public static void a(Activity activity) {
try {
int systemUiVisibility = activity.getWindow().getDecorView().getSystemUiVisibility();
activity.getWindow().addFlags(PKIFailureInfo.systemUnavail);
activity.getWindow().getDecorView().setSystemUiVisibility(systemUiVisibility | 1024);
activity.getWindow().setStatusBarColor(0);
activity.getWindow().setNavigationBarColor(0);
if (Build.VERSION.SDK_INT >= 29) {
activity.getWindow().setNavigationBarContrastEnforced(false);
}
} catch (Exception e) {
StringBuilder sb = new StringBuilder("exception occured:");
sb.append(e.getClass().getSimpleName());
as.d("[AccountSDK]AccountAuthUtil", sb.toString(), true);
}
}
}