APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Class 9 Nepali Solutions
版本号:12.0
包名称:com.kakideveloper.class9nepalinote

MD5 校验值:abac416d58de62cbb13589224e25fe1c

反编译源代码说明

JobIntentService.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.onesignal;

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

public abstract class JobIntentService extends Service {

    static final Object f15358q = new Object();

    static final HashMap<ComponentNameWithWakeful, WorkEnqueuer> f15359r = new HashMap<>();

    CompatJobEngine f15360j;

    WorkEnqueuer f15361k;

    CommandProcessor f15362l;

    boolean f15363m = false;

    boolean f15364n = false;

    boolean f15365o = false;

    final ArrayList<CompatWorkItem> f15366p = new ArrayList<>();

    public final class CommandProcessor extends AsyncTask<Void, Void, Void> {
        CommandProcessor() {
        }

        @Override
        public Void doInBackground(Void... voidArr) {
            while (true) {
                GenericWorkItem a7 = JobIntentService.this.a();
                if (a7 == null) {
                    return null;
                }
                JobIntentService.this.g(a7.getIntent());
                a7.complete();
            }
        }

        @Override
        public void onCancelled(Void r12) {
            JobIntentService.this.i();
        }

        @Override
        public void onPostExecute(Void r12) {
            JobIntentService.this.i();
        }
    }

    public interface CompatJobEngine {
        IBinder compatGetBinder();

        GenericWorkItem dequeueWork();
    }

    public static final class CompatWorkEnqueuer extends WorkEnqueuer {
        private final Context mContext;
        private final PowerManager.WakeLock mLaunchWakeLock;
        boolean mLaunchingService;
        private final PowerManager.WakeLock mRunWakeLock;
        boolean mServiceProcessing;

