导航菜单

页面标题

页面副标题

Petal Maps v4.7.0.310001 - TeamLocationShareService.java 源代码

正在查看: Petal Maps v4.7.0.310001 应用的 TeamLocationShareService.java JAVA 源代码文件

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


package com.huawei.maps.team.service;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import com.huawei.map.mapapi.model.BitmapDescriptorFactory;
import com.huawei.maps.app.routeplan.util.WorkerResult;
import com.huawei.maps.team.R$drawable;
import com.huawei.maps.team.service.TeamLocationShareService;
import com.huawei.secure.android.common.activity.SafeService;
import com.huawei.secure.android.common.intent.SafeBundle;
import com.huawei.secure.android.common.intent.SafeIntent;

public class TeamLocationShareService extends SafeService {
    public static volatile SafeIntent e = null;
    public static volatile boolean f = false;
    public static final Object g = new Object();
    public static String h = "";
    public static String i = "";
    public static String j = "";
    public static ServiceConnection k = null;
    public static boolean l = false;
    public Notification b;
    public NotificationManager c;
    public Bitmap d;

    public class a implements ServiceConnection {
        public static void b(IBinder iBinder) {
            ((b) iBinder).a().h();
        }

        @Override
        public void onServiceConnected(ComponentName componentName, final IBinder iBinder) {
            hm4.p("TeamLocationShareService", "LocationShareService bind");
            if (iBinder instanceof b) {
                try {
                    if (Build.VERSION.SDK_INT >= 31) {
                        rya.a.b(new WorkerResult() {
                            public final void doWork() {
                                TeamLocationShareService.a.b(iBinder);
                            }
                        });
                    } else {
                        ((b) iBinder).a().h();
                    }
                } catch (Exception e) {
                    o05.c(e, true);
                    hm4.p("TeamLocationShareService", "team onServiceConnected fail");
                }
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            hm4.p("TeamLocationShareService", "unbind");
        }
    }

    public class b extends Binder {
        public b() {
        }

        @NonNull
        public TeamLocationShareService a() {
            return TeamLocationShareService.this;
        }
    }

    private Notification a() {
        if (this.c == null) {
            NotificationManager notificationManager = (NotificationManager) o41.b().getSystemService("notification");
            this.c = notificationManager;
            if (notificationManager != null) {
                NotificationChannel notificationChannel = new NotificationChannel("80000", h, 2);
                notificationChannel.setSound(null, null);
                this.c.createNotificationChannel(notificationChannel);
            }
        }
        Uri parse = Uri.parse("petalmaps://showPage?page=TeamMapModule&fromType=" + j);
        SafeIntent a2 = jo9.a.a();
        if (a2 != null) {
            a2.setFlags(268435456);
            a2.setData(parse);
        } else {
            a2 = new SafeIntent(new Intent());
        }
        SafeBundle safeBundle = new SafeBundle();
        safeBundle.putBoolean("team_map_from_hot_key", true);
        a2.putExtra("TeamService", safeBundle.getBundle());
        PendingIntent activity = PendingIntent.getActivity(o41.b(), 0, a2, 201326592);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(o41.b(), "80000");
        builder.setContentText(i).setSmallIcon(R$drawable.appbg_color).setContentTitle(h).setLargeIcon(b()).setOngoing(false).setSound((Uri) null).setContentIntent(activity).setWhen(System.currentTimeMillis());
        return builder.build();
    }

    private Bitmap b() {
        Bitmap bitmap = this.d;
        if (bitmap != null) {
            return bitmap;
        }
        int i2 = R$drawable.appbg;
        this.d = BitmapDescriptorFactory.fromResource(i2).getBitmap();
        hm4.p("TeamLocationShareService", " getLargeIcon drawable is : " + i2);
        StringBuilder sb = new StringBuilder();
        sb.append(" getLargeIcon is empty : ");
        boolean z = false;
        sb.append(this.d == null);
        hm4.p("TeamLocationShareService", sb.toString());
        StringBuilder sb2 = new StringBuilder();
        sb2.append(" getLargeIcon is isRecycled : ");
        Bitmap bitmap2 = this.d;
        if (bitmap2 != null && bitmap2.isRecycled()) {
            z = true;
        }
        sb2.append(z);
        hm4.p("TeamLocationShareService", sb2.toString());
        return this.d;
    }

    private static ServiceConnection c() {
        return new a();
    }

    public static void e(String str) {
        j = str;
    }

    public static void f(String str) {
        i = str;
    }

    public static void g(String str) {
        h = str;
    }

    public static void i() {
        hm4.p("TeamLocationShareService", "startLocationShareService");
        synchronized (g) {
            try {
                if (f) {
                    return;
                }
                e = new SafeIntent(new Intent((Context) o41.b(), (Class<?>) TeamLocationShareService.class));
                if (e == null) {
                    f = false;
                    return;
                }
                k = c();
                l = o41.b().bindService(e, k, 1);
                f = true;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public static boolean j() {
        hm4.p("TeamLocationShareService", "stopLocationShareService");
        synchronized (g) {
            try {
                if (!f) {
                    return false;
                }
                if (k == null || e == null) {
                    f = false;
                    return false;
                }
                try {
                    if (l) {
                        hm4.p("TeamLocationShareService", "start unBindService");
                        o41.b().unbindService(k);
                        l = false;
                    }
                } catch (IllegalArgumentException unused) {
                    hm4.h("TeamLocationShareService", "unBindError");
                }
                o41.b().stopService(e);
                k = null;
                e = null;
                f = false;
                return true;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    private void k() {
        try {
            stopForeground(true);
            stopSelf();
        } catch (Exception unused) {
            hm4.p("TeamLocationShareService", "stopNavService LocationShareService catch exception");
        }
    }

    public void d() {
        if (this.b == null) {
            Notification a2 = a();
            this.b = a2;
            a2.flags |= 64;
        }
    }

    public void h() {
        d();
        if (Build.VERSION.SDK_INT >= 29) {
            startForeground(1002, this.b, -1);
        } else {
            startForeground(1002, this.b);
        }
    }

    @Nullable
    public IBinder onBind(Intent intent) {
        return new b();
    }

    public void onCreate() {
        super.onCreate();
        hm4.p("TeamLocationShareService", "onCreate");
    }

    public void onDestroy() {
        super.onDestroy();
        hm4.p("TeamLocationShareService", "onDestroy");
        Bitmap bitmap = this.d;
        if (bitmap != null) {
            bitmap.recycle();
            this.d = null;
        }
        NotificationManager notificationManager = this.c;
        if (notificationManager != null) {
            notificationManager.cancel(1002);
        }
        k();
    }
}