正在查看: Minits v4.9.3.32 应用的 XoneGPSService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 XoneGPSService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xone.maps.services;
import G7.b;
import U9.H;
import W9.a;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.GpsSatellite;
import android.location.GpsStatus;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateFormat;
import com.xone.android.utils.Utils;
import com.xone.maps.services.XoneGPSService;
import com.xone.replicator.helpers.DatabaseFilesHelper;
import fa.j;
import fb.AbstractC0698k;
import fb.t;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import q3.e;
import q3.f;
import q3.i;
import ua.InterfaceC1038m0;
import ua.L;
import ya.AbstractC1100b;
import z0.r;
@SuppressLint({"MissingPermission"})
public final class XoneGPSService extends Service implements L, LocationListener, GpsStatus.Listener {
public static boolean w;
public static String x;
public static String y;
public LocationManager l;
public ActivityManager m;
public int q;
public int s;
public int t;
public Object u;
public boolean v;
public final List n = new CopyOnWriteArrayList();
public final List o = new CopyOnWriteArrayList();
public int p = 3;
public final int r = 555;
public static void b(WeakReference weakReference) {
XoneGPSService xoneGPSService = (XoneGPSService) weakReference.get();
if (xoneGPSService == null || xoneGPSService.n()) {
return;
}
int i = xoneGPSService.t + 1;
xoneGPSService.t = i;
if (i > 60) {
xoneGPSService.t = 0;
return;
}
LocationManager j = xoneGPSService.j();
long k = xoneGPSService.k();
if (j.isProviderEnabled("gps")) {
j.requestLocationUpdates("gps", k, 0.0f, xoneGPSService);
} else {
xoneGPSService.q(weakReference);
}
}
public static boolean o() {
return w;
}
public static void r(boolean z) {
w = z;
}
public static void s(String str) {
y = str;
}
public static void t(String str) {
x = str;
}
@Override
public List a() {
return this.n.isEmpty() ? g() : h();
}
public final void d() {
if (Build.VERSION.SDK_INT < 30) {
this.l.addGpsStatusListener(this);
return;
}
b bVar = new b(this);
this.u = bVar;
this.l.registerGnssStatusCallback(H.a(bVar));
}
public final void e(Location location) {
Location i = i(location.getProvider());
if (i == null) {
this.n.add(location);
this.o.add(location.getProvider());
} else if (i.distanceTo(location) > this.p) {
this.n.add(location);
this.o.add(location.getProvider());
} else {
i.setTime(location.getTime());
}
if (this.n.size() == 10) {
this.n.remove(0);
this.o.remove(0);
}
}
public final void f() {
if (Build.VERSION.SDK_INT >= 30) {
Object obj = this.u;
if (obj != null) {
this.l.unregisterGnssStatusCallback(H.a(obj));
this.u = null;
}
} else {
this.l.removeGpsStatusListener(this);
}
this.l.removeUpdates(this);
}
public final List g() {
ArrayList arrayList = new ArrayList();
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("PRECISION", "0");
hashMap.put("VELOCIDAD", "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.add(hashMap);
return arrayList;
}
public final List h() {
ArrayList arrayList = new ArrayList();
for (int size = this.n.size() - 1; size >= 0; size--) {
Location location = (Location) this.n.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");
hashMap.put("SATELITES", t.y(Integer.valueOf(this.s)));
if (this.o.size() > size) {
hashMap.put("FUENTE", (String) this.o.get(size));
} else {
hashMap.put("FUENTE", "");
}
arrayList.add(hashMap);
}
return arrayList;
}
public final Location i(String str) {
if (this.n.isEmpty()) {
return null;
}
for (int size = this.n.size() - 1; size >= 0; size--) {
Location location = (Location) this.n.get(size);
if (TextUtils.equals(location.getProvider(), str)) {
return location;
}
}
return null;
}
public final LocationManager j() {
return this.l;
}
public final long k() {
return this.q;
}
public final NotificationManager l() {
Object systemService = getApplicationContext().getSystemService("notification");
if (systemService instanceof NotificationManager) {
return (NotificationManager) systemService;
}
throw new NullPointerException("Cannot get notification manager service");
}
public final void m() {
XoneGPSService xoneGPSService;
if (this.l.isProviderEnabled("network")) {
xoneGPSService = this;
this.l.requestLocationUpdates("network", this.q, 0.0f, xoneGPSService);
} else {
xoneGPSService = this;
}
if (Utils.h3(getApplication())) {
if (xoneGPSService.l.isProviderEnabled("gps")) {
XoneGPSService xoneGPSService2 = xoneGPSService;
xoneGPSService2.l.requestLocationUpdates("gps", xoneGPSService2.q, 0.0f, xoneGPSService2);
} else {
u();
q(new WeakReference(this));
}
}
d();
}
public final boolean n() {
return this.v;
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
if (o()) {
if (TextUtils.isEmpty(y)) {
y = " ";
}
if (TextUtils.isEmpty(x)) {
x = " ";
}
int i = Build.VERSION.SDK_INT;
if (i >= 26) {
NotificationManager l = l();
if (e.a(l, "LocationServiceNotificationChannel") == null) {
Context applicationContext = getApplicationContext();
a.a();
f.a(l, i.a("LocationServiceNotificationChannel", applicationContext.getString(AbstractC1100b.c), 2));
}
}
Context applicationContext2 = getApplicationContext();
r.e eVar = new r.e(applicationContext2, "LocationServiceNotificationChannel");
eVar.y(ha.t.a);
eVar.m(x);
eVar.l(y);
eVar.k(PendingIntent.getActivity(applicationContext2, 0, new Intent(), Utils.l2(false, 0)));
eVar.w(-2);
Notification c = eVar.c();
if (Utils.H2(applicationContext2) < 34 || i < 34) {
startForeground(555, c);
} else if (C9.e.o(applicationContext2, "android.permission.FOREGROUND_SERVICE_LOCATION")) {
startForeground(555, c, 8);
} else {
Utils.g4(applicationContext2, "FOREGROUND_SERVICE_LOCATION is not declared. Foreground service cannot be launched");
}
}
this.s = 0;
this.t = 0;
this.l = (LocationManager) getSystemService("location");
this.m = (ActivityManager) getSystemService("activity");
if (Utils.h3(getApplication()) && !this.l.isProviderEnabled("gps")) {
if (Utils.s3()) {
u();
} else {
j.m(new Runnable() {
@Override
public final void run() {
XoneGPSService.this.u();
}
});
}
}
m();
((InterfaceC1038m0) getApplicationContext()).e0(this);
this.v = false;
}
@Override
public void onDestroy() {
super.onDestroy();
this.v = true;
((InterfaceC1038m0) getApplicationContext()).e0(null);
f();
if (o()) {
stopForeground(true);
}
}
@Override
public void onGpsStatusChanged(int i) {
if (i != 4) {
return;
}
try {
if (Build.VERSION.SDK_INT >= 30) {
return;
}
GpsStatus gpsStatus = this.l.getGpsStatus(null);
this.s = 0;
if (gpsStatus == null) {
return;
}
Iterator<GpsSatellite> it = gpsStatus.getSatellites().iterator();
while (it.hasNext()) {
if (it.next().usedInFix()) {
this.s++;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onLocationChanged(Location location) {
if (location == null) {
return;
}
e(new Location(location));
}
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
this.p = AbstractC0698k.i(intent, "meters_distance_range", 3);
this.q = AbstractC0698k.i(intent, "time_between_updates", 0);
return super.onStartCommand(intent, i, i2);
}
@Override
public void onStatusChanged(String str, int i, Bundle bundle) {
}
public final boolean p(Context context) {
return !context.getPackageManager().queryIntentActivities(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"), 65536).isEmpty();
}
public final void q(final WeakReference weakReference) {
j.q(new Runnable() {
@Override
public final void run() {
XoneGPSService.b(weakReference);
}
}, 1000L);
}
public final void u() {
if (Ja.b.b(this.m)) {
return;
}
Intent intent = p(getApplicationContext()) ? new Intent("android.settings.LOCATION_SOURCE_SETTINGS") : null;
if (intent == null) {
try {
Settings.System.getInt(getContentResolver(), "android.settings.SECURITY_SETTINGS_SETUPWIZARD");
intent = new Intent("android.settings.SECURITY_SETTINGS_SETUPWIZARD");
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
}
if (intent == null) {
intent = new Intent("android.settings.SECURITY_SETTINGS");
}
intent.setFlags(268435456);
startActivity(intent);
}
}