package com.umeng.commonsdk.statistics.idtracking; import android.content.Context; import android.content.SharedPreferences; import android.text.TextUtils; import com.umeng.commonsdk.statistics.internal.PreferenceWrapper; import com.yanzhenjie.kalle.Headers; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLEncoder; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSession; import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; /* compiled from: UUIDTracker */ public class s extends a { /* renamed from: a reason: collision with root package name */ private static final String f6409a = "uuid"; private static final String e = "yosuid"; private static final String f = "23346339"; private Context b = null; private String c = null; private String d = null; public s(Context context) { super(f6409a); this.b = context; this.c = null; this.d = null; } public static String a(String str, String str2) { try { return (String) Class.forName("android.os.SystemProperties").getMethod("get", String.class, String.class).invoke(null, str, str2); } catch (Exception unused) { return str2; } } /* JADX DEBUG: Failed to insert an additional move for type inference into block B:37:? */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r3v23 */ /* JADX WARNING: Code restructure failed: missing block: B:51:0x00f0, code lost: if (r1 != null) goto L_0x0127; */ /* JADX WARNING: Code restructure failed: missing block: B:52:0x00f3, code lost: r7 = th; */ /* JADX WARNING: Code restructure failed: missing block: B:53:0x00f4, code lost: r3 = null; r0 = r2; */ /* JADX WARNING: Code restructure failed: missing block: B:82:0x0125, code lost: if (r1 == null) goto L_0x012a; */ /* JADX WARNING: Code restructure failed: missing block: B:84:0x0127, code lost: r1.disconnect(); */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Removed duplicated region for block: B:44:0x00e4 A[SYNTHETIC, Splitter:B:44:0x00e4] */ /* JADX WARNING: Removed duplicated region for block: B:48:0x00eb A[SYNTHETIC, Splitter:B:48:0x00eb] */ /* JADX WARNING: Removed duplicated region for block: B:52:0x00f3 A[ExcHandler: all (th java.lang.Throwable), Splitter:B:15:0x009a] */ /* JADX WARNING: Removed duplicated region for block: B:63:0x0106 A[SYNTHETIC, Splitter:B:63:0x0106] */ /* JADX WARNING: Removed duplicated region for block: B:67:0x010d A[SYNTHETIC, Splitter:B:67:0x010d] */ /* JADX WARNING: Removed duplicated region for block: B:71:0x0114 A[SYNTHETIC, Splitter:B:71:0x0114] */ /* JADX WARNING: Removed duplicated region for block: B:75:0x011b */ /* JADX WARNING: Removed duplicated region for block: B:80:0x0122 A[SYNTHETIC, Splitter:B:80:0x0122] */ private String b(String str) { HttpsURLConnection httpsURLConnection; Throwable th; BufferedReader bufferedReader; HttpsURLConnection httpsURLConnection2; InputStream inputStream; BufferedReader bufferedReader2; BufferedReader bufferedReader3; HttpsURLConnection httpsURLConnection3; BufferedReader bufferedReader4; this.d = a("ro.yunos.openuuid", ""); if (!TextUtils.isEmpty(this.d)) { return this.d; } this.c = a("ro.aliyun.clouduuid", ""); if (TextUtils.isEmpty(this.c)) { this.c = a("ro.sys.aliyun.clouduuid", ""); } if (!TextUtils.isEmpty(this.c)) { DataOutputStream dataOutputStream = null; InputStream inputStream2 = null; r0 = null; dataOutputStream = null; DataOutputStream dataOutputStream2 = null; try { httpsURLConnection = (HttpsURLConnection) new URL("https://cmnsguider.yunos.com:443/genDeviceToken").openConnection(); try { httpsURLConnection.setConnectTimeout(30000); httpsURLConnection.setReadTimeout(30000); httpsURLConnection.setRequestMethod("POST"); httpsURLConnection.setDoInput(true); httpsURLConnection.setDoOutput(true); httpsURLConnection.setUseCaches(false); httpsURLConnection.setRequestProperty("Content-Type", Headers.VALUE_APPLICATION_URLENCODED); httpsURLConnection.setHostnameVerifier(new HostnameVerifier() { /* class com.umeng.commonsdk.statistics.idtracking.s.AnonymousClass1 */ public boolean verify(String str, SSLSession sSLSession) { return new BrowserCompatHostnameVerifier().verify("cmnsguider.yunos.com", sSLSession); } }); String str2 = "appKey=" + URLEncoder.encode("23338940", "UTF-8") + "&uuid=" + URLEncoder.encode("FC1FE84794417B1BEF276234F6FB4E63", "UTF-8"); DataOutputStream dataOutputStream3 = new DataOutputStream(httpsURLConnection.getOutputStream()); try { dataOutputStream3.writeBytes(str2); dataOutputStream3.flush(); if (httpsURLConnection.getResponseCode() == 200) { InputStream inputStream3 = httpsURLConnection.getInputStream(); try { bufferedReader3 = new BufferedReader(new InputStreamReader(inputStream3)); } catch (Exception unused) { bufferedReader3 = null; } catch (Throwable th2) { httpsURLConnection3 = httpsURLConnection; inputStream = inputStream3; th = th2; bufferedReader4 = null; dataOutputStream2 = dataOutputStream3; httpsURLConnection2 = httpsURLConnection3; bufferedReader = bufferedReader4; if (dataOutputStream2 != null) { } if (bufferedReader != null) { } if (inputStream != null) { } if (httpsURLConnection2 != null) { } throw th; } try { StringBuffer stringBuffer = new StringBuffer(); while (true) { String readLine = bufferedReader3.readLine(); if (readLine == null) { break; } stringBuffer.append(readLine); } this.d = stringBuffer.toString(); } catch (Exception unused2) { } catch (Throwable th3) { httpsURLConnection3 = httpsURLConnection; inputStream = inputStream3; th = th3; bufferedReader4 = bufferedReader3; dataOutputStream2 = dataOutputStream3; httpsURLConnection2 = httpsURLConnection3; bufferedReader = bufferedReader4; if (dataOutputStream2 != null) { try { dataOutputStream2.close(); } catch (Exception unused3) { } } if (bufferedReader != null) { try { bufferedReader.close(); } catch (Exception unused4) { } } if (inputStream != null) { try { inputStream.close(); } catch (Exception unused5) { } } if (httpsURLConnection2 != null) { httpsURLConnection2.disconnect(); } throw th; } inputStream2 = inputStream3; bufferedReader2 = bufferedReader3; dataOutputStream3.close(); if (bufferedReader2 != null) { try { bufferedReader2.close(); } catch (Exception unused6) { } } if (inputStream2 != null) { try { inputStream2.close(); } catch (Exception unused7) { } } } bufferedReader2 = null; try { dataOutputStream3.close(); } catch (Exception unused8) { } if (bufferedReader2 != null) { } if (inputStream2 != null) { } } catch (Exception unused9) { dataOutputStream = dataOutputStream3; if (dataOutputStream != null) { } } catch (Throwable th4) { } } catch (Exception unused10) { if (dataOutputStream != null) { try { dataOutputStream.close(); } catch (Exception unused11) { } } } catch (Throwable th5) { th = th5; InputStream inputStream4 = null; httpsURLConnection2 = httpsURLConnection; inputStream = inputStream4; bufferedReader = inputStream4; if (dataOutputStream2 != null) { } if (bufferedReader != null) { } if (inputStream != null) { } if (httpsURLConnection2 != null) { } throw th; } } catch (Exception unused12) { httpsURLConnection = null; if (dataOutputStream != null) { } } catch (Throwable th6) { th = th6; inputStream = null; httpsURLConnection2 = null; bufferedReader = null; if (dataOutputStream2 != null) { } if (bufferedReader != null) { } if (inputStream != null) { } if (httpsURLConnection2 != null) { } throw th; } } return this.d; } @Override // com.umeng.commonsdk.statistics.idtracking.a public String f() { SharedPreferences sharedPreferences; SharedPreferences.Editor edit; try { if (TextUtils.isEmpty(a("ro.yunos.version", "")) || this.b == null || (sharedPreferences = PreferenceWrapper.getDefault(this.b)) == null) { return null; } String string = sharedPreferences.getString(e, ""); if (!TextUtils.isEmpty(string)) { return string; } this.d = b(f); if (!(TextUtils.isEmpty(this.d) || this.b == null || sharedPreferences == null || (edit = sharedPreferences.edit()) == null)) { edit.putString(e, this.d).commit(); } return this.d; } catch (Exception unused) { return null; } } }