package p138.p176.p177.p242.p258.p263;

import android.annotation.TargetApi;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.Context;
import android.os.Build;
import android.os.UserHandle;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ރ.ނ.ŀ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@TargetApi(24)
public final class C4378 {

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final Method f13664;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final Method f13665;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final JobScheduler f13666;

    static {
        Method declaredMethod;
        Method declaredMethod2 = null;
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                declaredMethod = JobScheduler.class.getDeclaredMethod("scheduleAsPackage", JobInfo.class, String.class, Integer.TYPE, String.class);
            } catch (NoSuchMethodException unused) {
                if (Log.isLoggable("JobSchedulerCompat", 6)) {
                    Log.e("JobSchedulerCompat", "No scheduleAsPackage method available, falling back to schedule");
                }
                declaredMethod = null;
            }
        } else {
            declaredMethod = null;
        }
        f13664 = declaredMethod;
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                declaredMethod2 = UserHandle.class.getDeclaredMethod("myUserId", null);
            } catch (NoSuchMethodException unused2) {
                if (Log.isLoggable("JobSchedulerCompat", 6)) {
                    Log.e("JobSchedulerCompat", "No myUserId method available");
                }
            }
        }
        f13665 = declaredMethod2;
    }

    public C4378(JobScheduler jobScheduler) {
        this.f13666 = jobScheduler;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static int m7276(Context context, JobInfo jobInfo, String str, String str2) {
        int iIntValue;
        JobScheduler jobScheduler = (JobScheduler) context.getSystemService("jobscheduler");
        if (f13664 == null || context.checkSelfPermission("android.permission.UPDATE_DEVICE_STATS") != 0) {
            return jobScheduler.schedule(jobInfo);
        }
        C4378 c4378 = new C4378(jobScheduler);
        Method method = f13665;
        if (method != null) {
            try {
                iIntValue = ((Integer) method.invoke(null, new Object[0])).intValue();
            } catch (IllegalAccessException | InvocationTargetException e) {
                if (Log.isLoggable("JobSchedulerCompat", 6)) {
                    Log.e("JobSchedulerCompat", "myUserId invocation illegal", e);
                }
                iIntValue = 0;
            }
        } else {
            iIntValue = 0;
        }
        Method method2 = f13664;
        if (method2 != null) {
            try {
                return ((Integer) method2.invoke(c4378.f13666, jobInfo, str, Integer.valueOf(iIntValue), str2)).intValue();
            } catch (IllegalAccessException | InvocationTargetException e2) {
                Log.e(str2, "error calling scheduleAsPackage", e2);
            }
        }
        return c4378.f13666.schedule(jobInfo);
    }
}
