package wh2; import android.annotation.SuppressLint; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.text.TextUtils; import android.util.Log; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.google.gson.Gson; import com.meizu.cloud.pushsdk.notification.model.AdvanceSetting; import com.xingin.trackview.view.TrackerData; import com.xingin.trackview.view.TrackerDisplayService; import dw2.r; import dw2.t; import dw2.u; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import kotlin.Metadata; import kotlin.TypeCastException; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import wh2.c; import wh2.j; @Metadata(bv = {}, d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u000e\u0018\u00002\u00020\u0001:\u0002\u0016\u0017B\t\b\u0002¢\u0006\u0004\b\u0014\u0010\u0015J\b\u0010\u0003\u001a\u00020\u0002H\u0002J\u000e\u0010\u0006\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004J\u0016\u0010\t\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u0007J\u001c\u0010\r\u001a\u00020\u00022\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\u0010\f\u001a\u0004\u0018\u00010\nH\u0007J&\u0010\u0010\u001a\u00020\u00022\b\u0010\u000e\u001a\u0004\u0018\u00010\n2\b\u0010\u000f\u001a\u0004\u0018\u00010\n2\b\u0010\b\u001a\u0004\u0018\u00010\nH\u0007J\u0006\u0010\u0011\u001a\u00020\u0002J\u000e\u0010\u0012\u001a\u00020\u00022\u0006\u0010\b\u001a\u00020\u0007J\u0006\u0010\u0013\u001a\u00020\u0002¨\u0006\u0018"}, d2 = {"Lwh2/f;", "", "", "r", "Landroid/content/Context;", "context", com.igexin.push.core.d.c.f25536c, "", "displayType", "q", "", "trackerResponse", "trackerType", "m", "tag", "logContent", GoogleApiAvailabilityLight.TRACKING_SOURCE_NOTIFICATION, "s", "t", "o", "<init>", "()V", "a", "b", "tracker_view_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public final class f { /* renamed from: o reason: collision with root package name */ public static final a f149551o = new a(null); /* renamed from: a reason: collision with root package name */ public final ExecutorService f149552a; /* renamed from: b reason: collision with root package name */ public final ArrayList<TrackerData> f149553b; /* renamed from: c reason: collision with root package name */ public Context f149554c; /* renamed from: d reason: collision with root package name */ public int f149555d; /* renamed from: e reason: collision with root package name */ public final Gson f149556e; /* renamed from: f reason: collision with root package name */ public final String f149557f; /* renamed from: g reason: collision with root package name */ public volatile boolean f149558g; /* renamed from: h reason: collision with root package name */ public c f149559h; /* renamed from: i reason: collision with root package name */ public boolean f149560i; /* renamed from: j reason: collision with root package name */ public boolean f149561j; /* renamed from: k reason: collision with root package name */ public final String f149562k; /* renamed from: l reason: collision with root package name */ public final String f149563l; /* renamed from: m reason: collision with root package name */ public final TrackerData f149564m; /* renamed from: n reason: collision with root package name */ public final i f149565n; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0004\u0010\u0005J\u0006\u0010\u0003\u001a\u00020\u0002¨\u0006\u0006"}, d2 = {"Lwh2/f$a;", "", "Lwh2/f;", "a", "<init>", "()V", "tracker_view_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class a { public a() { } public final f a() { return b.f149567b.a(); } public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) { this(); } } @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\bÂ\u0002\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0007\u0010\bR\u0017\u0010\u0003\u001a\u00020\u00028\u0006¢\u0006\f\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, d2 = {"Lwh2/f$b;", "", "Lwh2/f;", "INSTANCE", "Lwh2/f;", "a", "()Lwh2/f;", "<init>", "()V", "tracker_view_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class b { /* renamed from: a reason: collision with root package name */ public static final f f149566a = new f(null); /* renamed from: b reason: collision with root package name */ public static final b f149567b = new b(); public final f a() { return f149566a; } } @Metadata(bv = {}, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\u0010\u0007\u001a\u00020\u00042\u0014\u0010\u0003\u001a\u0010\u0012\f\u0012\n \u0002*\u0004\u0018\u00010\u00010\u00010\u0000H\n¢\u0006\u0004\b\u0005\u0010\u0006"}, d2 = {"Ldw2/t;", "Lcom/xingin/trackview/view/TrackerData;", "kotlin.jvm.PlatformType", "subscriber", "", "subscribe", "(Ldw2/t;)V", "<anonymous>"}, k = 3, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class c<T> implements u<T> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ f f149568a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f149569b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ String f149570c; public c(f fVar, String str, String str2) { this.f149568a = fVar; this.f149569b = str; this.f149570c = str2; } @Override // dw2.u public final void subscribe(t<TrackerData> tVar) { Intrinsics.checkParameterIsNotNull(tVar, "subscriber"); TrackerData trackerData = new TrackerData("", "", "", "", 1, false, true, ""); a aVar = (a) this.f149568a.f149556e.fromJson(this.f149569b, (Class) a.class); StringBuilder sb3 = new StringBuilder(); Intrinsics.checkExpressionValueIsNotNull(aVar, "trackResponse"); sb3.append(aVar.e()); sb3.append("\n"); sb3.append("点位ID:"); sb3.append(aVar.c()); sb3.append("\n"); sb3.append(aVar.a()); String sb4 = sb3.toString(); String f14 = aVar.f(); String b14 = aVar.b(); String d14 = aVar.d(); trackerData.p(sb4); if (f14 == null) { f14 = this.f149568a.f149562k; } trackerData.l(f14); if (b14 == null) { b14 = this.f149568a.f149562k; } trackerData.i(b14); String format = SimpleDateFormat.getTimeInstance().format(Long.valueOf(System.currentTimeMillis())); Intrinsics.checkExpressionValueIsNotNull(format, "SimpleDateFormat.getTime…stem.currentTimeMillis())"); trackerData.m(format); trackerData.r(aVar.g()); String str = this.f149570c; if (str == null) { str = ""; } trackerData.k(str); if (!aVar.g() && !this.f149568a.f149557f.equals(d14)) { vh2.b.e().g(aVar.e(), aVar.a(), aVar.f(), aVar.b()); } tVar.a(trackerData); tVar.onComplete(); } } @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lcom/xingin/trackview/view/TrackerData;", "kotlin.jvm.PlatformType", "trackerData", "", "a", "(Lcom/xingin/trackview/view/TrackerData;)V"}, k = 3, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class d<T> implements iw2.g<TrackerData> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ f f149571a; public d(f fVar) { this.f149571a = fVar; } /* renamed from: a */ public final void accept(TrackerData trackerData) { if (!this.f149571a.f149558g || this.f149571a.f149559h == null) { this.f149571a.f149553b.add(0, trackerData); this.f149571a.f149561j = false; return; } try { c cVar = this.f149571a.f149559h; if (cVar != null) { cVar.s0(trackerData); } this.f149571a.r(); } catch (RemoteException e14) { e14.printStackTrace(); } } } @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"", "kotlin.jvm.PlatformType", AdvanceSetting.NETWORK_TYPE, "", "a", "(Ljava/lang/Throwable;)V"}, k = 3, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class e<T> implements iw2.g<Throwable> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ f f149572a; public e(f fVar) { this.f149572a = fVar; } /* renamed from: a */ public final void accept(Throwable th3) { th3.printStackTrace(); this.f149572a.f149553b.add(0, this.f149572a.f149564m); } } @Metadata(bv = {}, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\u0010\u0007\u001a\u00020\u00042\u0014\u0010\u0003\u001a\u0010\u0012\f\u0012\n \u0002*\u0004\u0018\u00010\u00010\u00010\u0000H\n¢\u0006\u0004\b\u0005\u0010\u0006"}, d2 = {"Ldw2/t;", "Lcom/xingin/trackview/view/TrackerData;", "kotlin.jvm.PlatformType", "subscriber", "", "subscribe", "(Ldw2/t;)V", "<anonymous>"}, k = 3, mv = {1, 4, 0}) /* renamed from: wh2.f$f reason: collision with other inner class name */ /* compiled from: TrackerDisplayManager.kt */ public static final class C2400f<T> implements u<T> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ String f149573a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f149574b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ String f149575c; public C2400f(String str, String str2, String str3) { this.f149573a = str; this.f149574b = str2; this.f149575c = str3; } @Override // dw2.u public final void subscribe(t<TrackerData> tVar) { Intrinsics.checkParameterIsNotNull(tVar, "subscriber"); String str = this.f149573a; if (str == null) { str = ""; } TrackerData trackerData = new TrackerData("", "", "", "", 3, false, true, str); StringBuilder sb3 = new StringBuilder(); sb3.append(this.f149574b); sb3.append("\n"); String str2 = this.f149575c; if (str2 == null) { Intrinsics.throwNpe(); } int length = this.f149575c.length() / 6; if (str2 != null) { String substring = str2.substring(length); Intrinsics.checkExpressionValueIsNotNull(substring, "(this as java.lang.String).substring(startIndex)"); sb3.append(substring); String sb4 = sb3.toString(); Intrinsics.checkExpressionValueIsNotNull(sb4, "stringBuilderTitle.toString()"); trackerData.p(sb4); String str3 = this.f149574b + "\n============================\n" + this.f149575c; Intrinsics.checkExpressionValueIsNotNull(str3, "stringBuilderDesc.toString()"); trackerData.l(str3); String format = SimpleDateFormat.getTimeInstance().format(Long.valueOf(System.currentTimeMillis())); Intrinsics.checkExpressionValueIsNotNull(format, "SimpleDateFormat.getTime…stem.currentTimeMillis())"); trackerData.m(format); tVar.a(trackerData); tVar.onComplete(); return; } throw new TypeCastException("null cannot be cast to non-null type java.lang.String"); } } @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lcom/xingin/trackview/view/TrackerData;", "kotlin.jvm.PlatformType", "trackerData", "", "a", "(Lcom/xingin/trackview/view/TrackerData;)V"}, k = 3, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class g<T> implements iw2.g<TrackerData> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ f f149576a; public g(f fVar) { this.f149576a = fVar; } /* renamed from: a */ public final void accept(TrackerData trackerData) { if (!this.f149576a.f149558g || this.f149576a.f149559h == null) { this.f149576a.f149553b.add(0, trackerData); this.f149576a.f149561j = false; return; } try { this.f149576a.r(); c cVar = this.f149576a.f149559h; if (cVar != null) { cVar.s0(trackerData); } } catch (RemoteException e14) { e14.printStackTrace(); } } } @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u00032\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u0000H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"", "kotlin.jvm.PlatformType", AdvanceSetting.NETWORK_TYPE, "", "a", "(Ljava/lang/Throwable;)V"}, k = 3, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class h<T> implements iw2.g<Throwable> { /* renamed from: a reason: collision with root package name */ public static final h f149577a = new h(); /* renamed from: a */ public final void accept(Throwable th3) { th3.printStackTrace(); } } @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0016J\u0010\u0010\b\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\t"}, d2 = {"wh2/f$i", "Landroid/content/ServiceConnection;", "Landroid/content/ComponentName;", "name", "Landroid/os/IBinder;", "service", "", "onServiceConnected", "onServiceDisconnected", "tracker_view_library_release"}, k = 1, mv = {1, 4, 0}) /* compiled from: TrackerDisplayManager.kt */ public static final class i implements ServiceConnection { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ f f149578a; /* JADX WARN: Incorrect args count in method signature: ()V */ public i(f fVar) { this.f149578a = fVar; } public void onServiceConnected(ComponentName componentName, IBinder iBinder) { Intrinsics.checkParameterIsNotNull(componentName, "name"); Intrinsics.checkParameterIsNotNull(iBinder, "service"); Log.d("TrackerDisplayManager", "onServiceConnected====>"); this.f149578a.f149558g = true; this.f149578a.f149559h = c.a.T(iBinder); f fVar = this.f149578a; fVar.t(fVar.f149555d); } public void onServiceDisconnected(ComponentName componentName) { Intrinsics.checkParameterIsNotNull(componentName, "name"); Log.d("TrackerDisplayManager", "onServiceDisconnected====>"); this.f149578a.f149558g = false; this.f149578a.f149559h = null; } } public f() { this.f149552a = Executors.newSingleThreadExecutor(); this.f149553b = new ArrayList<>(); this.f149555d = 1; this.f149556e = new Gson(); this.f149557f = "NOT_POP"; this.f149562k = "No Msg"; this.f149563l = "The sdk does not have the permission to show a floating window."; this.f149564m = new TrackerData("解析失败(请联系后台)", "", "", "", 1, false, false, ""); this.f149565n = new i(this); } @SuppressLint({"CheckResult"}) public final void m(String str, String str2) { if (this.f149554c != null && !TextUtils.isEmpty(str)) { j b14 = j.f149666a.b(); Context context = this.f149554c; if (context == null) { throw new IllegalArgumentException("the context cannot be null.".toString()); } else if (b14.c(context)) { r.O(new c(this, str, str2)).x1(cx2.a.b(this.f149552a)).W0(gw2.a.a()).t1(new d(this), new e(this)); } } } @SuppressLint({"CheckResult"}) public final void n(String str, String str2, String str3) { if (this.f149554c != null && !TextUtils.isEmpty(str2)) { j b14 = j.f149666a.b(); Context context = this.f149554c; if (context == null) { throw new IllegalArgumentException("the context cannot be null.".toString()); } else if (b14.c(context)) { r.O(new C2400f(str3, str, str2)).x1(cx2.a.b(this.f149552a)).W0(gw2.a.a()).t1(new g(this), h.f149577a); } } } public final void o() { c cVar; if (this.f149558g && (cVar = this.f149559h) != null && this.f149560i) { if (cVar != null) { try { cVar.y0(); } catch (RemoteException e14) { e14.printStackTrace(); return; } } this.f149560i = false; } } public final void p(Context context) { Intrinsics.checkParameterIsNotNull(context, "context"); q(context, 1); } public final void q(Context context, int i10) { Context context2; Intrinsics.checkParameterIsNotNull(context, "context"); this.f149554c = context; this.f149555d = i10; j.a aVar = j.f149666a; if (!aVar.b().c(context)) { aVar.b().b(context); } else if ((!this.f149558g || this.f149559h == null) && (context2 = this.f149554c) != null) { context2.bindService(new Intent(this.f149554c, TrackerDisplayService.class), this.f149565n, 1); } } public final void r() throws RemoteException { if (!this.f149561j && this.f149553b.size() > 0) { int size = this.f149553b.size(); for (int i10 = 0; i10 < size; i10++) { c cVar = this.f149559h; if (cVar != null) { cVar.s0(this.f149553b.get(i10)); } } this.f149553b.clear(); this.f149561j = false; } } public final void s() { t(1); } public final void t(int i10) { c cVar; if (this.f149558g && (cVar = this.f149559h) != null && !this.f149560i) { if (cVar != null) { try { cVar.h1(i10); } catch (RemoteException e14) { e14.printStackTrace(); return; } } r(); this.f149560i = true; } } public /* synthetic */ f(DefaultConstructorMarker defaultConstructorMarker) { this(); } }