Warkop v5.73.0版本的 MD5 值为:a4330ec2d6f5e146f59fc7622f3cdb45
以下内容为反编译后的 u1.java 源代码,内容仅作参考
package com.zendrive.sdk.i;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.zendrive.sdk.ZendriveBroadcastReceiver;
import com.zendrive.sdk.ZendriveDriveDetectionMode;
import com.zendrive.sdk.ZendriveEventType;
import com.zendrive.sdk.ZendriveRegion;
import com.zendrive.sdk.ZendriveVehicleType;
import com.zendrive.sdk.data.InsurancePeriodEvent;
import com.zendrive.sdk.data.feedback.EventFeedback;
import com.zendrive.sdk.data.feedback.TripFeedback;
import com.zendrive.sdk.i.k4;
import com.zendrive.sdk.i.o;
import com.zendrive.sdk.manager.GeofenceManager;
import com.zendrive.sdk.manager.ServiceManagerFactory;
import com.zendrive.sdk.receiver.SetupReceiver;
import com.zendrive.sdk.services.TripService;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import java.util.UUID;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import sinet.startup.inDriver.core.data.data.NotificationData;
public abstract class u1 {
private static ServiceManagerFactory f42005a;
@SuppressLint({"StaticFieldLeak"})
protected static u1 f42006b;
public static final Object f42007c = new Object();
public static final Object f42008d = new Object();
public static final Object f42009e = new Object();
public static final Object f42010f = new Object();
static class a extends p {
final q6 f42011b;
final String f42012c;
final Context f42013d;
a(com.zendrive.sdk.w wVar, q6 q6Var, String str, Context context) {
super(wVar, null);
this.f42011b = q6Var;
this.f42012c = str;
this.f42013d = context;
}
@Override
public com.zendrive.sdk.x a() {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$10", "doOnHandler", "Calling startDriveWithInsurance%s with %s", this.f42011b.name(), this.f42012c);
if (!u1.i(this.f42013d)) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
Context context = this.f42013d;
int ordinal = this.f42011b.ordinal();
if (ordinal != 1) {
if (ordinal != 2) {
if (ordinal == 3) {
i3.a(context, "startDriveWithPeriod3");
}
} else {
i3.a(context, "startDriveWithPeriod2");
}
} else {
i3.a(context, "startDriveWithPeriod1");
}
String str = this.f42012c;
if (str != null && !"".equals(str)) {
if (!com.zendrive.sdk.utilities.m.d0(this.f42012c)) {
com.zendrive.sdk.x a16 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_TRACKING_ID, "Not a valid tracking id. Please look at Zendrive.isValidInputParameter(String) for list of disallowed characters in tracking id.");
com.zendrive.sdk.utilities.m.F(a16);
return a16;
}
com.zendrive.sdk.i.w a17 = com.zendrive.sdk.i.w.a(this.f42013d);
String str2 = this.f42012c;
String substring = str2.substring(0, Math.min(str2.length(), 64));
if (a17.s() == this.f42011b && substring.equals(a17.Q())) {
return com.zendrive.sdk.x.b();
}
com.zendrive.sdk.x a18 = u1.a(this.f42013d, this.f42011b, this.f42012c);
if (!a18.e()) {
return a18;
}
u1 d15 = u1.d(this.f42013d);
if (d15 != null) {
return d15.b(this.f42013d, this.f42012c);
}
com.zendrive.sdk.x a19 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a19);
return a19;
}
com.zendrive.sdk.x a25 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_TRACKING_ID, "Tracking id of a drive cannot be null or empty.");
com.zendrive.sdk.utilities.m.F(a25);
return a25;
}
}
static class a0 implements Runnable {
final com.zendrive.sdk.w f42014c;
a0(com.zendrive.sdk.w wVar) {
this.f42014c = wVar;
}
@Override
public void run() {
this.f42014c.onCompletion(com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_CONFIGURATION_ERROR, "Cannot perform this operation as ZendriveConfiguration is null"));
}
}
static class b extends p {
final Context f42015b;
b(com.zendrive.sdk.w wVar, Context context) {
super(wVar, null);
this.f42015b = context;
}
@Override
public com.zendrive.sdk.x a() {
if (!u1.i(this.f42015b)) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call stopInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42015b, "stopPeriod");
return u1.l(this.f42015b);
}
}
static class b0 implements Runnable {
final com.zendrive.sdk.w f42016c;
b0(com.zendrive.sdk.w wVar) {
this.f42016c = wVar;
}
@Override
public void run() {
this.f42016c.onCompletion(com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_DEBUG_UPLOAD_ERROR, "Cannot upload ZendriveData on device as ZendriveNotificationContainer is null."));
}
}
static class c extends p {
final String f42017b;
final Context f42018c;
c(com.zendrive.sdk.w wVar, String str, Context context) {
super(wVar, null);
this.f42017b = str;
this.f42018c = context;
}
@Override
public com.zendrive.sdk.x a() {
String str = this.f42017b;
if (str == null) {
str = "com.zendrive.sdk.internal";
}
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$12", "doOnHandler", "Calling startDrive with %s", str);
u1 d15 = u1.d(this.f42018c);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startDrive before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42018c, "startDrive");
return d15.b(this.f42018c, str);
}
}
static class c0 implements Runnable {
final com.zendrive.sdk.w f42019c;
c0(com.zendrive.sdk.w wVar) {
this.f42019c = wVar;
}
@Override
public void run() {
this.f42019c.onCompletion(com.zendrive.sdk.x.a(com.zendrive.sdk.n.UNSUPPORTED_OPERATION, "Operation not supported by ZendriveSDK-testing library"));
}
}
static class d extends p {
final Context f42020b;
d(com.zendrive.sdk.w wVar, Context context) {
super(wVar, null);
this.f42020b = context;
}
@Override
public com.zendrive.sdk.x a() {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$13", "doOnHandler", "Calling stopManualDrive", new Object[0]);
u1 d15 = u1.d(this.f42020b);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call stopManualDrive before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42020b, "stopManualDrive");
return d15.m(this.f42020b);
}
}
static class d0 extends p {
final Context f42021b;
d0(com.zendrive.sdk.w wVar, Context context) {
super(wVar, null);
this.f42021b = context;
}
@Override
public com.zendrive.sdk.x a() {
u1 u1Var;
u1 d15 = u1.d(this.f42021b);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$3", "doOnHandler", "Zendrive: Calling teardown on handler from public api", new Object[0]);
if (d15 != null) {
if (!com.zendrive.sdk.utilities.k.c(this.f42021b)) {
Context context = this.f42021b;
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
com.zendrive.sdk.l j15 = a15.j();
if (j15 == null) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "instrumentTeardownApi", "Skipping teardown instrumentation. Zendrive configuration is null.", new Object[0]);
} else if (!((HashSet) com.zendrive.sdk.cdetectorlib.h.h(a15.O().f41727d)).contains("SdkMetric")) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "instrumentTeardownApi", "Sdk Metric Debug Data Type not enabled, skipping instrumenting teardown api", new Object[0]);
} else {
String f15 = j15.f();
JSONArray jSONArray = new JSONArray();
try {
long a16 = com.zendrive.sdk.utilities.q0.a();
JSONObject a17 = com.zendrive.sdk.manager.k.a(a15, a16, a16);
t5 t5Var = t5.PublicApiInstrumentation;
a17.put("metricType", 14);
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
u1Var = d15;
try {
jSONObject2.put("total", 1);
jSONObject.put("teardown", jSONObject2);
k4.b bVar = new k4.b("SdkMetric", a17, jSONObject);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put(NotificationData.JSON_TYPE, bVar.d());
jSONObject3.put("key", bVar.a());
jSONObject3.put(AppMeasurementSdk.ConditionalUserProperty.VALUE, bVar.e());
jSONArray.put(jSONObject3);
if (com.zendrive.sdk.utilities.q.b(context)) {
com.zendrive.sdk.utilities.y.f(t5Var.toString(), context, "/v1/debug_data?encoding_format=json", jSONArray, f15, 5000);
}
} catch (JSONException e15) {
e = e15;
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "instrumentTeardownApi", "Skipping teardown instrumentation. Unable to create json: %s", e.getMessage());
StringBuilder sb5 = new StringBuilder();
sb5.append("Collecting SDKHealth point on: ");
o5 o5Var = o5.Teardown;
sb5.append(o5Var);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$3", "doOnHandler", sb5.toString(), new Object[0]);
com.zendrive.sdk.utilities.c0.a(this.f42021b, o5Var);
return u1Var.o(this.f42021b.getApplicationContext());
}
} catch (JSONException e16) {
e = e16;
u1Var = d15;
}
StringBuilder sb52 = new StringBuilder();
sb52.append("Collecting SDKHealth point on: ");
o5 o5Var2 = o5.Teardown;
sb52.append(o5Var2);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$3", "doOnHandler", sb52.toString(), new Object[0]);
com.zendrive.sdk.utilities.c0.a(this.f42021b, o5Var2);
}
u1Var = d15;
StringBuilder sb522 = new StringBuilder();
sb522.append("Collecting SDKHealth point on: ");
o5 o5Var22 = o5.Teardown;
sb522.append(o5Var22);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$3", "doOnHandler", sb522.toString(), new Object[0]);
com.zendrive.sdk.utilities.c0.a(this.f42021b, o5Var22);
} else {
u1Var = d15;
}
return u1Var.o(this.f42021b.getApplicationContext());
}
return com.zendrive.sdk.x.b();
}
}
static class e implements Runnable {
final Context f42022c;
e(Context context) {
this.f42022c = context;
}
@Override
public void run() {
i3.a(this.f42022c, "resumeAutoTracking");
}
}
static class e0 extends p {
final String f42023b;
final ik.a f42024c;
final Context f42025d;
e0(com.zendrive.sdk.w wVar, String str, ik.a aVar, Context context) {
super(null, 0 == true ? 1 : 0);
this.f42023b = str;
this.f42024c = aVar;
this.f42025d = context;
}
@Override
public com.zendrive.sdk.x a() {
TripFeedback tripFeedback = new TripFeedback();
tripFeedback.timestamp = com.zendrive.sdk.utilities.q0.a();
try {
tripFeedback.tripTimestamp = Long.parseLong(this.f42023b);
ik.a aVar = this.f42024c;
tripFeedback.falseTrip = false;
switch (aVar.ordinal()) {
case 0:
tripFeedback.transportationMode = w6.Car;
break;
case 1:
tripFeedback.travelerMode = x6.Driver;
tripFeedback.transportationMode = w6.Car;
break;
case 2:
tripFeedback.travelerMode = x6.Passenger;
tripFeedback.transportationMode = w6.Car;
break;
case 3:
tripFeedback.transportationMode = w6.Train;
break;
case 4:
tripFeedback.transportationMode = w6.Bus;
break;
case 5:
tripFeedback.transportationMode = w6.Bicycle;
break;
case 6:
tripFeedback.transportationMode = w6.OnFoot;
break;
case 7:
tripFeedback.transportationMode = w6.Motorcycle;
break;
case 8:
tripFeedback.transportationMode = w6.Transit;
break;
case 9:
tripFeedback.transportationMode = w6.Flight;
break;
case 10:
tripFeedback.falseTrip = true;
break;
case 11:
tripFeedback.transportationMode = w6.NotCar;
break;
case 12:
tripFeedback.transportationMode = w6.Other;
break;
default:
throw new UnsupportedOperationException();
}
u1 d15 = u1.d(this.f42025d);
if (d15 == null) {
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call addDriveCategoryFeedback before setup.");
}
i3.a(this.f42025d, "addDriveCategory");
return d15.a(tripFeedback);
} catch (NumberFormatException unused) {
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Invalid driveId: " + this.f42023b + ". Feedback ignored");
}
}
}
static class f implements Runnable {
final Context f42026c;
f(Context context) {
this.f42026c = context;
}
@Override
public void run() {
i3.a(this.f42026c, "isAutoTrackingPaused");
}
}
static class f0 extends p {
final String f42027b;
final long f42028c;
final boolean f42029d;
final ZendriveEventType f42030e;
final Context f42031f;
f0(com.zendrive.sdk.w wVar, String str, long j15, boolean z15, ZendriveEventType zendriveEventType, Context context) {
super(null, 0 == true ? 1 : 0);
this.f42027b = str;
this.f42028c = j15;
this.f42029d = z15;
this.f42030e = zendriveEventType;
this.f42031f = context;
}
@Override
public com.zendrive.sdk.x a() {
n6 n6Var;
EventFeedback eventFeedback = new EventFeedback();
eventFeedback.timestamp = com.zendrive.sdk.utilities.q0.a();
try {
eventFeedback.tripTimestamp = Long.parseLong(this.f42027b);
eventFeedback.eventTimestamp = this.f42028c;
eventFeedback.falseEvent = !this.f42029d;
ZendriveEventType zendriveEventType = this.f42030e;
int i15 = com.zendrive.sdk.utilities.i0.f42906c;
switch (zendriveEventType) {
case HARD_BRAKE:
n6Var = n6.HardBrake;
break;
case AGGRESSIVE_ACCELERATION:
n6Var = n6.AggressiveAcceleration;
break;
case PHONE_HANDLING:
n6Var = n6.PhoneUse;
break;
case SPEEDING:
n6Var = n6.OverSpeeding;
break;
case COLLISION:
n6Var = n6.Accident;
break;
case HARD_TURN:
n6Var = n6.HardTurn;
break;
case PHONE_SCREEN_INTERACTION:
n6Var = n6.PhoneTap;
break;
case STOP_SIGN_VIOLATION:
n6Var = n6.StopSignViolation;
break;
case HANDS_FREE_PHONE_CALL:
n6Var = n6.HandsFreePhoneCall;
break;
case PASSIVE_DISTRACTION:
n6Var = n6.PassiveDistraction;
break;
default:
throw new UnsupportedOperationException();
}
eventFeedback.eventType = n6Var;
u1 d15 = u1.d(this.f42031f);
if (d15 == null) {
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call addEventFeedback before setup.");
}
i3.a(this.f42031f, "addEventOccurrence");
return d15.a(eventFeedback);
} catch (NumberFormatException unused) {
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Invalid driveId: " + this.f42027b + ". Feedback ignored.");
}
}
}
static class g implements Runnable {
final Context f42032c;
final w1 f42033d;
g(Context context, w1 w1Var) {
this.f42032c = context;
this.f42033d = w1Var;
}
@Override
public void run() {
com.zendrive.sdk.k kVar;
i3.a(this.f42032c, "refreshBusinessHours");
Context context = this.f42032c;
w1 w1Var = this.f42033d;
if (!r1.f(context)) {
com.zendrive.sdk.utilities.b1.d("BusinessHoursManager", "refreshBusinessHours", "Business Hours not enabled in config", new Object[0]);
w1Var.onCompletion(null, com.zendrive.sdk.k.BUSINESS_HOURS_NOT_ENABLED);
} else {
if (!com.zendrive.sdk.utilities.q.b(context)) {
com.zendrive.sdk.utilities.b1.d("BusinessHoursManager", "refreshBusinessHours", "No active network is available", new Object[0]);
w1Var.onCompletion(null, com.zendrive.sdk.k.NO_NETWORK);
return;
}
com.zendrive.sdk.g0 a15 = o1.a(context, false);
if (a15 == null) {
com.zendrive.sdk.utilities.b1.d("BusinessHoursManager", "refreshBusinessHours", "The refresh business hours API request was timed out", new Object[0]);
kVar = com.zendrive.sdk.k.REQUEST_TIMEOUT;
} else {
kVar = com.zendrive.sdk.k.SUCCESS;
}
w1Var.onCompletion(a15, kVar);
}
}
}
static class g0 implements Runnable {
final Context f42034c;
g0(Context context) {
this.f42034c = context;
}
@Override
public void run() {
i3.a(this.f42034c, "getActiveDriveInfo");
}
}
static class h extends p {
final Context f42035b;
h(com.zendrive.sdk.w wVar, Context context) {
super(wVar, null);
this.f42035b = context;
}
@Override
public com.zendrive.sdk.x a() {
if (u1.i(this.f42035b)) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$17", "doOnHandler", "Wipe out request denied since SDK is setup", new Object[0]);
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_NOT_TORN_DOWN, "Cannot wipe out while sdk is running.");
}
com.zendrive.sdk.i.w.a(this.f42035b).a();
for (String str : this.f42035b.databaseList()) {
if (str.startsWith("com.zendrive.sdk.db.")) {
this.f42035b.deleteDatabase(str);
}
}
com.zendrive.sdk.utilities.e0[] values = com.zendrive.sdk.utilities.e0.values();
for (int i15 = 0; i15 < 5; i15++) {
values[i15].r().clear();
}
f3.a(this.f42035b);
com.zendrive.sdk.utilities.m.R(com.zendrive.sdk.utilities.m.f0(this.f42035b));
Context context = this.f42035b;
o.a aVar = com.zendrive.sdk.i.o.f41579d;
com.zendrive.sdk.utilities.m.K(context.getFilesDir(), "zendrive_transit_");
return com.zendrive.sdk.x.b();
}
}
static class h0 extends p {
final Context f42036b;
final ZendriveDriveDetectionMode f42037c;
h0(com.zendrive.sdk.w wVar, Context context, ZendriveDriveDetectionMode zendriveDriveDetectionMode) {
super(wVar, null);
this.f42036b = context;
this.f42037c = zendriveDriveDetectionMode;
}
@Override
public com.zendrive.sdk.x a() {
u1 d15 = u1.d(this.f42036b);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call setZendriveDriveDetectionMode before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42036b, "setZendriveDriveDetectionMode");
return d15.a(this.f42036b, this.f42037c);
}
}
static class i extends p {
final com.zendrive.sdk.t f42038b;
final Context f42039c;
i(com.zendrive.sdk.w wVar, com.zendrive.sdk.t tVar, Context context) {
super(wVar, null);
this.f42038b = tVar;
this.f42039c = context;
}
@Override
public com.zendrive.sdk.x a() {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$18", "doOnHandler", "Triggering mock accident with %s", this.f42038b.toString());
u1 d15 = u1.d(this.f42039c);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot trigger mock accident before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42039c, "triggerMockAccident");
return d15.a(this.f42039c, this.f42038b);
}
}
static class i0 extends p {
final Context f42040b;
final q6 f42041c;
i0(com.zendrive.sdk.w wVar, Context context, q6 q6Var) {
super(wVar, null);
this.f42040b = context;
this.f42041c = q6Var;
}
@Override
public com.zendrive.sdk.x a() {
if (!u1.i(this.f42040b)) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
i3.a(this.f42040b, "startPeriod1");
q6 s15 = com.zendrive.sdk.i.w.a(this.f42040b).s();
q6 q6Var = this.f42041c;
if (s15 == q6Var) {
return com.zendrive.sdk.x.b();
}
return u1.a(this.f42040b, q6Var, (String) null);
}
}
static class j implements Runnable {
final Context f42042c;
j(Context context) {
this.f42042c = context;
}
@Override
public void run() {
i3.a(this.f42042c, "startSession");
}
}
static class j0 implements Runnable {
final Context f42043c;
final UUID f42044d;
final int f42045e;
final int f42046f;
final p1 f42047g;
j0(Context context, UUID uuid, int i15, int i16, p1 p1Var) {
this.f42043c = context;
this.f42044d = uuid;
this.f42045e = i15;
this.f42046f = i16;
this.f42047g = p1Var;
}
@Override
public void run() {
i3.a(this.f42043c, "getNearbyBeacons");
com.zendrive.sdk.i.k0.b(this.f42043c, this.f42044d, this.f42045e, this.f42046f, this.f42047g);
}
}
static class k extends p {
final Context f42048b;
final com.zendrive.sdk.l f42049c;
final Class f42050d;
final Class f42051e;
k(com.zendrive.sdk.w wVar, Context context, com.zendrive.sdk.l lVar, Class cls, Class cls2) {
super(wVar, null);
this.f42048b = context;
this.f42049c = lVar;
this.f42050d = cls;
this.f42051e = cls2;
}
@Override
public com.zendrive.sdk.x a() {
return u1.a(this.f42048b.getApplicationContext(), this.f42049c, this.f42050d, this.f42051e);
}
}
static class k0 implements Runnable {
final Context f42052c;
k0(Context context) {
this.f42052c = context;
}
@Override
public void run() {
i3.a(this.f42052c, "pauseAutoTracking");
}
}
static class l implements Runnable {
final Context f42053c;
l(Context context) {
this.f42053c = context;
}
@Override
public void run() {
i3.a(this.f42053c, "stopSession");
}
}
static class m implements Runnable {
final Context f42054c;
final x1 f42055d;
m(Context context, x1 x1Var) {
this.f42054c = context;
this.f42055d = x1Var;
}
@Override
public void run() {
u1 d15 = u1.d(this.f42054c);
if (d15 != null) {
i3.a(this.f42054c, "getZendriveSettings");
d15.r().d(this.f42054c, this.f42055d);
}
}
}
static class n implements Runnable {
final Context f42056c;
n(Context context) {
this.f42056c = context;
}
@Override
public void run() {
u1 d15 = u1.d(this.f42056c);
if (d15 != null) {
i3.a(this.f42056c, "uploadAllDebugDataAndLogs");
m8.a(this.f42056c, d15.n());
}
}
}
static class o implements Runnable {
final Context f42057c;
final Handler f42058d;
class a implements Runnable {
final com.zendrive.sdk.j0 f42059c;
a(com.zendrive.sdk.j0 j0Var) {
this.f42059c = j0Var;
}
@Override
public void run() {
o.this.getClass();
throw null;
}
}
o(Context context, Handler handler, com.zendrive.sdk.k0 k0Var) {
this.f42057c = context;
this.f42058d = handler;
}
@Override
public void run() {
this.f42058d.post(new a(u1.e(this.f42057c)));
}
}
public static abstract class p {
private com.zendrive.sdk.w f42061a;
p(com.zendrive.sdk.w wVar, k kVar) {
this(wVar);
}
public abstract com.zendrive.sdk.x a();
void a(com.zendrive.sdk.x xVar) {
com.zendrive.sdk.w wVar = this.f42061a;
if (wVar != null) {
wVar.onCompletion(xVar);
}
}
private p(com.zendrive.sdk.w wVar) {
this.f42061a = wVar;
}
}
public static class q {
com.zendrive.sdk.x f42062a;
q(com.zendrive.sdk.x xVar) {
this.f42062a = xVar;
}
}
static class r implements Runnable {
final Context f42063c;
r(Context context) {
this.f42063c = context;
}
@Override
public void run() {
i3.a(this.f42063c, "getZendriveState");
}
}
static class s implements Runnable {
final Context f42064c;
s(Context context) {
this.f42064c = context;
}
@Override
public void run() {
i3.a(this.f42064c, "associateVehicle");
}
}
static class t implements Runnable {
final Context f42065c;
final List f42066d;
final com.zendrive.sdk.l0 f42067e;
t(Context context, List list, com.zendrive.sdk.l0 l0Var) {
this.f42065c = context;
this.f42066d = list;
this.f42067e = l0Var;
}
@Override
public void run() {
u1 d15 = u1.d(this.f42065c);
if (d15 != null) {
d15.a(this.f42066d);
com.zendrive.sdk.manager.u p15 = d15.p();
if (p15 != null) {
p15.z().d(this.f42067e);
}
}
}
}
static class u implements Runnable {
final Context f42068c;
u(Context context) {
this.f42068c = context;
}
@Override
public void run() {
i3.a(this.f42068c, "dissociateVehicle");
}
}
static class v extends p {
final Context f42069b;
v(com.zendrive.sdk.w wVar, Context context) {
super(wVar, null);
this.f42069b = context;
}
@Override
public com.zendrive.sdk.x a() {
u1 d15 = u1.d(this.f42069b);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$2", "doOnHandler", "Zendrive: Calling teardown as external message on handler", new Object[0]);
if (d15 != null) {
return d15.o(this.f42069b.getApplicationContext());
}
return com.zendrive.sdk.x.b();
}
}
static class w implements Runnable {
final Context f42070c;
final List f42071d;
final String f42072e;
w(Context context, List list, String str) {
this.f42070c = context;
this.f42071d = list;
this.f42072e = str;
}
@Override
public void run() {
u1 d15 = u1.d(this.f42070c);
if (d15 != null) {
d15.a(this.f42071d);
com.zendrive.sdk.manager.u p15 = d15.p();
if (p15 != null) {
p15.z().f(this.f42072e);
}
}
}
}
static class x implements Runnable {
final Context f42073c;
x(Context context) {
this.f42073c = context;
}
@Override
public void run() {
i3.a(this.f42073c, "getAssociatedVehicles");
}
}
public static class y implements Runnable {
final p f42074c;
final Handler f42075d;
class a implements Runnable {
final com.zendrive.sdk.x f42076c;
a(com.zendrive.sdk.x xVar) {
this.f42076c = xVar;
}
@Override
public void run() {
y.this.f42074c.a(this.f42076c);
}
}
y(p pVar, Handler handler) {
this.f42074c = pVar;
this.f42075d = handler;
}
@Override
public void run() {
if (!this.f42075d.post(new a(this.f42074c.a()))) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl$26", "run", "Failed to post result to app handler %s", this.f42075d.getLooper().getThread().getName());
}
}
}
static class z implements Runnable {
final Context f42078c;
z(Context context) {
this.f42078c = context;
}
@Override
public void run() {
if (u1.i(this.f42078c)) {
if (com.zendrive.sdk.receiver.i.k()) {
com.zendrive.sdk.receiver.i.b(this.f42078c);
}
com.zendrive.sdk.manager.p.d(this.f42078c);
com.zendrive.sdk.cdetectorlib.h.i(this.f42078c);
}
}
}
public static com.zendrive.sdk.b b(Context context) {
u1 u1Var = f42006b;
if (u1Var == null) {
return null;
}
x5.b(context, new g0(context));
return u1Var.b();
}
public static void c(Context context, com.zendrive.sdk.w wVar) {
a(new v(null, context));
}
public static synchronized u1 d(Context context) {
u1 u1Var;
synchronized (u1.class) {
try {
if (!com.zendrive.sdk.i.w.a(context).X()) {
f42006b = null;
} else if (f42006b == null) {
if (com.zendrive.sdk.utilities.k.c(context)) {
f42006b = l1.p(context);
} else {
f42006b = m1.p(context);
}
}
u1Var = f42006b;
} catch (Throwable th4) {
throw th4;
}
}
return u1Var;
}
public static void e(Context context, com.zendrive.sdk.w wVar) {
a(new h(wVar, context));
}
public static void f(Context context) {
x5.b(context, new z(context));
}
public static boolean g(Context context) {
x5.b(context, new f(context));
return s2.f41873a.b(context);
}
private static boolean h(Context context) {
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
return a15.W() && com.zendrive.sdk.cdetectorlib.h.z(a15.O()) && a15.b(context) && a15.T();
}
public static u1 i() {
return f42006b;
}
public static com.zendrive.sdk.a0 j(Context context) {
x5.b(context, new e(context));
return s2.f41873a.c(context);
}
public static com.zendrive.sdk.x k(Context context) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "sendDebugReport", "ZendriveImpl: sendDebugReport", new Object[0]);
long a15 = com.zendrive.sdk.utilities.q0.a();
com.zendrive.sdk.i.w a16 = com.zendrive.sdk.i.w.a(context);
if (i(context)) {
if (com.zendrive.sdk.utilities.k.c(context)) {
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.UNSUPPORTED_OPERATION, "Operation not supported by ZendriveSDK-testing library");
}
a16.a(Long.valueOf(a15));
x5.b(context, new n(context));
return com.zendrive.sdk.x.b();
}
return com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call send debug report before setup.");
}
public static ServiceManagerFactory l() {
if (f42005a == null) {
ServiceLoader load = ServiceLoader.load(ServiceManagerFactory.class);
if (load.iterator().hasNext()) {
f42005a = (ServiceManagerFactory) load.iterator().next();
}
}
return f42005a;
}
public static com.zendrive.sdk.x n(Context context) {
u1 d15;
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (i(context)) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "stopSession", "Stopping session", new Object[0]);
x5.b(context, new l(context));
a15.g((String) null);
if (com.zendrive.sdk.utilities.k.c(context) && (d15 = d(context)) != null) {
d15.b((String) null);
}
return com.zendrive.sdk.x.b();
}
com.zendrive.sdk.x a16 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call stopSession before setup.");
com.zendrive.sdk.utilities.m.F(a16);
return a16;
}
public abstract void A();
public abstract com.zendrive.sdk.x a(Context context, ZendriveDriveDetectionMode zendriveDriveDetectionMode);
protected abstract com.zendrive.sdk.x a(Context context, com.zendrive.sdk.t tVar);
protected abstract com.zendrive.sdk.x a(EventFeedback eventFeedback);
protected abstract com.zendrive.sdk.x a(TripFeedback tripFeedback);
public abstract List<String> a(String str);
public abstract void a();
public abstract void a(s5 s5Var, String str, f8 f8Var);
public abstract void a(com.zendrive.sdk.m mVar);
public abstract void a(com.zendrive.sdk.manager.b bVar);
protected abstract void a(String str, com.zendrive.sdk.l lVar, String str2, com.zendrive.sdk.data.g gVar, String str3);
public abstract void a(List<com.zendrive.sdk.l0> list);
public abstract boolean a(Context context, int i15);
protected abstract boolean a(Context context, ZendriveRegion zendriveRegion, boolean z15);
public abstract com.zendrive.sdk.b b();
protected abstract com.zendrive.sdk.x b(Context context, String str);
protected abstract void b(String str);
public abstract com.zendrive.sdk.manager.b c();
public abstract Context d();
public abstract com.zendrive.sdk.i.k e();
public abstract com.zendrive.sdk.manager.k f();
public abstract GeofenceManager g();
public abstract com.zendrive.sdk.manager.c h();
public abstract com.zendrive.sdk.manager.o j();
public abstract com.zendrive.sdk.manager.d k();
protected abstract com.zendrive.sdk.x m(Context context);
public abstract Long m();
public abstract com.zendrive.sdk.manager.y n();
@NonNull
public abstract com.zendrive.sdk.i.w o();
public abstract com.zendrive.sdk.x o(Context context);
public abstract com.zendrive.sdk.manager.u p();
public abstract com.zendrive.sdk.manager.c q();
public abstract com.zendrive.sdk.manager.z r();
public abstract void s();
public abstract boolean t();
public abstract boolean u();
public abstract void v();
public abstract void w();
public abstract void x();
public abstract void y();
protected abstract com.zendrive.sdk.x z();
public static void a(Context context, @NonNull com.zendrive.sdk.l lVar, Class<? extends ZendriveBroadcastReceiver> cls, Class<? extends com.zendrive.sdk.v> cls2, com.zendrive.sdk.w wVar) {
a(new k(wVar, context, lVar, cls, cls2));
}
public static List<com.zendrive.sdk.l0> c(Context context) {
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (!i(context)) {
return null;
}
x5.b(context, new x(context));
return a15.R();
}
public static com.zendrive.sdk.j0 e(Context context) {
if (!i(context)) {
return null;
}
com.zendrive.sdk.j0 j0Var = new com.zendrive.sdk.j0();
com.zendrive.sdk.l j15 = com.zendrive.sdk.i.w.a(context).j();
if (j15 == null) {
return null;
}
j0Var.f42420a = j15;
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
j0Var.f42421b = TripService.d();
String i15 = a15.i();
if (!TextUtils.isEmpty(i15)) {
j0Var.f42424e = r1.g(i15);
}
u1 u1Var = f42006b;
if (u1Var != null) {
j0Var.f42423d = a15.L();
j0Var.f42422c = u1Var.b() != null;
}
return j0Var;
}
public static boolean i(Context context) {
if (!com.zendrive.sdk.utilities.k.c(context)) {
return h(context) && com.zendrive.sdk.utilities.s.b(context.getApplicationContext(), SetupReceiver.class, 0, PKIFailureInfo.duplicateCertReq, true) != null;
}
try {
Class<?> cls = Class.forName("com.zendrive.sdk.testing.mockdrive.internal.ZendriveMock");
Method method = cls.getMethod("getInstance", new Class[0]);
Object invoke = cls.getMethod("getAppBroadcastReceiver", new Class[0]).invoke(method.invoke(null, new Object[0]), new Object[0]);
Object invoke2 = cls.getMethod("getAppNotificationProvider", new Class[0]).invoke(method.invoke(null, new Object[0]), new Object[0]);
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (invoke != null && invoke2 != null && a15.W() && a15.b(context)) {
if (a15.T()) {
return true;
}
}
} catch (Exception unused) {
}
return false;
}
static com.zendrive.sdk.x a(Context context, com.zendrive.sdk.l lVar, Class cls, Class cls2) {
com.zendrive.sdk.x a15;
q qVar;
String str;
boolean z15;
b5 b5Var;
q qVar2;
com.zendrive.sdk.utilities.a0 a0Var;
String str2;
com.zendrive.sdk.x xVar;
com.zendrive.sdk.x xVar2;
String str3;
int i15;
com.zendrive.sdk.utilities.m.a0();
String str4 = com.zendrive.sdk.utilities.i.f42903a;
com.zendrive.sdk.x a16 = (cls2 == null && com.zendrive.sdk.utilities.k.a(context)) ? com.zendrive.sdk.x.a(com.zendrive.sdk.n.NOTIFICATION_PROVIDER_ERROR, "Notification Provider is required for Zendrive SDK setup") : null;
if (a16 != null) {
com.zendrive.sdk.utilities.m.F(a16);
return a16;
}
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "setup", "Setup running on thread %s", Thread.currentThread().getName());
boolean i16 = i(context);
com.zendrive.sdk.x b15 = com.zendrive.sdk.x.b();
if (com.zendrive.sdk.utilities.n.d(context)) {
if (com.zendrive.sdk.utilities.k0.b()) {
if (com.zendrive.sdk.utilities.k0.a() == null) {
b15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.UNSUPPORTED_DEVICE, "Zendrive SDK does not support this device, please contact support@zendrive.com.");
} else if (com.zendrive.sdk.utilities.n.g(context)) {
b15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.GOOGLE_AND_HUAWEI_MOBILE_SERVICES_UNAVAILABLE, "Cannot setup Zendrive SDK as both Google and Huawei Mobile Services are not available on this device.");
} else if (com.zendrive.sdk.utilities.n.k(context)) {
b15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.HUAWEI_MOBILE_SERVICES_UPDATE_REQUIRED, "Cannot setup Zendrive SDK as Huawei Mobile Services version installed on device needs to be updated.");
}
} else {
b15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.GOOGLE_PLAY_SERVICES_UNAVAILABLE, "Cannot setup Zendrive SDK as Google Play services is not available on this device.");
}
} else if (com.zendrive.sdk.utilities.n.e(context)) {
b15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.GOOGLE_PLAY_SERVICES_UPDATE_REQUIRED, "Cannot setup zendrive SDK as Google Play Services version installed on device needs to be updated.");
}
if (!b15.e()) {
com.zendrive.sdk.utilities.m.F(b15);
qVar = new q(b15);
} else {
String str5 = "";
if (lVar == null) {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_CONFIGURATION_ERROR, "Cannot perform this operation as ZendriveConfiguration is null");
} else if (lVar.b() != null && !"".equals(lVar.b())) {
if (!com.zendrive.sdk.utilities.m.d0(lVar.b())) {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_DRIVER_ID, "Not a valid driver Id, cannot continue. Please look at Zendrive.isValidInputParameter(String) for list of disallowed characters in driverId");
} else if (lVar.b().length() > 64) {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_DRIVER_ID, "driverId cannot be longer than 64 characters.");
} else {
String f15 = lVar.f();
if (f15 != null && !"".equals(f15)) {
if (lVar.e() == null) {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.REGION_UNSUPPORTED, "Not a supported region. Please contact support@zendrive.com.");
} else {
a15 = com.zendrive.sdk.x.b();
}
} else {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_SDK_KEY, "Not a valid sdk key, cannot continue. To get your key, please sign up at https://developers.zendrive.com.. If you have already signed up, ensure that you are using the SDK key from your account and not the Analytics API key for SDK setup.");
}
}
} else {
a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_DRIVER_ID, "Invalid value supplied for driver id. It should be a non null, non empty string which uniquely identifies this driver for this application");
}
if (!a15.e()) {
com.zendrive.sdk.utilities.m.F(a15);
qVar = new q(a15);
} else {
com.zendrive.sdk.i.w a17 = com.zendrive.sdk.i.w.a(context);
com.zendrive.sdk.l j15 = a17.j();
if (j15 == null) {
File file = new File(com.zendrive.sdk.utilities.m.f0(context), "regionName.json");
if (file.exists()) {
try {
if (new JSONObject(com.zendrive.sdk.utilities.m.X(new FileInputStream(file))).getInt("region") != lVar.e().getValue()) {
qVar = new q(com.zendrive.sdk.x.a(com.zendrive.sdk.n.REGION_SWITCH_ERROR, "Changing region is not allowed. Please contact support@zendrive.com."));
}
} catch (IOException | JSONException unused) {
}
}
if (h(context) || j15 == null) {
str = "setup";
z15 = i16;
} else if (com.zendrive.sdk.utilities.m.O(j15, lVar)) {
z15 = i16;
str = "setup";
if (!com.zendrive.sdk.utilities.m.q(context.getPackageName(), a17.f(), lVar.b(), com.zendrive.sdk.utilities.d0.a(context), lVar.e()).equals(a17.n())) {
com.zendrive.sdk.utilities.b1.h("ZendriveImpl", "setupInBackgroundThread", "Setup called with same configuration after back up and restore of SDK data. Re-initializing the SDK.", new Object[0]);
a17.a0();
} else {
com.zendrive.sdk.utilities.b1.h("ZendriveImpl", "setupInBackgroundThread", "Zendrive is already setup for this driver Id.", new Object[0]);
a17.a((Class<? extends ZendriveBroadcastReceiver>) cls);
a17.b((Class<? extends com.zendrive.sdk.v>) cls2);
u1 d15 = d(context);
u1 u1Var = f42006b;
if (lVar.g() != j15.g()) {
xVar = u1Var.a(context, lVar.g());
xVar2 = xVar.e() ? xVar : null;
if (xVar != null && xVar.e()) {
d15.v();
}
if (xVar == null) {
xVar = com.zendrive.sdk.x.b();
}
qVar = new q(xVar);
if (!qVar.f42062a.e()) {
u1 d16 = d(context);
if (d16 != null) {
int ordinal = qVar.f42062a.c().ordinal();
if (ordinal == 3) {
str3 = str;
i15 = 0;
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str3, "Passed sdkKey: " + lVar.f(), new Object[0]);
} else if (ordinal == 4) {
str3 = str;
i15 = 0;
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str3, "Passed userId: " + lVar.b(), new Object[0]);
} else if (ordinal != 18) {
str3 = str;
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str3, "Setup task failed with error code: " + qVar.f42062a.c(), new Object[0]);
i15 = 0;
} else {
str3 = str;
StringBuilder sb5 = new StringBuilder();
sb5.append("NotificationProvider: ");
sb5.append(cls2 == null ? "null" : cls2.getName());
i15 = 0;
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str3, sb5.toString(), new Object[0]);
}
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str3, "Setup failed: " + qVar.f42062a.d(), new Object[i15]);
d16.o(context);
} else {
com.zendrive.sdk.utilities.m.h0();
}
} else {
String str6 = str;
if (com.zendrive.sdk.services.e.f()) {
d(context).a(context, 5);
}
if (!f42006b.a(context, lVar.e(), z15)) {
com.zendrive.sdk.x a18 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Something bad happened. Zendrive SDK is in inconsistent state. Contact support@zendrive.com if problem persists.");
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str6, "Setup failed: " + a18.d(), new Object[0]);
return a18;
}
com.zendrive.sdk.i.c a19 = com.zendrive.sdk.i.c.a(context);
a19.e(new Intent("com.zendrive.sdk.LOCATION_SETTINGS"));
a19.e(new Intent("com.zendrive.sdk.LOCATION_PERMISSION"));
i3.a(context, str6);
x5.b(context, new y7(context));
StringBuilder sb6 = new StringBuilder();
sb6.append("Collecting SDKHealth point on: ");
o5 o5Var = o5.SdkSetup;
sb6.append(o5Var);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", str6, sb6.toString(), new Object[0]);
com.zendrive.sdk.utilities.c0.a(context, o5Var);
}
return qVar.f42062a;
}
if (!lVar.a().equals(j15.a())) {
u1Var.a(lVar.a());
}
com.zendrive.sdk.i.w.a(context).a(lVar);
xVar = xVar2 != null ? xVar2 : com.zendrive.sdk.x.b();
if (xVar != null) {
d15.v();
}
if (xVar == null) {
}
qVar = new q(xVar);
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
} else {
str = "setup";
z15 = i16;
com.zendrive.sdk.utilities.b1.h("ZendriveImpl", "setupInBackgroundThread", "Zendrive is setup already with a different configuration. Tearing it down and re-initializing", new Object[0]);
u1 d17 = d(context);
if (d17 != null) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "setupInBackgroundThread", "Setup called with a different configuration", new Object[0]);
d17.o(context);
} else {
com.zendrive.sdk.utilities.m.h0();
}
}
if (com.zendrive.sdk.utilities.k.c(context)) {
String a25 = com.zendrive.sdk.utilities.d0.a(context);
com.zendrive.sdk.utilities.y0 a26 = com.zendrive.sdk.utilities.y0.a(context, a17, lVar, a25);
if (a26 != null && (a0Var = a26.f43004a) != com.zendrive.sdk.utilities.a0.INVALID_SDK_KEY) {
if (a0Var == com.zendrive.sdk.utilities.a0.REGION_UNSUPPORTED) {
com.zendrive.sdk.x a27 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.REGION_UNSUPPORTED, "Not a supported region. Please contact support@zendrive.com.");
com.zendrive.sdk.utilities.m.F(a27);
qVar2 = new q(a27);
} else if (a0Var == com.zendrive.sdk.utilities.a0.USER_DEPROVISIONED) {
com.zendrive.sdk.x a28 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.USER_DEPROVISIONED, "The user has been deprovisioned from using the Zendrive SDK.");
com.zendrive.sdk.utilities.m.F(a28);
qVar2 = new q(a28);
} else if (a0Var != com.zendrive.sdk.utilities.a0.OK) {
com.zendrive.sdk.x a29 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.NETWORK_NOT_AVAILABLE, "Cannot setup on device as network connectivity is unavailable or is flaky. Zendrive setup requires network connectivity. Try again after connecting the device to a reliable network. Contact support@zendrive.com if problem persists.");
com.zendrive.sdk.utilities.m.F(a29);
qVar2 = new q(a29);
} else {
q5 c15 = com.zendrive.sdk.cdetectorlib.h.c(a26.f43005b);
if (c15 != null && c15.f41726c != null && c15.f41728e != null && c15.f41725b != null && c15.f41727d != null && (str2 = c15.f41724a) != null && com.zendrive.sdk.cdetectorlib.h.b(str2) != null) {
if (!com.zendrive.sdk.cdetectorlib.h.z(c15)) {
qVar = new q(com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Invalid network response. Please contact support@zendrive.com."));
} else {
b5Var = com.zendrive.sdk.cdetectorlib.h.b(c15.f41724a);
if (b5Var == null) {
com.zendrive.sdk.x a35 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_SDK_KEY, "Unable to parse SDK key. Please contact support@zendrive.com if issue persists.");
com.zendrive.sdk.utilities.m.F(a35);
qVar2 = new q(a35);
} else if (!com.zendrive.sdk.cdetectorlib.h.y(c15) && lVar.a().f() == ZendriveVehicleType.MOTORCYCLE) {
com.zendrive.sdk.x a36 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.UNSUPPORTED_VEHICLE_TYPE, "Motorcycle feature is not currently supported. Please contact support@zendrive.com.");
com.zendrive.sdk.utilities.m.F(a36);
qVar2 = new q(a36);
} else {
String q15 = com.zendrive.sdk.utilities.m.q(context.getPackageName(), b5Var.f40818a, lVar.b(), a25, lVar.e());
if (q15 != null && !"".equals(q15)) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "setupInBackgroundThread", "Created new id : " + q15, new Object[0]);
a17.c(q15);
a17.a(a26);
str5 = a25;
} else {
com.zendrive.sdk.x a37 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Driver Id could not be computed. Driver id: " + lVar.b());
com.zendrive.sdk.utilities.m.F(a37);
qVar2 = new q(a37);
}
}
}
} else {
qVar = new q(com.zendrive.sdk.x.a(com.zendrive.sdk.n.ZENDRIVE_SDK_ERROR, "Unable to parse binary network response. Please contact support@zendrive.com if issue persists."));
}
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
} else {
com.zendrive.sdk.x a38 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_SDK_KEY, "Not a valid sdk key, cannot continue. To get your key, please sign up at https://developers.zendrive.com.. If you have already signed up, ensure that you are using the SDK key from your account and not the Analytics API key for SDK setup.");
com.zendrive.sdk.utilities.m.F(a38);
qVar2 = new q(a38);
}
qVar = qVar2;
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
b5Var = null;
a17.a((Class<? extends ZendriveBroadcastReceiver>) cls);
a17.b((Class<? extends com.zendrive.sdk.v>) cls2);
a17.a(lVar);
if (f42006b != null && !a17.X()) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "setupInBackgroundThread", "Zendrive instance is not null even though this is a new setup call", new Object[0]);
}
a17.f(true);
u1 d18 = d(context);
d18.a(b5Var != null ? null : b5Var.f40818a, lVar, str5, com.zendrive.sdk.data.g.a(context), a17.t());
d18.v();
a17.e(true);
com.zendrive.sdk.utilities.b1.h("ZendriveImpl", "setupInBackgroundThread", "Zendrive is setup.", new Object[0]);
qVar = new q(com.zendrive.sdk.x.b());
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
if (j15.e() != lVar.e()) {
qVar = new q(com.zendrive.sdk.x.a(com.zendrive.sdk.n.REGION_SWITCH_ERROR, "Changing region is not allowed. Please contact support@zendrive.com."));
}
if (h(context)) {
}
str = "setup";
z15 = i16;
if (com.zendrive.sdk.utilities.k.c(context)) {
}
a17.a((Class<? extends ZendriveBroadcastReceiver>) cls);
a17.b((Class<? extends com.zendrive.sdk.v>) cls2);
a17.a(lVar);
if (f42006b != null) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "setupInBackgroundThread", "Zendrive instance is not null even though this is a new setup call", new Object[0]);
}
a17.f(true);
u1 d182 = d(context);
d182.a(b5Var != null ? null : b5Var.f40818a, lVar, str5, com.zendrive.sdk.data.g.a(context), a17.t());
d182.v();
a17.e(true);
com.zendrive.sdk.utilities.b1.h("ZendriveImpl", "setupInBackgroundThread", "Zendrive is setup.", new Object[0]);
qVar = new q(com.zendrive.sdk.x.b());
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
}
str = "setup";
z15 = i16;
if (!qVar.f42062a.e()) {
}
return qVar.f42062a;
}
public static void b(@NonNull Context context, com.zendrive.sdk.w wVar) {
a(new b(wVar, context));
}
public static com.zendrive.sdk.x l(Context context) {
u1 d15 = d(context);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call stopInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
if (!d15.a(context, ZendriveDriveDetectionMode.AUTO_OFF).e()) {
com.zendrive.sdk.x a16 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call stopInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a16);
return a16;
}
com.zendrive.sdk.i.w a17 = com.zendrive.sdk.i.w.a(context);
com.zendrive.sdk.j0 e15 = e(context);
if (e15 != null && e15.f42422c && a17.Q() != null) {
com.zendrive.sdk.x m15 = d15.m(context);
if (!m15.e()) {
return m15;
}
}
return d15.z();
}
public static com.zendrive.sdk.x c(Context context, String str) {
u1 d15;
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (i(context)) {
x5.b(context, new j(context));
if (str != null && !"".equals(str)) {
if (!com.zendrive.sdk.utilities.m.d0(str)) {
com.zendrive.sdk.x a16 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_SESSION_ID, "Not a valid session id. Please look at Zendrive.isValidInputParameter(String) for list of disallowed characters in session id.");
com.zendrive.sdk.utilities.m.F(a16);
return a16;
}
String substring = str.substring(0, Math.min(str.length(), 64));
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "startSession", "Starting session with id : " + substring, new Object[0]);
a15.g(substring);
if (com.zendrive.sdk.utilities.k.c(context) && (d15 = d(context)) != null) {
d15.b(substring);
}
return com.zendrive.sdk.x.b();
}
com.zendrive.sdk.x a17 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.INVALID_SESSION_ID, "Session id cannot be null or empty.");
com.zendrive.sdk.utilities.m.F(a17);
return a17;
}
com.zendrive.sdk.x a18 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startSession before setup.");
com.zendrive.sdk.utilities.m.F(a18);
return a18;
}
public static void d(Context context, com.zendrive.sdk.w wVar) {
a(new d0(wVar, context));
}
public static void a(@NonNull Context context, @NonNull String str, @NonNull ik.a aVar) {
a(new e0(null, str, aVar, context));
}
public static void a(@NonNull Context context, @NonNull String str, long j15, @NonNull ZendriveEventType zendriveEventType, boolean z15) {
a(new f0(null, str, j15, z15, zendriveEventType, context));
}
public static void a(Context context, @NonNull com.zendrive.sdk.f0 f0Var) {
x1 x1Var = new x1(f0Var);
if (com.zendrive.sdk.utilities.k.c(context)) {
f0Var.onComplete(new com.zendrive.sdk.e0(new ArrayList(), new ArrayList()));
} else {
x5.b(context, new m(context, x1Var));
}
}
public static void a(Context context, ZendriveDriveDetectionMode zendriveDriveDetectionMode, com.zendrive.sdk.w wVar) {
a(new h0(wVar, context, zendriveDriveDetectionMode));
}
public static void a(Context context, q6 q6Var, com.zendrive.sdk.w wVar) {
a(new i0(wVar, context, q6Var));
}
public static void a(Context context, String str, @NonNull q6 q6Var, com.zendrive.sdk.w wVar) {
a(new a(wVar, q6Var, str, context));
}
public static void a(Context context, String str, com.zendrive.sdk.w wVar) {
a(new c(wVar, str, context));
}
public static void a(Context context, com.zendrive.sdk.w wVar) {
a(new d(wVar, context));
}
static com.zendrive.sdk.x a(Context context, q6 q6Var, String str) {
u1 d15 = d(context);
if (d15 == null) {
com.zendrive.sdk.x a15 = com.zendrive.sdk.x.a(com.zendrive.sdk.n.SDK_NOT_SETUP, "Cannot call startInsurancePeriod before setup.");
com.zendrive.sdk.utilities.m.F(a15);
return a15;
}
com.zendrive.sdk.x l15 = l(context);
if (!l15.e()) {
return l15;
}
if (q6Var == q6.Period1 && str == null) {
com.zendrive.sdk.x a16 = d15.a(context, ZendriveDriveDetectionMode.AUTO_ON);
if (!a16.e()) {
return a16;
}
}
d15.o().a(q6Var);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "startInsurancePeriod", "Starting insurance period with id : " + q6Var.name(), new Object[0]);
d15.e().a(new InsurancePeriodEvent(q6Var, com.zendrive.sdk.utilities.q0.a(), p6.Start));
d15.e().a(true);
return com.zendrive.sdk.x.b();
}
public static void a(@NonNull Context context, @NonNull com.zendrive.sdk.t tVar, com.zendrive.sdk.w wVar) {
a(new i(wVar, tVar, context));
}
public static void a(Context context, com.zendrive.sdk.k0 k0Var) {
x5.d(new o(context, com.zendrive.sdk.utilities.m.m0(), k0Var));
x5.b(context, new r(context));
}
public static com.zendrive.sdk.o0 a(Context context, com.zendrive.sdk.l0 l0Var) {
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (i(context)) {
x5.b(context, new s(context));
if (!com.zendrive.sdk.utilities.i.f(context)) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "associateVehicle", "Trying to associate a vehicle when bluetooth permission is revoked", new Object[0]);
return com.zendrive.sdk.o0.BLUETOOTH_PERMISSION_REVOKED;
}
if (l0Var != null && com.zendrive.sdk.utilities.p0.c(l0Var.b()) && BluetoothAdapter.checkBluetoothAddress(l0Var.a())) {
List<com.zendrive.sdk.l0> R = a15.R();
ArrayList arrayList = (ArrayList) R;
if (!arrayList.isEmpty()) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
com.zendrive.sdk.l0 l0Var2 = (com.zendrive.sdk.l0) it.next();
if (l0Var2.b().equals(l0Var.b()) || l0Var2.a().equals(l0Var.a())) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "associateVehicle", "Vehicle info %s conflicts with associated vehicle %s", l0Var.toString(), l0Var2.toString());
return com.zendrive.sdk.o0.ASSOCIATED_VEHICLE_CONFLICT;
}
}
}
List<String> a16 = com.zendrive.sdk.utilities.p0.a(context);
if (!a16.contains(l0Var.b()) && a16.size() == 10) {
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "associateVehicle", "Maximum number of associated vehicles reached", new Object[0]);
return com.zendrive.sdk.o0.ASSOCIATED_VEHICLES_LIMIT_EXCEEDED;
}
arrayList.add(l0Var);
a15.a(R);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "associateVehicle", "Associated new vehicle: %s", l0Var.toString());
x5.b(context, new t(context, R, l0Var));
return com.zendrive.sdk.o0.SUCCESS;
}
return com.zendrive.sdk.o0.INVALID_ZENDRIVE_VEHICLE_INFO;
}
return com.zendrive.sdk.o0.SDK_NOT_SETUP;
}
public static com.zendrive.sdk.o0 a(Context context, String str) {
com.zendrive.sdk.l0 l0Var;
com.zendrive.sdk.i.w a15 = com.zendrive.sdk.i.w.a(context);
if (i(context)) {
x5.b(context, new u(context));
if (!com.zendrive.sdk.utilities.p0.c(str)) {
return com.zendrive.sdk.o0.INVALID_VEHICLE_ID;
}
List<com.zendrive.sdk.l0> R = a15.R();
ArrayList arrayList = (ArrayList) R;
if (arrayList.isEmpty()) {
return com.zendrive.sdk.o0.VEHICLE_NOT_ASSOCIATED;
}
Iterator it = arrayList.iterator();
while (true) {
if (!it.hasNext()) {
l0Var = null;
break;
}
l0Var = (com.zendrive.sdk.l0) it.next();
if (str.equals(l0Var.b())) {
break;
}
}
if (l0Var == null) {
return com.zendrive.sdk.o0.VEHICLE_NOT_ASSOCIATED;
}
arrayList.remove(l0Var);
a15.a(R);
com.zendrive.sdk.utilities.b1.d("ZendriveImpl", "dissociateVehicle", "Dissociated vehicle: %s", l0Var.toString());
x5.b(context, new w(context, R, str));
return com.zendrive.sdk.o0.SUCCESS;
}
return com.zendrive.sdk.o0.SDK_NOT_SETUP;
}
private static void a(@NonNull p pVar) {
x5.d(new y(pVar, com.zendrive.sdk.utilities.m.m0()));
}
public static void a(Context context, com.zendrive.sdk.l lVar, com.zendrive.sdk.u uVar, com.zendrive.sdk.w wVar) {
if (lVar == null) {
com.zendrive.sdk.utilities.m.m0().post(new a0(wVar));
return;
}
if (uVar == null) {
com.zendrive.sdk.utilities.m.m0().post(new b0(wVar));
} else if (com.zendrive.sdk.utilities.k.c(context)) {
com.zendrive.sdk.utilities.m.m0().post(new c0(wVar));
} else {
new com.zendrive.sdk.utilities.v0(context.getApplicationContext(), lVar, uVar, wVar).b();
}
}
public static void a(Context context, UUID uuid, Integer num, Integer num2, com.zendrive.sdk.j jVar) {
x5.d(new j0(context, uuid, num == null ? -1 : num.intValue(), num2 != null ? num2.intValue() : -1, new p1(jVar)));
}
public static com.zendrive.sdk.y a(@NonNull Context context, @NonNull Long l15) {
x5.d(new k0(context));
return s2.f41873a.a(context, l15.longValue(), s6.User);
}
public static void a(Context context, com.zendrive.sdk.z zVar) {
x5.d(new g(context, new w1(zVar)));
}
}