导航菜单

页面标题

页面副标题

Aplazo v2.4.68 - FlutterLocationService.java 源代码

正在查看: Aplazo v2.4.68 应用的 FlutterLocationService.java JAVA 源代码文件

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


package com.lyokone.location;

import Cd.e;
import Cd.f;
import Cd.i;
import E1.F;
import E1.q;
import Z7.a;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.Service;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.L;
import com.google.android.gms.common.api.b;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationSettingsRequest;
import df.v;
import gi.o;
import hi.I;
import java.util.ArrayList;
import java.util.Map;
import kotlin.jvm.internal.l;
import sa.c;

public final class FlutterLocationService extends Service implements v {
    public final f c = new f(this);
    public boolean d;
    public L e;
    public A4.v f;
    public e g;
    public a h;

    public final boolean a(int i, String[] strArr, int[] iArr) {
        boolean z;
        l.e(strArr, "permissions");
        l.e(iArr, "grantResults");
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 29 && i == 641 && strArr.length == 2 && l.a(strArr[0], "android.permission.ACCESS_FINE_LOCATION") && l.a(strArr[1], "android.permission.ACCESS_BACKGROUND_LOCATION")) {
            if (iArr[0] == 0 && iArr[1] == 0) {
                c();
                a aVar = this.h;
                if (aVar != null) {
                    aVar.a(1);
                }
                this.h = null;
            } else {
                if (i2 >= 29) {
                    L l = this.e;
                    if (l == null) {
                        throw new ActivityNotFoundException();
                    }
                    z = ActivityCompat.w(l, "android.permission.ACCESS_BACKGROUND_LOCATION");
                } else {
                    z = false;
                }
                if (z) {
                    a aVar2 = this.h;
                    if (aVar2 != null) {
                        aVar2.c("PERMISSION_DENIED", "Background location permission denied", (Object) null);
                    }
                } else {
                    a aVar3 = this.h;
                    if (aVar3 != null) {
                        aVar3.c("PERMISSION_DENIED_NEVER_ASK", "Background location permission denied forever - please open app settings", (Object) null);
                    }
                }
                this.h = null;
            }
        }
        return false;
    }

    public final Map b(i iVar) {
        A4.v vVar = this.f;
        if (vVar != null) {
            boolean z = this.d;
            String str = ((i) vVar.e).a;
            String str2 = iVar.a;
            if (!l.a(str2, str)) {
                F f = new F((Context) vVar.d);
                NotificationChannel notificationChannel = new NotificationChannel("flutter_location_channel_01", str2, 0);
                notificationChannel.setLockscreenVisibility(0);
                f.b.createNotificationChannel(notificationChannel);
            }
            vVar.A(iVar, z);
            vVar.e = iVar;
        }
        if (this.d) {
            return I.f(new o[]{new o("channelId", "flutter_location_channel_01"), new o("notificationId", 75418)});
        }
        return null;
    }

    public final void c() {
        if (this.d) {
            Log.d("FlutterLocationService", "Service already in foreground mode.");
            return;
        }
        Log.d("FlutterLocationService", "Start service in foreground mode.");
        A4.v vVar = this.f;
        l.b(vVar);
        String str = ((i) vVar.e).a;
        F f = new F((Context) vVar.d);
        NotificationChannel notificationChannel = new NotificationChannel("flutter_location_channel_01", str, 0);
        notificationChannel.setLockscreenVisibility(0);
        f.b.createNotificationChannel(notificationChannel);
        Notification a = ((q) vVar.f).a();
        l.d(a, "builder.build()");
        startForeground(75418, a);
        this.d = true;
    }

    public final void d(Activity activity) {
        L l = (L) activity;
        this.e = l;
        e eVar = this.g;
        if (eVar != null) {
            eVar.c = l;
            if (activity == null) {
                ka.a aVar = eVar.d;
                if (aVar != null) {
                    aVar.f(eVar.h);
                }
                eVar.d = null;
                eVar.e = null;
                LocationManager locationManager = eVar.s;
                if (locationManager != null) {
                    locationManager.removeNmeaListener(eVar.i);
                    eVar.i = null;
                    return;
                }
                return;
            }
            int i = c.a;
            com.google.android.gms.common.api.a aVar2 = b.S0;
            com.google.android.gms.common.api.e eVar2 = com.google.android.gms.common.api.e.c;
            A4.c cVar = ka.a.k;
            eVar.d = new ka.a(activity, activity, cVar, aVar2, eVar2);
            eVar.e = new ka.a(activity, activity, cVar, aVar2, eVar2);
            eVar.d();
            eVar.e();
            ArrayList arrayList = new ArrayList();
            LocationRequest locationRequest = eVar.f;
            if (locationRequest != null) {
                arrayList.add(locationRequest);
            }
            eVar.g = new LocationSettingsRequest(arrayList, false, false);
        }
    }

    @Override
    public final IBinder onBind(Intent intent) {
        Log.d("FlutterLocationService", "Binding to location service.");
        return this.c;
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        Log.d("FlutterLocationService", "Creating service.");
        this.g = new e(getApplicationContext());
        Context applicationContext = getApplicationContext();
        l.d(applicationContext, "applicationContext");
        this.f = new A4.v(applicationContext);
    }

    @Override
    public final void onDestroy() {
        Log.d("FlutterLocationService", "Destroying service.");
        this.g = null;
        this.f = null;
        super.onDestroy();
    }

    @Override
    public final boolean onUnbind(Intent intent) {
        Log.d("FlutterLocationService", "Unbinding from location service.");
        return super.onUnbind(intent);
    }
}