package com.flurry.sdk; import android.content.Context; import android.content.Intent; import android.net.Uri; import androidx.browser.customtabs.CustomTabsIntent; import com.flurry.android.FlurryPrivacySession; import com.flurry.sdk.dc; import com.flurry.sdk.de; import com.flurry.sdk.ec; import com.flurry.sdk.ew; import java.util.HashMap; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; public final class ef extends f { private static ef a = new ef(); private FlurryPrivacySession.Request b; private final o<ak> d = new o<ak>() { /* class com.flurry.sdk.ef.AnonymousClass3 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // com.flurry.sdk.o public final /* synthetic */ void a(ak akVar) { n.a().g.unsubscribe(ef.this.d); ef.a(ef.this); } }; private ef() { super("PrivacyManager", ew.a(ew.a.MISC)); } /* access modifiers changed from: private */ public static void b(Context context, FlurryPrivacySession.a aVar) { Intent intent = new Intent("android.intent.action.VIEW", aVar.a); intent.setFlags(268435456); context.startActivity(intent); } public static void a(FlurryPrivacySession.Request request) { ef efVar = a; efVar.b = request; efVar.runAsync(new ea() { /* class com.flurry.sdk.ef.AnonymousClass1 */ @Override // com.flurry.sdk.ea public final void a() throws Exception { if (n.a().g.c()) { ef.a(ef.this); return; } cx.a(3, "PrivacyManager", "Waiting for ID provider."); n.a().g.subscribe(ef.this.d); } }); } static /* synthetic */ void a(ef efVar) { efVar.runAsync(new ea() { /* class com.flurry.sdk.ef.AnonymousClass2 */ @Override // com.flurry.sdk.ea public final void a() throws Exception { Map b = ef.b(ef.this.b); dc dcVar = new dc(); dcVar.f = "https://api.login.yahoo.com/oauth2/device_session"; dcVar.g = de.a.kPost; dcVar.a("Content-Type", "application/json"); dcVar.b = (RequestObjectType) new JSONObject(b).toString(); dcVar.d = new ds(); dcVar.c = new ds(); dcVar.a = new dc.a<String, String>() { /* class com.flurry.sdk.ef.AnonymousClass2.AnonymousClass1 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.flurry.sdk.dc, java.lang.Object] */ @Override // com.flurry.sdk.dc.a public final /* synthetic */ void a(dc<String, String> dcVar, String str) { String str2 = str; try { int i = dcVar.m; if (i == 200) { JSONObject jSONObject = new JSONObject(str2); ef.a(ef.this, new FlurryPrivacySession.a(jSONObject.getString("device_session_id"), jSONObject.getLong("expires_in"), ef.this.b)); ef.this.b.callback.success(); return; } cx.e("PrivacyManager", "Error in getting privacy dashboard url. Error code = ".concat(String.valueOf(i))); ef.this.b.callback.failure(); } catch (JSONException e) { cx.e("PrivacyManager", "Error in getting privacy dashboard url. ", e); ef.this.b.callback.failure(); } } }; cs.a().a(ef.this, dcVar); } }); } static /* synthetic */ Map b(FlurryPrivacySession.Request request) { HashMap hashMap = new HashMap(); hashMap.put("device_verifier", request.verifier); HashMap hashMap2 = new HashMap(); ak a2 = n.a().g.a(); String str = a2.a().get(al.AndroidAdvertisingId); if (str != null) { hashMap2.put("gpaid", str); } String str2 = a2.a().get(al.DeviceId); if (str2 != null) { hashMap2.put("andid", str2); } hashMap.putAll(hashMap2); HashMap hashMap3 = new HashMap(); byte[] bytes = n.a().g.a().a().get(al.AndroidInstallationId).getBytes(); if (bytes != null) { hashMap3.put("flurry_guid", dy.a(bytes)); } hashMap3.put("flurry_project_api_key", n.a().h.a); hashMap.putAll(hashMap3); Context context = request.context; HashMap hashMap4 = new HashMap(); hashMap4.put("src", "flurryandroidsdk"); hashMap4.put("srcv", "13.1.0"); hashMap4.put("appsrc", context.getPackageName()); bl.a(); hashMap4.put("appsrcv", bl.a(context)); hashMap.putAll(hashMap4); return hashMap; } static /* synthetic */ void a(ef efVar, final FlurryPrivacySession.a aVar) { Context a2 = b.a(); if (ec.a(a2)) { ec.a(a2, new CustomTabsIntent.Builder().setShowTitle(true).build(), Uri.parse(aVar.a.toString()), new ec.a() { /* class com.flurry.sdk.ef.AnonymousClass4 */ @Override // com.flurry.sdk.ec.a public final void a(Context context) { ef.b(context, aVar); } }); } else { b(a2, aVar); } } }