正在查看: Petal Maps v4.7.0.310001 应用的 FaqDispatchActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Petal Maps v4.7.0.310001 应用的 FaqDispatchActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.huawei.phoneservice.faq.dispatch;
import android.R;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.huawei.phoneservice.faq.R$layout;
import com.huawei.phoneservice.faq.R$string;
import com.huawei.phoneservice.faq.base.constants.FaqConstants;
import com.huawei.phoneservice.faq.base.network.SdkAppInfo;
import com.huawei.phoneservice.faq.base.util.FaqCommonUtils;
import com.huawei.phoneservice.faq.base.util.FaqLogger;
import com.huawei.phoneservice.faq.base.util.FaqSdk;
import com.huawei.phoneservice.faq.base.util.FaqUiUtils;
import com.huawei.phoneservice.faq.base.util.SdkListener;
import com.huawei.phoneservice.faq.base.util.SdkListenerPoxy;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
public class FaqDispatchActivity extends Activity {
public ProgressDialog a;
public SdkListenerPoxy b;
public com.huawei.phoneservice.faq.dispatch.b c;
public class a extends SdkListenerPoxy {
public final com.huawei.phoneservice.faq.dispatch.b a;
public final Intent b;
public a(SdkListener sdkListener, com.huawei.phoneservice.faq.dispatch.b bVar, Intent intent) {
super(sdkListener);
this.a = bVar;
this.b = intent;
}
@Override
public void onSdkInitImpl(int i, int i2, String str) {
FaqLogger.print("FaqDispatchActivity", "result: " + i + " code: " + i2 + " msg: " + str);
FaqDispatchActivity.this.c(this.a, this.b);
}
}
public class b implements PrivilegedAction<Object> {
public final Method a;
public b(Method method) {
this.a = method;
}
@Override
public Object run() {
this.a.setAccessible(true);
return null;
}
}
public class c implements PrivilegedAction<Object> {
public final Field a;
public c(Field field) {
this.a = field;
}
@Override
public Object run() {
this.a.setAccessible(true);
return null;
}
}
public class d implements DialogInterface.OnCancelListener {
public d() {
}
@Override
public void onCancel(DialogInterface dialogInterface) {
FaqDispatchActivity.this.finish();
}
}
public void a() {
ProgressDialog progressDialog = this.a;
if (progressDialog == null || !progressDialog.isShowing()) {
return;
}
this.a.dismiss();
}
public final void c(com.huawei.phoneservice.faq.dispatch.b bVar, Intent intent) {
bVar.setSdkListenerPoxy(this.b);
if (bVar.dispatch(this, intent)) {
return;
}
FaqLogger.e("FaqDispatchActivity", "Do not support this URI");
finish();
}
public final void d(com.huawei.phoneservice.faq.dispatch.b bVar, Intent intent) {
if (FaqSdk.getSdk().initIsDone()) {
c(bVar, intent);
} else {
this.b = new a(FaqSdk.getSdk().getSdkListener(), bVar, intent);
FaqSdk.getSdk().setSdkListener(this.b);
}
}
public final int[] e() {
return new int[]{R.id.content};
}
public final boolean f() {
try {
Field declaredField = Activity.class.getDeclaredField("mActivityInfo");
AccessController.doPrivileged(new c(declaredField));
ActivityInfo activityInfo = (ActivityInfo) declaredField.get(this);
if (activityInfo != null) {
activityInfo.screenOrientation = -1;
}
declaredField.setAccessible(false);
return true;
} catch (RuntimeException e) {
e = e;
FaqLogger.e("FaqDispatchActivity", e.getMessage());
return false;
} catch (Exception e2) {
e = e2;
FaqLogger.e("FaqDispatchActivity", e.getMessage());
return false;
}
}
public final boolean g() {
boolean z;
Throwable e;
try {
TypedArray obtainStyledAttributes = obtainStyledAttributes((int[]) Class.forName("com.android.internal.R$styleable").getField("Window").get(null));
Method method = ActivityInfo.class.getMethod("isTranslucentOrFloating", TypedArray.class);
AccessController.doPrivileged(new b(method));
z = ((Boolean) method.invoke(null, obtainStyledAttributes)).booleanValue();
try {
method.setAccessible(false);
} catch (RuntimeException e2) {
e = e2;
FaqLogger.e("FaqDispatchActivity", e.getMessage());
return z;
} catch (Exception e3) {
e = e3;
FaqLogger.e("FaqDispatchActivity", e.getMessage());
return z;
}
} catch (RuntimeException | Exception e4) {
z = false;
e = e4;
}
return z;
}
public void h() {
if (isFinishing()) {
return;
}
ProgressDialog progressDialog = this.a;
if (progressDialog == null || !progressDialog.isShowing()) {
ProgressDialog progressDialog2 = new ProgressDialog(this);
this.a = progressDialog2;
progressDialog2.setMessage(getString(R$string.faq_sdk_common_loading));
this.a.setOnCancelListener(new d());
this.a.setCanceledOnTouchOutside(false);
this.a.setCancelable(true);
this.a.show();
if (getResources().getIdentifier("androidhwext:style/Theme.Emui", null, null) != 0) {
return;
}
this.a.setContentView(getLayoutInflater().inflate(R$layout.faq_sdk_progress_dialog, (ViewGroup) null));
Window window = this.a.getWindow();
if (window == null) {
return;
}
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = -1;
window.setAttributes(attributes);
window.setGravity(80);
attributes.y = 50;
attributes.dimAmount = 0.2f;
window.setAttributes(attributes);
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
ProgressDialog progressDialog = this.a;
if (progressDialog == null || !progressDialog.isShowing()) {
return;
}
a();
h();
}
@Override
public void onCreate(Bundle bundle) {
SdkAppInfo.initAppInfo(getApplication());
requestWindowFeature(1);
int i = Build.VERSION.SDK_INT;
if (i == 26 && g()) {
FaqLogger.i("FaqDispatchActivity", "onCreate fixOrientation when Oreo, result = " + f());
}
if (i >= 28) {
WindowManager.LayoutParams attributes = getWindow().getAttributes();
attributes.layoutInDisplayCutoutMode = 1;
getWindow().setAttributes(attributes);
}
Intent intent = getIntent();
if (FaqCommonUtils.isPad()) {
FaqUiUtils.setPadPadding(this, e());
}
super.onCreate(bundle);
com.huawei.phoneservice.faq.dispatch.b a2 = com.huawei.phoneservice.faq.dispatch.d.a(intent);
this.c = a2;
if (a2 == null) {
finish();
return;
}
d(a2, intent);
if (this.c.shouldShowUi(intent) && FaqConstants.MODULE_KNOWLEDGE.equals(FaqSdk.getSdk().getSdk(FaqConstants.FAQ_SHOW_PROGRESS))) {
h();
}
}
@Override
public void onDestroy() {
super.onDestroy();
com.huawei.phoneservice.faq.dispatch.b bVar = this.c;
if (bVar != null && !bVar.isReleasePoxy() && this.b != null) {
FaqSdk.getSdk().setSdkListener(this.b.getSdkListener());
}
a();
}
@Override
public void setRequestedOrientation(int i) {
if (Build.VERSION.SDK_INT == 26 && g()) {
return;
}
super.setRequestedOrientation(i);
}
}