导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - i0.java 源代码

正在查看: BetterTogether v3.0.0 应用的 i0.java JAVA 源代码文件

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


package com.onesignal;

import android.app.Service;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.app.job.JobWorkItem;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerManager;
import java.util.ArrayList;
import java.util.HashMap;

public abstract class i0 extends Service {
    public static final Object x = new Object();
    public static final HashMap y = new HashMap();
    public JobIntentService$JobServiceEngineImpl d;
    public JobIntentService$WorkEnqueuer e;
    public JobIntentService$CommandProcessor i;
    public boolean v = false;
    public final ArrayList w = new ArrayList();

    public static JobIntentService$WorkEnqueuer b(final Context context, final ComponentName componentName, boolean z, final int i, final boolean z2) {
        JobIntentService$WorkEnqueuer jobIntentService$WorkEnqueuer;
        Object obj = new Object(componentName, z2) {
            private ComponentName componentName;
            private boolean useWakefulService;

            {
                this.componentName = componentName;
                this.useWakefulService = z2;
            }
        };
        HashMap hashMap = y;
        JobIntentService$WorkEnqueuer jobIntentService$WorkEnqueuer2 = (JobIntentService$WorkEnqueuer) hashMap.get(obj);
        if (jobIntentService$WorkEnqueuer2 != null) {
            return jobIntentService$WorkEnqueuer2;
        }
        if (z2) {
            jobIntentService$WorkEnqueuer = new JobIntentService$WorkEnqueuer(context, componentName) {
                private final Context mContext;
                private final PowerManager.WakeLock mLaunchWakeLock;
                boolean mLaunchingService;
                private final PowerManager.WakeLock mRunWakeLock;
                boolean mServiceProcessing;

                {
                    super(componentName);
                    this.mContext = context.getApplicationContext();
                    PowerManager powerManager = (PowerManager) context.getSystemService("power");
                    PowerManager.WakeLock newWakeLock = powerManager.newWakeLock(1, componentName.getClassName() + ":launch");
                    this.mLaunchWakeLock = newWakeLock;
                    newWakeLock.setReferenceCounted(false);
                    PowerManager.WakeLock newWakeLock2 = powerManager.newWakeLock(1, componentName.getClassName() + ":run");
                    this.mRunWakeLock = newWakeLock2;
                    newWakeLock2.setReferenceCounted(false);
                }

                @Override
                public void enqueueWork(Intent intent) {
                    Intent intent2 = new Intent(intent);
                    intent2.setComponent(this.mComponentName);
                    if (this.mContext.startService(intent2) != null) {
                        synchronized (this) {
                            if (!this.mLaunchingService) {
                                this.mLaunchingService = true;
                                if (!this.mServiceProcessing) {
                                    this.mLaunchWakeLock.acquire(60000L);
                                }
                            }
                        }
                    }
                }

                @Override
                public void serviceProcessingFinished() {
                    synchronized (this) {
                        if (this.mServiceProcessing) {
                            if (this.mLaunchingService) {
                                this.mLaunchWakeLock.acquire(60000L);
                            }
                            this.mServiceProcessing = false;
                            this.mRunWakeLock.release();
                        }
                    }
                }

                @Override
                public void serviceProcessingStarted() {
                    synchronized (this) {
                        if (!this.mServiceProcessing) {
                            this.mServiceProcessing = true;
                            this.mRunWakeLock.acquire(600000L);
                            this.mLaunchWakeLock.release();
                        }
                    }
                }

                @Override
                public void serviceStartReceived() {
                    synchronized (this) {
                        this.mLaunchingService = false;
                    }
                }
            };
        } else {
            if (!z) {
                throw new IllegalArgumentException("Can't be here without a job id");
            }
            jobIntentService$WorkEnqueuer = new JobIntentService$WorkEnqueuer(context, componentName, i) {
                private final JobInfo mJobInfo;
                private final JobScheduler mJobScheduler;

                {
                    super(componentName);
                    ensureJobId(i);
                    this.mJobInfo = new JobInfo.Builder(i, this.mComponentName).setOverrideDeadline(0L).build();
                    this.mJobScheduler = (JobScheduler) context.getApplicationContext().getSystemService("jobscheduler");
                }

                @Override
                public void enqueueWork(Intent intent) {
                    this.mJobScheduler.enqueue(this.mJobInfo, new JobWorkItem(intent));
                }
            };
        }
        JobIntentService$WorkEnqueuer jobIntentService$WorkEnqueuer3 = jobIntentService$WorkEnqueuer;
        hashMap.put(obj, jobIntentService$WorkEnqueuer3);
        return jobIntentService$WorkEnqueuer3;
    }