        CompatWorkEnqueuer(Context context, ComponentName componentName) {
            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
        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;
            }
        }
    }

    public final class CompatWorkItem implements GenericWorkItem {
        final Intent mIntent;
        final int mStartId;

        CompatWorkItem(Intent intent, int i6) {
            this.mIntent = intent;
            this.mStartId = i6;
        }

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

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

    public static class ComponentNameWithWakeful {
        private ComponentName componentName;
        private boolean useWakefulService;

        ComponentNameWithWakeful(ComponentName componentName, boolean z6) {
            this.componentName = componentName;
            this.useWakefulService = z6;
        }
    }

    public interface GenericWorkItem {
        void complete();

        Intent getIntent();
    }

    static final class JobServiceEngineImpl extends JobServiceEngine implements CompatJobEngine {
        static final boolean DEBUG = false;
        static final String TAG = "JobServiceEngineImpl";
        final Object mLock;
        JobParameters mParams;
        final JobIntentService mService;

        final class WrapperWorkItem implements GenericWorkItem {
            final JobWorkItem mJobWork;

            WrapperWorkItem(JobWorkItem jobWorkItem) {
                this.mJobWork = jobWorkItem;
            }

            @Override
            public void complete() {
                String str;
                String str2;
                synchronized (JobServiceEngineImpl.this.mLock) {
                    JobParameters jobParameters = JobServiceEngineImpl.this.mParams;
                    if (jobParameters != null) {
                        try {
                            jobParameters.completeWork(this.mJobWork);
                        } catch (IllegalArgumentException e6) {
                            e = e6;
                            str = JobServiceEngineImpl.TAG;
                            str2 = "IllegalArgumentException: Failed to run mParams.completeWork(mJobWork)!";
                            Log.e(str, str2, e);
                        } catch (SecurityException e7) {
                            e = e7;
                            str = JobServiceEngineImpl.TAG;
                            str2 = "SecurityException: Failed to run mParams.completeWork(mJobWork)!";
                            Log.e(str, str2, e);
                        }
                    }
                }
            }

            @Override
            public Intent getIntent() {
                return this.mJobWork.getIntent();
            }
        }

        JobServiceEngineImpl(JobIntentService jobIntentService) {
            super(jobIntentService);
            this.mLock = new Object();
            this.mService = jobIntentService;
        }

        @Override
        public IBinder compatGetBinder() {
            return getBinder();
        }

        @Override
        public GenericWorkItem dequeueWork() {
            synchronized (this.mLock) {
                JobParameters jobParameters = this.mParams;
                if (jobParameters == null) {
                    return null;
                }
                try {
                    JobWorkItem dequeueWork = jobParameters.dequeueWork();
                    if (dequeueWork == null) {
                        return null;
                    }
                    dequeueWork.getIntent().setExtrasClassLoader(this.mService.getClassLoader());
                    return new WrapperWorkItem(dequeueWork);
                } catch (SecurityException e6) {
                    Log.e(TAG, "Failed to run mParams.dequeueWork()!", e6);
                    return null;
                }
            }
        }

        @Override
        public boolean onStartJob(JobParameters jobParameters) {
            this.mParams = jobParameters;
            this.mService.e(DEBUG);
            return true;
        }

        @Override
        public boolean onStopJob(JobParameters jobParameters) {
            boolean b6 = this.mService.b();
            synchronized (this.mLock) {
                this.mParams = null;
            }
            return b6;
        }
    }

    public static final class JobWorkEnqueuer extends WorkEnqueuer {
        private final JobInfo mJobInfo;
        private final JobScheduler mJobScheduler;

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

        @Override
        void enqueueWork(Intent intent) {
            this.mJobScheduler.enqueue(this.mJobInfo, new JobWorkItem(intent));
        }
    }

    public static abstract class WorkEnqueuer {
        final ComponentName mComponentName;
        boolean mHasJobId;
        int mJobId;

        WorkEnqueuer(ComponentName componentName) {
            this.mComponentName = componentName;
        }

        abstract void enqueueWork(Intent intent);

        void ensureJobId(int i6) {
            if (!this.mHasJobId) {
                this.mHasJobId = true;
                this.mJobId = i6;
            } else {
                if (this.mJobId == i6) {
                    return;
                }
                throw new IllegalArgumentException("Given job ID " + i6 + " is different than previous " + this.mJobId);
            }
        }

        public void serviceProcessingFinished() {
        }

        public void serviceProcessingStarted() {
        }

        public void serviceStartReceived() {
        }
    }

    public static void c(Context context, ComponentName componentName, int i6, Intent intent, boolean z6) {
        if (intent == null) {
            throw new IllegalArgumentException("work must not be null");
        }
        synchronized (f15358q) {
            WorkEnqueuer f6 = f(context, componentName, true, i6, z6);
            f6.ensureJobId(i6);
            try {
                f6.enqueueWork(intent);
            } catch (IllegalStateException e6) {
                if (!z6) {
                    throw e6;
                }
                f(context, componentName, true, i6, false).enqueueWork(intent);
            }
        }
    }

    public static void d(Context context, Class cls, int i6, Intent intent, boolean z6) {
        c(context, new ComponentName(context, (Class<?>) cls), i6, intent, z6);
    }

    static WorkEnqueuer f(Context context, ComponentName componentName, boolean z6, int i6, boolean z7) {
        WorkEnqueuer compatWorkEnqueuer;
        ComponentNameWithWakeful componentNameWithWakeful = new ComponentNameWithWakeful(componentName, z7);
        HashMap<ComponentNameWithWakeful, WorkEnqueuer> hashMap = f15359r;
        WorkEnqueuer workEnqueuer = hashMap.get(componentNameWithWakeful);
        if (workEnqueuer != null) {
            return workEnqueuer;
        }
        if (Build.VERSION.SDK_INT < 26 || z7) {
            compatWorkEnqueuer = new CompatWorkEnqueuer(context, componentName);
        } else {
            if (!z6) {
                throw new IllegalArgumentException("Can't be here without a job id");
            }
            compatWorkEnqueuer = new JobWorkEnqueuer(context, componentName, i6);
        }
        WorkEnqueuer workEnqueuer2 = compatWorkEnqueuer;
        hashMap.put(componentNameWithWakeful, workEnqueuer2);
        return workEnqueuer2;
    }

    GenericWorkItem a() {
        GenericWorkItem dequeueWork;
        CompatJobEngine compatJobEngine = this.f15360j;
        if (compatJobEngine != null && (dequeueWork = compatJobEngine.dequeueWork()) != null) {
            return dequeueWork;
        }
        synchronized (this.f15366p) {
            if (this.f15366p.size() > 0) {
                return this.f15366p.remove(0);
            }
            return null;
        }
    }

    boolean b() {
        CommandProcessor commandProcessor = this.f15362l;
        if (commandProcessor != null) {
            commandProcessor.cancel(this.f15363m);
        }
        this.f15364n = true;
        return h();
    }

    void e(boolean z6) {
        if (this.f15362l == null) {
            this.f15362l = new CommandProcessor();
            WorkEnqueuer workEnqueuer = this.f15361k;
            if (workEnqueuer != null && z6) {
                workEnqueuer.serviceProcessingStarted();
            }
            this.f15362l.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
        }
    }

    protected abstract void g(Intent intent);

    public boolean h() {
        return true;
    }

    void i() {
        ArrayList<CompatWorkItem> arrayList = this.f15366p;
        if (arrayList != null) {
            synchronized (arrayList) {
                this.f15362l = null;
                ArrayList<CompatWorkItem> arrayList2 = this.f15366p;
                if (arrayList2 != null && arrayList2.size() > 0) {
                    e(false);
                } else if (!this.f15365o) {
                    this.f15361k.serviceProcessingFinished();
                }
            }
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        CompatJobEngine compatJobEngine = this.f15360j;
        if (compatJobEngine != null) {
            return compatJobEngine.compatGetBinder();
        }
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        if (Build.VERSION.SDK_INT >= 26) {
            this.f15360j = new JobServiceEngineImpl(this);
            this.f15361k = null;
        }
        this.f15361k = f(this, new ComponentName(this, getClass()), false, 0, true);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        b();
        synchronized (this.f15366p) {
            this.f15365o = true;
            this.f15361k.serviceProcessingFinished();
        }
    }

    @Override
    public int onStartCommand(Intent intent, int i6, int i7) {
        this.f15361k.serviceStartReceived();
        synchronized (this.f15366p) {
            ArrayList<CompatWorkItem> arrayList = this.f15366p;
            if (intent == null) {
                intent = new Intent();
            }
            arrayList.add(new CompatWorkItem(intent, i7));
            e(true);
        }
        return 3;
    }
}