package com.baidu.techain; import android.app.Activity; import android.app.AppOpsManager; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.graphics.Color; import android.graphics.drawable.GradientDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.view.MotionEvent; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import com.baidu.techain.h.a; import com.baidu.techain.i.c; import com.baidu.techain.i.p; import com.huawei.hms.push.constant.RemoteMessageConst; import com.meizu.cloud.pushsdk.constants.PushConstants; import com.umeng.analytics.pro.ak; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.HashMap; import org.json.JSONObject; public class NGuideActivity extends Activity { private TextView a; private TextView b; private TextView c; private LinearLayout d; private int e = -1; public boolean onTouchEvent(MotionEvent motionEvent) { return true; } public void onCreate(Bundle bundle) { super.onCreate(bundle); String action = getIntent().getAction(); if (TextUtils.isEmpty(action) || !action.equals("com.baidu.techain.notify.guide.aciton")) { a(4, 1); finish(); return; } String stringExtra = getIntent().getStringExtra(RemoteMessageConst.DATA); if (TextUtils.isEmpty(stringExtra)) { a(4, 2); finish(); return; } setTheme(16973835); requestWindowFeature(1); getWindow().setFlags(1024, 1024); getWindow().setBackgroundDrawableResource(R.drawable.n_gb); setContentView(R.layout.n_g); this.a = (TextView) findViewById(R.id.go_setting); this.d = (LinearLayout) findViewById(R.id.parent_id); this.c = (TextView) findViewById(R.id.dialog_title); this.b = (TextView) findViewById(R.id.dialog_content); this.a.setOnClickListener(new View.OnClickListener() { /* class com.baidu.techain.NGuideActivity.AnonymousClass1 */ public final void onClick(View view) { if (view.getId() == R.id.go_setting) { NGuideActivity.a(NGuideActivity.this); } } }); try { JSONObject jSONObject = new JSONObject(stringExtra); this.e = jSONObject.getInt("id"); String string = jSONObject.getString(ak.aH); String string2 = jSONObject.getString("c"); String string3 = jSONObject.getString("bcr"); String string4 = jSONObject.getString("bct"); String string5 = jSONObject.getString("bcc"); if (TextUtils.isEmpty(string3)) { string3 = "#FFDCDCDC"; } if (Build.VERSION.SDK_INT >= 16) { this.a.setBackground(a(string3)); } else { this.a.setBackgroundDrawable(a(string3)); } if (TextUtils.isEmpty(string5)) { string5 = "#FF000000"; } this.a.setTextColor(Color.parseColor(string5)); if (!TextUtils.isEmpty(string)) { this.c.setText(string); } if (!TextUtils.isEmpty(string4)) { this.a.setText(string4); } if (!TextUtils.isEmpty(string2)) { this.b.setText(string2); } a(1, 1); } catch (Throwable unused) { c.a(); a(4, 3); finish(); } } private static GradientDrawable a(String str) { GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setShape(0); gradientDrawable.setColor(Color.parseColor(str)); gradientDrawable.setCornerRadius(100.0f); return gradientDrawable; } /* access modifiers changed from: protected */ public void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); if (i == 1000) { boolean a2 = a(); a(3, 1); if (a2) { finish(); } } } private void a(int i, int i2) { try { HashMap hashMap = new HashMap(); hashMap.put(PushConstants.PUSH_TYPE_NOTIFY, Long.valueOf(System.currentTimeMillis())); hashMap.put("1", Integer.valueOf(i)); hashMap.put(PushConstants.PUSH_TYPE_UPLOAD_LOG, Integer.valueOf(a() ? 1 : 0)); hashMap.put(PushConstants.PUSH_FLYME_3_CHANGE_VERSION_START, "5|" + p.a(this)); hashMap.put(PushConstants.PUSH_TYPE_WITHDRAW_NOTIFICATION, Integer.valueOf(i2)); hashMap.put("5", Integer.valueOf(this.e)); c.a(this, "1025153", hashMap); } catch (Throwable unused) { c.a(); } } private boolean a() { try { if (Build.VERSION.SDK_INT >= 24) { Class<?> cls = Class.forName("android.app.NotificationManager"); Method a2 = a(cls, RemoteMessageConst.FROM, Context.class); a2.setAccessible(true); return ((Boolean) a(cls, "areNotificationsEnabled", new Class[0]).invoke(a2.invoke(null, this), new Object[0])).booleanValue(); } if (Build.VERSION.SDK_INT >= 19) { AppOpsManager appOpsManager = (AppOpsManager) getSystemService("appops"); ApplicationInfo applicationInfo = getApplicationInfo(); String packageName = getApplicationContext().getPackageName(); int i = applicationInfo.uid; try { Class<?> cls2 = Class.forName(AppOpsManager.class.getName()); return ((Integer) a(cls2, "checkOpNoThrow", new Class[]{Integer.TYPE, Integer.TYPE, String.class}).invoke(appOpsManager, new Object[]{Integer.valueOf(((Integer) a(cls2, "OP_POST_NOTIFICATION").get(Integer.class)).intValue()), Integer.valueOf(i), packageName})).intValue() == 0; } catch (Throwable unused) { c.a(); } } return true; } catch (Throwable unused2) { c.a(); } } private static Method a(Class<?> cls, String str, Class<?>... clsArr) throws NoSuchMethodException { try { Method method = cls.getMethod(str, clsArr); if (method != null) { return method; } } catch (Throwable unused) { c.a(); } while (cls != null) { try { Method declaredMethod = cls.getDeclaredMethod(str, clsArr); declaredMethod.setAccessible(true); return declaredMethod; } catch (Throwable unused2) { c.a(); cls = cls.getSuperclass(); } } throw new NoSuchMethodException(); } private static Field a(Class<?> cls, String str) throws NoSuchFieldException { try { Field field = cls.getField(str); if (field != null) { return field; } } catch (Throwable unused) { c.a(); } while (cls != null) { try { Field declaredField = cls.getDeclaredField(str); declaredField.setAccessible(true); return declaredField; } catch (Throwable unused2) { c.a(); cls = cls.getSuperclass(); } } throw new NoSuchFieldException(); } /* access modifiers changed from: protected */ public void onDestroy() { if (!a()) { a a2 = a.a(this); a2.b.putBoolean("k_n_g_t", true); if (Build.VERSION.SDK_INT >= 9) { a2.b.apply(); } else { a2.b.commit(); } } super.onDestroy(); } static /* synthetic */ void a(NGuideActivity nGuideActivity) { try { Intent intent = new Intent(); if ("meizu".equalsIgnoreCase(Build.BRAND) || "22c4185e".equalsIgnoreCase(Build.BRAND)) { intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.fromParts("package", nGuideActivity.getPackageName(), null)); } else if (Build.VERSION.SDK_INT >= 26) { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra("android.provider.extra.APP_PACKAGE", nGuideActivity.getApplicationContext().getPackageName()); } else if (Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT < 26) { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra("app_package", nGuideActivity.getPackageName()); intent.putExtra("app_uid", nGuideActivity.getApplicationInfo().uid); } else if (Build.VERSION.SDK_INT >= 9) { intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.fromParts("package", nGuideActivity.getPackageName(), null)); } else { intent.setAction("android.intent.action.VIEW"); intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails"); intent.putExtra("com.android.settings.ApplicationPkgName", nGuideActivity.getPackageName()); } nGuideActivity.startActivityForResult(intent, 1000); nGuideActivity.a(2, 1); } catch (Throwable unused) { c.a(); nGuideActivity.a(4, 4); } } }