正在查看: Tasker v6.5.11 应用的 ExecuteService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 ExecuteService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.UiModeManager;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.ComponentInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.net.VpnService;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.MediaStore;
import android.provider.Settings;
import android.speech.tts.TextToSpeech;
import android.telecom.TelecomManager;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Base64;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import com.joaomgcd.taskerm.helper.HelperExecuteService;
import com.joaomgcd.taskerm.spawn.RFactory;
import com.joaomgcd.taskerm.structuredoutput.StructureType;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerservercommon.ConstantsCommonTaskerServer;
import cyanogenmod.alarmclock.ClockContract;
import cyanogenmod.app.CMStatusBarManager;
import cyanogenmod.app.ProfileManager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.Thread;
import java.lang.ref.WeakReference;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import net.dinglisch.android.tasker.InputNetworkAccess;
import net.dinglisch.android.tasker.InputToggleWifi;
import net.dinglisch.android.taskerm.ActionEdit;
import net.dinglisch.android.taskerm.ExecuteService;
import net.dinglisch.android.taskerm.MyVpnService;
import net.dinglisch.android.taskerm.RunLog;
import net.dinglisch.android.taskerm.a1;
import net.dinglisch.android.taskerm.br;
import net.dinglisch.android.taskerm.c;
import net.dinglisch.android.taskerm.co;
import net.dinglisch.android.taskerm.d6;
import net.dinglisch.android.taskerm.dk;
import net.dinglisch.android.taskerm.h4;
import net.dinglisch.android.taskerm.ll;
import net.dinglisch.android.taskerm.ol;
import net.dinglisch.android.taskerm.th;
import net.dinglisch.android.taskerm.tn;
import net.dinglisch.android.taskerm.to;
import net.dinglisch.android.taskerm.vo;
import net.dinglisch.android.taskerm.wd;
import net.dinglisch.android.taskerm.yd;
import net.dinglisch.android.taskerm.zk;
public class ExecuteService extends MyService implements MediaRecorder.OnErrorListener {
private static volatile v I0;
private static volatile Bundle J0;
private static File i0;
private static List<File> j0;
private static int k0;
private static boolean l0;
private static boolean m0;
private static int p0;
public Handler Q;
public Handler R;
private Handler S;
private Handler T;
private Handler U;
private SharedPreferences X;
private ji.b a0;
private long t;
private volatile int w;
private static final int[] c0 = {87, 85, 88, 85, 86, 85, 89, 90};
private static final Object d0 = new Object();
private static Object e0 = new Object();
private static volatile Bitmap f0 = null;
private static volatile boolean g0 = false;
private static Object h0 = new Object();
private static Pattern n0 = null;
private static Pattern o0 = null;
private static Map<File, Integer> q0 = new HashMap();
private static Object r0 = new Object();
private static Object s0 = new Object();
private static LocationListener t0 = null;
private static LocationListener u0 = null;
private static Boolean v0 = new Boolean(false);
private static volatile Set<String> w0 = new HashSet();
private static Set<String> x0 = new HashSet();
private static Set<String> y0 = new HashSet();
private static int z0 = -1;
private static volatile HashMap<String, MediaPlayer> A0 = new HashMap<>();
private static volatile MediaPlayer B0 = null;
private static final Object C0 = new Object();
private static final Object D0 = new Object();
private static MediaRecorder E0 = null;
private static final Object F0 = new Object();
private static Object G0 = new Object();
private static volatile boolean H0 = false;
public static String K0 = "ACTION_STOP_ALL_RUNNING_TASKS";
public static String L0 = "ACTION_STOP_TASK";
public static String M0 = "EXTRA_STOP_TASK_ID";
private static xj.l<hg.z1, lj.e0> N0 = null;
private static mk.u<tn> O0 = mk.k0.a(null);
private PendingIntent s = null;
private BroadcastReceiver u = null;
private int v = 1;
private TextToSpeech x = null;
private long y = -1;
private AudioManager.OnAudioFocusChangeListener z = null;
private File A = null;
private boolean B = false;
private boolean C = false;
private boolean D = false;
private Location E = null;
private int F = 0;
public com.joaomgcd.taskerm.util.n7 G = new com.joaomgcd.taskerm.util.n7();
private int H = 0;
private Boolean I = Boolean.FALSE;
private List<q> J = new ArrayList();
private t K = null;
private volatile Set<String> L = new HashSet();
private Map<String, tn> M = new HashMap();
public Map<String, Long> N = new HashMap();
private int O = -1;
private long P = 0;
private Handler V = null;
private HashMap<Integer, c6> W = new HashMap<>();
public HelperExecuteService Y = new HelperExecuteService(this);
private Runnable Z = new j();
private boolean b0 = false;
class a implements Comparator<Integer> {
a() {
}
@Override
public int compare(Integer num, Integer num2) {
return num2.compareTo(num);
}
}
class b implements Comparator<String> {
b() {
}
@Override
public int compare(String str, String str2) {
return str.compareToIgnoreCase(str2);
}
}
class c implements Comparator<String> {
c() {
}
@Override
public int compare(String str, String str2) {
Double B3 = dq.B3(str);
Double B32 = dq.B3(str2);
if (B3 == null) {
B3 = dq.T(str);
}
if (B32 == null) {
B32 = dq.T(str2);
}
if (B3 == null) {
if (B32 == null) {
return str.compareToIgnoreCase(str2);
}
return 1;
}
if (B32 == null) {
return -1;
}
return B3.compareTo(B32);
}
}
class d implements Comparator<String> {
d() {
}
@Override
public int compare(String str, String str2) {
Long F3 = dq.F3(str);
Long F32 = dq.F3(str2);
if (F3 == null) {
F3 = dq.U(str);
}
if (F32 == null) {
F32 = dq.U(str2);
}
if (F3 == null) {
if (F32 == null) {
return str.compareToIgnoreCase(str2);
}
return 1;
}
if (F32 == null) {
return -1;
}
return F3.compareTo(F32);
}
}
class e implements Comparator<String> {
e() {
}
@Override
public int compare(String str, String str2) {
return str2.compareToIgnoreCase(str);
}
}
class f implements Comparator<String> {
f() {
}
@Override
public int compare(String str, String str2) {
return new Integer(str.length()).compareTo(new Integer(str2.length()));
}
}
class g implements Comparator<String> {
g() {
}
@Override
public int compare(String str, String str2) {
return new Integer(str2.length()).compareTo(new Integer(str.length()));
}
}
class h extends BroadcastReceiver {
h() {
}
@Override
public void onReceive(Context context, Intent intent) {
String action;
if (intent == null || (action = intent.getAction()) == null) {
return;
}
if (action.equals("android.intent.action.SCREEN_ON") || action.equals("android.intent.action.SCREEN_OFF")) {
AlarmManager alarmManager = (AlarmManager) oi.d(ExecuteService.this, "alarm", "E", action);
synchronized (ExecuteService.h0) {
try {
long currentTimeMillis = ExecuteService.this.t - System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
sb.append(action);
sb.append(": have intent: ");
sb.append(ExecuteService.this.s != null);
sb.append(" time to: ");
sb.append(currentTimeMillis);
r7.f("E", sb.toString());
if (ExecuteService.this.s != null && currentTimeMillis > 1000) {
ExecuteService.this.a7(alarmManager, action);
}
} finally {
}
}
}
}
}
static class i {
static final int[] a;
static final int[] b;
static final int[] c;
static final int[] d;
static final int[] e;
static final int[] f;
static {
int[] iArr = new int[d6.d.values().length];
f = iArr;
try {
iArr[d6.d.Delete.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
int[] iArr2 = new int[th.b.values().length];
e = iArr2;
try {
iArr2[th.b.Packages.ordinal()] = 1;
} catch (NoSuchFieldError unused2) {
}
try {
e[th.b.Applications.ordinal()] = 2;
} catch (NoSuchFieldError unused3) {
}
try {
e[th.b.Activities.ordinal()] = 3;
} catch (NoSuchFieldError unused4) {
}
try {
e[th.b.Services.ordinal()] = 4;
} catch (NoSuchFieldError unused5) {
}
try {
e[th.b.Receivers.ordinal()] = 5;
} catch (NoSuchFieldError unused6) {
}
try {
e[th.b.Providers.ordinal()] = 6;
} catch (NoSuchFieldError unused7) {
}
int[] iArr3 = new int[a1.b.values().length];
d = iArr3;
try {
iArr3[a1.b.Squash.ordinal()] = 1;
} catch (NoSuchFieldError unused8) {
}
try {
d[a1.b.RemoveDuplicates.ordinal()] = 2;
} catch (NoSuchFieldError unused9) {
}
try {
d[a1.b.Reverse.ordinal()] = 3;
} catch (NoSuchFieldError unused10) {
}
try {
d[a1.b.RotateLeft.ordinal()] = 4;
} catch (NoSuchFieldError unused11) {
}
try {
d[a1.b.RotateRight.ordinal()] = 5;
} catch (NoSuchFieldError unused12) {
}
try {
d[a1.b.Shuffle.ordinal()] = 6;
} catch (NoSuchFieldError unused13) {
}
try {
d[a1.b.SortAlphaCasefull.ordinal()] = 7;
} catch (NoSuchFieldError unused14) {
}
try {
d[a1.b.SortAlphaCasefullReverse.ordinal()] = 8;
} catch (NoSuchFieldError unused15) {
}
try {
d[a1.b.SortAlphaCaseless.ordinal()] = 9;
} catch (NoSuchFieldError unused16) {
}
try {
d[a1.b.SortNumericFloatingPoint.ordinal()] = 10;
} catch (NoSuchFieldError unused17) {
}
try {
d[a1.b.SortNumericInteger.ordinal()] = 11;
} catch (NoSuchFieldError unused18) {
}
try {
d[a1.b.SortAlphaCaselessReverse.ordinal()] = 12;
} catch (NoSuchFieldError unused19) {
}
try {
d[a1.b.SortLengthShortestFirst.ordinal()] = 13;
} catch (NoSuchFieldError unused20) {
}
try {
d[a1.b.SortLengthLongestFirst.ordinal()] = 14;
} catch (NoSuchFieldError unused21) {
}
int[] iArr4 = new int[th.a.values().length];
c = iArr4;
try {
iArr4[th.a.Receiver.ordinal()] = 1;
} catch (NoSuchFieldError unused22) {
}
try {
c[th.a.Service.ordinal()] = 2;
} catch (NoSuchFieldError unused23) {
}
try {
c[th.a.Activity.ordinal()] = 3;
} catch (NoSuchFieldError unused24) {
}
int[] iArr5 = new int[dk.j.values().length];
b = iArr5;
try {
iArr5[dk.j.Height.ordinal()] = 1;
} catch (NoSuchFieldError unused25) {
}
try {
b[dk.j.Width.ordinal()] = 2;
} catch (NoSuchFieldError unused26) {
}
try {
b[dk.j.HorizontalOffset.ordinal()] = 3;
} catch (NoSuchFieldError unused27) {
}
try {
b[dk.j.VerticalOffset.ordinal()] = 4;
} catch (NoSuchFieldError unused28) {
}
try {
b[dk.j.Status.ordinal()] = 5;
} catch (NoSuchFieldError unused29) {
}
int[] iArr6 = new int[a1.c.values().length];
a = iArr6;
try {
iArr6[a1.c.DisableCurrentOrNext.ordinal()] = 1;
} catch (NoSuchFieldError unused30) {
}
try {
a[a1.c.DisableByLabel.ordinal()] = 2;
} catch (NoSuchFieldError unused31) {
}
try {
a[a1.c.DisableByTime.ordinal()] = 3;
} catch (NoSuchFieldError unused32) {
}
}
}
class j implements Runnable {
j() {
}
@Override
public void run() {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.j.run():void");
}
}
class k implements TextToSpeech.OnInitListener {
final String a;
k(String str) {
this.a = str;
}
@Override
public void onInit(int i) {
r7.f("E", this.a + "got TTS init, status: " + i);
ExecuteService.this.H7(i, "on init listener");
}
}
class l implements X509TrustManager {
l() {
}
@Override
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
class m implements HostnameVerifier {
m() {
}
@Override
public boolean verify(String str, SSLSession sSLSession) {
return true;
}
}
class n extends BroadcastReceiver {
final tn a;
n(tn tnVar) {
this.a = tnVar;
}
public void b(tn tnVar) {
ExecuteService.this.k5(getResultCode(), getResultExtras(true), tnVar);
}
@Override
public void onReceive(Context context, Intent intent) {
r7.f("E", "plugin handler, onReceive");
final tn tnVar = this.a;
pg.w0.p0(new Runnable() {
@Override
public final void run() {
ExecuteService.n.this.b(tnVar);
}
});
}
}
class o implements LocationListener {
o() {
}
@Override
public void onLocationChanged(Location location) {
r7.f("E", "FIX: net: " + q7.e1(location) + " acc " + location.getAccuracy());
ExecuteService executeService = ExecuteService.this;
executeService.i8(false, true, executeService.D ^ true, true);
q7.C1(ExecuteService.this, location);
kq.r(ExecuteService.this);
ExecuteService.this.w5();
}
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public void onStatusChanged(String str, int i, Bundle bundle) {
}
}
class p implements LocationListener {
p() {
}
@Override
public void onLocationChanged(Location location) {
r7.f("E", "fix: GPS: " + q7.e1(location) + " acc " + location.getAccuracy() + " alt " + location.getAltitude() + " spd " + location.getSpeed());
long currentTimeMillis = System.currentTimeMillis();
kq.K1(currentTimeMillis - location.getTime());
location.setTime(currentTimeMillis);
if (q7.V0(ExecuteService.this.E, location)) {
ExecuteService.this.F++;
r7.f("E", "acc worse, count " + ExecuteService.this.F);
if (ExecuteService.this.F > 1) {
ExecuteService.this.i8(true, false, !r0.D, true);
}
} else {
ExecuteService.this.F = 0;
}
q7.B1(ExecuteService.this, location);
kq.q(ExecuteService.this);
ExecuteService.this.E = location;
ExecuteService.this.w5();
}
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public void onStatusChanged(String str, int i, Bundle bundle) {
}
}
public interface q {
void a(int i, int i2);
void b(int i, int i2, int i3, c.b bVar, SpannableStringBuilder spannableStringBuilder, int i4, int i5);
void c(int i, int i2, int i3);
void d(int i, int i2, int i3, int i4);
}
private static class r extends Handler {
WeakReference<ExecuteService> a;
r(ExecuteService executeService) {
this.a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.a.get();
Bundle data = message.getData();
int i = data.getInt(c6.EXTRA_ID);
int i2 = message.what;
if (i2 == 0) {
synchronized (executeService.W) {
try {
if (executeService.W.get(Integer.valueOf(i)) != null) {
r7.G("E", "found hanging jsi");
executeService.j8(i, false);
}
} finally {
}
}
try {
c6 runPureScript = c6.runPureScript(executeService.getBaseContext(), i, data.getString("src"), data.getInt("p"), data.getBoolean("ae"), data.getString("s"), data.getString("l"), data.getBundle("b"), this);
if (runPureScript == null) {
r7.G("E", "jsi load failed");
executeService.j8(i, true);
return;
} else {
synchronized (executeService.W) {
executeService.W.put(Integer.valueOf(i), runPureScript);
}
return;
}
} catch (Throwable th2) {
r7.l("E", "jsi exception", th2);
executeService.j8(i, true);
return;
}
}
if (i2 == 1) {
executeService.j8(i, false);
executeService.w5();
return;
}
if (i2 == 2) {
c6.flashErrorBundle(executeService, data);
executeService.j8(i, true);
executeService.w5();
} else if (i2 == 3) {
executeService.j8(i, true);
executeService.w5();
} else {
if (i2 != 4) {
return;
}
r7.G("E", "jsi: " + c6.formatConsoleMessageForLog(executeService, data));
}
}
}
private static class s extends Handler {
WeakReference<Context> a;
s(Context context) {
this.a = new WeakReference<>(context.getApplicationContext());
}
@Override
public void handleMessage(Message message) {
Context context = this.a.get();
if (context == null) {
r7.G("E", "MediaSessionHandler: no context");
} else {
dq.r1(context, message.getData().getBoolean("grab"), message.getData().getBoolean("newAPI"));
}
}
}
public class t extends Thread {
private boolean i;
public t(ThreadGroup threadGroup, Runnable runnable, String str) {
super(threadGroup, runnable, str);
this.i = false;
}
}
private static class u extends Handler {
u() {
}
@Override
public void handleMessage(Message message) {
synchronized (ExecuteService.D0) {
try {
if (ExecuteService.B0 == null) {
ExecuteService.B0 = new MediaPlayer();
} else {
r7.G("E", "pc: already have media player");
}
} catch (Throwable th2) {
throw th2;
}
}
}
}
public enum v {
None,
Cancelled,
Error,
NeedRestart
}
private static class w extends Handler {
WeakReference<ExecuteService> a;
class a implements MediaPlayer.OnCompletionListener {
a() {
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
String str;
if (mediaPlayer != null) {
try {
mediaPlayer.release();
} catch (Exception e) {
r7.H("E", "rtone: onCompletion exception", e);
}
}
synchronized (ExecuteService.A0) {
try {
Iterator it = ExecuteService.A0.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
str = null;
break;
}
Map.Entry entry = (Map.Entry) it.next();
if (((MediaPlayer) entry.getValue()).equals(mediaPlayer)) {
str = (String) entry.getKey();
break;
}
}
if (str != null) {
ExecuteService.A0.remove(str);
}
} catch (Throwable th2) {
throw th2;
}
}
}
}
class b implements MediaPlayer.OnErrorListener {
b() {
}
@Override
public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
r7.G("E", "rtone: media player onError: " + i + ",!" + i2);
return false;
}
}
w(ExecuteService executeService) {
this.a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.a.get();
Bundle data = message.getData();
String string = data.getString("uri");
int i = data.getInt("stream");
int i2 = data.getInt("exeid");
String string2 = data.getString("tname");
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setOnCompletionListener(new a());
mediaPlayer.setOnErrorListener(new b());
try {
mediaPlayer.setLooping(false);
mediaPlayer.setAudioStreamType(i);
mediaPlayer.setDataSource(executeService, Uri.parse(string));
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException e) {
r7.H("E", "rtone: " + string, e);
}
synchronized (ExecuteService.A0) {
ExecuteService.A0.put(ExecuteService.p6(i2, string2), mediaPlayer);
}
}
}
private static class x extends Handler {
WeakReference<ExecuteService> a;
x(ExecuteService executeService) {
this.a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.a.get();
if (executeService == null) {
r7.f("E", "TTSCompletedHandler: no service");
return;
}
if (message == null) {
r7.G("E", "TTSCompletedHandler: null message");
} else {
int i = message.what;
if (i == 0) {
executeService.E6("ttscompHandler-ok", null, false);
} else if (i == 1) {
executeService.E6("ttscompHandler-err", null, true);
}
}
executeService.w5();
}
}
private static class y extends Handler {
WeakReference<ExecuteService> a;
y(ExecuteService executeService) {
this.a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(android.os.Message r12) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.y.handleMessage(android.os.Message):void");
}
}
private void A0(String str, int i2) {
if (i2 == 600) {
C0(str);
} else {
D0(str, i2);
}
}
private int A1(java.lang.String r9, net.dinglisch.android.taskerm.c r10, android.os.Bundle r11) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.A1(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int A2(java.lang.String r33, net.dinglisch.android.taskerm.c r34, android.os.Bundle r35) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.A2(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int A3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Intent e2 = th.e(getPackageManager(), th.a.Service, new Intent("com.teslacoilsw.intent.FLASHLIGHT"));
if (e2 == null) {
r7.G("E", str + ": failed to resolve service intent com.teslacoilsw.intent.FLASHLIGHT");
} else {
String[] strArr = {"off", "on", "toggle"};
int v2 = cVar.x(0).v();
int l4 = v2 == 1 ? l4(cVar, 1, bundle) : 0;
if (l4 != Integer.MAX_VALUE) {
String str2 = strArr[v2];
if (l4 > 0) {
e2.putExtra("strobe", l4);
} else {
e2.putExtra(str2, true);
}
if (startService(e2) != null) {
return -1;
}
r7.f("E", cVar.getName() + ": failed to start service");
}
}
return -3;
}
public boolean A5(boolean z, boolean z2, String str, File file, String str2) {
return f4(str2, z, z2, str);
}
public void A6(int i2, int i3, int i4, int i5) {
synchronized (this.J) {
try {
Iterator<q> it = this.J.iterator();
while (it.hasNext()) {
it.next().d(i2, i3, i4, i5);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private int A7(net.dinglisch.android.taskerm.c cVar, tn tnVar, String str, String str2, int i2) {
Intent intent = new Intent(this, (Class<?>) MonitorService.class);
intent.setAction("net.dinglisch.android.tasker.ANDPROFTUM");
if (to.v1(this).J(str2)) {
intent.putExtra("pfname", str2);
intent.putExtra("pfttp", i2);
intent.putExtra("eventType", 9986);
MonitorService.J6(this, intent);
return -1;
}
String str3 = str + ": unknown profile '" + str2 + "'";
r7.G("E", str3);
tnVar.T1(cVar, str3);
return -3;
}
private boolean A8(TextToSpeech textToSpeech, Locale locale) {
int i2;
try {
i2 = textToSpeech.isLanguageAvailable(locale);
} catch (Throwable unused) {
i2 = -1;
}
r7.f("E", "tts: loc " + locale.toString() + " available: " + i2);
return i2 == 0 || i2 == 1 || i2 == 2;
}
private String B0(Intent intent, String str, String str2) {
File N4 = N4(str2, str, true, true, false);
if (N4 == null) {
return null;
}
String H02 = dq.H0(N4);
if (H02.length() <= 0) {
r7.G("E", "couldn't determine MIME type of " + N4.toString());
return null;
}
intent.putExtra("android.intent.extra.STREAM", Uri.parse("file://" + N4.toString()));
intent.setType(H02);
return H02;
}
private int B1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return wl.k(this, F4(cVar, 0, bundle), F4(cVar, 3, bundle), j4(cVar, 2, bundle)) ? -1 : -3;
}
private int B2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (v1.a()) {
return C2(str, cVar, bundle);
}
r7.G("E", str + " no cyanogen quick setting API available");
return -3;
}
private int B3(net.dinglisch.android.taskerm.tn r17, java.lang.String r18, net.dinglisch.android.taskerm.c r19, int r20, android.os.Bundle r21) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.B3(net.dinglisch.android.taskerm.tn, java.lang.String, net.dinglisch.android.taskerm.c, int, android.os.Bundle):int");
}
private SharedPreferences B4() {
return getSharedPreferences(g6.h, 0);
}
public ji.r B5(net.dinglisch.android.taskerm.d dVar, MyVpnService.Mode mode, Context context) {
return net.dinglisch.android.tasker.g.b(this, new InputNetworkAccess(dVar.K(), mode, false, false));
}
private void B6(int i2, int i3, int i4) {
synchronized (this.J) {
try {
Iterator<q> it = this.J.iterator();
while (it.hasNext()) {
it.next().c(i2, i3, i4);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void B7(boolean z, tn tnVar, String str) {
this.b0 = z;
l6("Set isWaitActionPending " + str + " to " + z, tnVar);
}
private void B8(BluetoothAdapter bluetoothAdapter, int i2) {
long currentTimeMillis = System.currentTimeMillis();
r7.f("E", "wait for BT state " + i2);
boolean z = false;
while (!z && !this.I.booleanValue()) {
z = (bluetoothAdapter.isEnabled() ? 12 : 10) == i2 || System.currentTimeMillis() - currentTimeMillis > 10000;
if (!z) {
N3(100L);
}
}
r7.f("E", "done");
}
private int C1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return wl.s(this, F4(cVar, 0, bundle), F4(cVar, 1, bundle)) ? -1 : -3;
}
private int C2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
try {
CMStatusBarManager.getInstance(this).removeTile(F4(cVar, 0, bundle).hashCode());
return -1;
} catch (Exception e2) {
r7.H("E", str, e2);
return -3;
}
}
private int C3(tn tnVar, String str, int i2, String str2, Bundle bundle) {
String valueOf;
dk E = wl.E(str);
int i3 = i.b[dk.j.values()[i2].ordinal()];
int i4 = -1;
if (i3 == 1) {
if (E != null) {
valueOf = String.valueOf(E.l1());
}
i4 = -3;
valueOf = null;
} else if (i3 == 2) {
if (E != null) {
valueOf = String.valueOf(E.V1());
}
i4 = -3;
valueOf = null;
} else if (i3 == 3) {
if (E != null) {
valueOf = String.valueOf(E.n1() - 100);
}
i4 = -3;
valueOf = null;
} else if (i3 != 4) {
if (i3 == 5) {
if (E != null) {
valueOf = E.I2() ? E.O2() ? "visible" : "background" : "hidden";
} else if (to.u1(this).p(str)) {
valueOf = "uncreated";
}
}
i4 = -3;
valueOf = null;
} else {
if (E != null) {
valueOf = String.valueOf(E.U1() - 100);
}
i4 = -3;
valueOf = null;
}
String str3 = valueOf;
if (str3 == null) {
kq.F(this, str2, false, true, bundle, tnVar);
} else {
kq.W1(this, str2, str3, true, bundle, "testScene", null, new Integer[]{Integer.valueOf(tnVar.Y0())}, Integer.valueOf(tnVar.P0()));
}
return i4;
}
private String C4(File file) {
String y4 = y4(file, "title", -1);
if (!TextUtils.isEmpty(y4)) {
return y4;
}
String name = file.getName();
return name.substring(0, name.length() - dq.G0(name, true).length());
}
public static lj.e0 C5(String str, String str2) {
r7.G("E", str + ": " + str2);
return lj.e0.a;
}
private void C6(int i2, int i3) {
synchronized (this.J) {
try {
for (Object obj : this.J.toArray()) {
((q) obj).a(i2, i3);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void C7(boolean z, boolean z2, boolean z3) {
Intent intent = new Intent("com.google.code.apndroid.intent.action.CHANGE_REQUEST");
intent.putExtra("com.google.code.apndroid.intent.extra.TARGET_MMS_STATE", z2 ? 1 : 0);
intent.putExtra("com.google.code.apndroid.intent.extra.TARGET_STATE", z ? 1 : 0);
intent.putExtra("com.google.code.apndroid.intent.extra.SHOW_NOTIFICATION", z3);
if (U7(intent)) {
return;
}
r7.G("E", "Mobile Data: APNDroid not installed");
}
private void C8(String str) {
while (MonitorService.H6() < 1000) {
r7.f("E", str + ": monitor just disabled wifi, give wifi manager time to effect");
N3(100L);
}
}
private void D0(String str, int i2) {
if (this.L.contains(str)) {
r7.G("E", "already waiting for " + str);
return;
}
this.L.add(str);
synchronized (this.N) {
this.N.put(str, Long.valueOf(h5(i2)));
}
}
private int D1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int l4 = l4(cVar, 2, bundle);
return wl.t0(this, F4(cVar, 0, bundle), F4(cVar, 1, bundle), ll.e.values()[l4], l4 == ll.e.Load.ordinal() ? cVar.N(3).w() : F4(cVar, 3, bundle)) ? -1 : -3;
}
private int D2(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
String Z4 = Z4(this, cVar, 1, bundle);
if (Z4 == null) {
return -3;
}
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, false)) {
return Y7(cVar, i2, bundle) ? -1 : -3;
}
if (!M0(h4, str, false, true, true, false)) {
return -3;
}
byte[] k2 = h4.k(this, h4);
if (k2 == null) {
r7.G("E", str + ": " + Z4 + ": no value");
return -3;
}
String encodeToString = Base64.encodeToString(k2, 0);
if (!TextUtils.isEmpty(encodeToString)) {
kq.U1(this, Z4, encodeToString, true, bundle, str);
return -5;
}
r7.G("E", str + ": base 64 encoding failed");
return -3;
}
private int D3(String str, int i2) {
if (!yd.x.a(this)) {
r7.f("E", str + ": not supported");
return -3;
}
String d2 = yd.x.d(this);
if (d2 == null) {
r7.G("E", str + ": no regexs");
return -3;
}
boolean z = dq.v3(d2, yd.x.j(this)) != -1;
String[] g2 = yd.x.g(this);
for (String str2 : g2) {
r7.f("E", "tetherable: " + str2);
}
dq.v3(d2, g2);
boolean X4 = X4(z, i2);
r7.f("E", str + ": " + z + " -> " + X4);
return (z == X4 || new rf.x(this).a(X4).b()) ? -1 : -3;
}
private int[] D4() {
int[] iArr;
synchronized (this.G) {
try {
iArr = new int[this.G.size()];
for (int i2 = 0; i2 < this.G.size(); i2++) {
iArr[i2] = this.G.get(i2).K0();
}
} catch (Throwable th2) {
throw th2;
}
}
return iArr;
}
public static lj.e0 D5(String str, String str2) {
r7.f("E", str + ": " + str2);
return lj.e0.a;
}
private ji.b D6() {
return pg.w0.c0(new Runnable() {
@Override
public final void run() {
ExecuteService.this.N5();
}
});
}
private Integer D7(net.dinglisch.android.taskerm.c cVar, Notification.Builder builder, Bundle bundle) {
if (yd.f0.d()) {
int j2 = cVar.j();
int i2 = 5;
if (j2 != 523) {
if (j2 == 525) {
i2 = 6;
} else if (j2 != 536 && j2 != 538) {
r7.k("E", "unhandled not code: " + j2);
i2 = -1;
}
}
if (i2 > -1) {
int l4 = l4(cVar, i2, bundle);
if (l4 == 0) {
l4 = a1.b0(j2, i2);
}
int d02 = (l4 - a1.d0(j2, i2)) - 2;
Integer valueOf = Integer.valueOf(d02);
yd.f0.l(builder, d02);
return valueOf;
}
}
return null;
}
private int D8() {
long currentTimeMillis = System.currentTimeMillis();
r7.f("E", "wait for stable wimax state...");
int i2 = -1;
while (!this.I.booleanValue() && System.currentTimeMillis() - currentTimeMillis < 12000 && (i2 = yd.e1.a(this)) != 1 && i2 != 3) {
r7.f("E", "wimax state: " + i2);
N3(500L);
}
r7.f("E", "done wimax wait, state: " + i2);
return i2;
}
private int E0(java.lang.String r9, android.net.Uri r10, android.os.Bundle r11) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.E0(java.lang.String, android.net.Uri, android.os.Bundle):int");
}
private int E1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return wl.v0(this, F4(cVar, 0, bundle), F4(cVar, 1, bundle), ol.c.values()[l4(cVar, 2, bundle)], F4(cVar, 3, bundle)) ? -1 : -3;
}
private int E2(String str, net.dinglisch.android.taskerm.c cVar, tn.b bVar, int i2, Bundle bundle, tn tnVar) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, false)) {
return Y7(cVar, i2, bundle) ? -1 : -3;
}
if (!M0(h4, str, false, true, true, false)) {
return -3;
}
try {
String m2 = h4.m(this, h4);
if (m2 == null) {
return -3;
}
if (cVar.N(1).w().length() > 0) {
String Z4 = Z4(this, cVar, 1, bundle);
if (TextUtils.isEmpty(Z4)) {
return -3;
}
y8(Z4, m2, tnVar, str, true, com.joaomgcd.taskerm.structuredoutput.c.e(cVar));
} else if (bVar != null) {
bVar.a(m2);
}
return -5;
} catch (Throwable th2) {
r7.l("E", "Error reading file", th2);
return -3;
}
}
private int E3(tn tnVar, final String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, int i2) {
int i3;
boolean z;
String str2;
rf.y yVar;
int i4;
int i5;
if (yd.x.b(this)) {
WifiManager wifiManager = (WifiManager) oi.d(this, "wifi", "E", "dtw");
if (wifiManager == null) {
r7.k("E", vh.g(this, 2131887723, new Object[0]));
} else {
int a2 = yd.d1.a(wifiManager);
r7.f("E", "current state: " + a2);
if (a2 != 4) {
if (a2 == 3 || a2 == 2) {
i3 = i2;
z = true;
} else {
i3 = i2;
z = false;
}
boolean X4 = X4(z, i3);
r7.f("E", str + ": cur: " + z + " new: " + X4);
if (z != X4) {
rf.y yVar2 = new rf.y(this, cVar, new xj.l() {
@Override
public final Object invoke(Object obj) {
lj.e0 D5;
D5 = ExecuteService.D5(str, (String) obj);
return D5;
}
});
if (X4) {
if (cVar.i(1).T(this, bundle)) {
str2 = ": skipping, time to leave";
yVar = yVar2;
i4 = -1;
i5 = -1;
} else {
str2 = ": skipping, time to leave";
yVar = yVar2;
i4 = -1;
i5 = S3(tnVar, cVar, bundle, a1.v(425), 0, false);
N3(200L);
}
if (this.I.booleanValue()) {
r7.f("E", str + "skipping, time to leave");
} else if (i5 != i4 && i5 != -5) {
r7.G("E", str + ": wifi disable failed");
} else if (a2 == 2) {
F8(wifiManager, 3, true);
} else {
if (a2 == 0) {
F8(wifiManager, 1, true);
}
if (this.I.booleanValue()) {
r7.f("E", str + str2);
} else {
r7.f("E", str + ": setWifiEnabled()");
com.joaomgcd.taskerm.util.s6 a3 = yVar.a(wifiManager, true);
if (a3.b()) {
F8(wifiManager, 3, true);
} else {
r7.k("E", ((com.joaomgcd.taskerm.util.t6) a3).c());
}
}
}
return i5;
}
if (a2 == 0) {
F8(wifiManager, 1, true);
} else {
if (a2 == 2) {
F8(wifiManager, 3, true);
}
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else {
com.joaomgcd.taskerm.util.s6 a4 = yVar2.a(wifiManager, false);
if (a4.b()) {
F8(wifiManager, 1, true);
} else {
r7.k("E", ((com.joaomgcd.taskerm.util.t6) a4).c());
}
}
}
}
return -1;
}
r7.G("E", str + ": skip, current AP state failed");
}
} else {
r7.f("E", str + ": not supported");
r7.f("E", str + ": haveApi: " + yd.d1.c());
r7.f("E", str + " supported: " + yd.x.n(this));
r7.f("E", str + " regex: " + dq.u3(yd.x.i(this), ","));
}
return -3;
}
public void E5(tn tnVar) {
l6("marking wait pending as false because !doAgainFlag", tnVar);
B7(false, tnVar, "because !doAgainFlag");
l6("Posting DoingWait", tnVar);
pg.d.j(new HelperExecuteService.a());
l6("Posted DoingWait", tnVar);
}
private static void E7(boolean z, String str) {
synchronized (G0) {
H0 = z;
}
r7.f("E", "set proxy: " + z + " (" + str + ")");
}
private void E8(mp mpVar, long j2) {
long d2 = mpVar.d();
long currentTimeMillis = System.currentTimeMillis();
while (!this.I.booleanValue() && !mpVar.c() && System.currentTimeMillis() < currentTimeMillis + d2) {
N3(j2);
}
}
public static void F0(Context context, String str, String str2, boolean z) {
Intent intent = new Intent("net.dinglisch.android.tasker.ACTION_TASK_COMPLETE");
intent.setData(Uri.fromParts("task", str, null));
intent.putExtra("success", z);
if (str2 != null) {
intent.putExtra("output", jr.d(str2));
com.joaomgcd.taskerm.util.f1.i(intent, false, false);
}
context.sendBroadcast(intent);
}
private int F1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
Bitmap w2;
synchronized (e0) {
try {
i2 = -3;
if (f0 == null) {
r7.G("E", str + ": no image loaded");
} else {
int l4 = l4(cVar, 1, bundle);
if (l4 != Integer.MAX_VALUE) {
try {
int r4 = r4(cVar, 0);
if (r4 == 0) {
w2 = zg.w(f0, l4);
} else if (r4 == 1) {
w2 = zg.p(f0, 3, false, l4);
} else if (r4 == 2) {
w2 = zg.p(f0, 2, false, l4);
} else if (r4 == 3) {
w2 = zg.p(f0, 1, false, l4);
} else if (r4 == 4) {
w2 = zg.x(f0);
} else if (r4 != 5) {
r7.G("E", str + ": unknown mode");
w2 = null;
} else {
w2 = zg.p(f0, 0, true, l4);
}
if (w2 != null) {
f0 = w2;
i2 = -1;
}
} catch (OutOfMemoryError unused) {
r7.G("E", str + ": oom");
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return i2;
}
private int F2(tn tnVar, String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
String F4 = F4(cVar, 1, bundle);
if (b5(cVar, 2, bundle) != null) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, true, true, false)) {
Integer E3 = (F4.length() == 0 || F4.startsWith("%")) ? 0 : dq.E3(F4);
if (E3 == null) {
r7.G("E", str + ": not a number: " + F4);
} else if (Y6(tnVar, cVar, str, cVar.j(), h4, E3.intValue(), cVar.N(2).w(), bundle)) {
return -5;
}
}
}
return -3;
}
private int F3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return !TaskerAppWidgetConfigure.h(this, co.p(r4(cVar, 1)), F4(cVar, 0, bundle), null) ? -3 : -1;
}
public void F5(tn tnVar, rf.m mVar, net.dinglisch.android.taskerm.c cVar, String str) {
if (this.b0) {
long currentTimeMillis = System.currentTimeMillis();
l6("Wait is pending. Waiting for DoingWait", tnVar);
this.Y.a1(500);
l6("Waited " + (System.currentTimeMillis() - currentTimeMillis) + "ms for DoingWait", tnVar);
}
int b2 = mVar.b();
if (b2 == -3) {
cVar.D1(c.b.Err);
if (cVar.G1()) {
tnVar.o2(true);
}
} else if (b2 == -4) {
tnVar.o2(false);
}
h7(str);
x5(tnVar);
}
private int F6(final int i2, final net.dinglisch.android.taskerm.c cVar, final tn tnVar) {
if (MyAccessibilityService.p()) {
return (MyAccessibilityService.j(i2) && MyAccessibilityService.n(i2)) ? -1 : -3;
}
final String F02 = a1.F0(this, cVar, tnVar.m(), tnVar.K0());
C0(F02);
this.Y.p(new Runnable() {
@Override
public final void run() {
ExecuteService.this.Q5(i2, tnVar, cVar, F02);
}
});
return -1;
}
private void F8(android.net.wifi.WifiManager r11, int r12, boolean r13) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.F8(android.net.wifi.WifiManager, int, boolean):void");
}
private void G0(NotificationManager notificationManager) {
U0();
for (Map.Entry<String, ?> entry : t4().getAll().entrySet()) {
w5.n(this, (String) entry.getValue(), Integer.parseInt(entry.getKey()));
}
T0();
notificationManager.cancelAll();
}
private void G1(String str, String str2, int i2) {
Message obtainMessage = this.Q.obtainMessage();
Bundle bundle = new Bundle();
bundle.putString("ti", str);
bundle.putString("tx", str2.substring(0, Math.min(str2.length(), 4095)));
bundle.putInt("l", i2);
obtainMessage.setData(bundle);
this.Q.sendMessage(obtainMessage);
wp.a(this, 20000L);
}
private int G2(tn tnVar, net.dinglisch.android.taskerm.c cVar, int i2) {
String str = "reboot";
if (i2 == 1) {
str = "reboot recovery";
} else if (i2 == 2) {
str = "reboot bootloader";
} else if (i2 == 3) {
str = "reboot -p";
}
r7.f("E", str);
if (vm.t(true, 10000L, str, false) == 0) {
return -1;
}
tnVar.T1(cVar, "Reboot action failed. Your device needs to be rooted for it to work.");
return -3;
}
private int G3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String F4 = F4(cVar, 0, bundle);
int m4 = m4(cVar, 1, true, false, bundle);
int m42 = m4(cVar, 2, true, false, bundle);
int m43 = m4(cVar, 3, true, false, bundle);
int m44 = m4(cVar, 4, true, false, bundle);
if (m4 == Integer.MAX_VALUE || m42 == Integer.MAX_VALUE || m43 == Integer.MAX_VALUE || m44 == Integer.MAX_VALUE) {
return -3;
}
return !TaskerAppWidgetConfigure.h(this, co.b.SetTime, F4, new int[]{m44, m43, m42, m4}) ? -3 : -1;
}
public Boolean G5(boolean[] zArr, net.dinglisch.android.taskerm.c cVar, tn tnVar, int i2, Integer num) {
boolean z = false;
try {
zArr[0] = wl.n0(this, H4(cVar, 0, tnVar), H4(cVar, 1, tnVar), zk.e.values()[i2], H4(cVar, 3, tnVar));
z = true;
} catch (Throwable unused) {
}
if (!z) {
r7.f("E", "Need retry setElementMapControl: " + num);
}
return Boolean.valueOf(z);
}
private boolean G6() {
if (p0 >= j0.size()) {
return false;
}
if (l0) {
Random random = new Random();
if (j0.size() > 1) {
int i2 = k0;
while (i2 == k0) {
i2 = random.nextInt(j0.size());
}
k0 = i2;
} else {
k0 = 0;
}
} else {
k0 = (k0 + 1) % j0.size();
}
p0++;
r7.f("E", "picktrack: track no " + p0 + " index: " + k0 + " name " + j0.get(k0).getName() + " count now: " + p0);
return true;
}
private SSLSocketFactory G7() {
SSLSocketFactory defaultSSLSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
TrustManager[] trustManagerArr = {new l()};
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, trustManagerArr, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
return defaultSSLSocketFactory;
} catch (Exception e2) {
r7.l("E", "trustAllHosts", e2);
return null;
}
}
private void H0(NotificationManager notificationManager, int i2) {
if (!s5(i2)) {
notificationManager.cancel(i2);
} else {
w5.n(this, s4(i2), i2);
f7(i2);
}
}
private int H1(java.lang.String r25, net.dinglisch.android.taskerm.c r26, net.dinglisch.android.taskerm.eq r27, android.os.Bundle r28, net.dinglisch.android.taskerm.tn r29) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.H1(java.lang.String, net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.eq, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private int H2(String str, String str2, boolean z) {
return !vm.r(str2, z) ? -3 : -1;
}
private int H3(String str, int i2) {
String str2;
int i3;
int i4 = i2;
if (str.length() == 0) {
r7.G("E", "doType: empty string");
return -3;
}
if (i4 == Integer.MAX_VALUE) {
return -3;
}
if (i4 == 0) {
i4 = 1;
}
int i5 = -1;
KeyCharacterMap load = KeyCharacterMap.load(-1);
ArrayList arrayList = new ArrayList();
int i6 = 0;
int i7 = -1;
while (i6 < i4) {
String[] split = str.split("\\s+");
boolean r2 = dq.r(split);
int i8 = 0;
int i9 = 0;
while (true) {
if (i8 >= str.length()) {
break;
}
if (r2 || i9 >= split.length) {
str2 = null;
i3 = -1;
} else {
str2 = split[i9];
i3 = str2.length();
}
if (str2 != null) {
int i10 = i8 + i3;
if (str.substring(i8, i10).equals(str2)) {
arrayList.add("input text '" + str2 + "'");
i9++;
i8 = i10;
}
}
int i11 = i8 + 1;
char charAt = str.charAt(i8);
KeyEvent[] events = load.getEvents(new char[]{charAt});
if (dq.r(events)) {
r7.G("E", "no key events for character " + charAt);
i7 = -3;
break;
}
arrayList.add("input keyevent " + events[0].getKeyCode());
i8 = i11;
}
i6++;
i5 = -1;
}
if (i7 == i5) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
if (vm.t(true, 8000L, (String) it.next(), false) != 0) {
return -3;
}
}
}
return i7;
}
private String H4(net.dinglisch.android.taskerm.c cVar, int i2, tn tnVar) {
return F4(cVar, i2, tnVar.m());
}
public Integer H5(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, Context context) {
return Integer.valueOf(g1(str, cVar, bundle));
}
private boolean H6(File file, int i2, boolean z, int i3) {
List<File> list;
jf.d j2 = jf.a.j(file, this);
Object obj = C0;
synchronized (obj) {
try {
kq.A(this);
boolean z2 = true;
if (!j2.Z()) {
r7.G("E", "musicplay: file doesn't exist: " + j2.getName());
l8(this, true, "pmf1");
return false;
}
final FileInputStream c02 = j2.c0();
if (B0 == null) {
r7.f("E", "init mediaplayer creation");
this.T.sendEmptyMessage(0);
r7.f("E", "wait for mediaplayer creation");
synchronized (obj) {
long currentTimeMillis = System.currentTimeMillis();
while (true) {
if (this.I.booleanValue() || System.currentTimeMillis() - currentTimeMillis >= 10000) {
break;
}
synchronized (D0) {
try {
if (B0 != null) {
break;
}
} finally {
}
}
N3(200L);
}
if (B0 != null) {
B0.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public final void onCompletion(MediaPlayer mediaPlayer) {
ExecuteService.this.R5(c02, mediaPlayer);
}
});
B0.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public final boolean onError(MediaPlayer mediaPlayer, int i4, int i5) {
boolean S5;
S5 = ExecuteService.S5(mediaPlayer, i4, i5);
return S5;
}
});
}
}
} else {
l8(this, false, "pmf2");
}
if (this.I.booleanValue() && i0 == null) {
r7.f("E", "playMusicFile: time to leave, not playing dir, abort");
l8(this, true, "pmf3");
} else if (B0 == null) {
r7.G("E", "no media player");
} else {
B0.setLooping(z);
B0.setAudioStreamType(i3);
try {
try {
try {
if (c02 == null) {
B0.setDataSource(j2.toString());
} else {
B0.setDataSource(c02.getFD());
}
B0.prepare();
if (i2 > 0) {
int i4 = i2 * 1000;
if (i4 > B0.getDuration()) {
N6(2131887988, new Object[0]);
} else if (com.joaomgcd.taskerm.util.k.r()) {
B0.seekTo(i4, 3);
} else {
B0.seekTo(i4);
}
}
B0.start();
} catch (IllegalStateException e2) {
r7.G("E", "playmusic: illegal state: " + e2.toString());
B0 = null;
}
} catch (IllegalArgumentException e3) {
r7.G("E", "playmusic: bad argument: " + e3.toString());
B0 = null;
}
} catch (IOException e4) {
r7.G("E", "playmusic: IO exception: " + e4.toString());
B0 = null;
}
if (B0 != null) {
kq.n1(this, C4(j2.z()));
if (m0 && (list = j0) != null && list.size() > 0 && k0 < list.size()) {
G1(null, C4(list.get(k0)), 1);
}
r7.f("E", "playmusic: started track: " + j2.getName());
return z2;
}
r7.G("E", "playmusic: failed to init music player for " + j2.toString());
}
z2 = false;
return z2;
} catch (Throwable th2) {
throw th2;
}
}
}
public void H7(int i2, String str) {
r7.f("E", "set TTSStatus to " + i2 + " by " + str);
this.w = i2;
}
private void I0(AlarmManager alarmManager, String str) {
synchronized (h0) {
if (this.s != null) {
r7.f("E", "AC cancel wait alarm: " + str);
if (alarmManager == null) {
alarmManager = (AlarmManager) oi.d(this, "alarm", "E", "cancelWA");
}
try {
alarmManager.cancel(this.s);
} catch (Exception e2) {
r7.H("E", "cancel wait alarm", e2);
}
this.s = null;
}
}
}
private void I1(String str, boolean z) {
Intent intent;
if (TextUtils.isEmpty(str)) {
intent = new Intent("com.mobitobi.android.gentlealarm.POWER");
intent.putExtra("power", z);
} else {
Intent intent2 = new Intent("com.mobitobi.android.gentlealarm.ENABLE_ALARM");
intent2.putExtra("enable", z);
intent2.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
intent = intent2;
}
r7.z(intent.getAction(), intent);
sendBroadcast(intent);
}
private String I2(String str, tn tnVar) {
return kq.N(this, str, tnVar.m());
}
private int I3(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, true)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, false, true, false)) {
if (!h4.toString().endsWith(".zip")) {
h4 = dq.i(h4, ".zip");
}
if (!h4.i(this, h4)) {
I6(2131887958, str, h4.toString());
} else {
if (h4.a0(this, h4)) {
if (cVar.i(1).T(this, bundle) && !h4.f(this, h4)) {
N6(2131887957, h4.toString());
}
return -5;
}
I6(2131888003, h4.getName());
}
}
return -3;
}
public static String I4(Context context, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return J4(context, i2, cVar, bundle, true);
}
public static Integer I5(String str, net.dinglisch.android.taskerm.g gVar, Context context) {
return Integer.valueOf(TaskerAppWidgetConfigure.e(context, str, null, gVar) ? -1 : -3);
}
private boolean J0(int i2, String str) {
if (a1.p(i2)) {
return true;
}
if (dq.J1(i2, a1.X()) != -1) {
O6(vh.g(this, 2131887269, a1.v(i2), "4.2+"), new Object[0]);
} else {
com.joaomgcd.taskerm.util.j1 c2 = com.joaomgcd.taskerm.util.b4.f().c(i2);
if (c2.b()) {
N6(2131887940, str);
} else {
N6(2131890908, com.joaomgcd.taskerm.util.k.c(c2.a()));
}
}
return false;
}
private int J1(tn tnVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int v2 = cVar.x(0).v();
int m4 = m4(cVar, 1, true, false, bundle);
boolean j4 = j4(cVar, 2, bundle);
this.D = j4(cVar, 3, bundle);
boolean z = v2 == 0 || v2 == 2;
boolean z2 = v2 == 1 || v2 == 2;
if (!j4) {
this.Y.Q0(tnVar);
}
this.E = null;
this.F = 0;
LocationManager locationManager = (LocationManager) oi.d(this, "location", "E", "dgf");
if (m4 != Integer.MAX_VALUE) {
if (locationManager == null) {
r7.k("E", "no location manager");
} else {
if (z2) {
if (t0 == null) {
r7.f("E", "register net listener");
o oVar = new o();
t0 = oVar;
locationManager.requestLocationUpdates("network", 0L, 0.0f, oVar, Looper.getMainLooper());
this.C = true;
} else {
r7.k("E", "couldn't start net fixes, already have location listener");
}
}
if (z) {
if (u0 == null) {
r7.f("E", "register GPS listener");
p pVar = new p();
u0 = pVar;
locationManager.requestLocationUpdates("gps", 0L, 0.0f, pVar, Looper.getMainLooper());
this.B = true;
} else {
r7.k("E", "couldn't start GPS fixes, already have location listener");
}
}
if (q5()) {
if (!j4) {
D0("Fix Group", m4);
return -1;
}
synchronized (this.N) {
this.N.put("Fix Group", Long.valueOf(h5(m4)));
}
return -5;
}
}
}
return -3;
}
public u3 J2(tn tnVar, net.dinglisch.android.taskerm.c cVar, int i2, int i3) {
int i4;
int i5;
int i6;
int i7;
u3 u3Var = new u3(-1);
if (cVar == null) {
r7.k("E", "null action, end macro");
tnVar.o2(false);
return u3Var;
}
int j2 = cVar.j();
j6("exe: " + tnVar.Z0(), cVar);
boolean z = j2 == 30 && cVar.J() != 0;
if (!cVar.L()) {
u3Var.a = -5;
return u3Var;
}
if (j2 == 43 && u5(tnVar, i2)) {
S7(tnVar, 37, -1, 38, false);
u3Var.a = -1;
return u3Var;
}
if (!z) {
if (d6.J(this)) {
i7 = 37;
if (cVar.w(this, true, tnVar.T0(), tnVar.m(), "doRunAction[" + cVar.getName() + "]")) {
i4 = 43;
i5 = 39;
i6 = 35;
}
} else {
i7 = 37;
}
if (j2 == i7) {
cVar.p1(false);
S7(tnVar, 37, 43, 38, false);
u3Var.a = -1;
return u3Var;
}
if (j2 == 43) {
q6(tnVar, i2, false);
S7(tnVar, 37, 43, 38, false);
u3Var.a = -1;
return u3Var;
}
if (j2 == 39) {
S7(tnVar, 39, -1, 40, true);
u3Var.a = -1;
return u3Var;
}
if (j2 == 35) {
cVar.p();
return d4(cVar, tnVar, i2, i3);
}
r7.f("E", "condition failed");
u3Var.a = -7;
return u3Var;
}
i4 = 43;
i5 = 39;
i6 = 35;
i7 = 37;
if (j2 == 40) {
T7(tnVar, i5, 40, true);
u3Var.a = -2;
return u3Var;
}
if (j2 == i6) {
u3Var.a = -1;
return u3Var;
}
if (j2 == i7) {
cVar.p1(true);
u3Var.a = -1;
return u3Var;
}
if (j2 != i4) {
return d4(cVar, tnVar, i2, i3);
}
q6(tnVar, i2, true);
u3Var.a = -1;
return u3Var;
}
private int J3(tn tnVar, String str, String str2, int i2, int i3, String str3, tn.b bVar, Bundle bundle) {
String valueOf;
String s02;
String F02 = kq.F0(this, str2, null, true, bundle);
if (str2 != null) {
if (F02 == null) {
J6(str + ": " + str2 + ": no value", new Object[0]);
} else {
switch (i2) {
case 0:
Long F3 = dq.F3(F02);
if (F3 != null) {
valueOf = String.valueOf(F3.longValue() / 1024);
break;
}
valueOf = null;
break;
case 1:
Double B3 = dq.B3(F02);
if (B3 != null) {
double doubleValue = B3.doubleValue() / 1048576.0d;
String s03 = dq.s0("%f", Double.valueOf(doubleValue));
char a2 = w6.a();
int indexOf = s03.indexOf(a2);
if (indexOf != -1) {
if (doubleValue > 10.0d || s03.charAt(1 + indexOf) == '0') {
s03 = s03.substring(0, indexOf);
} else {
s03 = s03.substring(0, indexOf + 2);
if (a2 != '.') {
s03 = s03.replace(a2, '.');
}
}
}
valueOf = s03;
break;
}
valueOf = null;
break;
case 2:
Double B32 = dq.B3(F02);
if (B32 != null) {
s02 = dq.s0("%f", Double.valueOf(B32.doubleValue() / 1.073741824E9d));
char a3 = w6.a();
int indexOf2 = s02.indexOf(a3);
if (indexOf2 != -1) {
if (s02.charAt(1 + indexOf2) == '0') {
s02 = s02.substring(0, indexOf2);
} else {
s02 = s02.substring(0, indexOf2 + 2);
if (a3 != '.') {
s02 = s02.replace(a3, '.');
}
}
}
valueOf = s02;
break;
}
valueOf = null;
break;
case 3:
Calendar R = bh.R(this, F02);
if (R != null) {
valueOf = String.valueOf(R.getTimeInMillis() / 1000);
break;
}
valueOf = null;
break;
case 4:
Long F32 = dq.F3(F02);
if (F32 != null) {
Calendar t2 = bh.t(F32.longValue() * 1000);
valueOf = bh.i(this, t2) + " " + bh.o(t2);
break;
}
valueOf = null;
break;
case 5:
case ClockContract.InstancesColumns.MISSED_STATE:
Long F33 = dq.F3(F02);
if (F33 != null) {
valueOf = DateFormat.format(i2 == 6 ? "EEEE, MMMM dd, yyyy hh:mmaa" : "MMM dd, yyyy kk:mm", F33.longValue() * 1000).toString();
break;
}
valueOf = null;
break;
case 7:
valueOf = Html.fromHtml(F02).toString();
break;
case 8:
Double B33 = dq.B3(F02);
if (B33 != null) {
valueOf = String.valueOf(((B33.doubleValue() * 9.0d) / 5.0d) + 32.0d);
break;
}
valueOf = null;
break;
case 9:
Double B34 = dq.B3(F02);
if (B34 != null) {
valueOf = String.valueOf(((B34.doubleValue() - 32.0d) * 5.0d) / 9.0d);
break;
}
valueOf = null;
break;
case 10:
valueOf = S0(F02, 0.4d);
break;
case 11:
valueOf = S0(F02, 2.5d);
break;
case 12:
valueOf = S0(F02, 3.28083d);
break;
case 13:
valueOf = S0(F02, 0.3048d);
break;
case 14:
valueOf = S0(F02, 2.2046226218d);
break;
case 15:
valueOf = S0(F02, 0.45359237d);
break;
case 16:
valueOf = S0(F02, 0.621371192d);
break;
case 17:
valueOf = S0(F02, 1.60934d);
break;
case 18:
valueOf = dq.N(F02);
break;
case 19:
valueOf = dq.S(F02);
break;
case 20:
case 21:
case 22:
case 23:
try {
s02 = i2 == 21 ? Long.toBinaryString(Long.parseLong(F02, 10)) : i2 == 23 ? Long.toHexString(Long.parseLong(F02, 10)) : i2 == 22 ? String.valueOf(Long.parseLong(F02, 16)) : String.valueOf(Long.parseLong(F02, 2));
valueOf = s02;
break;
} catch (Exception e2) {
r7.H("E", str, e2);
break;
}
case 24:
valueOf = Base64.encodeToString(F02.getBytes(), 2);
break;
case 25:
byte[] decode = Base64.decode(F02, i3 == 1 ? 8 : 0);
if (decode != null) {
valueOf = new String(decode);
break;
}
valueOf = null;
break;
case 26:
valueOf = b2.d(F02);
break;
case 27:
valueOf = b2.e(F02);
break;
case 28:
valueOf = F02.toLowerCase();
break;
case 29:
valueOf = F02.toUpperCase();
break;
case 30:
valueOf = dq.J3(F02);
break;
case 31:
valueOf = new mc.e().r(F02);
if (valueOf != null && valueOf.length() > 1) {
valueOf = valueOf.substring(1, valueOf.length() - 1);
}
break;
default:
r7.k("E", "bad conversion: " + i2);
valueOf = null;
break;
}
if (valueOf != null) {
if (bVar != null) {
bVar.a(valueOf);
}
if (TextUtils.isEmpty(str3)) {
w8(str2, valueOf, tnVar, str);
} else {
w8(str3, valueOf, tnVar, str);
}
return -1;
}
J6(str + ": " + str2 + ": failed", new Object[0]);
}
}
return -3;
}
public static String J4(Context context, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle, boolean z) {
try {
if (cVar.Y() <= i2 || cVar.p0(i2) != 1) {
return null;
}
return z ? kq.N(context, cVar.N(i2).w(), bundle) : cVar.N(i2).w();
} catch (Throwable th2) {
r7.l("E", "can't get variable", th2);
return null;
}
}
public Integer J5(tn tnVar, net.dinglisch.android.taskerm.c cVar, String str, String str2, Bundle bundle, Context context) {
return M7(tnVar, cVar, str, str2, bundle);
}
private void J6(String str, Object... objArr) {
L6(true, str, objArr);
}
public void K0() {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
LinkedList linkedList = null;
while (it.hasNext()) {
tn next = it.next();
if (next.N1() && next.j1() > 600000) {
if (linkedList == null) {
linkedList = new LinkedList();
}
r7.f("E", "task" + next.K0() + ", paused > 600000");
linkedList.add(Integer.valueOf(next.J0()));
}
}
if (!dq.F(linkedList)) {
Iterator it2 = linkedList.iterator();
while (it2.hasNext()) {
s8(((Integer) it2.next()).intValue(), true, false);
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void K1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String w2;
Intent p2 = th.p();
net.dinglisch.android.taskerm.h x2 = cVar.x(0);
int G = x2 != null ? x2.I() ? x2.G(this, bundle) : x2.v() : 0;
if (G > 0) {
p2.putExtra("net.dinglisch.android.tasker.extras.HOME_PAGE", G);
p2.putExtra("com.fede.launcher.extra.SCREEN", G);
}
net.dinglisch.android.taskerm.j N = cVar.N(1);
if (N != null && (w2 = N.w()) != null) {
p2.setComponent(ExtensionsContextKt.n1(this, w2));
}
if (U7(p2)) {
return;
}
N6(2131887971, new Object[0]);
}
private void K2(String str, boolean z, String str2, Bundle bundle) {
File file = new File(new File(Environment.getExternalStorageDirectory(), "sl4a/scripts"), str);
if (!file.exists()) {
I6(2131887973, str);
return;
}
Intent intent = new Intent(z ? "com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT" : "com.googlecode.android_scripting.action.LAUNCH_BACKGROUND_SCRIPT");
intent.setComponent(new ComponentName("com.googlecode.android_scripting", "com.googlecode.android_scripting.activity.ScriptingLayerServiceLauncher"));
intent.putExtra("com.googlecode.android_scripting.extra.SCRIPT_PATH", file.toString());
r7.f("E", "ACTION: " + intent.getAction());
r7.f("E", "COMPONENT: " + intent.getComponent().toString());
r7.f("E", "EXTRA SCRIPT KEY/PATH: com.googlecode.android_scripting.extra.SCRIPT_PATH / " + file);
if (!TextUtils.isEmpty(str2)) {
String[] split = str2.split(",");
if (dq.r(split)) {
r7.G("E", "couldn't get any variable definitions from spec");
} else {
for (String str3 : split) {
String trim = str3.trim();
String D02 = kq.D0(this, trim, bundle);
if (D02 != null) {
r7.f("E", "EXTRA: VAR: " + trim + " value: |" + D02 + "|");
intent.putExtra(trim, D02);
}
}
}
}
U7(intent);
}
private int K3(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, Bundle bundle) {
Random random = new Random();
String b5 = b5(cVar, 0, bundle);
int m4 = m4(cVar, 1, false, false, bundle);
int m42 = m4(cVar, 2, false, false, bundle);
if (b5 == null || m4 == Integer.MAX_VALUE || m42 == Integer.MAX_VALUE) {
return -3;
}
if (m42 >= m4) {
w8(b5, Integer.toString(m4 + random.nextInt((m42 - m4) + 1)), tnVar, str);
return -1;
}
r7.G("E", str + ": odd range: " + m4 + " - " + m42);
return -3;
}
public static List<String> K4() {
ArrayList<String> y3;
synchronized (x0) {
y3 = dq.y3(x0);
}
return y3;
}
public Integer K5(tn tnVar, String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, Context context) {
return Integer.valueOf(c2(tnVar, str, cVar, bundle));
}
private void K6(boolean z, int i2, Object... objArr) {
L6(z, vh.g(this, i2, new Object[0]), objArr);
}
private void K7(long j2, tn tnVar) {
AlarmManager alarmManager = (AlarmManager) oi.d(this, "alarm", "E", "setWA");
m6("set wait alarm for " + j2 + "ms", tnVar);
if (alarmManager != null) {
synchronized (h0) {
try {
if (j2 == 0) {
I0(alarmManager, "setWaitAlarm");
} else if (j2 < 0) {
r7.f("E", "not setting wait alarm for negative time " + j2 + "ms");
} else if (j2 < 2000) {
r7.f("E", "don't bother setting wait alarm for < 2s");
} else {
Intent f5 = f5(this);
this.s = PendingIntent.getBroadcast(this, 0, f5, com.joaomgcd.taskerm.util.k8.g(268435456, f5));
this.t = System.currentTimeMillis() + j2;
a7(alarmManager, "set");
}
} finally {
}
}
}
}
private boolean L0(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, u3 u3Var) {
Set<String> A = dq.A(this, cVar.D0(this, null, false).keySet());
if (A != null) {
if (A.contains("android.permission.WRITE_SETTINGS") && sd.l()) {
if (!sd.m(this)) {
r7.f("E", str + ": missing 'modify system settings' permission, start proxy");
this.Y.M0(new String[]{"android.permission.WRITE_SETTINGS"});
u3Var.a = -3;
return true;
}
A.remove("android.permission.WRITE_SETTINGS");
}
if (A.contains("android.permission.SYSTEM_ALERT_WINDOW") && sd.i()) {
if (!sd.j(this)) {
r7.f("E", str + ": missing 'draw over other apps' permission, start proxy");
if (b8(4, tnVar.m1(), 20, cVar, tnVar.m())) {
cVar.r1(2);
u3Var.a = -1;
} else {
u3Var.a = -3;
}
return true;
}
A.remove("android.permission.SYSTEM_ALERT_WINDOW");
}
if (com.joaomgcd.taskerm.util.k.u()) {
String str2 = sd.d;
if (A.contains(str2) && com.joaomgcd.taskerm.util.k8.H()) {
A.remove(str2);
}
}
if (A.size() > 0) {
this.Y.M0((String[]) A.toArray(new String[A.size()]));
ArrayList<String> y3 = dq.y3(A);
ArrayList arrayList = new ArrayList();
Iterator<String> it = y3.iterator();
while (it.hasNext()) {
arrayList.add(com.joaomgcd.taskerm.util.r5.A(it.next(), this));
}
r7.G("E", str + ": don't have permission(s): " + dq.x3(arrayList));
u3Var.a = -3;
return true;
}
}
this.Y.R0();
return false;
}
private int L1(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, int i2, Bundle bundle) {
int i3;
int r4 = r4(cVar, 0);
if (r4 == 0) {
int m4 = m4(cVar, 1, true, false, bundle);
if (m4 != Integer.MAX_VALUE) {
i3 = m4 - 1;
}
i3 = -1;
} else if (r4 == 1) {
String H4 = H4(cVar, 2, tnVar);
if (TextUtils.isEmpty(H4)) {
r7.G("E", str + ": empty label");
i3 = -1;
} else {
i3 = tnVar.V0(this, H4, bundle);
}
} else if (r4 == 2) {
i3 = tnVar.l1(i2 - 1, 39);
} else if (r4 != 3) {
if (r4 == 4) {
i3 = tnVar.b1(i2 + 1, 38);
}
i3 = -1;
} else {
i3 = tnVar.b1(i2 + 1, 40) + 1;
}
if (i3 != -1) {
return i3;
}
tnVar.J("Target action doesn't exist.");
return -3;
}
private int L2(net.dinglisch.android.taskerm.c cVar, tn tnVar, String str, int i2, boolean z, String str2, String str3, String str4, int i3, boolean z2, Bundle bundle, boolean z3, boolean z4) {
if (str2 == null || str3 == null || str4 == null) {
r7.G("E", "runShell: variable name error");
return -3;
}
boolean z5 = z2 || str2.length() > 0;
boolean z6 = str3.length() > 0;
if (str2.length() > 0) {
kq.E(this, str2, false, true, bundle);
}
if (z6) {
kq.E(this, str3, false, true, bundle);
}
if (i2 == Integer.MAX_VALUE) {
return -3;
}
if (z && !s5.p(this, Boolean.TRUE)) {
r7.G("E", "shell: no root");
return -3;
}
int i4 = i2 == 0 ? -1 : (int) (i2 * 1000);
if (!z4) {
vm.s(this, i3, z, i4, z5, z6, new String[]{str}, z3);
C0(a1.w0(i3));
return -1;
}
String d2 = vm.d(this, z, str);
if (d2 == null) {
return -3;
}
return this.Y.X0(cVar, bundle, tnVar, d2, i4, z, z3, str2, str3);
}
private int L3(net.dinglisch.android.taskerm.tn r7, java.lang.String r8, java.lang.String r9, int r10, int r11, boolean r12, java.lang.String r13, android.os.Bundle r14) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.L3(net.dinglisch.android.taskerm.tn, java.lang.String, java.lang.String, int, int, boolean, java.lang.String, android.os.Bundle):int");
}
public static String L4() {
StringBuilder sb = new StringBuilder();
synchronized (x0) {
try {
if (x0.size() > 0) {
sb.append(",");
}
Iterator<String> it = x0.iterator();
while (it.hasNext()) {
sb.append(it.next());
sb.append(",");
}
} catch (Throwable th2) {
throw th2;
}
}
return sb.toString();
}
private void L6(boolean z, String str, Object... objArr) {
String s02 = dq.s0(str + ".", objArr);
if (z && this.X.getBoolean("tEnable", true)) {
G1(vh.g(this, 2131891164, new Object[0]), s02, 1);
}
r7.m("E", z, s02);
}
private void L7() {
if (zq.j("E")) {
zq.m(this, "E", !y6());
}
}
private boolean M0(File file, String str, boolean z, boolean z2, boolean z3, boolean z4) {
return N0(file, str, true, z, z2, z3, z4);
}
private void M1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int r4 = r4(cVar, 0);
boolean z = true;
boolean z2 = r4 == 0;
boolean j4 = j4(cVar, 1, bundle);
if (dq.S1()) {
if (ph.b()) {
r7.f("E", str + ": defaulting to use new API on Android 6.0+ since have existing session");
}
z = j4;
} else {
if (j4) {
r7.f("E", str + ": defaulting to not use new API for grab pre-Android.6.0");
z = false;
}
z = j4;
}
r7.f("E", str + ": grab: " + r4 + " useNewAPI: " + z);
if (!z) {
dq.r1(this, z2, false);
return;
}
Message obtainMessage = this.V.obtainMessage();
Bundle bundle2 = new Bundle();
bundle2.putBoolean("grab", z2);
bundle2.putBoolean("newAPI", z);
obtainMessage.setData(bundle2);
this.V.sendMessage(obtainMessage);
}
private int M2(java.lang.String r38, net.dinglisch.android.taskerm.c r39, int r40, android.os.Bundle r41, net.dinglisch.android.taskerm.tn r42) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.M2(java.lang.String, net.dinglisch.android.taskerm.c, int, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private int M3(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (oi.d(this, "vibrator", "E", "exevib") == null) {
I6(2131887722, new Object[0]);
return -3;
}
int l4 = l4(cVar, 0, bundle);
if (l4 == Integer.MAX_VALUE) {
return -3;
}
dq.L3(this, l4);
return -3;
}
public static mk.i0<tn> M4() {
return O0;
}
public void M6(int i2, String str, Throwable th2) {
J6("code " + i2 + ": " + th2.toString(), new Object[0]);
StringBuilder sb = new StringBuilder();
sb.append("prefsException/");
sb.append(str);
r7.l("E", sb.toString(), th2);
}
@android.annotation.TargetApi(23)
private java.lang.Integer M7(net.dinglisch.android.taskerm.tn r39, net.dinglisch.android.taskerm.c r40, final java.lang.String r41, java.lang.String r42, android.os.Bundle r43) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.M7(net.dinglisch.android.taskerm.tn, net.dinglisch.android.taskerm.c, java.lang.String, java.lang.String, android.os.Bundle):java.lang.Integer");
}
private int N1(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File h4 = h4(str, cVar, 0, bundle);
if (h4 != null && !h4.toString().endsWith(".gz")) {
h4 = dq.i(h4, ".gz");
}
File file = h4;
if (h4.L(this, file, false, true, true)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(file, str, false, true, true, false)) {
if (h4.B(this, file, dq.y2(file, ".gz"))) {
if (!cVar.i(1).T(this, bundle) || h4.f(this, file)) {
return -1;
}
N6(2131887957, file.toString());
return -1;
}
I6(2131888003, file.getName());
}
return -3;
}
private int N2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
synchronized (e0) {
try {
if (f0 == null) {
r7.G("E", str + ": no image loaded");
} else {
boolean j4 = j4(cVar, 2, bundle);
File N4 = N4(F4(cVar, 0, bundle), str, false, true, false);
int k4 = k4(this, cVar, 1, true, true, bundle);
if (k4 >= 1 && k4 <= 100) {
if (k4 != Integer.MAX_VALUE && N4 != null && zg.z(f0, N4, zg.h(N4), k4)) {
if (j4) {
P0();
}
i2 = -1;
}
}
r7.G("E", str + ": bad quality " + k4);
}
i2 = -3;
} finally {
}
}
return i2;
}
public void N5() {
if (j1.r()) {
j1.a();
}
bi.b(this, "E");
w6.e(getBaseContext());
this.U = new x(this);
if (dq.S1()) {
this.V = new s(this);
}
this.R = new r(this);
this.Q = new y(this);
this.S = new w(this);
this.T = new u();
if (yd.c.b() && Settings.P3(this)) {
a4(true);
}
this.Y.I();
}
private boolean N7(int i2) {
AudioManager audioManager = (AudioManager) oi.d(this, "audio", "E", "saf");
if (audioManager == null) {
return true;
}
AudioManager.OnAudioFocusChangeListener onAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@Override
public final void onAudioFocusChange(int i3) {
ExecuteService.this.U5(i3);
}
};
this.z = onAudioFocusChangeListener;
if (audioManager.requestAudioFocus(onAudioFocusChangeListener, i2, 3) != 0) {
return true;
}
r7.f("E", "audio focus denied, stop");
w0();
return false;
}
private void O0() {
int i2 = this.O;
if ((i2 == 48 || i2 == 550 || i2 == 49) && System.currentTimeMillis() - this.P < 3000) {
r7.f("E", "pre-show-scene wait for cleanup of old");
N3(200L);
}
}
private int O1(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, true, true, false)) {
if (h4.C(this, h4, dq.i(h4, ".gz"))) {
if (!cVar.i(1).T(this, bundle) || h4.f(this, h4)) {
return -1;
}
N6(2131887956, h4.toString());
return -1;
}
I6(2131888004, h4.toString());
}
return -3;
}
private int O2(String str, net.dinglisch.android.taskerm.c cVar, String str2) {
if (str2.length() > 0) {
File O4 = O4(str2, str, true, false, false, true, true);
r7.f("E", str + ": scan " + O4);
if (!O4.exists() || !O4.isDirectory()) {
oh.b(this, O4);
N3(1000L);
return -1;
}
if (v7(O4, 12500L)) {
return -1;
}
} else {
File c1 = dq.c1();
r7.f("E", str + ": no file spec, scan root " + c1);
if (c1 == null) {
N6(2131887969, new Object[0]);
} else {
if (dq.g() < 19) {
sendBroadcast(dq.P0());
return -1;
}
if (v7(c1, 12500L)) {
return -1;
}
}
}
return -3;
}
private void O6(String str, Object... objArr) {
String s02 = dq.s0(str + ".", objArr);
if (this.X.getBoolean("tEnable", true)) {
G1(vh.g(this, 2131891282, new Object[0]), s02, 0);
}
r7.G("E", s02);
}
private boolean O7(TextToSpeech textToSpeech) {
boolean z;
boolean z2 = true;
if (yd.p0.d()) {
Class<?> j2 = yd.j(th.B() + ".MyUtteranceProgressListener");
try {
Object newInstance = j2.newInstance();
yd.u(yd.q(j2, "setHandler", new Class[]{Handler.class}), newInstance, -1, this.U);
yd.p0.g(textToSpeech, newInstance);
z = true;
} catch (Exception e2) {
r7.l("E", "setProgressListener", e2);
}
if (z && yd.p0.b()) {
Class<?> j3 = yd.j(th.B() + ".MyUtteranceCompletedListener");
try {
Object newInstance2 = j3.newInstance();
yd.u(yd.q(j3, "setHandler", new Class[]{Handler.class}), newInstance2, -1, this.U);
if (yd.p0.f(textToSpeech, newInstance2) != 0) {
r7.k("E", "failed to register for utterance completed");
z2 = z;
}
return z2;
} catch (Exception e3) {
r7.l("E", "setCompletedListener", e3);
return z;
}
}
}
z = false;
return z ? z : z;
}
private void P0() {
boolean z;
synchronized (e0) {
try {
z = false;
if (f0 != null) {
if (!g0) {
f0.recycle();
}
f0 = null;
g0 = false;
z = true;
}
} catch (Throwable th2) {
throw th2;
}
}
if (z) {
System.gc();
}
}
private int P1(net.dinglisch.android.taskerm.c r29, net.dinglisch.android.taskerm.tn r30) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.P1(net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.tn):int");
}
private int P2(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return wl.k0(this, F4(cVar, 0, bundle), F4(cVar, 1, bundle), j4(cVar, 2, bundle)) ? -1 : -3;
}
private int P3(net.dinglisch.android.taskerm.c cVar, int i2, int i3, Bundle bundle, final tn tnVar) {
net.dinglisch.android.taskerm.c cVar2;
Bundle bundle2;
int i4;
boolean y6;
boolean z;
int[] iArr;
int i5 = -2;
if (i2 == 30) {
cVar2 = cVar;
bundle2 = bundle;
i4 = -1;
} else {
cVar2 = cVar;
bundle2 = bundle;
i4 = -2;
}
long d5 = d5(cVar2, bundle2);
long currentTimeMillis = System.currentTimeMillis();
l6("need wait for " + d5 + "ms (task elapsed time: " + cVar.J() + ")", tnVar);
if (d5 == Long.MIN_VALUE) {
i4 = -3;
} else {
if (!this.L.isEmpty()) {
synchronized (this.N) {
try {
Iterator<Long> it = this.N.values().iterator();
while (it.hasNext()) {
long longValue = it.next().longValue();
if (currentTimeMillis < longValue) {
long j2 = longValue - currentTimeMillis;
if (j2 < d5) {
l6("doWaitAction: have nearer wait flag expiry, use that (" + j2 + "ms)", tnVar);
d5 = j2;
}
}
}
} finally {
}
}
}
if (d5 > 10) {
K7(10 + d5, tnVar);
synchronized (this.G) {
y6 = y6();
}
if (!y6 && zq.j("E")) {
l6("wait: release wakelock E", tnVar);
zq.k(this, "E");
}
synchronized (this.G) {
try {
if (i3 != this.H) {
l6("doWaitAction: new task since queue choice, go back and choose again", tnVar);
z = true;
} else {
z = false;
}
} finally {
}
}
if (z) {
iArr = null;
} else {
l6("do wait", tnVar);
this.Y.p(new Runnable() {
@Override
public final void run() {
ExecuteService.this.E5(tnVar);
}
});
l6("getting queue exe ids", tnVar);
int[] D4 = D4();
l6("doing wait for " + d5 + "ms", tnVar);
boolean O3 = O3(d5, tnVar);
l6("finished wait, ok: " + O3, tnVar);
z = O3;
iArr = D4;
}
zq.f(this, "E", !y6, false);
if (z) {
l6("set do again", tnVar);
} else {
i5 = i4;
}
B7(z, tnVar, "doAgainFlag");
T6(System.currentTimeMillis() - currentTimeMillis, iArr);
K7(0L, tnVar);
i4 = i5;
}
}
if (i4 == -1) {
cVar.p();
l6("returnStatus is ACTION_EXECUTE_STATUS_OK", tnVar);
B7(false, tnVar, "ACTION_EXECUTE_STATUS_OK");
}
return i4;
}
private String P4(String str) {
return str;
}
public static ji.v P5(String[] strArr, Throwable th2) throws Exception {
strArr[0] = th2.getMessage();
return ji.r.w(Boolean.FALSE);
}
public static boolean P6() {
boolean z;
synchronized (G0) {
z = H0;
}
return z;
}
private void P7(tn tnVar) {
boolean z;
synchronized (this.I) {
try {
if (!this.I.booleanValue()) {
if (this.K == null) {
r7.f("E", "workthread null");
z = true;
} else {
r7.f("E", "ui sync stoplock");
synchronized (d0) {
r7.f("E", "ui insync stoplock");
Thread.State o1 = dq.o1(this.K);
r7.f("E", "tstate: " + o1);
if (o1 == null) {
r7.G("E", "receive task " + tnVar.Z0() + ": t unknown, try join, start new ");
try {
this.K.join(200L);
} catch (Exception e2) {
r7.g("E", "join exception", e2);
}
z = true;
} else {
if (!o1.equals(Thread.State.TERMINATED)) {
if (o1.equals(Thread.State.TIMED_WAITING)) {
this.K.interrupt();
} else if (o1.equals(Thread.State.WAITING)) {
this.K.interrupt();
} else if (this.K.i) {
r7.f("E", "workthread exiting, join");
try {
this.K.join();
} catch (InterruptedException e3) {
r7.g("E", "join exception", e3);
}
}
z = false;
}
z = true;
}
}
r7.f("E", "ui postsync stoplock");
}
if (z) {
t tVar = new t(null, this.Z, ExecuteService.class.getSimpleName());
this.K = tVar;
tVar.setPriority(1);
this.K.start();
r7.f("E", "started new thread");
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
public static void Q0() {
synchronized (w0) {
w0.clear();
}
}
private int Q1(int r17, java.lang.String r18, net.dinglisch.android.taskerm.c r19, android.os.Bundle r20, net.dinglisch.android.taskerm.tn r21) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.Q1(int, java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private boolean Q2(int i2, String str, String str2, int i3, int i4, int i5, long j2) {
return wl.l0(this, i2, str, str2, i3 < 2, i3 == 0 || i3 == 2, i4, i5, j2);
}
public void Q3() {
N3(g5());
}
private Locale Q4() {
Locale d2 = yq.d(getResources().getConfiguration());
if (d2 != null) {
return d2;
}
r7.f("E", "tts: still no locale, use eng-usa");
return new Locale("eng-usa");
}
public void Q5(int i2, tn tnVar, net.dinglisch.android.taskerm.c cVar, String str) {
final String[] strArr = {null};
if (!MyAccessibilityService.j(i2) || !((Boolean) wd.c.k(this, i2).C(new oi.e() {
@Override
public final Object a(Object obj) {
ji.v P5;
P5 = ExecuteService.P5(strArr, (Throwable) obj);
return P5;
}
}).f()).booleanValue()) {
String str2 = strArr[0];
if (str2 == null) {
str2 = "Error performing global accessibility action";
}
tnVar.S1(cVar, 1, str2);
if (cVar.G1()) {
tnVar.o2(true);
}
}
h7(str);
}
private boolean Q6(String str, int i2, int i3) {
String d2 = a1.d(i2);
if (i2 == 808 && !dq.M1(getContentResolver(), d2)) {
r7.f("E", "putIntSetting: no auto-brightness found, try hero version");
d2 = "screen_auto";
}
return R6(str, d2, i3);
}
public static void Q7(Context context) {
R7(context, v.None, null);
}
private void R0() {
i0 = null;
j0 = null;
}
private int R1(String str, dk.d dVar) {
return wl.P(this, str, dVar, "E#doHideScene") ? -1 : -3;
}
private int R2(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
int m4 = m4(cVar, 0, true, false, bundle);
if (m4 != Integer.MAX_VALUE) {
if (m4 < 20 && !cVar.i(1).T(this, bundle)) {
m4 = 20;
}
boolean z = dq.g() < 19 && cVar.i(3).T(this, bundle);
if ((!Q6(str, cVar.j(), m4) && !cVar.i(2).T(this, bundle)) || !z) {
return -5;
}
if (b8(1, i2, 1, cVar, bundle)) {
N3(200L);
z7("99");
return -1;
}
}
return -3;
}
private void R3(String str, net.dinglisch.android.taskerm.c cVar) {
int v2 = cVar.x(0).v();
Intent e2 = th.e(getPackageManager(), th.a.Service, new Intent(vh.i(this, 2130903186)[v2]));
if (e2 == null) {
r7.G("E", str + ": couldn't get explicit intent");
return;
}
if (v2 < 4) {
r7.f("E", str + ": start service: " + e2.getAction());
startService(e2);
return;
}
r7.f("E", str + ": start activity: " + e2.getAction());
U7(e2);
}
public void R5(FileInputStream fileInputStream, MediaPlayer mediaPlayer) {
synchronized (C0) {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException unused) {
r7.f("E", "playMusicFile: inputStream couldn't close");
}
}
StringBuilder sb = new StringBuilder();
sb.append("playMusicFile: onCompletion: have player: ");
sb.append(B0 != null);
r7.f("E", sb.toString());
if (B0 != null) {
kq.A(this);
if (i0 == null) {
r7.f("E", "no playing dir, release");
h7("Music");
B0.release();
B0 = null;
} else {
r7.f("E", "start dir player loop");
X7();
}
}
}
}
private boolean R6(String str, String str2, int i2) {
return S6(str, str2, i2, true);
}
public static void R7(Context context, v vVar, Bundle bundle) {
synchronized (G0) {
r7.f("E", "signalProxyExit, result: " + vVar.toString());
I0 = vVar;
J0 = bundle;
E7(false, "signalProxyExit");
}
}
private String S0(String str, double d2) {
Double B3 = dq.B3(str);
if (B3 == null) {
return null;
}
return String.valueOf(B3.doubleValue() * d2);
}
private int S1(java.lang.String r24, net.dinglisch.android.taskerm.c r25, android.os.Bundle r26) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.S1(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int S2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
int m4 = m4(cVar, 0, true, false, bundle);
int m42 = m4(cVar, 1, true, false, bundle);
int m43 = m4(cVar, 2, true, false, bundle);
if (m4 != Integer.MAX_VALUE && m42 != Integer.MAX_VALUE && m43 != Integer.MAX_VALUE) {
if (a1.d1(cVar)) {
i2 = 2147482;
} else {
i2 = (m43 * 3600) + m4 + (m42 * 60);
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": set to ");
int i3 = i2 * 1000;
sb.append(i3);
sb.append("ms");
r7.f("E", sb.toString());
if (Q6(str, cVar.j(), i3)) {
r7.f("E", str + ": ok");
return -5;
}
}
return -3;
}
private int S3(tn tnVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle, String str, int i2, boolean z) {
WifiManager wifiManager = (WifiManager) oi.d(this, "wifi", "E", "doWifiStatus");
if (wifiManager == null) {
r7.k("E", vh.g(this, 2131887723, new Object[0]));
return -3;
}
C8(str + ": preAP");
r7.f("E", "check AP state");
int a2 = (z && yd.x.b(this)) ? yd.d1.a(wifiManager) : 1;
r7.f("E", "AP state: " + a2);
int i3 = -5;
if (a2 == 2 || a2 == 3) {
r7.f("E", "skipping wifi enable, wifi tether enabl(ed|ing)");
return -5;
}
C8(str + ": postAP");
int wifiState = wifiManager.getWifiState();
r7.f("E", "current state: " + wifiState);
if (wifiState == 4) {
r7.f("E", str + ": current wifi state unknown, continue anyway");
} else if (wifiState == 3 && !wifiManager.pingSupplicant()) {
r7.f("E", "action wifi: wifi supplicant not responding, continuing anyway");
}
boolean z2 = wifiState == 3 || wifiState == 2;
r7.f("E", "curval: " + wifiState);
boolean X4 = X4(z2, i2);
r7.f("E", str + ": cur: " + z2 + " new: " + X4);
if (z2 == X4) {
if (X4) {
MonitorService.K8("E/doWifiStatus2");
}
return -5;
}
if (!X4) {
if (wifiState == 0) {
F8(wifiManager, 1, false);
return -5;
}
if (wifiState == 2) {
F8(wifiManager, 3, false);
}
if (!this.I.booleanValue()) {
return z8(wifiManager, tnVar, cVar, bundle, false);
}
r7.f("E", str + ": skipping, time to leave");
return -5;
}
if (wifiState == 2) {
F8(wifiManager, 3, false);
} else {
if (wifiState == 0) {
F8(wifiManager, 1, false);
}
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else {
r7.f("E", str + ": setWifiEnabled()");
i3 = z8(wifiManager, tnVar, cVar, bundle, true);
}
}
MonitorService.K8("E/doWifiStatus1");
return i3;
}
public static boolean S5(MediaPlayer mediaPlayer, int i2, int i3) {
r7.G("E", "playMusicFile: media player onError: " + i2 + "," + i3);
return false;
}
private boolean S6(String str, String str2, int i2, boolean z) {
boolean z2;
ContentResolver contentResolver;
int i3;
boolean z3 = false;
try {
contentResolver = getContentResolver();
i3 = str2.equals("wifi_sleep_policy") ? Settings.System.getInt(contentResolver, str2, 0) : Settings.System.getInt(contentResolver, str2);
r7.f("E", str + ": curval: " + i3 + " new: " + i2);
} catch (Settings.SettingNotFoundException unused) {
z2 = false;
} catch (SecurityException unused2) {
z2 = false;
} catch (Exception e2) {
e = e2;
}
if (i3 == i2) {
return true;
}
if (Settings.System.putInt(contentResolver, str2, i2)) {
z2 = true;
} else {
r7.G("E", str + ": putInt " + str2 + "/" + i2 + " failed");
z2 = false;
}
try {
N3(100L);
} catch (Settings.SettingNotFoundException unused3) {
if (z) {
N6(2131887994, str2);
}
return z2;
} catch (SecurityException unused4) {
I6(2131887982, str);
return z2;
} catch (Exception e3) {
e = e3;
z3 = z2;
r7.l("E", "putIntSetting", e);
return z3;
}
return z2;
}
public void S7(tn tnVar, int i2, int i3, int i4, boolean z) {
int i5 = 1;
while (true) {
int a1 = tnVar.a1();
if (a1 != i2) {
if (a1 != i4) {
if (a1 == i3) {
if (i5 == 1) {
break;
}
}
if (a1 == -1) {
break;
}
} else {
i5--;
if (i5 == 0) {
tnVar.B1();
break;
}
}
} else {
i5++;
}
tnVar.B1();
if (z) {
r7.f("E", "in-between action: " + a1 + ": clear state");
tnVar.H0().s();
}
}
r7.f("E", "skipToEndOfBlock, " + i2 + ", new action " + tnVar.I0());
}
private int T1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int r4 = r4(cVar, 0);
String F4 = F4(cVar, 2, bundle);
int i2 = -3;
if (TextUtils.isEmpty(F4)) {
r7.G("E", str + ": refusing to load empty config");
return -3;
}
if (r4 == 0) {
synchronized (to.B[to.g.Active.ordinal()]) {
g5 p3 = to.u1(this).p3(this, F4, 0, false);
tn tnVar = (tn) p3.c;
if (!p3.a() && tnVar != null) {
i2 = -1;
}
}
return i2;
}
if (r4 != 1) {
r7.G("E", str + ": bad data type: " + r4);
return -3;
}
to toVar = new to();
if (!toVar.o1(this, str, F4)) {
r7.G("E", str + ": failed to load config");
return -3;
}
Object[] objArr = to.B;
to.g gVar = to.g.Active;
synchronized (objArr[gVar.ordinal()]) {
o8(this);
W6(true);
to.U4(gVar, toVar);
r7.f("E", str + ": finished config load, restart monitor");
MonitorService.j8(this, true);
}
return -4;
}
private void T2(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean j4 = j4(cVar, 1, bundle);
String F4 = F4(cVar, 0, bundle);
Intent intent = new Intent(j4 ? "android.intent.action.WEB_SEARCH" : "android.intent.action.SEARCH");
intent.putExtra("query", F4);
U7(intent);
}
private int T3(String str, int i2) {
int i3;
int i4;
if (!yd.e1.b(this)) {
r7.G("E", str + ": no wimax available");
return -1;
}
int D8 = D8();
if (D8 == 3) {
i3 = -1;
i4 = 1;
} else {
if (D8 == 1) {
i3 = -1;
} else {
r7.G("E", str + ": failed: wimax state unstable");
i3 = -3;
}
i4 = 0;
}
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else if (i3 == -1) {
int W4 = W4(i4, i2);
r7.f("E", str + ": state: " + D8 + " cur: " + i4 + " new: " + W4);
if (i4 != W4) {
boolean z = W4 == 1;
yd.e1.d(this, z);
int D82 = D8();
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else if ((z && D82 != 3) || (!z && D82 != 1)) {
r7.f("E", str + ": set " + z + ": state still not correct: " + D82);
}
}
}
return i3;
}
public void T5(Notification.Builder builder, boolean z, net.dinglisch.android.taskerm.g gVar, int i2, CharSequence charSequence, CharSequence charSequence2, PendingIntent pendingIntent, NotificationManager notificationManager) {
Notification f2 = yd.f0.f(builder);
if (!z) {
notificationManager.notify(i2, f2);
} else {
w5.m(this, gVar.O(), i2, f2, charSequence.toString(), charSequence2.toString(), pendingIntent);
t8(i2, gVar.O());
}
}
private void T6(long j2, int[] iArr) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (!next.F1()) {
if (iArr != null && dq.J1(next.K0(), iArr) == -1) {
}
net.dinglisch.android.taskerm.c H02 = next.H0();
if (H02 != null) {
H02.e(j2);
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void T7(tn tnVar, int i2, int i3, boolean z) {
r7.f("E", "skipToStartOfBlock, " + i2);
int i4 = 1;
while (true) {
int k1 = tnVar.k1();
if (k1 == i3) {
i4++;
} else if (k1 == i2) {
i4--;
if (i4 == 0) {
tnVar.C1();
return;
}
} else if (k1 == -1) {
return;
}
tnVar.C1();
if (z) {
tnVar.H0().s();
}
}
}
private void U1(Runnable runnable, String str) {
r7.f("E", "Doing in background after init execute: " + str);
this.Y.Z(W1().u(pg.w0.b), runnable);
}
private int U2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, tn tnVar) {
Pattern pattern;
int i2;
int i3;
Matcher matcher;
String a5 = a5(this, cVar, 0, bundle, true);
String Z4 = Z4(this, cVar, 5, bundle);
if (a5 == null || Z4 == null) {
return -3;
}
if (!kq.M0(this, a5, bundle)) {
r7.G("E", str + ": undefined variable: " + a5);
return -3;
}
String F4 = F4(cVar, 1, bundle);
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
boolean j43 = j4(cVar, 4, bundle);
boolean z = Z4.length() > 0;
boolean j44 = j4(cVar, 6, bundle);
if (z) {
kq.x(this, Z4, bundle);
}
String D02 = kq.D0(this, a5, bundle);
int i4 = j4 ? 2 : 0;
if (j42) {
i4 |= 8;
}
try {
pattern = Pattern.compile(F4, i4);
i2 = -1;
} catch (PatternSyntaxException unused) {
r7.G("E", str + ": bad search pattern: " + F4);
pattern = null;
i2 = -3;
}
if (i2 == -1) {
Matcher matcher2 = pattern.matcher(D02);
int i5 = 0;
while (true) {
if (!matcher2.find()) {
i3 = i2;
matcher = matcher2;
break;
}
String group = matcher2.group();
int i6 = i5 + 1;
if (z) {
i3 = i2;
matcher = matcher2;
kq.l1(this, Z4, Integer.MAX_VALUE, group, false, bundle);
} else {
i3 = i2;
matcher = matcher2;
}
if (j43) {
i5 = i6;
break;
}
i5 = i6;
matcher2 = matcher;
i2 = i3;
}
if (j44 && i5 > 0) {
String F42 = F4(cVar, 7, bundle);
matcher.reset();
Matcher matcher3 = matcher;
try {
String replaceFirst = j43 ? matcher3.replaceFirst(F42) : matcher3.replaceAll(F42);
if (TextUtils.isEmpty(replaceFirst)) {
kq.F(this, a5, false, true, bundle, tnVar);
} else {
kq.W1(this, a5, replaceFirst, true, bundle, str, Integer.valueOf(tnVar.x1()), new Integer[]{Integer.valueOf(tnVar.Y0())}, Integer.valueOf(tnVar.P0()));
}
} catch (Throwable th2) {
r7.l("E", "Couldn't replace variable", th2);
}
}
} else {
i3 = i2;
}
return i3;
}
private int U3(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
String a5 = a5(this, cVar, 0, bundle, true);
if (a5 != null) {
File h4 = h4(str, cVar, 1, bundle);
if (h4.L(this, h4, false, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, false, true, false)) {
String F4 = F4(cVar, 0, bundle);
if (!TextUtils.isEmpty(F4)) {
try {
com.joaomgcd.taskerm.util.g8.b(this, F4, h4);
} catch (Throwable th2) {
r7.I("E", str + ": decoding failed with stream. Trying putting it all in memory", th2);
byte[] decode = Base64.decode(F4.getBytes(), 0);
if (decode == null || decode.length == 0) {
r7.k("E", str + ": decoding failed with bytes in memory, is the data base 64 ?");
} else if (h4.b(this, decode, h4)) {
}
}
return -5;
}
r7.G("E", str + ": " + a5 + ": no value");
}
}
return -3;
}
public void U5(int i2) {
r7.f("E", "focusChange: " + i2);
if (i2 == -3 || i2 == -2 || i2 == -1) {
E6("lostFocus", null, false);
}
}
public tn U6() {
long j2;
int i2;
int i3;
int i4;
String F02;
if (this.G.size() <= 0) {
return null;
}
HashMap hashMap = new HashMap();
int p4 = p4();
HashMap hashMap2 = new HashMap();
Iterator<tn> it = this.G.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
tn next = it.next();
if (!next.N1()) {
hashMap2.put(Integer.valueOf(next.K0()), Integer.valueOf(n4(next)));
int Y0 = next.Y0();
if (Y0 != -1) {
j2 = hashMap.containsKey(Integer.valueOf(Y0)) ? ((Long) hashMap.get(Integer.valueOf(Y0))).longValue() : Long.MAX_VALUE;
long S0 = next.S0();
if (S0 < j2) {
hashMap.put(Integer.valueOf(Y0), Long.valueOf(S0));
}
}
}
}
int i5 = 0;
int i6 = -1;
int i7 = -1;
while (true) {
if (i5 >= 2) {
i2 = -1;
break;
}
for (int size = this.G.size() - 1; size >= 0; size--) {
tn tnVar = this.G.get(size);
if (tnVar.N1()) {
i4 = i6;
} else {
int Y02 = tnVar.Y0();
net.dinglisch.android.taskerm.c H02 = tnVar.H0();
int j3 = H02.j();
int i8 = ((j3 == 30 || j3 == 35) && H02.L()) ? 1 : 0;
int m1 = tnVar.m1();
i4 = i6;
if (Y02 != -1 && tnVar.S0() > ((Long) hashMap.get(Integer.valueOf(Y02))).longValue()) {
r7.f("E", "qc: reject: earlier received from same profile id (" + Y02 + ") in queue " + tnVar.Z0());
} else if (tnVar.F1() && ((Integer) hashMap2.get(Integer.valueOf(tnVar.K0()))).intValue() >= m1) {
r7.f("E", "qc: REJ: have higher pri child " + tnVar.Z0());
} else if (i5 == i8) {
if (i5 != 0) {
long d5 = d5(tnVar.H0(), tnVar.m());
if (d5 >= j2) {
r7.f("E", "qc: REJ: wait: not lowest " + tnVar.Z0());
} else {
r7.f("E", "qc: ACC: wait: " + d5 + "ms " + tnVar.Z0());
j2 = d5;
i6 = size;
}
} else if (m1 > i7 && m1 >= p4 && (((F02 = a1.F0(this, H02, tnVar.m(), tnVar.K0())) == null || !F02.equals("Speech Group") || this.x == null || !this.L.contains("Speech Group")) && ((F02 == null || !F02.equals("Fix Group") || (!this.B && !this.C)) && (F02 == null || !this.M.containsKey(F02))))) {
i7 = m1;
i6 = size;
}
}
}
i6 = i4;
}
i2 = -1;
if (i6 != -1) {
break;
}
i5++;
}
if (i6 == i2) {
return null;
}
if (i7 <= 1051) {
try {
this.G.add(0, this.G.remove(i6));
i3 = 0;
} catch (Exception e2) {
r7.l("E", "choosingQueueTaskA", e2);
}
} else {
i3 = i6;
}
i6 = i3;
try {
return this.G.get(i6);
} catch (Exception e3) {
r7.l("E", "choosingQueueTaskB", e3);
return null;
}
}
private void V0(int i2, int i3) {
X0(i2, vh.i(this, i3), false);
}
public static synchronized int V1(Context context, net.dinglisch.android.taskerm.c cVar, boolean z, Bundle bundle, tn tnVar) {
int i2;
int k4;
Long valueOf;
Integer num;
Integer[] numArr;
Integer num2;
Double B3;
synchronized (ExecuteService.class) {
try {
int j2 = cVar.j();
String Z4 = Z4(context, cVar, 0, bundle);
i2 = -3;
if (Z4 != null) {
long j3 = 0L;
if (kq.M0(context, Z4, bundle)) {
String y02 = kq.y0(context, Z4, bundle);
if (y02.length() > 0) {
if (y02.indexOf(w6.a()) != -1 && (B3 = dq.B3(y02)) != null) {
y02 = String.valueOf(Math.round(B3.doubleValue()));
}
j3 = dq.F3(y02);
}
}
Long l2 = j3;
if (l2 != null && (k4 = k4(context, cVar, 1, false, false, bundle)) != Integer.MAX_VALUE) {
long k42 = k4(context, cVar, 2, false, false, bundle);
if (j2 == 890) {
long longValue = l2.longValue() - k4;
valueOf = Long.valueOf(longValue);
if (k42 > 0 && longValue < 0) {
valueOf = Long.valueOf(k42 - ((0 - longValue) % k42));
}
} else {
if (k42 == 0) {
k42 = Long.MAX_VALUE;
}
valueOf = Long.valueOf((l2.longValue() + k4) % k42);
}
if (tnVar != null) {
num = Integer.valueOf(tnVar.x1());
num2 = Integer.valueOf(tnVar.P0());
numArr = new Integer[]{Integer.valueOf(tnVar.Y0())};
} else {
num = null;
numArr = null;
num2 = null;
}
kq.W1(context, Z4, Long.toString(valueOf.longValue()), z, bundle, "incdec", num, numArr, num2);
i2 = -1;
}
}
} finally {
}
}
return i2;
}
private int V2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int l4 = l4(cVar, 1, bundle);
if (l4 != Integer.MAX_VALUE) {
String F4 = F4(cVar, 2, bundle);
byte[] decode = Base64.decode(F4, 0);
if (decode == null) {
r7.G("E", "base64decode failed: " + F4);
} else if (decode.length > 133) {
r7.G("E", str + ": binary data " + decode.length + "bytes , max 133");
} else {
String[] split = F4(cVar, 0, bundle).split(",");
if (!dq.r(split)) {
for (String str2 : split) {
SmsManager.getDefault().sendDataMessage(str2, null, (short) l4, decode, null, null);
r7.f("E", str + ": sent " + F4 + " as " + decode.length + " bytes ");
}
return -1;
}
r7.G("E", str + ": no recipients");
}
}
return -3;
}
private int V3(String str, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, false, true)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, false, true, false)) {
String F4 = F4(cVar, 1, bundle);
if (j4(cVar, 3, bundle)) {
F4 = F4 + "\n";
}
if (h4.Y(this, F4, h4, j4(cVar, 2, bundle), true)) {
return -5;
}
}
return -3;
}
public static void V5(com.joaomgcd.taskerm.util.s6 s6Var, Throwable th2) throws Exception {
String str = "TaskerBackCompat.shutdownNetworkAccess ";
if (s6Var != null) {
str = "TaskerBackCompat.shutdownNetworkAccess success: " + s6Var.b() + "; error: " + s6Var.a();
}
if (th2 != null) {
str = str + "; exception: " + th2.getMessage();
}
r7.f("E", str);
}
private void W0(int i2, int i3, ComponentName componentName) {
Y0(i2, vh.i(this, i3), false, componentName);
}
private synchronized ji.b W1() {
try {
if (this.a0 == null) {
this.a0 = ExtensionsContextKt.Y1(this).i().A(pg.w0.b).g(D6()).j();
}
} catch (Throwable th2) {
throw th2;
}
return this.a0;
}
private int W2(String str, net.dinglisch.android.taskerm.c cVar, eq eqVar, Bundle bundle) {
boolean z;
String F4 = F4(cVar, 0, bundle);
Intent intent = F4.length() == 0 ? new Intent() : new Intent(F4);
String F42 = F4(cVar, 7, bundle);
String F43 = F4(cVar, 8, bundle);
if (F42.length() > 0) {
if (F43.length() > 0) {
intent.setComponent(new ComponentName(F42, F43));
} else {
intent.setPackage(F42);
}
z = false;
} else {
z = true;
}
String q1 = a1.q1(cVar.x(1).v());
if (q1 != null) {
intent.addCategory(q1);
}
String F44 = F4(cVar, 3, bundle);
String F45 = F4(cVar, 2, bundle);
boolean isEmpty = TextUtils.isEmpty(F44);
boolean z2 = F45.length() > 0;
if (z2) {
F45 = yd.e0.a() ? yd.e0.c(F45) : F45.toLowerCase();
}
if (com.joaomgcd.taskerm.util.z2.x(F44)) {
F44 = com.joaomgcd.taskerm.util.g8.i0(k7("Sent Intent", com.joaomgcd.taskerm.util.z2.r(F44)), this, null, intent).toString();
}
if (!isEmpty && z2) {
intent.setDataAndType(Uri.parse(F44), F45);
} else if (!isEmpty) {
intent.setData(Uri.parse(F44));
} else if (z2) {
intent.setType(F45);
}
String F46 = F4(cVar, 4, bundle);
if (!TextUtils.isEmpty(F46)) {
y0(str, intent, F46, eqVar, bundle);
}
String F47 = F4(cVar, 5, bundle);
if (!TextUtils.isEmpty(F47)) {
y0(str, intent, F47, eqVar, bundle);
}
String F48 = F4(cVar, 6, bundle);
if (!TextUtils.isEmpty(F48)) {
y0(str, intent, F48, eqVar, bundle);
}
th.a aVar = th.a.values()[cVar.x(9).v()];
try {
int i2 = i.c[aVar.ordinal()];
if (i2 == 1) {
r7.f("E", "send broadcast...");
sendBroadcast(intent, null);
} else if (i2 == 2) {
if (z) {
r7.f("E", "resolve implicit intent");
intent = th.e(getPackageManager(), aVar, intent);
}
if (intent == null) {
return -3;
}
r7.f("E", "start service...");
r7.y("E", intent, false);
Integer W1 = ExtensionsContextKt.W1(this, intent.getComponent());
com.joaomgcd.taskerm.util.p.u(this, intent, W1 == null ? ExtensionsContextKt.z0(this) : W1.intValue(), true);
} else {
if (i2 != 3) {
return -3;
}
r7.f("E", "start activity...");
U7(intent);
}
return -1;
} catch (SecurityException unused) {
I6(2131887982, str);
return -3;
}
}
private int W3(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
int i3;
File file;
boolean z = false;
String F4 = F4(cVar, 0, bundle);
ArrayList arrayList = new ArrayList();
String[] split = F4.split("\n");
boolean z2 = true;
if (split != null) {
int length = split.length;
int i4 = 0;
while (i4 < length) {
File k7 = k7(str, split[i4]);
if (h4.L(this, k7, z, z2, z)) {
return Y7(cVar, i2, bundle) ? -1 : -3;
}
int i5 = i4;
int i6 = length;
i3 = 1;
if (!M0(k7, str, false, true, true, true)) {
arrayList = null;
break;
}
arrayList.add(k7);
i4 = i5 + 1;
length = i6;
z2 = true;
z = false;
}
}
i3 = 1;
if (F4(cVar, 3, bundle).length() > 0) {
file = h4(str, cVar, 3, bundle);
if (h4.L(this, file, false, i3, i3)) {
return Y7(cVar, i2, bundle) ? -1 : -3;
}
if (M0(file, str, false, false, true, false)) {
file = dq.j(file, ".zip");
}
} else if (arrayList.size() == i3) {
file = dq.i((File) arrayList.get(0), ".zip");
} else {
r7.G("E", str + ": multiple files specified but no archive name give");
file = null;
}
int m4 = m4(cVar, 2, true, true, bundle);
if (arrayList == null || file == null || m4 == Integer.MAX_VALUE) {
return -3;
}
int size = arrayList.size();
File[] fileArr = new File[size];
for (int i7 = 0; i7 < size; i7 += i3) {
fileArr[i7] = (File) arrayList.get(i7);
}
if (!h4.e0(this, fileArr, file, m4)) {
I6(2131888004, dq.i2(arrayList));
return -3;
}
if (cVar.i(i3).T(this, bundle)) {
for (int i8 = 0; i8 < size; i8 += i3) {
File file2 = fileArr[i8];
if (h4.F(this, file2)) {
if (!h4.S(this, file2)) {
Object[] objArr = new Object[i3];
objArr[0] = file2.toString();
N6(2131887956, objArr);
}
} else if (!h4.f(this, file2)) {
Object[] objArr2 = new Object[i3];
objArr2[0] = file2.toString();
N6(2131887956, objArr2);
}
}
}
return -5;
}
private int W4(int i2, int i3) {
if (i3 != 2) {
return i3;
}
if (i2 != -1) {
return 1 - i2;
}
r7.G("E", "ignoring toggle of unknown value");
return -1;
}
public static ji.v W5(boolean z, Context context, Boolean bool) throws Exception {
if (!bool.booleanValue()) {
return net.dinglisch.android.tasker.g.f(context, new InputToggleWifi(z));
}
StringBuilder sb = new StringBuilder();
sb.append("svc wifi ");
sb.append(z ? "enable" : c6.DISABLE_LABEL);
return com.joaomgcd.taskerm.util.r6.f(sb.toString()).x(new oi.e() {
@Override
public final Object a(Object obj) {
return ((com.joaomgcd.taskerm.util.h6) obj).e();
}
});
}
private void W6(boolean z) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
it.next().o2(z);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void X0(int i2, String[] strArr, boolean z) {
Y0(i2, strArr, z, null);
}
private int X1(java.lang.String r31, net.dinglisch.android.taskerm.c r32, net.dinglisch.android.taskerm.eq r33, android.os.Bundle r34, net.dinglisch.android.taskerm.tn r35) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.X1(java.lang.String, net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.eq, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private int X2(java.lang.String r22, net.dinglisch.android.taskerm.c r23, android.os.Bundle r24) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.X2(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int X3(int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String str;
String str2;
String str3;
String str4;
String str5 = null;
if (i2 != 721) {
if (i2 != 793) {
switch (i2) {
case 740:
str2 = "text";
str = null;
str3 = str;
break;
case 741:
str4 = "textSize";
break;
case 742:
str2 = "textColour";
str = null;
str3 = str;
break;
default:
switch (i2) {
case 760:
str4 = "alpha";
break;
case 761:
str2 = "uri";
str = null;
str3 = str;
break;
case 762:
str2 = "startColour";
str3 = "endColour";
str = null;
break;
default:
r7.k("E", "unhandled zoom element action: " + i2);
str2 = null;
str = null;
str3 = str;
break;
}
}
} else {
str4 = "activeState";
}
str = null;
str3 = null;
str5 = str4;
str2 = null;
} else {
str = "visible";
str2 = null;
str3 = null;
}
Intent i5 = i5(kq.N(this, cVar.N(0).w(), bundle).replaceFirst(" / ", "/"));
int i3 = -3;
if (str5 != null) {
int l4 = l4(cVar, 1, bundle);
if (l4 != Integer.MAX_VALUE) {
i5.putExtra(str5, l4);
i3 = -1;
}
} else {
if (str2 != null) {
i5.putExtra(str2, kq.N(this, cVar.N(1).w(), bundle));
} else if (str != null) {
i5.putExtra(str, cVar.i(1).T(this, bundle));
}
i3 = -1;
}
if (str3 != null) {
i5.putExtra(str3, kq.N(this, cVar.N(2).w(), bundle));
}
if (i3 == -1) {
sendBroadcast(i5);
}
return i3;
}
public ji.r X5(final boolean z, final Context context) {
return s5.n(this, true).t(new oi.e() {
@Override
public final Object a(Object obj) {
ji.v W5;
W5 = ExecuteService.W5(z, context, (Boolean) obj);
return W5;
}
});
}
public int X6() {
int size;
synchronized (this.G) {
size = this.G.size();
}
return size;
}
private void X7() {
if (G6()) {
while (!H6(j0.get(k0), 0, false, 3) && G6()) {
}
}
}
private void Y0(int i2, String[] strArr, boolean z, ComponentName componentName) {
Intent intent = new Intent(strArr[i2]);
if (componentName != null) {
intent.setComponent(componentName);
}
if (z) {
r7.f("E", "send: (activity) " + strArr[i2]);
V7(intent, true);
return;
}
r7.f("E", "send (receiver): " + strArr[i2]);
sendBroadcast(intent);
}
private int Y1(String str, net.dinglisch.android.taskerm.c cVar, eq eqVar, Bundle bundle) {
int r4 = r4(cVar, 0);
String F4 = F4(cVar, 1, bundle);
if (i.f[d6.R(r4).ordinal()] != 1) {
return -1;
}
if (F4.length() == 0) {
d6.h.a();
eqVar.a();
return -1;
}
eqVar.b(F4);
d6.h.b(F4);
return -1;
}
private int Y2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String F4 = F4(cVar, 2, bundle);
String F42 = F4(cVar, 3, bundle);
int r4 = r4(cVar, 4);
boolean j4 = j4(cVar, 5, bundle);
int l4 = l4(cVar, 0, bundle);
int l42 = l4(cVar, 1, bundle);
if (l4 < 0 && l4 > 23) {
r7.G("E", str + ": bad hour: " + l4);
} else if (l42 < 0 && l42 > 59) {
r7.G("E", str + ": bad minute: " + l4);
} else if (V7(a1.y(this, l4, l42, F4, F42, r4, j4), true)) {
return -1;
}
return -3;
}
private int Y3(int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i3;
boolean z = true;
int v2 = cVar.x(1).v();
int i4 = 0;
boolean z2 = v2 < 2;
if (v2 != 0 && v2 != 2) {
z = false;
}
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
if (i2 == 794) {
if (z2) {
arrayList.add("xPort");
arrayList2.add(Integer.valueOf(l4(cVar, 2, bundle)));
arrayList.add("yPort");
arrayList2.add(Integer.valueOf(l4(cVar, 3, bundle)));
}
if (z) {
arrayList.add("xLand");
arrayList2.add(Integer.valueOf(l4(cVar, 2, bundle)));
arrayList.add("yLand");
arrayList2.add(Integer.valueOf(l4(cVar, 3, bundle)));
}
} else if (i2 == 795) {
if (z2) {
arrayList.add("widthPort");
arrayList2.add(Integer.valueOf(l4(cVar, 2, bundle)));
arrayList.add("heightPort");
arrayList2.add(Integer.valueOf(l4(cVar, 3, bundle)));
}
if (z) {
arrayList.add("widthLand");
arrayList2.add(Integer.valueOf(l4(cVar, 2, bundle)));
arrayList.add("heightLand");
arrayList2.add(Integer.valueOf(l4(cVar, 3, bundle)));
}
} else {
r7.k("E", "unknown action code " + i2);
}
Intent i5 = i5(cVar.N(0).w().replaceFirst(" / ", "/"));
while (true) {
if (i4 >= arrayList.size()) {
i3 = -1;
break;
}
int intValue = ((Integer) arrayList2.get(i4)).intValue();
if (intValue == Integer.MAX_VALUE) {
i3 = -3;
break;
}
i5.putExtra((String) arrayList.get(i4), intValue);
i4++;
}
if (i3 == -1) {
sendBroadcast(i5);
}
return i3;
}
private List<String> Y4(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
ArrayList arrayList = new ArrayList();
uo v1 = to.v1(this);
for (int i2 = 0; i2 < cVar.Y(); i2++) {
String F4 = F4(cVar, i2, bundle);
if (F4.length() == 0 || v1.Z(F4)) {
arrayList.add(F4);
} else {
r7.G("E", str + ": unknown task " + F4);
}
}
if (arrayList.size() == cVar.Y()) {
return arrayList;
}
return null;
}
private boolean Y6(tn tnVar, net.dinglisch.android.taskerm.c cVar, String str, int i2, File file, int i3, String str2, Bundle bundle) {
StringBuilder sb;
String str3;
boolean z = false;
String str4 = null;
try {
BufferedReader bufferedReader = new BufferedReader(h4.l(this, file));
int intValue = i3 == 0 ? q0.containsKey(file) ? q0.get(file).intValue() + 1 : 1 : i3;
sb = null;
str3 = null;
boolean z2 = false;
int i4 = 0;
boolean z3 = true;
while (!z2) {
try {
str3 = bufferedReader.readLine();
if (str3 != null) {
if (str3.length() > 0) {
if (z3 && (i4 = i4 + 1) == intValue) {
sb = new StringBuilder(1024);
}
if (sb != null) {
sb.append(str3.trim());
sb.append("\n");
}
if (i2 == 416) {
z3 = false;
}
} else {
z3 = true;
}
if (sb != null && z3) {
}
}
z2 = true;
} catch (Exception unused) {
str4 = str3;
N6(2131887959, str, file.toString());
str3 = str4;
if (str3 == null) {
q0.remove(file);
}
return z;
}
}
bufferedReader.close();
StructureType e2 = com.joaomgcd.taskerm.structuredoutput.c.e(cVar);
if (sb == null) {
x8(str2, "EOF", tnVar, str, e2);
} else {
q0.put(file, Integer.valueOf(i4));
x8(str2, sb.toString().trim(), tnVar, str, e2);
}
z = true;
} catch (Exception unused2) {
sb = null;
}
if (str3 == null && sb == null) {
q0.remove(file);
}
return z;
}
private boolean Y7(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return b8(4, i2, 20, cVar, bundle);
}
private int Z0(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b5 = b5(cVar, 0, bundle);
if (b5 == null) {
return -3;
}
if (kq.x(this, b5, bundle) > 0) {
kq.E1(this, b5, bundle);
}
return -1;
}
private int Z1(String str, net.dinglisch.android.taskerm.c cVar, int i2, String str2, int i3, Bundle bundle) {
cVar.j();
String scriptFromAction = c6.getScriptFromAction(this, cVar, bundle);
String F4 = F4(cVar, 1, bundle);
boolean T = cVar.i(2).T(this, bundle);
int m4 = m4(cVar, 3, true, false, bundle);
if (m4 != Integer.MAX_VALUE && scriptFromAction != null) {
if (!c6.scriptHasDialogs(scriptFromAction)) {
synchronized (this.W) {
Message obtainMessage = this.R.obtainMessage();
obtainMessage.what = 0;
Bundle bundle2 = new Bundle();
bundle2.putString("s", scriptFromAction);
bundle2.putBundle("b", bundle);
bundle2.putInt("p", i2);
bundle2.putString("src", str2);
bundle2.putBoolean("ae", T);
bundle2.putString("l", F4);
bundle2.putInt(c6.EXTRA_ID, i3);
obtainMessage.setData(bundle2);
D0(a1.e0(i3), m4);
this.R.sendMessage(obtainMessage);
}
return -1;
}
if (b8(1, i2, m4, cVar, bundle)) {
return -1;
}
}
return -3;
}
private int Z2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
List<String> Y4 = Y4(str, cVar, bundle);
if (Y4 == null) {
return -3;
}
for (int i2 = 0; i2 < Y4.size(); i2++) {
Settings.W2(this, i2, Y4.get(i2));
}
wm.i(this, false);
return -1;
}
public void Z3() {
synchronized (this.G) {
this.G.clear();
F7();
}
}
public static String Z4(Context context, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a5(context, cVar, i2, bundle, false);
}
public static void Z5(Context context, Intent intent) {
synchronized (v0) {
v0 = Boolean.TRUE;
zq.f(context, "E", true, false);
try {
com.joaomgcd.taskerm.util.f1.g(intent);
context.startService(intent);
} catch (Exception e2) {
r7.H("E", "startService", e2);
v0 = Boolean.FALSE;
}
}
}
public static void Z6(String str) {
synchronized (w0) {
w0.add(str);
}
}
private boolean Z7(File file, boolean z, boolean z2, boolean z3, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return h4.L(this, file, z, z2, z3) && Y7(cVar, i2, bundle);
}
private int a1(int i2, String str, String str2, int i3, String str3, Bundle bundle) {
if (i3 != Integer.MAX_VALUE && str2 != null) {
if (i3 >= 1) {
kq.k1(this, str2, i3, str3, bundle);
return -1;
}
r7.G("E", str + ": bad position: " + i3);
}
return -3;
}
private int a2(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, Bundle bundle) {
String b5 = b5(cVar, 0, bundle);
if (b5 == null) {
return -3;
}
boolean T = cVar.i(2).T(this, bundle);
String H4 = H4(cVar, 1, tnVar);
StringBuilder sb = new StringBuilder(1024);
List<String> d02 = kq.d0(this, b5, true, bundle);
Iterator<String> it = d02.iterator();
while (it.hasNext()) {
String y02 = kq.y0(this, it.next(), bundle);
if (sb.length() > 0) {
sb.append(H4);
}
sb.append(y02);
}
if (T) {
Iterator<String> it2 = d02.iterator();
while (it2.hasNext()) {
kq.E(this, it2.next(), true, true, bundle);
}
}
w8(b5, sb.toString(), tnVar, str);
return -1;
}
private int a3(String str, int i2, String str2, int i3, int i4) {
return (i3 != Integer.MAX_VALUE && i4 != Integer.MAX_VALUE && l1.u(i2, str2, true) && l1.t(i2, i3) && l1.t(i2, i4) && l1.s(i2, str2, i3, i4)) ? -1 : -3;
}
private void a4(boolean z) {
BroadcastReceiver broadcastReceiver = this.u;
if (broadcastReceiver == null) {
if (z) {
this.u = new h();
}
} else if (!z) {
unregisterReceiver(broadcastReceiver);
this.u = null;
}
if (z) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.SCREEN_ON");
ExtensionsContextKt.V2(this, this.u, intentFilter);
}
}
public static String a5(Context context, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, boolean z) {
String w2 = cVar.N(i2).w();
String name = cVar.getName();
String s1 = kq.s1(context, w2, bundle, true, name);
if (s1 != null) {
s1 = kq.u1(context, s1, bundle, "exe/gvna");
}
if (!z && lq.f(s1)) {
r7.k("E", "Can't write values to variable structure " + s1);
return null;
}
r7.N("E", s1 == null, name + ": " + w2 + " -> " + s1);
return s1;
}
public static void a6(Context context, String str) {
b6(context, str, null);
}
public void a7(AlarmManager alarmManager, String str) {
b7(alarmManager, kp.G1(this, x7()), str);
}
private boolean a8(Intent intent, String str, String str2) {
if (intent == null) {
return false;
}
intent.setComponent(new ComponentName(this, Main.class.getCanonicalName()));
intent.putExtra(str, str2);
return U7(intent);
}
private int b1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b5 = b5(cVar, 0, bundle);
if (b5 == null) {
return -3;
}
a1.b bVar = a1.b.values()[r4(cVar, 1)];
a1.b bVar2 = a1.b.Squash;
boolean z = bVar != bVar2;
boolean z2 = bVar == bVar2 || bVar == a1.b.RotateLeft || bVar == a1.b.RotateRight || bVar == a1.b.Reverse || bVar == a1.b.RemoveDuplicates;
boolean z3 = bVar == bVar2 || bVar == a1.b.RemoveDuplicates;
List<String> d02 = kq.d0(this, b5, z, bundle);
List<String> f02 = kq.f0(this, b5, z2, z3, bundle);
r7.f("E", "names: " + dq.x3(d02));
r7.f("E", "values: " + dq.x3(f02));
switch (i.d[bVar.ordinal()]) {
case 2:
ArrayList arrayList = new ArrayList();
HashSet hashSet = new HashSet();
for (int i2 = 0; i2 < f02.size(); i2++) {
String str = f02.get(i2);
if (hashSet.contains(str)) {
arrayList.add(Integer.valueOf(i2));
} else {
hashSet.add(str);
}
}
Collections.sort(arrayList, new a());
Iterator it = arrayList.iterator();
while (it.hasNext()) {
int intValue = ((Integer) it.next()).intValue();
d02.remove(intValue);
f02.remove(intValue);
}
r7.f("E", "new names: " + dq.x3(d02));
r7.f("E", "new values: " + dq.x3(f02));
break;
case 3:
Collections.reverse(f02);
break;
case 4:
Collections.rotate(f02, -1);
break;
case 5:
Collections.rotate(f02, 1);
break;
case ClockContract.InstancesColumns.MISSED_STATE:
Collections.shuffle(d02);
break;
case 7:
Collections.sort(f02);
break;
case 8:
Collections.sort(f02);
Collections.reverse(f02);
break;
case 9:
Collections.sort(f02, new b());
break;
case 10:
Collections.sort(f02, new c());
break;
case 11:
Collections.sort(f02, new d());
break;
case 12:
Collections.sort(f02, new e());
break;
case 13:
Collections.sort(f02, new f());
break;
case 14:
Collections.sort(f02, new g());
break;
}
if (bVar == a1.b.Squash) {
kq.O1(this, b5, f02, bundle, true);
} else if (kq.W0(b5)) {
kq.R1(d02, f02, bundle);
} else {
kq.P1(this, d02, f02);
}
kq.I1(this, b5, bundle);
return -1;
}
private int b2(String str, int i2) {
if (i7.i(str)) {
i7.l(str, i2);
return -1;
}
r7.G("E", "unknown light or bad configuration: " + str);
return -3;
}
private int b3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, tn tnVar) {
int r4 = r4(cVar, 0);
int l4 = l4(cVar, 2, bundle);
String F4 = F4(cVar, 1, bundle);
boolean j4 = j4(cVar, 3, bundle);
String F42 = F4(cVar, 4, bundle);
String F43 = F4(cVar, 5, bundle);
String E4 = E4(cVar, 6, bundle);
String E42 = E4(cVar, 8, bundle);
String E43 = E4(cVar, 7, bundle);
String F44 = F4(cVar, 9, bundle);
String F45 = F4(cVar, 10, bundle);
String F46 = F4(cVar, 11, bundle);
String F47 = F4(cVar, 12, bundle);
uo v1 = to.v1(this);
if (F4.length() == 0 || v1.Z(F4)) {
Settings.Z2(this, r4, F4);
}
if (!TextUtils.isEmpty(F42) && !v1.Z(F42)) {
r7.k("E", str + ": unknown task " + F42);
return -3;
}
Settings.Y2(this, r4, F42);
if (!TextUtils.isEmpty(F43) && !v1.Z(F43)) {
r7.k("E", str + ": unknown task " + F43);
return -3;
}
Settings.X2(this, r4, F43);
Settings.P2(this, r4, F44);
Settings.Q2(this, r4, F46);
Settings.R2(this, r4, F45);
Settings.S2(this, r4, F47);
Settings.V2(this, r4, E4);
Settings.T2(this, r4, E43);
Settings.U2(this, r4, E42);
Settings.a3(this, r4, l4);
Settings.b3(this, r4, Integer.valueOf(tnVar.P0()), Integer.valueOf(tnVar.Y0()), Integer.valueOf(tnVar.n1(to.u1(this))));
com.joaomgcd.taskerm.settings.q0.L(this, r4, j4);
yi.j(r4);
return -5;
}
public static void b6(Context context, String str, Bundle bundle) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(context.getPackageName(), ExecuteService.class.getName()));
intent.setAction(str);
if (bundle != null) {
intent.putExtras(bundle);
}
Z5(context, intent);
}
private void b7(AlarmManager alarmManager, boolean z, String str) {
kp.y1(alarmManager, 0, this.t, this.s, z, "E/" + str);
}
private boolean b8(int i2, int i3, int i4, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return c8(i2, i3, i4, cVar.U(0), 0, bundle);
}
private int c1(int i2, String str, String str2, int i3, String str3, boolean z, Bundle bundle) {
if (i3 != Integer.MAX_VALUE && str2 != null) {
if (i3 >= 1) {
kq.l1(this, str2, i3, str3, z, bundle);
return -1;
}
r7.G("E", str + ": bad position: " + i3);
}
return -3;
}
private int c2(tn tnVar, String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
int i3 = 2;
String b5 = b5(cVar, 2, bundle);
int r4 = r4(cVar, 0);
th.b G = th.G(r4);
int i4 = 1;
String F4 = F4(cVar, 1, bundle);
kq.x(this, b5, bundle);
if (G == null) {
r7.G("E", str + ": bad list type " + r4);
return -3;
}
if (b5 == null) {
return -3;
}
PackageManager packageManager = getPackageManager();
int i5 = i.e[G.ordinal()];
if (i5 == 3) {
i3 = 1;
} else if (i5 == 4) {
i3 = 4;
} else if (i5 != 5) {
i3 = i5 != 6 ? 0 : 8;
}
for (PackageInfo packageInfo : packageManager.getInstalledPackages(i3)) {
String str2 = packageInfo.packageName;
if (!TextUtils.isEmpty(str2)) {
r7.f("E", "test: " + str2);
if (G == th.b.Packages) {
if (F4.length() == 0 || Expr.l(F4, str2)) {
StringBuilder sb = new StringBuilder();
sb.append(b5);
i2 = i4 + 1;
sb.append(String.valueOf(i4));
w8(sb.toString(), str2, tnVar, str);
i4 = i2;
}
} else if (G == th.b.Applications) {
ApplicationInfo applicationInfo = packageInfo.applicationInfo;
if (applicationInfo != null && applicationInfo.enabled && !TextUtils.isEmpty(applicationInfo.className)) {
String str3 = str2 + ConstantsCommonTaskerServer.ID_SEPARATOR + applicationInfo.className;
if (F4.length() == 0 || Expr.l(F4, str3)) {
StringBuilder sb2 = new StringBuilder();
sb2.append(b5);
i2 = i4 + 1;
sb2.append(String.valueOf(i4));
w8(sb2.toString(), str3, tnVar, str);
i4 = i2;
}
}
} else {
ComponentInfo[] componentInfoArr = G == th.b.Activities ? packageInfo.activities : G == th.b.Receivers ? packageInfo.receivers : G == th.b.Providers ? packageInfo.providers : packageInfo.services;
if (!dq.r(componentInfoArr)) {
for (ComponentInfo componentInfo : componentInfoArr) {
if (componentInfo.enabled && componentInfo.exported && !TextUtils.isEmpty(((PackageItemInfo) componentInfo).name)) {
String str4 = str2 + ConstantsCommonTaskerServer.ID_SEPARATOR + ((PackageItemInfo) componentInfo).name;
if (F4.length() == 0 || Expr.l(F4, str4)) {
w8(b5 + String.valueOf(i4), str4, tnVar, str);
i4++;
}
}
}
}
}
}
}
return -1;
}
private void c3(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
MonitorService.S8(this, cVar.g0(0).n0(this, bundle).getName());
}
public void c4() {
r7.f("E", "exe thread tidy up");
i8(true, true, true, true);
E6("exeThreadTidy", null, false);
if (this.I.booleanValue()) {
for (String str : this.L) {
if (str.startsWith("Scene Group ")) {
String substring = str.substring(12);
r7.f("E", "exeThreadTidyUp: timetoleave, destroy waiting: " + substring);
x1(substring);
}
}
}
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
RunLog.Q0(this, this.X, tn.e.ExitKill, it.next());
}
} catch (Throwable th2) {
throw th2;
}
}
Looper myLooper = Looper.myLooper();
if (myLooper != null) {
myLooper.quit();
}
}
public static void c6(Context context, tn tnVar, int i2, int i3, int i4, int i5, int i6, String str, List<String> list, String str2, Bundle bundle) {
Z5(context, v4(context, tnVar, i2, i4, i5, i6, str, list, str2, bundle));
}
private void c7(tn tnVar, tn.e eVar) {
RunLog.Q0(this, this.X, eVar, tnVar);
if (a()) {
O6("Not running task \"" + tnVar.Z0() + "\": " + eVar.d(this), new Object[0]);
}
}
private boolean c8(int r9, int r10, int r11, net.dinglisch.android.taskerm.qi r12, int r13, android.os.Bundle r14) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.c8(int, int, int, net.dinglisch.android.taskerm.qi, int, android.os.Bundle):boolean");
}
private int d1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b5 = b5(cVar, 0, bundle);
String F4 = F4(cVar, 1, bundle);
String F42 = F4(cVar, 2, bundle);
if (b5 == null) {
return -3;
}
kq.x(this, b5, bundle);
return q3(str, b5, F4, F42, false, bundle, false);
}
private int d2(String str, net.dinglisch.android.taskerm.c cVar, tn.b bVar, int i2, Bundle bundle) {
File file;
String str2;
String[] I;
final String F4 = F4(cVar, 1, bundle);
final boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
int r4 = r4(cVar, 4);
boolean j43 = j4(cVar, 6, bundle);
String b5 = b5(cVar, 5, bundle);
boolean z = !j42;
File h4 = h4(str, cVar, 0, bundle);
h4.d dVar = h4.d.values()[r4];
if (h4.L(this, h4, j42, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (b5 != null && M0(h4, str, j42, z, false, true)) {
kq.x(this, b5, bundle);
final boolean z2 = !TextUtils.isEmpty(F4);
if (j42) {
ArrayList<String> arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
str2 = b5;
int u2 = vm.u(true, 10000L, new String[]{"ls " + h4.toString()}, arrayList, arrayList2, j43);
if (u2 == 0) {
ArrayList arrayList3 = new ArrayList();
for (String str3 : arrayList) {
if (str3.length() > 0 && f4(str3, j4, z2, F4)) {
arrayList3.add(str3);
}
}
I = arrayList3.size() > 0 ? dq.w3(arrayList3) : new String[0];
file = h4;
} else {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": ");
file = h4;
sb.append(file);
sb.append(": code ");
sb.append(u2);
sb.append(" ");
sb.append(dq.h2(arrayList2, '\n'));
r7.G("E", sb.toString());
I = null;
}
} else {
file = h4;
str2 = b5;
r7.f("E", str + ": run listWrapper");
I = h4.I(this, file, new FilenameFilter() {
@Override
public final boolean accept(File file2, String str4) {
boolean A5;
A5 = ExecuteService.this.A5(j4, z2, F4, file2, str4);
return A5;
}
});
if (I == null) {
I = new String[0];
}
r7.f("E", str + " found " + I.length + " matching files");
}
if (I != null) {
String[] X = h4.X(this, file, I, dVar);
String str4 = file.toString() + File.separator;
int i3 = 1;
for (String str5 : X) {
if (str2.length() > 0) {
StringBuilder sb2 = new StringBuilder();
sb2.append(str2);
sb2.append(String.valueOf(i3));
kq.U1(this, sb2.toString(), str4 + str5, false, bundle, str);
i3++;
} else if (bVar != null) {
if (bVar.b() > 0) {
bVar.append('\n');
}
bVar.a(str4).a(str5);
}
}
kq.I1(this, str2, bundle);
return -5;
}
}
return -3;
}
private int d3(java.lang.String r29, net.dinglisch.android.taskerm.c r30, android.os.Bundle r31) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.d3(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private net.dinglisch.android.taskerm.u3 d4(net.dinglisch.android.taskerm.c r32, net.dinglisch.android.taskerm.tn r33, int r34, int r35) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.d4(net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.tn, int, int):net.dinglisch.android.taskerm.u3");
}
private long d5(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
long e5 = e5(cVar, bundle);
if (e5 == Long.MIN_VALUE) {
return Long.MIN_VALUE;
}
return e5 - cVar.J();
}
public static void d6(Context context, tn tnVar, int i2, int i3, int i4, int i5, String str, List<String> list, String str2, Bundle bundle) {
c6(context, tnVar, i2, i3, i4, i5, -1, str, list, str2, bundle);
}
private int d8(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Intent intent;
int j2 = cVar.j();
String str = a1.v0().get(Integer.valueOf(j2));
if (str == null) {
return -3;
}
if (j2 == 216) {
String F4 = F4(cVar, 0, bundle);
if (TextUtils.isEmpty(F4)) {
intent = new Intent(str);
} else {
intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", F4, null));
}
} else {
intent = str.equals("android.intent.action.POWER_USAGE_SUMMARY") ? new Intent("android.intent.action.POWER_USAGE_SUMMARY") : str.equals("com.android.settings.fuelgauge.PowerUsageSummary") ? a1.T("com.android.settings.fuelgauge.PowerUsageSummary") : new Intent(str);
}
intent.addFlags(1073741824);
return !U7(intent) ? -3 : -1;
}
private void e1(net.dinglisch.android.taskerm.c cVar) {
boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
int W4 = W4(masterSyncAutomatically ? 1 : 0, cVar.i(0).v());
if (masterSyncAutomatically != W4) {
ContentResolver.setMasterSyncAutomatically(W4 == 1);
N3(300L);
z7("99");
}
}
private int e2(java.lang.String r12, net.dinglisch.android.taskerm.c r13, android.os.Bundle r14) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.e2(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
public static synchronized int e3(android.content.Context r20, java.lang.String r21, net.dinglisch.android.taskerm.c r22, boolean r23, android.os.Bundle r24, net.dinglisch.android.taskerm.tn r25) throws kg.w0.b {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.e3(android.content.Context, java.lang.String, net.dinglisch.android.taskerm.c, boolean, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private int e4(net.dinglisch.android.taskerm.c r22, net.dinglisch.android.taskerm.tn r23, android.os.Bundle r24) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.e4(net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.tn, android.os.Bundle):int");
}
private long e5(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int m4 = m4(cVar, 0, true, false, bundle);
int m42 = m4(cVar, 1, true, false, bundle);
int m43 = m4(cVar, 2, true, false, bundle);
int m44 = m4(cVar, 3, true, false, bundle);
int m45 = m4(cVar, 4, true, false, bundle);
if (m4 == Integer.MAX_VALUE || m42 == Integer.MAX_VALUE || m43 == Integer.MAX_VALUE || m44 == Integer.MAX_VALUE || m45 == Integer.MAX_VALUE) {
return Long.MIN_VALUE;
}
return m4 + (m42 * 1000) + (m43 * 60000) + (m44 * 3600000) + (m45 * 86400000);
}
public static void e6(Context context, tn tnVar, List<String> list, String str, boolean z) {
d6(context, tnVar, z ? 1 : 0, -1, -1, -1, null, list, str, null);
}
private void e7(tn tnVar) {
int K02 = tnVar.K0();
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next != tnVar && next.E1(K02)) {
next.Z1(K02);
if (tnVar.F1()) {
next.c0(tnVar);
return;
}
return;
}
}
}
public boolean e8(String str) {
Long l2;
r7.f("E", "stillWaiting: test " + str);
synchronized (this.L) {
try {
if (!this.L.contains(str)) {
return false;
}
synchronized (this.N) {
try {
l2 = this.N.get(str);
if (l2 == null) {
l2 = 0L;
}
} finally {
}
}
if (System.currentTimeMillis() > l2.longValue()) {
r7.f("E", "wait timeout type " + str);
h7(str);
if (str.equals("Proxy Group")) {
E7(false, "stillWaiting");
} else if (str.equals("Voice Group")) {
kq.C(this, 92);
} else if (a1.g1(str)) {
r7.f("E", "plugin timeout, key " + str);
tn tnVar = this.M.get(str);
if (tnVar != null) {
net.dinglisch.android.taskerm.c H02 = tnVar.H0();
if (H02.G1()) {
tnVar.o2(true);
H02.D1(c.b.Err);
tnVar.Q2(2);
tnVar.J(getString(2131890127));
} else {
tnVar.Q2(2);
tnVar.W("%errmsg", "timeout");
H02.D1(c.b.ErrIgnore);
}
}
} else if (str.startsWith("JSI")) {
int parseInt = Integer.parseInt(str.substring(3));
r7.f("E", "jsi timeout, id " + parseInt);
tn tnVar2 = this.M.get(str);
net.dinglisch.android.taskerm.c H03 = tnVar2.H0();
if (H03.G1()) {
tnVar2.o2(true);
H03.D1(c.b.Err);
} else {
H03.D1(c.b.ErrIgnore);
}
tnVar2.Q2(2);
c6.sendMessageWithID(this.R, 3, parseInt);
} else if (str.equals(a1.j0())) {
x1(xl.y());
} else if (str.equals(a1.o0())) {
x1(xl.A());
} else if (str.equals(a1.r0())) {
x1(xl.E());
} else if (str.equals(a1.Z())) {
x1(xl.m());
} else if (str.equals(a1.q0())) {
x1(xl.D());
} else if (str.equals(a1.s0())) {
dk E = wl.E(xl.I());
if (E != null) {
E.Q3("TextEdit1");
}
x1(xl.I());
}
}
if (str.equals("Proxy Group")) {
if (!P6()) {
h7(str);
}
} else if (str.equals("Speech Group")) {
synchronized (r0) {
try {
if (this.x != null) {
if (System.currentTimeMillis() - this.y > 5000 && !this.x.isSpeaking()) {
}
}
E6("stillWaiting", null, false);
} finally {
}
}
} else if (str.equals("Fix Group")) {
h8();
} else if (str.equals(a1.j0())) {
if (!wl.N(xl.y())) {
h7(str);
}
} else if (str.equals(a1.r0())) {
if (!wl.N(xl.E())) {
h7(str);
}
} else if (str.equals(a1.Z())) {
if (!wl.N(xl.m())) {
h7(str);
}
} else if (str.equals(a1.s0())) {
if (!wl.N(xl.I())) {
h7(str);
}
} else if (str.equals(a1.q0())) {
if (!wl.N(xl.D())) {
h7(str);
}
} else if (str.equals(a1.o0())) {
if (!wl.N(xl.A())) {
h7(str);
}
} else if (str.startsWith("Shell")) {
if (vm.g(Integer.parseInt(str.substring(5)))) {
m5(this.M.get(str));
h7(str);
}
} else if (str.startsWith("Scene Group ")) {
String substring = str.substring(12);
if (!wl.N(substring) || (!wl.X(substring) && wl.y(substring) > 2000)) {
h7(str);
}
}
return this.L.contains(str);
} catch (Throwable th2) {
throw th2;
}
}
}
private int f1(net.dinglisch.android.taskerm.c cVar, Bundle bundle, tn tnVar, String str, net.dinglisch.android.taskerm.c cVar2) {
net.dinglisch.android.taskerm.c cVar3;
int i2;
BluetoothAdapter i4 = i4();
int i3 = -3;
if (i4 == null) {
r7.G("E", str + ": no adapter");
return -3;
}
int state = i4.getState();
if (state == 12 || state == 11) {
cVar3 = cVar2;
i2 = 1;
} else {
cVar3 = cVar2;
i2 = 0;
}
int W4 = W4(i2, cVar3.i(0).v());
if (i2 == W4) {
if (W4 == 1) {
MonitorService.J8();
}
return -5;
}
boolean z = W4 == 1;
if (!com.joaomgcd.taskerm.util.k.m() && !com.joaomgcd.taskerm.util.k.y(this) && !ExtensionsContextKt.M(this)) {
return this.Y.Z0(cVar, bundle, tnVar, z);
}
if (W4 != 1) {
if (state == 11) {
B8(i4, 12);
}
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else if (state == 13) {
B8(i4, 10);
} else {
if (!i4.disable()) {
N6(2131887939, str);
return -3;
}
B8(i4, 10);
}
return -5;
}
if (state == 13) {
B8(i4, 10);
}
if (this.I.booleanValue()) {
r7.f("E", str + ": skipping, time to leave");
} else if (state == 11) {
B8(i4, 12);
} else {
if (!i4.enable()) {
N6(2131887939, str);
MonitorService.J8();
return i3;
}
B8(i4, 12);
}
i3 = -5;
MonitorService.J8();
return i3;
}
private int f2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
P0();
int l4 = cVar.x(1).k() ? l4(cVar, 1, bundle) : 0;
int i3 = -3;
if (l4 != Integer.MAX_VALUE) {
net.dinglisch.android.taskerm.g n02 = cVar.g0(0).n0(this, bundle);
if (l4 > 0) {
i2 = l4;
} else {
l4 = -1;
i2 = -1;
}
try {
synchronized (e0) {
try {
f0 = n02.y(this, l4, i2, "exe/doLoadImage");
if (f0 == null) {
r7.G("E", "no bitmap from icon " + n02.y0(this));
} else {
Uri y02 = n02.y0(this);
i3 = (y02 != null && "file".equals(y02.getScheme()) && j4(cVar, 2, bundle)) ? E0(str, y02, bundle) : -1;
}
} finally {
}
}
} catch (Exception e2) {
r7.H("E", str, e2);
} catch (OutOfMemoryError unused) {
r7.G("E", str + ": oom");
}
}
return i3;
}
private boolean f4(String str, boolean z, boolean z2, String str2) {
r7.f("E", "fa: " + str + " haveMatch: " + z2 + " match " + str2);
return (z || !str.startsWith(".")) && (!z2 || Expr.l(str2, str));
}
public static Intent f5(Context context) {
Intent intent = new Intent(context, (Class<?>) ReceiverStaticAlwaysOn.class);
intent.setAction("net.dinglisch.android.tasker.WILLYUM");
return intent;
}
public static void f6(Context context, net.dinglisch.android.taskerm.c[] cVarArr, int i2, boolean z) {
g6(context, cVarArr, i2, z, null, null, null, null);
}
public static void f8(Context context) {
a6(context, K0);
}
private int g1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int m4 = m4(cVar, 0, true, false, bundle);
int m42 = m4(cVar, 1, true, true, bundle);
int m43 = m4(cVar, 2, true, true, bundle);
String F4 = F4(cVar, 4, bundle);
int i2 = -3;
if (m4 != Integer.MAX_VALUE && m42 != Integer.MAX_VALUE && m43 != Integer.MAX_VALUE) {
int r4 = r4(cVar, 3);
r7.f("E", str + ": freq " + m4 + " dur: " + m42 + " stream: " + r4);
mp mpVar = new mp((double) m4, m42, (short) m43);
if (!TextUtils.isEmpty(F4)) {
Long F3 = dq.F3(F4);
if (F3 == null) {
r7.k("E", "Do At Time must be a valid integer number, was " + F4);
return -3;
}
long longValue = F3.longValue() - com.joaomgcd.taskerm.action.location.n.a(com.joaomgcd.taskerm.action.location.m.a());
if (longValue < 0) {
r7.k("E", "Do At Time must be in the future, was " + (-longValue) + " ms in the past");
return -3;
}
if (longValue > 60000) {
r7.k("E", "Do At Time must at most 1 minute in the future, was " + longValue + "ms in the future");
return -3;
}
try {
Thread.sleep(longValue);
r7.f("E", "Waiting " + longValue + "ms to do beep");
} catch (InterruptedException e2) {
e2.printStackTrace();
}
}
if (mpVar.e(r4)) {
r7.f("E", str + ": wait for track to finish");
E8(mpVar, 100L);
r7.f("E", str + ": done");
i2 = -1;
}
mpVar.f();
}
return i2;
}
private int g2(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, tn tnVar) {
String F4 = F4(cVar, 1, bundle);
if (F4.length() == 0) {
r7.G("E", str + ": empty code");
return -3;
}
if (i6(F4)) {
return -5;
}
if (!TextUtils.isDigitsOnly(F4)) {
r7.G("E", cVar.getName() + ": not showing, code has non-numerics");
return -3;
}
String F42 = F4(cVar, 6, bundle);
if (TextUtils.isEmpty(F42)) {
F42 = xl.w();
}
uo v1 = to.v1(this);
dk c02 = v1.p(F42) ? v1.c0(F42) : xl.v(this);
c02.G(a1.I(cVar.j(), 6));
if (!wl.p(this, c02, bundle)) {
return -3;
}
a1.u1(this, to.v1(this), c02, cVar, 6, bundle);
c02.W("%bpar", F4);
c02.F3(i2);
c02.X2();
wl.g0(this, c02.getName(), cVar.i(4).T(this, bundle) ? dk.e.OverlayBlockingFullDisplay : dk.e.OverlayBlocking, 100, 100, Integer.valueOf(tnVar.P0()), false, false, false, false);
C0(a1.h0());
return -1;
}
private int g3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
Bitmap s2;
String F4 = F4(cVar, 1, bundle);
br.a g2 = br.g(r4(cVar, 0));
if (!br.m(g2, str)) {
if (!F4.equals("STORED")) {
if (TextUtils.isEmpty(F4)) {
br.j(this, g2);
} else {
int d2 = br.d(this);
int c2 = br.c(this);
if (F4.startsWith("android.resource://")) {
String lastPathSegment = Uri.parse(F4).getLastPathSegment();
try {
net.dinglisch.android.taskerm.g gVar = new net.dinglisch.android.taskerm.g();
gVar.s0(lastPathSegment, true);
s2 = gVar.y(this, d2, c2, str);
} catch (Exception e2) {
r7.G("E", str + ": " + e2.getMessage());
s2 = null;
}
i2 = c2;
} else {
i2 = c2;
File N4 = N4(F4, str, true, true, false);
s2 = N4 != null ? zg.s(N4.toString(), d2, i2) : null;
}
System.gc();
if (s2 == null) {
N6(2131887964, str);
} else {
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
boolean j43 = j4(cVar, 4, bundle);
if (j4) {
int width = s2.getWidth();
int height = s2.getHeight();
if (width < d2 || height < i2) {
s2 = zg.v(s2, d2, i2);
}
}
if (j42) {
int width2 = s2.getWidth();
int height2 = s2.getHeight();
if (width2 > d2 || height2 > i2) {
s2 = zg.d(s2, d2, i2);
}
}
Rect a2 = j43 ? tf.c.a(this, s2) : null;
System.gc();
if (br.i(this, s2, g2, a2)) {
}
}
}
return -1;
}
System.gc();
if (br.h(this, g2)) {
return -1;
}
}
return -3;
}
private void g4(SharedPreferences sharedPreferences) {
String str = "";
for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
String key = entry.getKey();
if (key.equals("*")) {
key = vh.g(this, 2131891119, new Object[0]);
}
if (str.length() > 0) {
str = str + "\n";
}
str = str + key + " --> " + entry.getValue();
}
String g2 = vh.g(this, 2131887472, new Object[0]);
if (str.length() <= 0) {
str = vh.g(this, 2131891208, new Object[0]);
}
G1(g2, str, 1);
}
private int g5() {
return this.X.getInt("lmp", 1000);
}
public static void g6(Context context, net.dinglisch.android.taskerm.c[] cVarArr, int i2, boolean z, List<String> list, String str, Bundle bundle, String str2) {
tn X1 = to.X1();
X1.D2(i2);
for (int i3 = 0; i3 < cVarArr.length; i3++) {
net.dinglisch.android.taskerm.c cVar = cVarArr[i3];
if (cVar == null) {
r7.G("E", "lass: skipping null action index " + i3);
} else {
X1.a0(cVar);
}
}
if (X1.c1() > 0) {
d6(context, X1, z ? 1 : 0, -1, -1, -1, str2, list, str, bundle);
} else {
r7.G("E", "lass: no actions to execute");
}
}
private static void g8(MediaPlayer mediaPlayer) {
if (mediaPlayer != null) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.release();
}
}
private int h1(java.lang.String r23, int r24, int r25) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.h1(java.lang.String, int, int):int");
}
private int h2(java.lang.String r17, net.dinglisch.android.taskerm.c r18, int r19, android.os.Bundle r20) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.h2(java.lang.String, net.dinglisch.android.taskerm.c, int, android.os.Bundle):int");
}
private int h3(final String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, false, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, false, true, true, false)) {
String F4 = F4(cVar, 1, bundle);
if (TextUtils.isEmpty(F4)) {
F4 = null;
}
boolean j4 = j4(cVar, 2, bundle);
String F42 = F4(cVar, 3, bundle);
String F43 = F4(cVar, 4, bundle);
Intent b0 = com.joaomgcd.taskerm.util.g8.b0(h4, this, F4, "android.intent.action.SEND", new xj.l() {
@Override
public final Object invoke(Object obj) {
lj.e0 C5;
C5 = ExecuteService.C5(str, (String) obj);
return C5;
}
}, j4, F42);
b0.putExtra("android.intent.extra.CHOOSER_CUSTOM_ACTIONS", this.Y.C0(F43, bundle));
if (U7(b0)) {
return -5;
}
}
return -3;
}
private File h4(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return k7(str, F4(cVar, i2, bundle));
}
private long h5(int i2) {
return System.currentTimeMillis() + (i2 * 1000);
}
public static void h6(Context context, net.dinglisch.android.taskerm.c[] cVarArr, boolean z) {
g6(context, cVarArr, 5, z, null, null, null, null);
}
public boolean h8() {
boolean z;
boolean containsKey;
Long l2;
synchronized (s0) {
try {
z = true;
if (!this.B) {
if (this.C) {
}
if (!this.B || this.C) {
z = false;
} else {
r7.f("E", "fix finished, remove wait flag");
h7("Fix Group");
}
}
synchronized (this.N) {
containsKey = this.N.containsKey("Fix Group");
l2 = this.N.get("Fix Group");
}
if (!containsKey || l2 == null || System.currentTimeMillis() > l2.longValue()) {
r7.f("E", "fix timed out, force stop");
i8(true, true, true, true);
}
if (this.B) {
}
z = false;
} catch (Throwable th2) {
throw th2;
}
}
return z;
}
private int i1(net.dinglisch.android.taskerm.c r5, java.lang.String r6, java.lang.String r7, android.os.Bundle r8) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.i1(net.dinglisch.android.taskerm.c, java.lang.String, java.lang.String, android.os.Bundle):int");
}
private int i2(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String F4 = F4(cVar, 0, bundle);
boolean j4 = j4(cVar, 1, bundle);
if (j4 && F4 != null && !F4.startsWith("\"") && !F4.endsWith("\"") && (F4.contains("#") || F4.contains("*"))) {
F4 = "\"" + F4 + "\"";
}
Intent intent = new Intent(j4 ? "android.intent.action.CALL" : "android.intent.action.DIAL", Uri.parse("tel:" + Uri.encode(F4)));
nf.i.a(intent, this, F4(cVar, 2, bundle));
return U7(intent) ? -1 : -3;
}
private int i3(net.dinglisch.android.taskerm.c cVar) {
return V7(new Intent("android.intent.action.SHOW_ALARMS"), true) ? -1 : -3;
}
private BluetoothAdapter i4() {
return j1.r() ? j1.e() : j1.h(this);
}
private Intent i5(String str) {
return new Intent("net.dinglisch.android.zoom.ACTION_MAKE_CHANGES").setData(Uri.parse("widget://" + str));
}
public static boolean i6(String str) {
boolean contains;
synchronized (w0) {
contains = w0.contains(str);
}
return contains;
}
private void i7(String str) {
synchronized (this.N) {
try {
if (this.N.containsKey(str)) {
k6("removeWait: " + str);
this.L.remove(str);
synchronized (this.N) {
try {
if (!str.equals("Fix Group")) {
this.N.remove(str);
}
} finally {
}
}
}
} finally {
}
}
}
public void i8(boolean z, boolean z2, boolean z3, boolean z4) {
synchronized (s0) {
try {
LocationManager locationManager = (LocationManager) oi.d(this, "location", "E", "sgf");
if (z2) {
if (z3 && t0 != null) {
r7.f("E", "remove Net listener");
locationManager.removeUpdates(t0);
t0 = null;
}
if (z4) {
this.C = false;
}
}
if (z) {
if (z3 && u0 != null) {
r7.f("E", "remove GPS listener");
locationManager.removeUpdates(u0);
u0 = null;
}
if (z4) {
this.B = false;
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
private int j1(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Integer E3;
Integer num;
Integer num2 = 0;
String F4 = F4(cVar, 0, bundle);
if (!TextUtils.isEmpty(F4)) {
if (F4.contains("/")) {
String[] split = F4.split(Pattern.quote("/"));
if (split.length == 2) {
E3 = dq.E3(split[0].trim());
num2 = dq.E3(split[1].trim());
} else {
num2 = null;
}
} else {
E3 = dq.E3(F4);
}
Integer num3 = E3;
num = num2;
num2 = num3;
if (num2 != null || num == null) {
r7.G("E", "calendar Insert: bad start: " + F4);
return -3;
}
if (num.intValue() == 0) {
num = 1;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
String F42 = F4(cVar, 2, bundle);
if (bh.N(getContentResolver(), (num2.intValue() * 60) + currentTimeMillis, 60 * num.intValue(), F4(cVar, 1, bundle), F42, F4(cVar, 3, bundle), F4(cVar, 4, bundle), j4(cVar, 5, bundle), j4(cVar, 6, bundle))) {
return -1;
}
N6(2131887946, F42);
return -3;
}
num = num2;
if (num2 != null) {
}
r7.G("E", "calendar Insert: bad start: " + F4);
return -3;
}
private void j2(int i2, net.dinglisch.android.taskerm.d dVar) {
AudioManager audioManager;
if (i2 == 1 && (audioManager = (AudioManager) oi.d(this, "audio", "E", "dmcvb")) != null && !audioManager.isMusicActive()) {
r7.f("E", "buttonMediaControl: music not active, don't toggle pause");
return;
}
int x4 = x4(i2);
String H = (dVar == null || !dVar.k()) ? null : dVar.H();
r7.f("E", "BUTTON CONTROL index " + i2 + " code " + x4);
long uptimeMillis = SystemClock.uptimeMillis();
long j2 = uptimeMillis - 1;
String str = H;
oi.n(this, str, j2, j2, 0, x4, 0);
oi.n(this, str, j2, uptimeMillis, 1, x4, 0);
}
private int j3(java.lang.String r20, net.dinglisch.android.taskerm.c r21, boolean r22, java.lang.String r23, int r24, boolean r25, boolean r26, android.os.Bundle r27, net.dinglisch.android.taskerm.tn r28) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.j3(java.lang.String, net.dinglisch.android.taskerm.c, boolean, java.lang.String, int, boolean, boolean, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
public net.dinglisch.android.taskerm.tn j5(android.os.Bundle r17, boolean r18) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.j5(android.os.Bundle, boolean):net.dinglisch.android.taskerm.tn");
}
private void j6(String str, net.dinglisch.android.taskerm.c cVar) {
if (r7.K()) {
Resources resources = getResources();
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(" / ");
sb.append(cVar.N0(resources, true));
if (cVar.H()) {
if (cVar.j() != 37) {
sb.append(" If ");
} else {
sb.append(' ');
}
sb.append(cVar.Q().e0(resources));
}
r7.f("E", sb.toString());
}
}
private boolean j7(tn tnVar, boolean z) {
int P0 = tnVar.P0();
boolean u2 = tnVar.u();
String name = u2 ? tnVar.getName() : null;
for (int i2 = 0; i2 < this.G.size(); i2++) {
tn tnVar2 = this.G.get(i2);
if (!tnVar2.K1() && ((P0 == tnVar2.P0() && !to.B3(P0)) || (u2 && tnVar2.u() && tnVar2.getName().equals(name)))) {
if (z) {
this.G.remove(i2);
RunLog.Q0(this, this.X, tn.e.ExitRep, tnVar2);
F7();
L7();
C6(tnVar2.K0(), tnVar2.N0());
}
return true;
}
}
return false;
}
public void j8(int i2, boolean z) {
int i3;
synchronized (this.W) {
try {
r7.f("E", "stop JSI " + i2 + " error: " + z);
c6 c6Var = this.W.get(Integer.valueOf(i2));
if (c6Var != null) {
c6Var._stop();
} else if (!z) {
r7.G("E", "stopJSI: " + i2 + ": null");
}
String e02 = a1.e0(i2);
synchronized (this.G) {
try {
tn tnVar = this.M.get(e02);
if (tnVar != null) {
i3 = tnVar.I0();
if (z) {
tnVar.o2(z);
}
} else {
i3 = -1;
}
h7(e02);
if (tnVar != null) {
tnVar.h2(i3, z ? c.b.Err : c.b.OK);
kg.w0.U(to.u1(this), tnVar);
}
} finally {
}
}
this.W.remove(Integer.valueOf(i2));
r7.f("E", "stopJSI " + i2 + " done");
} catch (Throwable th2) {
throw th2;
}
}
}
private int k1(net.dinglisch.android.taskerm.c cVar, String str, String str2, Bundle bundle) {
int j2 = cVar.j();
SharedPreferences sharedPreferences = getSharedPreferences(g6.p, 0);
SharedPreferences.Editor edit = sharedPreferences.edit();
boolean contains = sharedPreferences.contains(str);
if (j2 == 99) {
if (str.length() == 0) {
edit.clear();
} else if (contains) {
edit.remove(str);
}
} else if (!contains) {
if (str.length() == 0) {
str = "*";
}
if (j2 == 95) {
edit.putString(str, "block");
} else {
edit.putString(str, str2);
}
}
edit.commit();
dq.V2(this, false, "exe");
if (!cVar.i(j2 == 97 ? 2 : 1).T(this, bundle)) {
return -1;
}
g4(sharedPreferences);
return -1;
}
private void k2(int i2) {
r7.f("E", "WIDGET CONTROL index " + i2);
String[] i3 = vh.i(this, RFactory.layout.activity_pick_location);
Intent intent = new Intent("com.android.music.musicservicecommand");
intent.putExtra("command", i3[i2]);
intent.addFlags(1073741824);
sendBroadcast(intent);
}
private void k3(net.dinglisch.android.taskerm.c cVar) {
V7(Settings.D1(this, true, r4(cVar, 0)), true);
}
private static int k4(Context context, net.dinglisch.android.taskerm.c cVar, int i2, boolean z, boolean z2, Bundle bundle) {
int c02;
int d02;
net.dinglisch.android.taskerm.h x2 = cVar.x(i2);
if (!x2.I()) {
return x2.v();
}
int G = x2.G(context, bundle);
int i3 = Integer.MAX_VALUE;
if (G == Integer.MAX_VALUE) {
String[] P0 = a1.P0(ExtensionsContextKt.J0(context).getResources(), cVar.j(), i2, cVar);
if (P0 == null) {
r7.G("E", "var " + x2.C() + ": non-numeric or extreme value");
return G;
}
int indexOf = Arrays.asList(P0).indexOf(x2.H(context, bundle));
if (indexOf != -1) {
return indexOf;
}
r7.G("E", "var " + x2.C() + ": not valid option for " + cVar.getName());
return G;
}
int j2 = cVar.j();
if (z && G < (d02 = a1.d0(j2, i2))) {
r7.G("E", "action " + cVar.getName() + ": param " + i2 + "var: " + x2.C() + ": value " + G + " too small, min is " + d02);
G = Integer.MAX_VALUE;
}
if (!z2 || G <= (c02 = a1.c0(j2, i2)) || j2 == 810) {
i3 = G;
} else {
r7.G("E", "action " + cVar.getName() + ": param " + i2 + "var: " + x2.C() + ": value " + G + " too large, max is " + c02);
}
return i3;
}
public void k5(int r8, android.os.Bundle r9, net.dinglisch.android.taskerm.tn r10) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.k5(int, android.os.Bundle, net.dinglisch.android.taskerm.tn):void");
}
private void k6(String str) {
l6(str, null);
}
private File k7(String str, String str2) {
return l7(str, str2, true);
}
private void k8() {
synchronized (this.W) {
try {
for (Object obj : this.W.keySet().toArray()) {
j8(((Integer) obj).intValue(), false);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void l1(java.lang.String r5, net.dinglisch.android.taskerm.c r6) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.l1(java.lang.String, net.dinglisch.android.taskerm.c):void");
}
private void l2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Intent intent;
String a2;
String B02;
boolean z = cVar.j() == 111;
boolean z2 = dq.g() >= 19;
String F4 = F4(cVar, 0, bundle);
String F42 = z ? F4(cVar, 2, bundle) : F4(cVar, 1, bundle);
if (z2) {
if (F4.length() == 0) {
intent = new Intent("android.intent.action.SEND");
if (!TextUtils.isEmpty(F42)) {
intent.putExtra("android.intent.extra.TEXT", F42);
r7 = "text/plain";
}
if (z) {
String F43 = F4(cVar, 3, bundle);
if (F43.length() > 0 && (B02 = B0(intent, str, F43)) != null) {
r7 = B02;
}
}
if (r7 != null) {
intent.setType(r7);
}
if (yd.r0.b() && (a2 = yd.r0.a(this)) != null) {
intent.setPackage(a2);
}
} else {
intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse("smsto:" + Uri.encode(F4)));
}
if (z) {
String F44 = F4(cVar, 1, bundle);
if (!TextUtils.isEmpty(F44)) {
intent.putExtra("android.intent.extra.SUBJECT", F44);
}
}
} else {
intent = new Intent(z ? "android.intent.action.SEND" : "android.intent.action.VIEW");
intent.putExtra("address", F4);
intent.putExtra("sms_body", F42);
intent.putExtra("exit_on_sent", true);
if (z) {
String F45 = F4(cVar, 1, bundle);
if (!TextUtils.isEmpty(F45)) {
intent.putExtra("subject", F45);
}
String F46 = F4(cVar, 3, bundle);
intent = (F46.length() <= 0 || B0(intent, str, F46) != null) ? intent : null;
} else {
intent.setType("vnd.android-dir/mms-sms");
}
}
if (intent != null) {
V7(intent, false);
}
}
private void l3(net.dinglisch.android.taskerm.c cVar) {
V7(RunLog.y0(this), true);
}
private void l5(Intent intent) {
tn tnVar;
int w2 = ri.w(intent);
r7.f("E", "handlePluginFinishFromIntent: id " + w2);
if (w2 != Integer.MAX_VALUE) {
String p02 = a1.p0(w2);
synchronized (this.L) {
tnVar = this.M.get(p02);
}
long currentTimeMillis = System.currentTimeMillis();
while (tnVar == null && System.currentTimeMillis() - currentTimeMillis < 1000) {
r7.f("E", "plugin result before initialisation ? loop-a-little");
N3(50L);
synchronized (this.M) {
tnVar = this.M.get(p02);
}
}
if (tnVar != null) {
k5(vo.c.j(intent), intent.getExtras(), tnVar);
return;
}
r7.f("E", "no wait task for plugin exe ID " + w2);
}
}
private void l6(String str, tn tnVar) {
if (tnVar == null) {
r7.f("Ew", str);
return;
}
r7.f("Ew", "Task " + tnVar.Z0() + ": " + str);
}
private File l7(String str, String str2, boolean z) {
File c1 = dq.c1();
if (c1 == null) {
K6(z, 2131887974, str);
} else {
if (str2.length() != 0) {
return str2.startsWith(File.separator) ? new File(str2) : new File(c1, str2);
}
K6(z, 2131887967, str);
}
return null;
}
private static void l8(Context context, boolean z, String str) {
if (B0 != null) {
r7.f("E", "stopMediaPlayer: " + str);
if (B0.isPlaying()) {
B0.stop();
}
if (z) {
B0.release();
B0 = null;
} else {
B0.reset();
}
kq.A(context);
}
}
private int m1(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean z = false;
a1.c cVar2 = a1.c.values()[r4(cVar, 0)];
Intent intent = null;
if (cVar2 == a1.c.SnoozeCurrent) {
int l4 = l4(cVar, 2, bundle);
if (l4 != Integer.MAX_VALUE) {
intent = new Intent("android.intent.action.SNOOZE_ALARM");
intent.putExtra("android.intent.extra.alarm.SNOOZE_DURATION", l4);
}
} else {
int i2 = i.a[cVar2.ordinal()];
if (i2 == 1) {
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.next");
} else if (i2 == 2) {
String F4 = F4(cVar, 3, bundle);
if (TextUtils.isEmpty(F4)) {
r7.G("E", str + ": disableByTime: no time specified");
} else {
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.label");
intent.putExtra("android.intent.extra.alarm.MESSAGE", F4);
}
} else if (i2 != 3) {
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.all");
} else {
int l42 = l4(cVar, 1, bundle);
int l43 = l4(cVar, 2, bundle);
if (l42 < 0 && l42 > 23) {
r7.G("E", str + ": bad hour: " + l42);
} else if (l43 >= 0 || l43 <= 59) {
if (l42 > 12) {
l42 -= 12;
z = true;
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": ");
sb.append(l42);
sb.append(".");
sb.append(l43);
sb.append(" ");
sb.append(z ? "pm" : "am");
r7.f("E", sb.toString());
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.time");
intent.putExtra("android.intent.extra.alarm.IS_PM", z);
intent.putExtra("android.intent.extra.alarm.HOUR", l42);
intent.putExtra("android.intent.extra.alarm.MINUTES", l43);
} else {
r7.G("E", str + ": bad minute: " + l42);
}
}
}
return (intent == null || !U7(intent)) ? -3 : -1;
}
private int m2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
UsbManager k2 = USBHandler.k(this);
int m4 = m4(cVar, 2, true, false, bundle);
if (m4 != Integer.MAX_VALUE) {
if (k2 == null) {
r7.G("E", "no USB manager");
} else {
UsbDevice j2 = USBHandler.j(k2, 1, 3);
if (j2 == null) {
r7.G("E", str + ": no midi device");
} else {
xd a2 = MIDIHandler.a(k2, j2);
if (a2 == null) {
r7.G("E", str + ": no midi output device");
} else {
r3 = w6(a2, 0, wd.a.values()[r4(cVar, 1)], F4(cVar, 3, bundle), m4) ? -1 : -3;
N3(m4);
a2.g();
}
}
}
}
return r3;
}
private int m3(String str, net.dinglisch.android.taskerm.c cVar) {
AudioManager audioManager = (AudioManager) oi.d(this, "audio", "E", "exesm");
int i2 = 0;
if (audioManager == null) {
I6(2131887705, new Object[0]);
return -3;
}
int v2 = cVar.x(0).v();
if (v2 == 1) {
i2 = 1;
} else if (v2 != 2) {
i2 = 2;
}
r7.f("E", str + ": " + kq.r0(audioManager.getRingerMode()) + " -> " + kq.r0(i2));
if (!dq.P1()) {
audioManager.setRingerMode(i2);
} else if (i2 == 0) {
r7.f("E", "lollipop compat, set filter to priority");
ji.s(this, 2);
} else {
int e2 = ji.e(this);
r7.f("E", "current filter " + e2);
audioManager.setRingerMode(i2);
ji.s(this, e2);
}
r7.f("E", "now: " + kq.r0(audioManager.getRingerMode()));
return -1;
}
private int m4(net.dinglisch.android.taskerm.c cVar, int i2, boolean z, boolean z2, Bundle bundle) {
return k4(this, cVar, i2, z, z2, bundle);
}
private void m5(net.dinglisch.android.taskerm.tn r22) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.m5(net.dinglisch.android.taskerm.tn):void");
}
private void m6(String str, tn tnVar) {
if (tnVar == null) {
r7.f("E", str);
return;
}
r7.f("E", "Task " + tnVar.Z0() + ": " + str);
}
public static void m7(Context context, tn tnVar) {
n7(context, tnVar, null);
}
private static void m8(boolean z) {
MediaRecorder mediaRecorder = E0;
if (mediaRecorder != null) {
mediaRecorder.reset();
if (z) {
E0.release();
E0 = null;
}
}
}
private int n1(net.dinglisch.android.taskerm.c cVar, String str, Bundle bundle) {
NotificationManager notificationManager = (NotificationManager) oi.d(this, "notification", "E", "execn");
if (notificationManager == null) {
I6(2131887715, new Object[0]);
return -3;
}
if (str.length() == 0) {
G0(notificationManager);
} else {
int A4 = A4(str);
if (A4 != -1) {
g7(str);
H0(notificationManager, A4);
} else if (cVar.i(1).T(this, bundle)) {
N6(2131888002, str);
}
}
return -1;
}
private int n2(java.lang.String r13, net.dinglisch.android.taskerm.c r14, android.os.Bundle r15) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.n2(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int n3(boolean z, String str) {
Intent intent = new Intent("android.intent.action.RUN");
intent.setClassName("com.lslk.sleepbot", "com.lslk.sleepbot.IntentAPI");
intent.putExtra("key", "[email protected]");
intent.putExtra("api", 1);
intent.putExtra("debug", "alarm1");
if (z) {
intent.putExtra("Sleep", true);
} else {
intent.putExtra("Wake up", true);
if (str.length() > 0) {
intent.putExtra("Note", str);
}
}
intent.putExtra("DialogFree", true);
return !U7(intent) ? -3 : -1;
}
private int n4(tn tnVar) {
int i2 = -1;
if (tnVar.F1()) {
Set<Integer> G02 = tnVar.G0();
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (G02.contains(Integer.valueOf(next.K0())) && next.m1() > i2) {
i2 = next.m1();
}
}
}
return i2;
}
private void n6(List<Object> list) {
if (list.size() == 0) {
r7.f("E", "argObjects: zero-length");
return;
}
for (int i2 = 0; i2 < list.size(); i2++) {
Object obj = list.get(i2);
StringBuilder sb = new StringBuilder();
sb.append("arg");
sb.append(i2);
sb.append(" class ");
String str = "null";
sb.append(obj == null ? "null" : obj.getClass().getName());
sb.append(" value ");
if (obj != null) {
str = obj.toString();
}
sb.append(str);
r7.f("E", sb.toString());
}
}
public static void n7(Context context, tn tnVar, Bundle bundle) {
if (bundle == null) {
bundle = new Bundle();
}
String string = bundle.getString("%caller1");
if (TextUtils.isEmpty(string)) {
string = "launch";
}
o7(context, tnVar, bundle, string);
}
private void n8(String str, boolean z) {
synchronized (A0) {
try {
ArrayList arrayList = new ArrayList();
Iterator<Map.Entry<String, MediaPlayer>> it = A0.entrySet().iterator();
while (it.hasNext()) {
String key = it.next().getKey();
String[] split = key.split("\n");
if ((z ? split[1] : split[0]).equals(str)) {
arrayList.add(key);
}
}
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
g8(A0.remove((String) it2.next()));
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void o1(int i2, boolean z) {
UiModeManager uiModeManager = (UiModeManager) oi.d(this, "uimode", "E", "dcm");
int currentModeType = uiModeManager.getCurrentModeType();
boolean z2 = currentModeType == 3;
boolean X4 = X4(z2, i2);
r7.f("E", "car: cur: " + currentModeType + " curBool: " + z2 + " set: " + i2 + " newbool: " + X4);
if (X4) {
uiModeManager.enableCarMode(z ? 1 : 0);
} else {
uiModeManager.disableCarMode(z ? 1 : 0);
}
}
private int o2(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, j4, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, j4, true, true, true)) {
File h42 = h4(str, cVar, 1, bundle);
if (h4.L(this, h42, j4, false, true)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, j4, false, true, true) && !h4.equals(h42)) {
if (j4) {
if (vm.t(true, 7000L, "mv " + dq.u2(h4.toString()) + " " + dq.u2(h42.toString()), j42) == 0) {
return -5;
}
} else {
if (h4.U(this, h4, h42)) {
return -5;
}
File file = h4.F(this, h42) ? new File(h42, h4.getName()) : h42;
if (h4.V(this, h4, file)) {
return -5;
}
I6(2131887987, h4.toString(), file.toString());
}
}
}
return -3;
}
private int o3(java.lang.String r17, net.dinglisch.android.taskerm.c r18, android.os.Bundle r19, net.dinglisch.android.taskerm.tn r20) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.o3(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle, net.dinglisch.android.taskerm.tn):int");
}
private int o4() {
Iterator<Map.Entry<String, ?>> it = B4().getAll().entrySet().iterator();
int i2 = 0;
while (it.hasNext()) {
int intValue = ((Integer) it.next().getValue()).intValue();
if (intValue > i2) {
i2 = intValue;
}
}
return i2;
}
private void o5(final Intent intent, final int i2) {
U1(new Runnable() {
@Override
public final void run() {
ExecuteService.this.M5(intent, i2);
}
}, "handleStartAfterInit");
}
private void o6() {
for (int i2 = 0; i2 < this.G.size(); i2++) {
tn tnVar = this.G.get(i2);
StringBuilder sb = new StringBuilder();
sb.append("q");
sb.append(Integer.toString(i2));
sb.append(": id: ");
sb.append(tnVar.P0());
String str = "";
sb.append(tnVar.u() ? " n: " + tnVar.getName() : "");
sb.append(" eid: ");
sb.append(tnVar.K0());
sb.append(" gid: ");
sb.append(tnVar.J0());
sb.append(" p: ");
sb.append(tnVar.m1());
if (tnVar.N1()) {
str = "P";
}
sb.append(str);
sb.append(" a: ");
sb.append(tnVar.I0());
sb.append(" qt: ");
sb.append(tnVar.o1());
sb.append(tnVar.v1(getResources(), 3, true));
r7.f("E", sb.toString());
}
}
public static void o7(Context context, tn tnVar, Bundle bundle, String str) {
p7(context, tnVar, bundle, null, str);
}
public static void o8(Context context) {
synchronized (C0) {
l8(context, true, "stopRunningActions");
}
synchronized (F0) {
m8(true);
}
synchronized (A0) {
try {
Iterator<MediaPlayer> it = A0.values().iterator();
while (it.hasNext()) {
g8(it.next());
}
A0.clear();
} catch (Throwable th2) {
throw th2;
}
}
if (net.dinglisch.android.tasker.g.c()) {
net.dinglisch.android.tasker.g.e(context).G(new oi.b() {
@Override
public final void accept(Object obj, Object obj2) {
ExecuteService.V5((com.joaomgcd.taskerm.util.s6) obj, (Throwable) obj2);
}
});
} else {
MyVpnService.t(context);
}
}
private int p1(tn tnVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean j4 = j4(cVar, 1, bundle);
boolean z = false;
String c5 = c5(cVar, 0, bundle, j4);
if (j4 && j4(cVar, 2, bundle)) {
z = true;
}
boolean j42 = j4(cVar, 3, bundle);
if ("".equals(c5) && !j42) {
this.Y.P0();
}
if (c5 == null) {
return -3;
}
kq.H(this, c5, j4, !z, false, true, bundle, j42, Integer.valueOf(tnVar.P0()), Integer.valueOf(tnVar.n1(to.u1(this))));
return -1;
}
private int p2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
File N4 = N4(F4(cVar, 0, bundle), str, true, true, false);
int m4 = m4(cVar, 1, true, false, bundle);
int r4 = r4(cVar, 3);
boolean T = cVar.i(4).T(this, bundle);
if (N4 != null && m4 != Integer.MAX_VALUE) {
if (H6(N4, m4, cVar.i(2).T(this, bundle), r4)) {
if (!T) {
D0("Music", 99999);
return -1;
}
synchronized (this.N) {
this.N.put("Music", Long.valueOf(h5(99999)));
}
return -5;
}
I6(2131887983, str, C4(N4));
}
return -3;
}
private int p3(java.lang.String r22, net.dinglisch.android.taskerm.c r23, java.lang.String r24, java.lang.String r25, float r26, float r27, android.os.Bundle r28) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.p3(java.lang.String, net.dinglisch.android.taskerm.c, java.lang.String, java.lang.String, float, float, android.os.Bundle):int");
}
private int p4() {
int m1;
Iterator<String> it = this.L.iterator();
int i2 = Integer.MIN_VALUE;
while (it.hasNext()) {
tn tnVar = this.M.get(it.next());
if (tnVar != null && !tnVar.N1() && (m1 = tnVar.m1()) > i2) {
i2 = m1;
}
}
return i2;
}
private void p5(Intent intent) {
if (!this.L.contains("Voice Group")) {
r7.f("E", "ignoring voice results, not waiting for them");
return;
}
StringBuilder sb = new StringBuilder();
if (intent.hasExtra("android.speech.extra.RESULTS")) {
ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("android.speech.extra.RESULTS");
if (stringArrayListExtra != null) {
r7.f("E", "handleVoiceResults: " + stringArrayListExtra.size() + " results");
Iterator<String> it = stringArrayListExtra.iterator();
while (it.hasNext()) {
String next = it.next();
if (sb.length() > 0) {
sb.append(",");
}
sb.append(next);
}
tn tnVar = this.M.get("Voice Group");
if (tnVar == null) {
r7.f("E", "no wait task for voice");
} else {
tnVar.g0(sb.toString());
}
kq.S1(this, 92, sb.toString());
h7("Voice Group");
}
r7.f("E", "handleVoiceResults: null extra");
} else {
r7.f("E", "no voice recognition results");
}
this.M.get("Voice Group").o2(true);
kq.C(this, 92);
h7("Voice Group");
}
public static String p6(int i2, String str) {
StringBuilder sb = new StringBuilder();
if (str == null) {
str = "";
}
sb.append(str);
sb.append("\n");
sb.append(i2);
return sb.toString();
}
public static void p7(Context context, tn tnVar, Bundle bundle, List<String> list, String str) {
if (bundle == null) {
bundle = new Bundle();
}
c6(context, tnVar, 1, -1, -1, -1, -1, null, list, str, bundle);
}
public boolean p8(int i2) {
boolean stopSelfResult;
synchronized (d0) {
stopSelfResult = stopSelfResult(i2);
}
return stopSelfResult;
}
private void q1(net.dinglisch.android.taskerm.c cVar, tn tnVar, String str, Bundle bundle, String str2, String str3) {
String I2 = I2(cVar.N(2).w(), tnVar);
I2(cVar.N(3).w(), tnVar);
V7(com.joaomgcd.taskerm.util.h8.a(this, str2, str3, I2, false, null), false);
}
private void q2(java.lang.String r10, java.lang.String r11, net.dinglisch.android.taskerm.c r12, android.os.Bundle r13) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.q2(java.lang.String, java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):void");
}
private int q3(String str, String str2, String str3, String str4, boolean z, Bundle bundle, boolean z2) {
if (str3.length() <= 0) {
r7.G("E", str + ": can't split unset value to set " + str2);
return -3;
}
if (TextUtils.isEmpty(str4)) {
str4 = "\\s+";
} else if (!z2) {
str4 = Pattern.quote(str4);
}
String[] split = str3.split(str4);
SharedPreferences.Editor edit = kq.W0(str2) ? null : kq.u0(this).edit();
int i2 = 0;
while (i2 < split.length) {
StringBuilder sb = new StringBuilder();
sb.append(str2);
int i3 = i2 + 1;
sb.append(String.valueOf(i3));
String sb2 = sb.toString();
String str5 = split[i2];
if (edit == null) {
bundle.putString(sb2, str5);
} else {
edit.putString(sb2, str5);
}
i2 = i3;
}
if (edit != null) {
edit.commit();
}
if (z) {
kq.E(this, str2, true, true, bundle);
}
kq.I1(this, str2, bundle);
return -1;
}
public static Bitmap q4(boolean z) {
Bitmap bitmap;
synchronized (e0) {
if (z) {
try {
g0 = true;
} catch (Throwable th2) {
throw th2;
}
}
bitmap = f0;
}
return bitmap;
}
private boolean q5() {
return (u0 == null && t0 == null) ? false : true;
}
private void q6(tn tnVar, int i2, boolean z) {
List<net.dinglisch.android.taskerm.c> z02 = tnVar.z0(i2, false, false, true);
if (!z02.isEmpty()) {
z02.get(0).p1(z);
return;
}
r7.k("E", "task position " + i2 + ": else without header if");
}
public static boolean q7(Context context, String str) {
return r7(context, str, null);
}
public boolean q8() {
boolean z;
synchronized (r0) {
try {
if (this.x != null) {
z = false;
if (System.currentTimeMillis() - this.y < 500) {
r7.f("E", "TTS just started speech, let it get moving");
} else if (this.w == -34234) {
r7.f("E", "TTS still initializing");
} else if (this.x.isSpeaking()) {
r7.f("E", "TTS still speaking");
} else {
E6("stopTTSIfFinished", null, false);
}
}
z = true;
} catch (Throwable th2) {
throw th2;
}
}
return z;
}
private void r1(net.dinglisch.android.taskerm.c cVar) {
String str;
int v2 = cVar.x(0).v();
if (v2 == 0) {
str = "com.android.contacts.action.LIST_STARRED";
} else if (v2 == 1) {
str = "com.android.contacts.action.LIST_FREQUENT";
} else if (v2 != 2) {
r7.k("E", "contacts: bad type " + v2);
str = null;
} else {
str = "com.android.contacts.action.LIST_STREQUENT";
}
if (str != null) {
U7(new Intent(str));
}
}
private int r2(String str, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle, tn tnVar) {
int v2 = cVar.x(0).v();
final net.dinglisch.android.taskerm.d V = cVar.V(this, 1, bundle);
final MyVpnService.Mode mode = MyVpnService.Mode.values()[v2];
if (!net.dinglisch.android.tasker.g.c()) {
return VpnService.prepare(this) != null ? b8(4, i2, 20, cVar, bundle) ? -1 : -3 : MyVpnService.u(this, mode, V.K()) ? -5 : -3;
}
r7.f("E", "Will run Network Access in Tasker Settings");
return this.Y.x0(cVar, bundle, tnVar, "network access", new xj.l() {
@Override
public final Object invoke(Object obj) {
ji.r B5;
B5 = ExecuteService.this.B5(V, mode, (Context) obj);
return B5;
}
});
}
private int r3(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, Bundle bundle) {
String I2;
boolean z;
String b5 = b5(cVar, 0, bundle);
if (b5 == null) {
return -3;
}
boolean T = cVar.i(2).T(this, bundle);
kq.x(this, b5, bundle);
if (kq.M0(this, b5, bundle)) {
I2 = kq.y0(this, b5, bundle);
z = true;
} else {
I2 = I2(b5, tnVar);
if (I2.equals(b5)) {
I2 = "";
}
z = false;
}
return q3(str, b5, I2, F4(cVar, 1, bundle), z && T, bundle, cVar.i(3).T(this, bundle));
}
public static boolean r5() {
boolean z;
synchronized (e0) {
z = f0 != null;
}
return z;
}
private void r6(boolean z, int i2) {
if (B0 == null || !B0.isPlaying()) {
return;
}
int i3 = i2 * 1000;
int currentPosition = B0.getCurrentPosition();
if (z) {
int i4 = currentPosition + i3;
if (i4 < B0.getDuration()) {
B0.seekTo(i4);
return;
}
return;
}
int i5 = currentPosition - i3;
if (i5 < 0) {
i5 = 0;
}
B0.seekTo(i5);
}
public static boolean r7(Context context, String str, Bundle bundle) {
tn N;
if (str == null || (N = to.u1(context).N(str)) == null) {
return false;
}
N.D2(1000);
n7(context, N, bundle);
return true;
}
public static void r8(Context context, int i2) {
Bundle bundle = new Bundle();
bundle.putInt(M0, i2);
b6(context, L0, bundle);
}
private int s1(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, j4, true, false)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, j4, true, false, true)) {
File h42 = h4(str, cVar, 1, bundle);
if (h4.L(this, h42, j4, false, true)) {
if (Y7(cVar, i2, bundle)) {
return -1;
}
} else if (M0(h4, str, j4, false, false, true) && !h4.equals(h42)) {
if (j4) {
if (vm.t(true, 60000L, "cp -r " + dq.u2(h4.toString()) + " " + dq.u2(h42.toString()), j42) == 0) {
return -5;
}
} else {
if (h4.e(this, h4, h4.i(this, h42) ? new File(h42, h4.getName()) : h42, true)) {
return -5;
}
}
}
}
return -3;
}
private void s2(int i2) {
TelephonyManager telephonyManager = (TelephonyManager) oi.d(this, "phone", "E", "doNM");
int phoneType = telephonyManager != null ? telephonyManager.getPhoneType() : 0;
int d1 = dq.d1(getContentResolver(), "preferred_network_mode");
int r1 = i2 >= 256 ? i2 - 256 : a1.r1(i2, phoneType);
r7.f("E", "current mode: " + d1 + " wanted: " + r1 + " phone type: " + phoneType);
if (r1 != d1) {
r7.f("E", "send network modification broadcast");
sendBroadcast(new Intent("com.android.internal.telephony.MODIFY_NETWORK_MODE").putExtra("networkMode", r1));
}
}
private int s3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int l4 = l4(cVar, 0, bundle);
if (l4 != Integer.MAX_VALUE) {
String F4 = F4(cVar, 1, bundle);
boolean j4 = j4(cVar, 2, bundle);
Intent intent = new Intent("android.intent.action.SET_TIMER");
if (l4 > 0) {
intent.putExtra("android.intent.extra.alarm.LENGTH", l4);
}
intent.putExtra("android.intent.extra.alarm.SKIP_UI", !j4);
if (F4.length() > 0) {
intent.putExtra("android.intent.extra.alarm.MESSAGE", F4);
}
if (V7(intent, true)) {
return -1;
}
}
return -3;
}
private long s6(ArrayList<HashMap<Integer, Long>> arrayList) {
Iterator<HashMap<Integer, Long>> it = arrayList.iterator();
int i2 = 0;
while (it.hasNext()) {
i2 += it.next().size();
}
return i2;
}
public static boolean s7(Context context, String str, Bundle bundle, String str2) {
if (!TextUtils.isEmpty(str2)) {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putString("%caller1", str2);
}
return r7(context, str, bundle);
}
private int t1(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
String F4 = F4(cVar, 0, bundle);
String F42 = F4(cVar, 1, bundle);
File k7 = k7(str, F4);
File k72 = k7(str, F42);
if (Z7(k7, j4, true, false, cVar, i2, bundle) || Z7(k72, j4, false, true, cVar, i2, bundle)) {
return -1;
}
if (j4) {
StringBuilder sb = new StringBuilder();
sb.append("cp ");
sb.append(dq.u2(k7.toString()));
sb.append(" ");
sb.append(dq.u2(k72.toString()));
return vm.t(true, 7000L, sb.toString(), j42) == 0 ? -5 : -3;
}
try {
com.joaomgcd.taskerm.util.g8.h(this, F4, F42);
return -5;
} catch (com.joaomgcd.taskerm.util.t1 e2) {
r7.m("E", true, e2.a(this, str));
return -3;
} catch (Exception e3) {
r7.m("E", true, e3.getMessage());
return -3;
}
}
private void t2(int i2) {
UiModeManager uiModeManager = (UiModeManager) oi.d(this, "uimode", "E", "dnm");
int nightMode = uiModeManager.getNightMode();
int i3 = i2 != 0 ? i2 == 1 ? 2 : 0 : 1;
r7.f("E", "night: cur: " + nightMode + " wanted: " + i3);
if (nightMode != i3) {
uiModeManager.setNightMode(i3);
}
}
private int t3(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar) {
int i2;
boolean z = r4(cVar, 0) == 0;
r7.f("E", str + ": expand: " + z);
if (z && MyAccessibilityService.c(4, false, str)) {
r7.f("E", str + ": accessibilityservice available, try using it");
i2 = F6(4, cVar, tnVar);
} else {
i2 = -3;
}
if (i2 != -3) {
return i2;
}
r7.f("E", str + ": accessibility service unavailable or failed, check SBS");
if (!yd.n0.a(this)) {
r7.f("E", str + ": no SBS");
return i2;
}
r7.f("E", str + ": SBS available, let's try it");
if (z) {
if (!yd.n0.g(this, true)) {
return i2;
}
} else {
if (!com.joaomgcd.taskerm.util.k.l()) {
return this.Y.t0(cVar, tnVar);
}
if (!yd.n0.g(this, false)) {
return i2;
}
}
return -5;
}
private SharedPreferences t4() {
return getSharedPreferences(g6.i, 0);
}
private long t6(ArrayList<HashMap<Integer, Long>> arrayList, long j2, long j3, long j4) {
long j5 = j2 + j3;
Iterator<HashMap<Integer, Long>> it = arrayList.iterator();
long j6 = Long.MAX_VALUE;
while (it.hasNext()) {
for (Long l2 : it.next().values()) {
if (l2.longValue() < j6) {
j6 = l2.longValue();
}
}
}
return Math.min(j6, j5) - j4;
}
public static boolean t7(Context context, String str, String str2, String str3) {
return u7(context, str, str2, str3, null);
}
private int u1(String str, String str2, Bundle bundle) {
to u1 = to.u1(this);
if (!u1.p(str2)) {
r7.G("E", str + ": unknown scene " + str2);
} else {
if (wl.n(getApplicationContext(), u1.c0(str2), bundle)) {
dk E = wl.E(str2);
if (E != null) {
E.s(bundle);
}
return -1;
}
r7.G("E", str + ": failed to create scene " + str2);
}
return -3;
}
private int u2(net.dinglisch.android.taskerm.c cVar, String str, String str2, Bundle bundle) {
int i2;
int i3;
int l4;
int v2 = cVar.x(0).v();
boolean isEmpty = TextUtils.isEmpty(str);
String str3 = v2 == 0 ? "geo:" : v2 == 1 ? "google.streetview:cbll=" : "google.navigation:q=";
if (isEmpty) {
String N = kq.N(this, cVar.N(2).w(), bundle);
if (N.split(Pattern.quote(",")).length == 2) {
if (v2 != 0 || str2.length() <= 0) {
str3 = str3 + N;
} else {
str3 = str3 + "0,0?q=" + N + " (" + str2 + ")";
}
i2 = -1;
i3 = -1;
} else {
N6(2131887943, cVar.getName(), N);
i2 = -1;
i3 = -3;
}
} else if (v2 == 1) {
r7.k("E", "Open Map: addresses not supported for streetview");
i2 = -1;
i3 = -3;
} else {
if (v2 == 2) {
str3 = str3 + str;
} else {
str3 = str3 + "0,0?q=" + str;
if (str2.length() > 0) {
str3 = str3 + " (" + str2 + ")";
}
}
i2 = -1;
i3 = -1;
}
if (i3 == i2 && (l4 = l4(cVar, 3, bundle)) != Integer.MAX_VALUE && l4 != 1) {
if (v2 == 2) {
r7.G("E", "Open Map: zoom not valid for Navigate mode ");
} else if (v2 == 1) {
if (isEmpty) {
str3 = str3 + "&mz=" + String.valueOf(l4);
} else {
r7.G("E", "Open Map: zoom not valid for StreetView / Address");
}
} else if (!isEmpty) {
r7.G("E", "Open Map: zoom not valid for Point / Address");
} else if (str2.length() > 0) {
r7.G("E", "OpenMap: zoom not valid with label");
} else {
str3 = str3 + "?z=" + String.valueOf(l4);
}
}
if (i3 != -1) {
return i3;
}
try {
U7(new Intent("android.intent.action.VIEW", Uri.parse(str3)));
return i3;
} catch (Exception e2) {
r7.G("E", "Open Map: " + e2.toString());
return -3;
}
}
private int u3(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, int i2, String str2) {
boolean T = cVar.i(0).T(this, bundle);
String F4 = F4(cVar, 1, bundle);
if (TextUtils.isEmpty(F4)) {
int i3 = T ? -3 : -4;
n8(String.valueOf(i2), true);
return i3;
}
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.u() && next.getName().equals(F4) && !next.K1()) {
b4(next);
next.o2(T);
}
}
} catch (Throwable th2) {
throw th2;
}
}
return -1;
}
private Context u4(String str, Bundle bundle) {
Context context;
String string;
if (bundle.containsKey("%scene_name") && (context = wl.F((string = bundle.getString("%scene_name")))) != null && (context instanceof Activity)) {
r7.f("E", str + " use activity context for " + string);
} else {
context = null;
}
if (context != null) {
return context;
}
r7.f("E", str + " use app context");
return this;
}
private boolean u5(tn tnVar, int i2) {
List<net.dinglisch.android.taskerm.c> z02 = tnVar.z0(i2, false, false, true);
if (!z02.isEmpty()) {
return z02.get(0).y();
}
r7.k("E", "task position " + i2 + ": else without header if");
return true;
}
private void u6(xd xdVar, int i2, int i3, String str) {
Integer[] f2 = wd.f(str);
if (f2 != null) {
for (int i4 = 0; i4 < f2.length; i4++) {
int intValue = f2[i4].intValue();
if (intValue != -1) {
if (i4 == 0) {
r7.f("E", "midi set channel " + i3 + " msb to " + intValue);
if (xdVar != null) {
xdVar.b(i2, i3, 0, intValue);
}
} else if (i4 == 1) {
r7.f("E", "midi set channel " + i3 + " lsb to " + intValue);
if (xdVar != null) {
xdVar.b(i2, i3, 32, intValue);
}
} else {
r7.f("E", "midi set channel " + i3 + " program to " + intValue);
if (xdVar != null) {
xdVar.f(i2, i3, intValue);
}
}
}
}
}
}
public static boolean u7(Context context, String str, String str2, String str3, String str4) {
Bundle bundle;
if (str2 == null && str3 == null && str4 == null) {
bundle = null;
} else {
Bundle bundle2 = new Bundle();
bundle2.putString(tn.h1(1), str2);
bundle2.putString(tn.h1(2), str3);
if (!TextUtils.isEmpty(str4)) {
bundle2.putString("%caller1", str4);
}
bundle = bundle2;
}
return r7(context, str, bundle);
}
private int v1(java.lang.String r18, net.dinglisch.android.taskerm.c r19, int r20, android.os.Bundle r21) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.v1(java.lang.String, net.dinglisch.android.taskerm.c, int, android.os.Bundle):int");
}
private int v2(String str, net.dinglisch.android.taskerm.c cVar, tn tnVar, Bundle bundle, u3 u3Var) {
String F4 = F4(cVar, 0, bundle);
tn z4 = z4(str, F4);
u3Var.b = F4;
int i2 = -3;
if (z4 == null) {
String Q4 = com.joaomgcd.taskerm.util.x2.Q4(2131887975, this, F4);
tnVar.T1(cVar, Q4);
J6(Q4, new Object[0]);
} else {
tn r02 = z4.r0();
if (cVar.i(9).T(this, bundle)) {
r02.V("allow_child_ovvvreeeww", Boolean.TRUE);
}
if (cVar.i(10).T(this, bundle)) {
r02.V("structure_return_var", Boolean.TRUE);
}
kg.w0.E(bundle);
if (cVar.i(6).T(this, bundle)) {
com.joaomgcd.taskerm.util.x2.K(bundle, this, r02, cVar.N(7).w());
}
int m4 = m4(cVar, 1, true, false, tnVar.m());
boolean z = cVar.N(4).w().length() > 0;
String b5 = z ? b5(cVar, 4, bundle) : null;
if ((z && b5 == null) || m4 == Integer.MAX_VALUE) {
tnVar.T1(cVar, "Need Return Var Name");
} else {
i2 = cVar.i(5).T(this, bundle) ? -4 : -1;
r02.D2(MonitorService.c7(tnVar.m1()) + m4);
for (int i3 = 2; i3 <= 3; i3++) {
if (cVar.N(i3).w().length() > 0) {
r02.W(tn.h1(i3 - 1), H4(cVar, i3, tnVar));
}
}
if (z) {
r02.W("return", b5);
if (j4(cVar, 8, bundle)) {
if (kq.W0(b5)) {
bundle.remove(b5);
} else {
kq.D(this, b5);
}
}
}
u3Var.d = r02;
}
}
return i2;
}
private void v3(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int v2 = cVar.x(0).v();
i8(v2 == 0 || v2 == 2, v2 == 1 || v2 == 2, true, true);
}
private static Intent v4(Context context, tn tnVar, int i2, int i3, int i4, int i5, String str, List<String> list, String str2, Bundle bundle) {
if (bundle != null && com.joaomgcd.taskerm.util.k.r()) {
bundle = bundle.deepCopy();
}
Intent intent = new Intent(context, (Class<?>) ExecuteService.class);
if (str2 != null || list != null) {
if (bundle == null) {
bundle = new Bundle();
}
kq.d(str2, list, bundle);
}
intent.putExtra("mcro", tnVar.U(0).c0());
intent.putExtra("flags", i2);
if (i3 != -1) {
intent.putExtra("gid", i3);
}
if (i4 != -1) {
intent.putExtra("ppi", i4);
}
if (i5 != -1) {
intent.putExtra("ppri", i5);
}
if (bundle != null) {
intent.putExtra("lvars", bundle);
}
if (str != null) {
intent.putExtra("sc", str);
}
return intent;
}
public final void v5() {
synchronized (this.I) {
try {
r7.f("E", "join: set timeToLeave");
this.I = Boolean.TRUE;
t tVar = this.K;
if (tVar == null) {
r7.f("E", "joinWorkThread: null, maybe it was never created");
} else {
tVar.interrupt();
Thread.State o1 = dq.o1(this.K);
if (o1 == null || !(o1.equals(Thread.State.BLOCKED) || o1.equals(Thread.State.WAITING) || o1.equals(Thread.State.TIMED_WAITING))) {
while (this.K != null) {
try {
r7.f("E", "join");
this.K.join();
r7.f("E", "joined");
this.K = null;
} catch (InterruptedException unused) {
r7.f("E", "interrupted during thread join");
}
}
} else {
r7.f("E", "workthread blocked, try again in 500ms");
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
ExecuteService.this.v5();
}
}, 500L);
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
private int v6(int i2, String str) {
if (str.length() == 1) {
r7.G("E", "ignoring empty velocity in " + str);
} else {
String substring = str.substring(1);
Integer E3 = dq.E3(substring);
if (E3 == null) {
r7.G("E", "bad o spec: " + substring);
} else {
if (E3.intValue() >= 0 && E3.intValue() <= 127) {
return E3.intValue();
}
r7.G("E", "bad velocity index: " + E3);
}
}
return -1;
}
private boolean v7(File file, long j2) {
if (file != null) {
MediaScannerConnection mediaScannerConnection = new MediaScannerConnection(this, null);
mediaScannerConnection.connect();
r7.f("E", "wait for media scanner connection...");
long currentTimeMillis = System.currentTimeMillis();
while (!mediaScannerConnection.isConnected() && System.currentTimeMillis() - currentTimeMillis < j2 && !this.I.booleanValue()) {
N3(300L);
}
if (mediaScannerConnection.isConnected()) {
r7.f("E", "connected, starting scan");
if (!this.I.booleanValue()) {
w7(file, mediaScannerConnection, currentTimeMillis, j2);
}
r7.f("E", "scan finished, disconnect");
mediaScannerConnection.disconnect();
return true;
}
r7.G("E", "failed to connect to media scanner service");
}
return false;
}
private void v8(String str, String str2) {
if (!dq.w1(getPackageManager(), "sms")) {
r7.G("E", "no messaging app");
return;
}
r7.f("E", "store sms");
try {
ContentValues contentValues = new ContentValues();
contentValues.put("address", str);
contentValues.put("body", str2);
if (getContentResolver().insert(Uri.parse("content://sms/sent"), contentValues) == null) {
r7.G("E", "storage of SMS sent to " + str + " failed");
}
r7.f("E", "stored");
} catch (Exception e2) {
r7.G("E", "failed to write to messaging DB: " + e2.toString());
}
}
private void w0() {
synchronized (r0) {
if (this.z != null) {
r7.f("E", "abandon speech audio focus");
try {
((AudioManager) oi.d(this, "audio", "E", "asaf")).abandonAudioFocus(this.z);
} catch (Exception e2) {
r7.f("E", "exception: " + e2.getMessage());
}
this.z = null;
}
}
}
private int w1(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean j4 = j4(cVar, 2, bundle);
boolean j42 = j4(cVar, 3, bundle);
boolean G1 = cVar.G1();
File h4 = h4(str, cVar, 0, bundle);
if (h4.L(this, h4, j4, true, true)) {
return Y7(cVar, i2, bundle) ? -1 : -3;
}
if (!M0(h4, str, j4, true, true, false)) {
return -3;
}
int l4 = l4(cVar, 1, bundle);
if (l4 > 0 && l4 != Integer.MAX_VALUE) {
if (h4.c0(this, h4, true)) {
r7.f("E", str + ": shredding unsupported on Android 21+ external SD");
} else if (!dq.e3(h4, l4)) {
r7.N("E", G1, str + ": failed to shred " + h4);
}
}
if (j4) {
String u2 = dq.u2(h4.toString());
if (vm.t(true, 7000L, "rm -f " + u2, j42) != 0) {
if (vm.t(true, 7000L, "rm " + u2, j42) != 0) {
return -3;
}
}
} else if (!h4.f(this, h4)) {
if (!G1) {
return -3;
}
N6(2131887955, h4.toString());
return -3;
}
return -5;
}
private int w2(String str, int i2, String str2, int i3, int i4, String str3) {
int g2 = zj.g(i2);
if (str2.length() == 0) {
str2 = zj.a(this, g2);
}
Uri j2 = zj.j(this, g2, str2);
if (j2 == null) {
r7.G("E", str + "couldn't get Uri, type " + g2 + " title " + str2);
return -3;
}
r7.f("E", str + "uri: " + j2.toString());
Message obtainMessage = this.S.obtainMessage();
Bundle bundle = new Bundle();
bundle.putString("uri", j2.toString());
bundle.putInt("stream", i3);
bundle.putInt("exeid", i4);
bundle.putString("tname", str3);
obtainMessage.setData(bundle);
this.S.sendMessage(obtainMessage);
return -1;
}
private int w3() {
if (!MyDeviceAdminReceiver.a(this)) {
r7.G("E", "device admin disabled");
this.Y.N0(com.joaomgcd.taskerm.util.e5.T(), new hg.w(this));
} else if (MyDeviceAdminReceiver.e(this)) {
return -1;
}
return -3;
}
public static Intent w4(Context context, tn tnVar, int i2, int i3, int i4, String str, List<String> list, String str2, Bundle bundle) {
return v4(context, tnVar, i2, i3, i4, -1, str, list, str2, bundle);
}
private boolean w7(File file, MediaScannerConnection mediaScannerConnection, long j2, long j3) {
if (this.I.booleanValue()) {
r7.f("E", "scanFileAux: interrupted");
return false;
}
if (System.currentTimeMillis() - j3 >= j2) {
r7.G("E", "scanFile: timeout scanning " + file);
return false;
}
if (!file.isDirectory()) {
mediaScannerConnection.scanFile(file.toString(), null);
return true;
}
File[] listFiles = file.listFiles();
if (dq.r(listFiles)) {
return true;
}
for (File file2 : listFiles) {
if (!w7(file2, mediaScannerConnection, j2, j3)) {
return false;
}
}
return true;
}
private void w8(String str, String str2, tn tnVar, String str3) {
x8(str, str2, tnVar, str3, null);
}
private int x1(String str) {
if (wl.N(str)) {
return wl.v(this, str, true) ? -1 : -3;
}
r7.f("E", "doDestroyScene: " + str + ": doesn't exist");
return -1;
}
private int x2(net.dinglisch.android.taskerm.c cVar, int i2, int i3, int i4, int i5, Bundle bundle, tn tnVar) {
dk G;
int l4 = l4(cVar, i2, bundle);
if (l4 != Integer.MAX_VALUE) {
O0();
String F4 = F4(cVar, i3, bundle);
if (F4.length() == 0) {
F4 = a1.I(cVar.j(), i3);
}
uo v1 = to.v1(this);
int j2 = cVar.j();
if (v1.p(F4)) {
G = v1.c0(F4);
hh G1 = a1.G1(getResources(), j2, i3, G);
if (G1 != null) {
G1.b(this, "E");
G = null;
}
} else {
G = a1.G(this, F4);
}
dk dkVar = G;
if (dkVar == null) {
r7.k("E", "unknown scene: " + F4);
} else {
String I = a1.I(j2, i3);
a1.u1(this, to.v1(this), dkVar, cVar, i3, bundle);
dkVar.G(I);
if (wl.p(this, dkVar, bundle)) {
dkVar.F3(i5);
dkVar.s(bundle);
dkVar.X2();
wl.f0(this, 268435460, dkVar.getName(), dk.e.DialogDimBehind, 100, 100, dk.e0, i4 == -1 ? true : j4(cVar, i4, bundle), tnVar);
A0(a1.F0(this, cVar, bundle, -1), l4);
return -1;
}
}
}
return -3;
}
@SuppressLint({"MissingPermission"})
@TargetApi(26)
private void x3() {
Object systemService;
if (dq.g() >= 26 && this.Y.M0(com.joaomgcd.taskerm.util.e5.W())) {
r7.f("E", "Taking Call with Oreo and permissions");
systemService = getSystemService(TelecomManager.class);
TelecomManager telecomManager = (TelecomManager) systemService;
if (telecomManager == null) {
r7.k("E", "Taking Call telecomManager null");
return;
} else {
telecomManager.acceptRingingCall();
return;
}
}
if (s5.p(this, Boolean.TRUE)) {
r7.f("E", "Taking Call with root");
com.joaomgcd.taskerm.util.r6.e(5).f();
} else {
r7.f("E", "Taking Call ACTION_MEDIA_BUTTON");
Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
intent.putExtra("android.intent.extra.KEY_EVENT", new KeyEvent(1, 79));
sendOrderedBroadcast(intent, "android.permission.CALL_PRIVILEGED");
}
}
private int x4(int i2) {
if (i2 == 1) {
return 127;
}
if (i2 == 5) {
return 126;
}
return c0[i2];
}
private void x6(xd xdVar, int i2, int i3, int i4, long j2, HashMap<Integer, Long> hashMap) {
for (Object obj : hashMap.keySet().toArray()) {
Integer num = (Integer) obj;
int intValue = num.intValue();
if (hashMap.get(num).longValue() <= j2) {
hashMap.remove(num);
r7.f("E", "midi channel " + i3 + " stop note " + intValue);
if (xdVar != null) {
xdVar.d(i2, i3, intValue, i4);
}
}
}
}
private boolean x7() {
return ((PowerManager) oi.d(getApplicationContext(), "power", "E", "screenOn")).isScreenOn();
}
private void x8(String str, String str2, tn tnVar, String str3, StructureType structureType) {
y8(str, str2, tnVar, str3, true, structureType);
}
private void y0(String str, Intent intent, String str2, eq eqVar, Bundle bundle) {
String[] split = str2.split(ConstantsCommonTaskerServer.ID_SEPARATOR, 2);
if (split.length != 2) {
r7.G("E", "ignoring bad extra format: " + str2);
return;
}
String trim = split[0].trim();
String trim2 = split[1].trim();
if (TextUtils.isEmpty(trim) || TextUtils.isEmpty(trim2)) {
r7.k("E", "action/component intent: empty extra key/val");
return;
}
d6.J(this);
d6.c b2 = d6.b(null, trim2, d6.a.Obj, eqVar, bundle, null, null, str);
String str3 = null;
if (b2 != null) {
Object obj = b2.b;
if (obj != null && !b2.d) {
String name = obj.getClass().getName();
r7.f("E", "attempt to put java object as parcelable (class " + name + ")");
try {
intent.putExtra(trim, (Parcelable) b2.b);
str3 = "parcelable(" + name + ")";
} catch (Exception unused) {
r7.G("E", str + ": Java object extra: class " + name + " not parcelable");
}
}
String str4 = b2.h;
if (str4 != null) {
trim2 = str4;
}
}
if (b2.a != null) {
if (Uri.class.getName().equals(b2.a)) {
trim2 = b2.h;
intent.putExtra(trim, Uri.parse(trim2));
str3 = "parcelable(uri)";
} else {
Object obj2 = b2.b;
if (obj2 != null) {
Class<?> cls = obj2.getClass();
if (cls == Integer.class) {
intent.putExtra(trim, (Integer) b2.b);
str3 = "int";
} else if (cls == Long.class) {
intent.putExtra(trim, (Long) b2.b);
str3 = "long";
} else if (cls == Float.class) {
intent.putExtra(trim, (Float) b2.b);
str3 = "float";
} else if (cls == Double.class) {
intent.putExtra(trim, (Double) b2.b);
str3 = "double";
} else if (cls == Boolean.class) {
intent.putExtra(trim, (Boolean) b2.b);
str3 = "bool";
}
}
}
}
if (str3 == null) {
intent.putExtra(trim, trim2);
str3 = "string";
}
r7.f("E", "added " + str3 + " extra: " + trim + "/" + trim2);
}
private int y1(int i2, int i3) {
if (i3 == Integer.MAX_VALUE) {
return -3;
}
if (i3 == 0) {
i3 = 1;
}
int i4 = new int[]{19, 20, 21, 22, 23}[i2];
String[] strArr = new String[i3];
for (int i5 = 0; i5 < i3; i5++) {
strArr[i5] = "input keyevent " + i4;
}
return vm.u(true, 8000L, strArr, null, null, false) != 0 ? -3 : -1;
}
private int y2(String str) {
Intent intent = new Intent(this, (Class<?>) ActionEdit.class);
if (str.length() > 0) {
int u2 = a1.u(str);
if (u2 == -1) {
I6(2131887941, str);
} else {
intent.putExtra("actionindex", u2);
}
}
intent.putExtra("raf", ActionEdit.b0.Exe.toString());
intent.addFlags(262144);
C0("Proxy Group");
E7(true, "doQueryAction");
if (U7(intent)) {
return -1;
}
E7(false, "doQueryAction (failed)");
h7("Proxy Group");
return -4;
}
private int y3(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return !b8((cVar.i(4).T(this, bundle) || kh.d(this)) ? 3 : 0, i2, (cVar.i(3).T(this, bundle) ? (int) (((long) 10) + 5) : 10) + this.X.getInt("csnipD", 2), cVar, bundle) ? -3 : -1;
}
public static void y5(Boolean bool) throws Exception {
}
private boolean y6() {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
if (it.next().P2()) {
return true;
}
}
return false;
}
private int y7(java.lang.String r22, java.lang.String r23, java.lang.String r24, java.lang.String r25, boolean r26, int r27, java.lang.String r28, java.lang.String r29, java.lang.String r30, java.io.File r31, android.os.Bundle r32, boolean r33, boolean r34, boolean r35) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.y7(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, int, java.lang.String, java.lang.String, java.lang.String, java.io.File, android.os.Bundle, boolean, boolean, boolean):int");
}
private void y8(String str, String str2, tn tnVar, String str3, boolean z, StructureType structureType) {
kq.X1(this, str, str2, z, tnVar.m(), str3, Integer.valueOf(tnVar.x1()), new Integer[]{Integer.valueOf(tnVar.Y0())}, Integer.valueOf(tnVar.P0()), structureType);
}
private void z0(net.dinglisch.android.taskerm.c cVar, Notification.Builder builder, int i2, boolean z, Bundle bundle) {
PendingIntent pendingIntent;
if (cVar.T0() && yd.f0.h()) {
List<k7> B02 = cVar.B0();
for (int i3 = 0; i3 < B02.size(); i3++) {
k7 k7Var = B02.get(i3);
if (k7Var.l()) {
String str = th.B() + ".ReceiverStaticInternal";
Intent intent = new Intent("net.dinglisch.android.tasker.WIDICKYUM");
intent.setClassName(getPackageName(), str);
if (bundle != null) {
Bundle I = dq.I(bundle, cVar.getName());
kq.d(kq.a1("nbutton", k7Var.e()), null, I);
intent.putExtra("lvars", I);
}
tn X1 = to.X1();
X1.a0(k7Var.d());
intent.putExtra("mcro", X1.U(0).c0());
int i4 = (i2 * 3) + 90000 + i3;
String h2 = com.joaomgcd.taskerm.util.f1.h(intent, true);
if (h2 != null) {
builder.setDeleteIntent(new hg.i(this, h2).d());
}
intent.setData(Uri.fromParts(ExecuteService.class.getSimpleName(), Integer.toString(i4), null));
pendingIntent = PendingIntent.getBroadcast(this, i4, intent, com.joaomgcd.taskerm.util.k8.g(134217728, intent));
} else {
pendingIntent = null;
}
net.dinglisch.android.taskerm.g icon = k7Var.getIcon();
yd.f0.a(builder, (icon == null || icon.g0() || xl.r().equals(icon.getName())) ? 0 : Kid.b(this) ? icon.J(this, th.B()) : icon.I(this), k7Var.n() ? kq.Q(this, k7Var.e(), false, false, true, false, null, bundle) : null, pendingIntent);
if (z) {
builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), 2131231379));
}
}
}
}
private int z1(java.lang.String r9, net.dinglisch.android.taskerm.c r10, android.os.Bundle r11) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.z1(java.lang.String, net.dinglisch.android.taskerm.c, android.os.Bundle):int");
}
private int z2(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (v1.a()) {
return A2(str, cVar, bundle);
}
r7.G("E", str + " no cyanogen quick setting API available");
return -3;
}
private int z3(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return b8(1, i2, 20, cVar, bundle) ? -1 : -3;
}
private tn z4(String str, String str2) {
to u1 = to.u1(this);
if (u1 == null) {
return null;
}
return u1.N(str2);
}
public static void z5(Throwable th2) throws Exception {
}
public void z6(tn tnVar, int i2, int i3, int i4, c.b bVar, SpannableStringBuilder spannableStringBuilder, int i5, int i6, Bundle bundle, net.dinglisch.android.taskerm.c cVar) {
if (bVar == c.b.Err || bVar == c.b.Exception) {
String string = bundle.getString("%err");
String string2 = bundle.getString("%errmsg");
r7.a(this, spannableStringBuilder, 2, "E", vh.g(this, 2131891164, new Object[0]) + ": " + string);
if (string2 != null) {
r7.a(this, spannableStringBuilder, 2, "E", string2);
}
this.Y.E0(tnVar, cVar, bVar, i3, i4, string, string2, spannableStringBuilder);
}
synchronized (this.J) {
try {
Iterator<q> it = this.J.iterator();
while (it.hasNext()) {
it.next().b(i2, i3, i4, bVar, spannableStringBuilder, i5, i6);
}
} catch (Throwable th2) {
throw th2;
}
}
}
private void z7(String str) {
if (a1.p(332)) {
Intent a1 = dq.a1();
a1.setData(Uri.parse(str));
try {
sendBroadcast(a1);
} catch (Exception unused) {
}
}
}
private int z8(WifiManager wifiManager, tn tnVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle, final boolean z) {
if (!com.joaomgcd.taskerm.util.k.j() && !com.joaomgcd.taskerm.util.k.x(this) && !ExtensionsContextKt.M(this)) {
return this.Y.x0(cVar, bundle, tnVar, "Couldn't toggle wifi: ", new xj.l() {
@Override
public final Object invoke(Object obj) {
ji.r X5;
X5 = ExecuteService.this.X5(z, (Context) obj);
return X5;
}
});
}
if (wifiManager.setWifiEnabled(z)) {
F8(wifiManager, z ? 3 : 1, false);
return -5;
}
r7.G("E", cVar.K() + ": enable failed");
return -3;
}
public int A4(String str) {
return B4().getInt(str, -1);
}
public void C0(String str) {
D0(str, Integer.MAX_VALUE);
}
public String E4(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return kq.R(this, cVar.N(i2).w(), false, true, true, false, null, bundle, false);
}
public void E6(String str, String str2, boolean z) {
tn tnVar;
net.dinglisch.android.taskerm.c H02;
File file;
r7.f("E", "onUtteranceCompleted: " + str + " id: " + str2 + " err: " + z);
synchronized (r0) {
try {
if (this.x != null) {
r7.f("E", "TTS shutdown");
kq.C(this, 76);
if (this.A != null) {
file = new File(this.A.toString() + ".save");
this.A.renameTo(file);
} else {
file = null;
}
if (Settings.f3(this)) {
this.Y.Y0(this.x);
}
this.x = null;
if (file != null) {
file.renameTo(this.A);
}
}
this.A = null;
w0();
} catch (Throwable th2) {
throw th2;
}
}
if (z && (tnVar = this.M.get("Speech Group")) != null && (H02 = tnVar.H0()) != null) {
tnVar.T1(tnVar.H0(), getString(2131891270));
if (H02.G1()) {
tnVar.o2(true);
}
}
h7("Speech Group");
}
public String F4(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return kq.N(this, cVar.N(i2).w(), bundle);
}
public void F7() {
synchronized (x0) {
try {
x0.clear();
y0.clear();
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.u()) {
String name = next.getName();
x0.add(name);
if (next.O2()) {
y0.add(name);
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
this.Y.F0(y0);
kq.F1(this, 77);
}
public String G4(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, vo.a aVar) {
return kq.O(this, cVar.N(i2).w(), bundle, aVar);
}
public void I6(int i2, Object... objArr) {
L6(true, vh.g(this, i2, new Object[0]), objArr);
}
public void I7(int i2, boolean z) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
next.C2(z);
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
public void J7(int i2, boolean z) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
next.K2(z);
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
public boolean N0(java.io.File r19, java.lang.String r20, boolean r21, boolean r22, boolean r23, boolean r24, boolean r25) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.N0(java.io.File, java.lang.String, boolean, boolean, boolean, boolean, boolean):boolean");
}
public boolean N3(long j2) {
return O3(j2, null);
}
public File N4(String str, String str2, boolean z, boolean z2, boolean z3) {
return O4(str, str2, true, false, z, z2, z3);
}
public void N6(int i2, Object... objArr) {
O6(vh.g(this, i2, new Object[0]), objArr);
}
public boolean O3(long j2, tn tnVar) {
try {
synchronized (this) {
try {
if (j2 > 0) {
if (j2 >= 100) {
l6("wait for " + j2 + "ms", tnVar);
}
wait(j2);
if (j2 >= 100) {
l6("wait finished", tnVar);
}
} else {
l6("No need to wait for " + j2 + "ms", tnVar);
}
} finally {
}
}
return true;
} catch (InterruptedException unused) {
l6("wait int", tnVar);
return !this.I.booleanValue();
} catch (Exception unused2) {
l6("wait e", tnVar);
return !this.I.booleanValue();
}
}
public File O4(String str, String str2, boolean z, boolean z2, boolean z3, boolean z4, boolean z5) {
File l7 = l7(str2, str, z);
if (l7 == null || N0(l7, str2, z, z2, z3, z4, z5)) {
return l7;
}
return null;
}
public int R4(int i2) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
return next.I0();
}
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
public int S4(int i2) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
return next.N0();
}
}
return 0;
} catch (Throwable th2) {
throw th2;
}
}
}
public void T0() {
t4().edit().clear().commit();
}
public int T4(int i2) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
return next.J0();
}
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
public void U0() {
B4().edit().clear().commit();
}
public int U4(int i2) {
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (it.hasNext()) {
tn next = it.next();
if (next.K0() == i2) {
return next.P0();
}
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
public boolean U7(Intent intent) {
return V7(intent, true);
}
public c.b[] V4(int i2, int i3) {
c.b[] bVarArr;
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
while (true) {
if (!it.hasNext()) {
bVarArr = null;
break;
}
tn next = it.next();
if (next.K0() == i2) {
bVarArr = next.C0(i3);
break;
}
}
} catch (Throwable th2) {
throw th2;
}
}
return bVarArr;
}
public void V6() {
synchronized (this.G) {
try {
boolean z = false;
for (int size = this.G.size() - 1; size >= 0; size--) {
tn tnVar = this.G.get(size);
if (tnVar.K1()) {
r7.f("E", "remove finished task from q: " + tnVar.Z0());
this.G.remove(size);
RunLog.Q0(this, this.X, tnVar.x0(2) ? tn.e.ExitErr : tn.e.ExitOK, tnVar);
e7(tnVar);
L7();
F0(this, tnVar.Z0(), tnVar.e1(), !tnVar.x0(2));
C6(tnVar.K0(), tnVar.N0());
z = true;
}
}
if (z) {
F7();
}
} catch (Throwable th2) {
throw th2;
}
}
}
public boolean V7(Intent intent, boolean z) {
return W7(intent, z, false);
}
public boolean W7(Intent intent, boolean z, boolean z2) {
intent.addFlags(268435456);
intent.addFlags(4);
intent.addFlags(536870912);
if (z) {
intent.addFlags(8388608);
}
return dq.m3(this, intent, z2);
}
public boolean X4(boolean z, int i2) {
return W4(z ? 1 : 0, i2) == 1;
}
public List<Integer> Y5(int i2, boolean z) {
LinkedList linkedList;
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
linkedList = null;
while (it.hasNext()) {
tn next = it.next();
if (!z && next.K1()) {
}
if ((next.N0() & i2) > 0) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(Integer.valueOf(next.K0()));
}
}
} catch (Throwable th2) {
throw th2;
}
}
return linkedList;
}
public void b4(tn tnVar) {
r7.f("E", "end wait stuff " + tnVar.Z0() + "/" + tnVar.K0());
if (tnVar.u()) {
n8(tnVar.getName(), false);
}
if (tnVar.H0().j() == 123) {
vm.x(tnVar.K0());
}
}
public String b5(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return Z4(this, cVar, i2, bundle);
}
public String c5(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, boolean z) {
return a5(this, cVar, i2, bundle, z);
}
public void d7(q qVar) {
synchronized (this.J) {
int i2 = 0;
while (true) {
try {
if (i2 >= this.J.size()) {
break;
}
if (this.J.get(i2) == qVar) {
this.J.remove(i2);
break;
}
i2++;
} catch (Throwable th2) {
throw th2;
}
}
}
}
public int f3(int i2, int i3, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
AudioManager audioManager = (AudioManager) oi.d(this, "audio", "E", "doSetVol");
if (i2 == Integer.MAX_VALUE) {
return -3;
}
if (audioManager == null) {
I6(2131887705, new Object[0]);
return -3;
}
if (audioManager.getStreamVolume(i3) != i2) {
boolean T = cVar.i(1).T(this, bundle);
int i4 = T;
if (cVar.i(2).T(this, bundle)) {
i4 = (T ? 1 : 0) | 4;
}
try {
audioManager.setStreamVolume(i3, i2, i4);
dq.K2(this, i3);
} catch (SecurityException unused) {
r7.G("E", "no service interface, notification access service enabled in Android settings?");
this.Y.L0(cVar.j(), new hg.g0(this));
return -3;
}
}
return -1;
}
public void f7(int i2) {
t4().edit().remove(String.valueOf(i2)).commit();
}
public void g7(String str) {
B4().edit().remove(str).commit();
}
public void h7(String str) {
synchronized (this.G) {
i7(str);
}
}
public boolean j4(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return cVar.i(i2).T(this, bundle);
}
public int l4(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return k4(this, cVar, i2, true, true, bundle);
}
public void M5(Intent intent, int i2) {
synchronized (this.G) {
try {
com.joaomgcd.taskerm.util.f1.e(intent);
Boolean bool = Boolean.FALSE;
this.I = bool;
v0 = bool;
r7.f("E", "++++ on start, ID: " + i2);
if (intent == null) {
r7.f("E", "onStart: null intent");
} else {
String action = intent.getAction();
if (action != null && action.equals("net.dinglisch.android.tasker.WILLYUM")) {
r7.f("E", "got wait alarm ");
w5();
} else if (action != null && action.equals("net.dinglisch.android.tasker.RECCY")) {
p5(intent);
} else if (action != null && action.equals("net.dinglisch.android.tasker.ACTION_PLUGIN_FINISHED")) {
l5(intent);
} else if (action != null && action.equals(K0)) {
this.Y.G0(this.G);
}
if (action == null || !action.equals(L0)) {
Bundle extras = intent.getExtras();
if (extras == null) {
r7.f("E", "onStart: null extras");
} else {
j5(extras, true);
}
} else {
int intExtra = intent.getIntExtra(M0, -1);
this.Y.H0(this.G, intExtra == -1 ? null : Integer.valueOf(intExtra));
}
}
if (this.G.size() == 0) {
if (a()) {
r7.f("E", "queue empty but not stopping, have bound client(s)");
} else {
r7.f("E", "onStart: queue empty, stop self " + i2);
if (p8(i2)) {
r7.f("E", "nothing waiting set timeToLeave");
this.I = Boolean.TRUE;
} else {
r7.f("E", "onStart: queue empty but not stopping, new intent waiting");
}
}
}
this.H = i2;
r7.f("E", "onstart done: " + i2);
} catch (Throwable th2) {
throw th2;
}
}
}
@Override
public void onCreate() {
com.joaomgcd.taskerm.util.p.t(this, "E");
super.onCreate();
r7.f("E", "oncreate");
yc.d.c(this, this.Y.v(), to.v1(this), this.G);
SharedPreferences R0 = dq.R0(this);
this.X = R0;
RunLog.M0(this, R0, RunLog.i.Start);
U1(new Runnable() {
@Override
public final void run() {
r7.f("E", "------------------ EXECUTE ASYNC STARTUP COMPLETE -----------------");
}
}, "onCreate");
}
@Override
public void onDestroy() {
r7.f("E", "ondestroy");
a4(false);
RunLog.M0(this, dq.R0(this), RunLog.i.Stop);
vm.w();
if (j1.r()) {
j1.b();
}
v5();
k8();
this.J.clear();
this.Y.J();
super.onDestroy();
I0(null, "onDestroy");
if (Kid.b(this) && to.u1(this).b2() == 0 && wl.B() == 0 && kq.i1() == 0) {
r7.f("E", "onDestroy: disable monitor, not needed");
MonitorService.z8(this, true);
}
synchronized (v0) {
try {
if (v0.booleanValue()) {
r7.f("E", "not releasing wakelock, service start pending");
} else {
zq.k(this, "E");
}
} catch (Throwable th2) {
throw th2;
}
}
r7.f("E", "destroyed");
}
@Override
public void onError(MediaRecorder mediaRecorder, int i2, int i3) {
N6(2131887965, new Object[0]);
synchronized (F0) {
try {
MediaRecorder mediaRecorder2 = E0;
if (mediaRecorder2 != null) {
mediaRecorder2.release();
E0 = null;
}
} catch (Throwable th2) {
throw th2;
}
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
r7.G("E", "low memory reported");
synchronized (C0) {
try {
if (i0 != null) {
R0();
System.gc();
r7.G("E", "low mem, cleared music dir records");
}
} catch (Throwable th2) {
throw th2;
}
}
}
@Override
public void onStart(Intent intent, int i2) {
o5(intent, i2);
}
@Override
public int onStartCommand(Intent intent, int i2, int i3) {
o5(intent, i3);
return 3;
}
public int r4(net.dinglisch.android.taskerm.c cVar, int i2) {
return cVar.x(i2).v();
}
public String s4(int i2) {
return t4().getString(String.valueOf(i2), null);
}
public boolean s5(int i2) {
return t4().contains(String.valueOf(i2));
}
public void s8(int i2, boolean z, boolean z2) {
boolean z3;
synchronized (this.G) {
try {
Iterator<tn> it = this.G.iterator();
z3 = false;
while (it.hasNext()) {
tn next = it.next();
if (next.J0() == i2) {
r7.f("E", "task " + next.K0() + ": in group " + i2 + ", finish");
next.o2(z);
z3 = true;
}
}
} catch (Throwable th2) {
throw th2;
}
}
if (z2 && z3) {
w5();
}
}
public boolean t5(String str) {
return B4().contains(str);
}
public void t8(int i2, String str) {
t4().edit().putString(String.valueOf(i2), str).commit();
}
public void u8(String str, int i2) {
B4().edit().putInt(str, i2).commit();
}
public boolean w5() {
synchronized (this.I) {
try {
if (this.I.booleanValue()) {
r7.f("E", "kick workthread: ignoring, time to leave");
return false;
}
if (this.K == null) {
r7.f("E", "kick workthread: ignoring, null");
return false;
}
synchronized (this) {
Thread.State o1 = dq.o1(this.K);
if (o1 != null && !o1.equals(Thread.State.TIMED_WAITING)) {
r7.f("E", "kick workthread: ignoring, thread state not null or timed wait: " + o1);
return false;
}
this.K.interrupt();
r7.f("E", "interruped workthread: " + o1);
return true;
}
} catch (Throwable th2) {
throw th2;
}
}
}
public boolean w6(net.dinglisch.android.taskerm.xd r35, int r36, net.dinglisch.android.taskerm.wd.a r37, java.lang.String r38, int r39) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.w6(net.dinglisch.android.taskerm.xd, int, net.dinglisch.android.taskerm.wd$a, java.lang.String, int):boolean");
}
public void x0(q qVar) {
synchronized (this.J) {
this.J.add(qVar);
}
}
public boolean x5(tn tnVar) {
int i2 = 0;
while (i2 < 100) {
if (w5()) {
r7.f("E", "kicked workthread after " + i2 + " retries");
return true;
}
i2++;
O3(10L, tnVar);
}
l6("Couldn't kick work thread after " + i2 + " retries", tnVar);
return false;
}
public String y4(File file, String str, int i2) {
String Q0 = dq.Q0(getContentResolver(), MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "_data", file.toString(), str);
return (i2 == -1 || !TextUtils.isEmpty(Q0)) ? Q0 : vh.g(this, i2, new Object[0]);
}
}