导航菜单

页面标题

页面副标题

CashVia v1.6.02 - LocationService.java 源代码

正在查看: CashVia v1.6.02 应用的 LocationService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xy.credyclub.service;

import V2.C0062e0;
import V2.G;
import android.app.Service;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.IBinder;
import androidx.core.content.ContextCompat;
import com.google.gson.Gson;
import com.sensorsdata.analytics.android.sdk.aop.push.PushAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.data.SAProviderHelper;
import com.sensorsdata.analytics.android.sdk.data.adapter.DbParams;
import com.tencent.mmkv.MMKV;
import com.xy.credyclub.repository.risk.info.InfoLocation;
import com.xy.credyclub.service.LocationService;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import q2.AbstractC0257d;
import r2.i;
import t2.c;
import u2.s;

@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/xy/credyclub/service/LocationService;", "Landroid/app/Service;", "<init>", "()V", "app_prodRelease"}, k = 1, mv = {1, SAProviderHelper.URI_CODE.FLUSH_DATA, 0})
@SourceDebugExtension({"SMAP\nLocationService.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LocationService.kt\ncom/xy/credyclub/service/LocationService\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,141:1\n1855#2,2:142\n*S KotlinDebug\n*F\n+ 1 LocationService.kt\ncom/xy/credyclub/service/LocationService\n*L\n59#1:142,2\n*E\n"})
public final class LocationService extends Service {
    public static final int c = 0;
    public LocationManager a;
    public final c b = new c(this);

    public final void a(List list, boolean z) {
        List list2 = list;
        if (list2 == null || list2.isEmpty()) {
            return;
        }
        Address address = (Address) list.get(0);
        HashMap extendInfo = MapsKt.hashMapOf(TuplesKt.to("province", address.getAdminArea()), TuplesKt.to("city", address.getLocality()));
        Intrinsics.checkNotNullParameter("APP_LOCATION", "eventName");
        Intrinsics.checkNotNullParameter(extendInfo, "extendInfo");
        String valueOf = String.valueOf(System.currentTimeMillis());
        String d = AbstractC0257d.d();
        if (d == null) {
            d = "";
        }
        i event = new i(valueOf, d, "", DbParams.GZIP_DATA_EVENT, "APP_LOCATION", "", extendInfo, 384);
        Intrinsics.checkNotNullParameter(event, "event");
        G.h(C0062e0.a, null, new s(event, null), 3);
        String json = new Gson().toJson(new InfoLocation(address.getLocality(), address.getAdminArea(), address.getThoroughfare(), address.getLatitude(), address.getLongitude(), 0, 32, null));
        Intrinsics.checkNotNullExpressionValue(json, "toJson(...)");
        Intrinsics.checkNotNullParameter(json, "json");
        AbstractC0257d.a.putString("il", json);
        if (z) {
            LocationManager locationManager = this.a;
            if (locationManager != null) {
                locationManager.removeUpdates(this.b);
            }
            this.a = null;
            stopSelf();
        }
    }

    public final void b(Location location, final boolean z) {
        if (location == null) {
            return;
        }
        double latitude = location.getLatitude();
        double longitude = location.getLongitude();
        MMKV mmkv = AbstractC0257d.a;
        StringBuilder sb = new StringBuilder();
        sb.append(latitude);
        sb.append(',');
        sb.append(longitude);
        AbstractC0257d.a.putString("lbs", sb.toString());
        try {
            Geocoder geocoder = new Geocoder(this, Locale.getDefault());
            if (Build.VERSION.SDK_INT >= 33) {
                geocoder.getFromLocation(latitude, longitude, 1, new Geocoder.GeocodeListener() {
                    @Override
                    public final void onGeocode(List it) {
                        LocationService this$0 = LocationService.this;
                        boolean z3 = z;
                        int i = LocationService.c;
                        Intrinsics.checkNotNullParameter(this$0, "this$0");
                        Intrinsics.checkNotNullParameter(it, "it");
                        this$0.a(it, z3);
                    }
                });
            } else {
                a(geocoder.getFromLocation(latitude, longitude, 1), z);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public final IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public final int onStartCommand(Intent intent, int i, int i4) {
        LocationManager locationManager;
        List<String> allProviders;
        Object systemService;
        PushAutoTrackHelper.onServiceStartCommand(this, intent, i, i4);
        if (ContextCompat.checkSelfPermission(this, "android.permission.ACCESS_COARSE_LOCATION") != 0) {
            stopSelf();
        } else {
            LocationManager locationManager2 = this.a;
            if (locationManager2 != null) {
                locationManager2.removeUpdates(this.b);
                this.a = null;
            }
            try {
                if (Build.VERSION.SDK_INT >= 23) {
                    systemService = getSystemService(LocationManager.class);
                    locationManager = (LocationManager) systemService;
                } else {
                    Object systemService2 = getSystemService("location");
                    Intrinsics.checkNotNull(systemService2, "null cannot be cast to non-null type android.location.LocationManager");
                    locationManager = (LocationManager) systemService2;
                }
                this.a = locationManager;
                if (locationManager != null && (allProviders = locationManager.getAllProviders()) != null) {
                    Iterator<T> it = allProviders.iterator();
                    while (it.hasNext()) {
                        if (Intrinsics.areEqual((String) it.next(), "network")) {
                            LocationManager locationManager3 = this.a;
                            b(locationManager3 != null ? locationManager3.getLastKnownLocation("network") : null, false);
                            LocationManager locationManager4 = this.a;
                            if (locationManager4 != null) {
                                locationManager4.requestLocationUpdates("network", 0L, 0.0f, this.b);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return super.onStartCommand(intent, i, i4);
    }
}