package com.kuaishou.weapon.p0; import android.content.Context; import android.os.Build; import android.text.TextUtils; import com.kuaishou.weapon.p0.jni.Engine; import java.io.InputStreamReader; import java.io.LineNumberReader; import org.json.JSONObject; public class b1 { public JSONObject a; public int b; public b1(Context context, int i, String str, boolean z) { if (Engine.loadSuccess && z) { try { String pqr = Engine.getInstance(context).pqr(Integer.valueOf(l2.f).intValue(), 0, i, str); if (!TextUtils.isEmpty(pqr)) { this.a = new JSONObject(pqr); } } catch (Throwable unused) { } } } public static boolean a(Context context) { try { return Build.VERSION.SDK_INT < 23 || h.a(context, h.i) != -1; } catch (Exception unused) { return false; } } public int a() { return this.b; } public String a(String str) { JSONObject jSONObject = this.a; if (jSONObject == null) { return null; } try { return jSONObject.getString(str); } catch (Exception unused) { return null; } } public JSONObject b() { return this.a; } /* JADX WARNING: Can't wrap try/catch for region: R(7:0|(3:1|2|(10:3|4|5|6|(5:9|(2:11|(2:13|(3:17|(1:23)|24)))|25|(1:27)(1:50)|7)|51|28|(1:30)|31|32))|43|44|46|(1:48)(1:49)|(1:(0))) */ /* JADX WARNING: Code restructure failed: missing block: B:42:0x00b4, code lost: if (r6 != null) goto L_0x00b7; */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:43:0x00b7 */ /* JADX WARNING: Removed duplicated region for block: B:39:0x00af A[SYNTHETIC, Splitter:B:39:0x00af] */ public JSONObject c() { LineNumberReader lineNumberReader; InputStreamReader inputStreamReader; JSONObject jSONObject = new JSONObject(); this.b = 0; try { inputStreamReader = new InputStreamReader(Runtime.getRuntime().exec(j.a("2afcabd3eda8ae", "077f")).getInputStream()); try { lineNumberReader = new LineNumberReader(inputStreamReader); try { int i = 0; for (String readLine = lineNumberReader.readLine(); !TextUtils.isEmpty(readLine); readLine = lineNumberReader.readLine()) { if (readLine.contains("]:")) { String[] split = readLine.split("]:"); if (split.length == 2) { String trim = split[0].trim(); String trim2 = split[1].trim(); if (trim.length() > 2 && trim2.length() > 2) { String substring = trim.substring(1); String substring2 = trim2.substring(1, trim2.length() - 1); if (substring.startsWith("init.svc.") && (substring2.equals("stopped") || substring2.equals("running"))) { substring.replace("init.svc.", ""); } jSONObject.put(substring, substring2); } } } i++; if (i > 1300) { break; } } if (jSONObject.length() > 10) { jSONObject.put("n", jSONObject.length()); } inputStreamReader.close(); } catch (Throwable unused) { if (inputStreamReader != null) { try { inputStreamReader.close(); } catch (Throwable unused2) { } } } } catch (Throwable unused3) { lineNumberReader = null; if (inputStreamReader != null) { } } } catch (Throwable unused4) { lineNumberReader = null; inputStreamReader = null; if (inputStreamReader != null) { } } lineNumberReader.close(); if (jSONObject.length() > 10) { return jSONObject; } return null; } }