    public final void a(boolean z) {
        if (this.i == null) {
            this.i = new AsyncTask<Void, Void, Void>() {
                @Override
                public Void doInBackground(Void... voidArr) {
                    JobIntentService$GenericWorkItem jobIntentService$GenericWorkItem;
                    while (true) {
                        i0 i0Var = i0.this;
                        JobIntentService$JobServiceEngineImpl jobIntentService$JobServiceEngineImpl = i0Var.d;
                        if (jobIntentService$JobServiceEngineImpl == null || (jobIntentService$GenericWorkItem = jobIntentService$JobServiceEngineImpl.dequeueWork()) == null) {
                            synchronized (i0Var.w) {
                                jobIntentService$GenericWorkItem = i0Var.w.size() > 0 ? (JobIntentService$GenericWorkItem) i0Var.w.remove(0) : null;
                            }
                        }
                        if (jobIntentService$GenericWorkItem == null) {
                            return null;
                        }
                        i0 i0Var2 = i0.this;
                        Intent intent = jobIntentService$GenericWorkItem.getIntent();
                        FCMIntentJobService fCMIntentJobService = (FCMIntentJobService) i0Var2;
                        fCMIntentJobService.getClass();
                        Bundle extras = intent.getExtras();
                        if (extras != null) {
                            y3.A(fCMIntentJobService);
                            m3.M(fCMIntentJobService, extras, new androidx.recyclerview.widget.k0(fCMIntentJobService, 1));
                        }
                        jobIntentService$GenericWorkItem.complete();
                    }
                }

                @Override
                public void onCancelled(Void r1) {
                    i0.this.c();
                }

                @Override
                public void onPostExecute(Void r1) {
                    i0.this.c();
                }
            };
            JobIntentService$WorkEnqueuer jobIntentService$WorkEnqueuer = this.e;
            if (jobIntentService$WorkEnqueuer != null && z) {
                jobIntentService$WorkEnqueuer.serviceProcessingStarted();
            }
            executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
        }
    }

    public final void c() {
        ArrayList arrayList = this.w;
        if (arrayList != null) {
            synchronized (arrayList) {
                this.i = null;
                ArrayList arrayList2 = this.w;
                if (arrayList2 != null && arrayList2.size() > 0) {
                    a(false);
                } else if (!this.v) {
                    this.e.serviceProcessingFinished();
                }
            }
        }
    }

    @Override
    public final IBinder onBind(Intent intent) {
        JobIntentService$JobServiceEngineImpl jobIntentService$JobServiceEngineImpl = this.d;
        if (jobIntentService$JobServiceEngineImpl != null) {
            return jobIntentService$JobServiceEngineImpl.compatGetBinder();
        }
        return null;
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        this.d = new JobIntentService$JobServiceEngineImpl(this);
        this.e = null;
        this.e = b(this, new ComponentName(this, getClass()), false, 0, true);
    }

    @Override
    public final void onDestroy() {
        super.onDestroy();
        JobIntentService$CommandProcessor jobIntentService$CommandProcessor = this.i;
        if (jobIntentService$CommandProcessor != null) {
            jobIntentService$CommandProcessor.cancel(false);
        }
        synchronized (this.w) {
            this.v = true;
            this.e.serviceProcessingFinished();
        }
    }

    @Override
    public final int onStartCommand(final Intent intent, int i, final int i2) {
        this.e.serviceStartReceived();
        synchronized (this.w) {
            ArrayList arrayList = this.w;
            if (intent == null) {
                intent = new Intent();
            }
            arrayList.add(new JobIntentService$GenericWorkItem(intent, i2) {
                final Intent mIntent;
                final int mStartId;

                {
                    this.mIntent = intent;
                    this.mStartId = i2;
                }

                @Override
                public void complete() {
                    i0.this.stopSelf(this.mStartId);
                }

                @Override
                public Intent getIntent() {
                    return this.mIntent;
                }
            });
            a(true);
        }
        return 3;
    }
}