正在查看: Minits v4.9.3.32 应用的 XoneGPSServiceV2.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 XoneGPSServiceV2.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xone.maps.services;
import Aa.a;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateFormat;
import b4.b;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.xone.android.utils.Utils;
import com.xone.interfaces.IXoneApp;
import com.xone.interfaces.IXoneObject;
import com.xone.maps.services.XoneGPSServiceV2;
import com.xone.replicator.helpers.DatabaseFilesHelper;
import fb.AbstractC0692e;
import fb.AbstractC0698k;
import ha.t;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import m4.l;
import q3.e;
import q3.f;
import q3.i;
import q3.j;
import ua.InterfaceC1038m0;
import ua.L;
import ya.AbstractC1100b;
import z0.r;
@SuppressLint({"MissingPermission"})
public final class XoneGPSServiceV2 extends Service implements L {
public static boolean w = false;
public static String x;
public static String y;
public final int l = 555;
public final List m = new CopyOnWriteArrayList();
public final List n = new CopyOnWriteArrayList();
public boolean o;
public Thread p;
public b q;
public a r;
public String s;
public long t;
public int u;
public Future v;
private synchronized void e(Location location) {
if (location != null) {
try {
if (!TextUtils.isEmpty(location.getProvider())) {
Location j = j(location);
if (j == null) {
this.m.add(location);
this.n.add(location.getProvider());
} else if (j.distanceTo(location) > 3.0f) {
this.m.add(location);
this.n.add(location.getProvider());
} else {
Location location2 = new Location(j);
location2.setTime(location.getTime());
this.m.add(location2);
this.n.add(location2.getProvider());
}
if (this.m.size() == 5) {
this.m.remove(0);
this.n.remove(0);
}
g(location);
}
} finally {
}
}
}
private List h() {
HashMap hashMap = new HashMap();
hashMap.put(DatabaseFilesHelper.ID_COLUMN, "0");
hashMap.put("LATITUD", "0");
hashMap.put("LONGITUD", "0");
hashMap.put("ALTITUD", "0");
hashMap.put("RUMBO", "0");
hashMap.put("VELOCIDAD", "0");
hashMap.put("PRECISION", "0");
GregorianCalendar gregorianCalendar = new GregorianCalendar();
hashMap.put("FGPS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(gregorianCalendar.getTime()));
hashMap.put("HGPS", DateFormat.getTimeFormat(getApplicationContext()).format(gregorianCalendar.getTime()));
hashMap.put(DatabaseFilesHelper.STATUS_COLUMN, "0");
hashMap.put("SATELITES", "0");
ArrayList arrayList = new ArrayList();
arrayList.add(hashMap);
return arrayList;
}
private List i() {
ArrayList arrayList = new ArrayList();
for (int size = this.m.size() - 1; size >= 0; size--) {
try {
Location location = (Location) this.m.get(size);
HashMap hashMap = new HashMap();
hashMap.put(DatabaseFilesHelper.ID_COLUMN, String.valueOf(size));
hashMap.put("LATITUD", String.valueOf(location.getLatitude()));
hashMap.put("LONGITUD", String.valueOf(location.getLongitude()));
hashMap.put("ALTITUD", String.valueOf(location.getAltitude()));
hashMap.put("PRECISION", String.valueOf(location.getAccuracy()));
hashMap.put("RUMBO", String.valueOf(location.getBearing()));
hashMap.put("VELOCIDAD", String.valueOf(location.getSpeed()));
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeInMillis(location.getTime());
hashMap.put("FGPS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(gregorianCalendar.getTime()));
hashMap.put("HGPS", DateFormat.getTimeFormat(getApplicationContext()).format(gregorianCalendar.getTime()));
hashMap.put(DatabaseFilesHelper.STATUS_COLUMN, "1");
Bundle extras = location.getExtras();
if (extras != null && extras.containsKey("satellites")) {
hashMap.put("SATELITES", AbstractC0692e.j(extras, "satellites", ""));
}
if (this.n.size() > size) {
hashMap.put("FUENTE", (String) this.n.get(size));
this.n.remove(size);
} else {
hashMap.put("FUENTE", "");
}
arrayList.add(hashMap);
this.m.remove(size);
} catch (Exception e) {
e.printStackTrace();
}
}
return arrayList;
}
private NotificationManager k() {
Object systemService = getApplicationContext().getSystemService("notification");
if (systemService instanceof NotificationManager) {
return (NotificationManager) systemService;
}
throw new NullPointerException("Cannot get notification manager service");
}
private static boolean l() {
return w;
}
public static boolean m(Context context) {
return j.o().g(context.getApplicationContext()) == 0;
}
public static boolean n(Context context) {
LocationManager locationManager = (LocationManager) context.getApplicationContext().getSystemService("location");
if (locationManager != null) {
return locationManager.isProviderEnabled("gps");
}
throw new NullPointerException("Cannot obtain LocationManager instance");
}
private static boolean o(Context context) {
return !context.getPackageManager().queryIntentActivities(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"), 65536).isEmpty();
}
public static void r(Context context) {
while (!n(context)) {
try {
v(context);
Thread.sleep(30000L);
} catch (InterruptedException unused) {
return;
} catch (Exception e) {
e.printStackTrace();
return;
}
}
}
public static void s(boolean z) {
w = z;
}
public static void t(String str) {
y = str;
}
public static void u(String str) {
x = str;
}
public static void v(Context context) {
Intent intent;
if (o(context)) {
intent = new Intent("android.settings.LOCATION_SOURCE_SETTINGS");
} else {
try {
Settings.System.getInt(context.getContentResolver(), "android.settings.SECURITY_SETTINGS_SETUPWIZARD");
intent = new Intent("android.settings.SECURITY_SETTINGS_SETUPWIZARD");
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
intent = null;
}
}
if (intent == null) {
intent = new Intent("android.settings.SECURITY_SETTINGS");
}
intent.setFlags(268435456);
context.startActivity(intent);
}
@Override
public List a() {
return this.m.isEmpty() ? h() : i();
}
public final void f() {
if (Build.VERSION.SDK_INT < 26) {
return;
}
NotificationManager k = k();
if (e.a(k, "LocationServiceNotificationChannel") != null) {
return;
}
W9.a.a();
f.a(k, i.a("LocationServiceNotificationChannel", getApplicationContext().getString(AbstractC1100b.c), 2));
}
public final void g(Location location) {
InterfaceC1038m0 interfaceC1038m0;
IXoneApp G0;
IXoneObject currentCompany;
if (TextUtils.isEmpty(this.s) || this.o) {
return;
}
if (this.u == 2) {
this.o = true;
}
ComponentCallbacks2 application = getApplication();
if (!(application instanceof InterfaceC1038m0) || (G0 = (interfaceC1038m0 = (InterfaceC1038m0) application).G0()) == null || (currentCompany = G0.getCurrentCompany()) == null) {
return;
}
Future future = this.v;
if (future == null || future.isDone()) {
this.v = new Ga.f(interfaceC1038m0, currentCompany, this.s, location).runSerially();
}
}
public final Location j(Location location) {
String provider;
if (location != null && !this.m.isEmpty()) {
for (int size = this.m.size() - 1; size >= 0; size--) {
Location location2 = (Location) this.m.get(size);
if (location2 != null && (provider = location2.getProvider()) != null && provider.equals(location.getProvider())) {
return location2;
}
}
}
return null;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
Context applicationContext = getApplicationContext();
if (l()) {
if (TextUtils.isEmpty(y)) {
y = " ";
}
if (TextUtils.isEmpty(x)) {
x = " ";
}
f();
r.e eVar = new r.e(applicationContext, "LocationServiceNotificationChannel");
eVar.y(t.a);
eVar.m(x);
eVar.l(y);
eVar.k(PendingIntent.getActivity(applicationContext, 0, new Intent(), Utils.l2(false, 0)));
eVar.w(-2);
Notification c = eVar.c();
if (Utils.H2(applicationContext) < 34 || Build.VERSION.SDK_INT < 34) {
startForeground(555, c);
} else if (C9.e.o(applicationContext, "android.permission.FOREGROUND_SERVICE_LOCATION")) {
startForeground(555, c, 8);
} else {
Utils.g4(applicationContext, "FOREGROUND_SERVICE_LOCATION is not declared. Foreground service cannot be launched");
}
}
j o = j.o();
int g = o.g(applicationContext);
if (g != 0) {
o.q(applicationContext, g);
this.o = true;
return;
}
this.o = false;
w();
b a = b4.f.a(applicationContext);
this.q = a;
a.f().c(new m4.f() {
public final void a(l lVar) {
XoneGPSServiceV2.this.q(lVar);
}
});
((InterfaceC1038m0) applicationContext).e0(this);
}
@Override
public void onDestroy() {
super.onDestroy();
((InterfaceC1038m0) getApplicationContext()).e0(null);
Thread thread = this.p;
if (thread != null && thread.isAlive()) {
try {
this.p.interrupt();
} catch (Exception e) {
e.printStackTrace();
}
}
this.o = true;
y();
if (l()) {
stopForeground(true);
}
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
if (!m(getApplicationContext())) {
return super.onStartCommand(intent, i, i2);
}
Bundle f = AbstractC0698k.f(intent);
if (f != null) {
this.s = f.getString("callback_nodename");
this.t = f.getLong("gps_interval");
this.u = f.getInt("gps_flag");
}
this.o = false;
w();
x();
return super.onStartCommand(intent, i, i2);
}
public final void p(LocationResult locationResult) {
e(locationResult.j1());
}
public final void q(l lVar) {
try {
Location location = (Location) lVar.l();
if (location == null) {
return;
}
e(location);
} catch (Exception e) {
e.printStackTrace();
}
}
public final void w() {
if (this.o) {
return;
}
Thread thread = this.p;
if (thread == null || !thread.isAlive()) {
final Context applicationContext = getApplicationContext();
Thread thread2 = new Thread(new Runnable() {
@Override
public final void run() {
XoneGPSServiceV2.r(applicationContext);
}
}, "CheckGpsStatusThread");
this.p = thread2;
thread2.start();
}
}
public final void x() {
y();
if (this.q == null) {
return;
}
if (this.r == null) {
this.r = new a(new Ca.b() {
@Override
public final void a(LocationResult locationResult) {
XoneGPSServiceV2.this.p(locationResult);
}
}, null);
}
int i = this.u;
this.q.g(new LocationRequest.a(this.t).j(i != 1 ? i != 2 ? 100 : 104 : 102).a(), this.r, Looper.getMainLooper());
}
public final void y() {
a aVar;
b bVar = this.q;
if (bVar == null || (aVar = this.r) == null) {
return;
}
bVar.b(aVar);
}
}