ComeetChat v1.866866806590版本的 MD5 值为:4a7461802cd62adce19de75377dd7ca7
以下内容为反编译后的 ExecuteService.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.ActivityInfo;
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.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.Icon;
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.ExifInterface;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.media.MediaScannerConnection;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.net.VpnService;
import android.net.wifi.WifiManager;
import android.os.Build;
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.CallLog;
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 android.widget.Toast;
import androidx.core.app.NotificationCompat;
import com.android.internal.telephony.ITelephony;
import com.google.android.gms.maps.g;
import com.joaomgcd.taskerm.call.AcceptCallActivity;
import com.joaomgcd.taskerm.helper.n;
import com.joaomgcd.taskerm.plugin.ServicePluginFinished;
import com.joaomgcd.taskerm.structuredoutput.StructureType;
import com.joaomgcd.taskerservercommon.ConstantsCommonTaskerServer;
import cyanogenmod.app.CMStatusBarManager;
import cyanogenmod.app.CustomTile;
import cyanogenmod.app.ProfileManager;
import cyanogenmod.os.Build;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.lang.Thread;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.SocketException;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
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.danlew.android.joda.R;
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.at;
import net.dinglisch.android.taskerm.bg;
import net.dinglisch.android.taskerm.bu;
import net.dinglisch.android.taskerm.bw;
import net.dinglisch.android.taskerm.c;
import net.dinglisch.android.taskerm.cr;
import net.dinglisch.android.taskerm.di;
import net.dinglisch.android.taskerm.dt;
import net.dinglisch.android.taskerm.eh;
import net.dinglisch.android.taskerm.et;
import net.dinglisch.android.taskerm.eu;
import net.dinglisch.android.taskerm.ft;
import net.dinglisch.android.taskerm.fw;
import net.dinglisch.android.taskerm.fy;
import net.dinglisch.android.taskerm.ga;
import net.dinglisch.android.taskerm.gd;
import net.dinglisch.android.taskerm.hh;
import net.dinglisch.android.taskerm.n;
import org.jsoup.helper.HttpConnection;
public class ExecuteService extends MyService implements MediaRecorder.OnErrorListener {
private static volatile f J;
private static volatile Bundle K;
private static File k;
private static List<File> l;
private static int m;
private static boolean n;
private static boolean o;
private static int r;
private long M;
private volatile int P;
private Handler ai;
private Handler aj;
private Handler ak;
private SharedPreferences an;
private b.a.b ap;
public Handler f11021b;
public Handler f11022c;
private static final int[] f11018e = {87, 85, 88, 85, 86, 85, 89, 90};
private static final Object f11019f = new Object();
private static Object g = new Object();
private static volatile Bitmap h = null;
private static volatile boolean i = false;
private static Object j = new Object();
private static Pattern p = null;
private static Pattern q = null;
private static Map<File, Integer> s = new HashMap();
private static Object t = new Object();
private static Object u = new Object();
private static LocationListener v = null;
private static LocationListener w = null;
private static Boolean x = new Boolean(false);
private static volatile Set<String> y = new HashSet();
private static Set<String> z = new HashSet();
private static int A = -1;
private static volatile HashMap<String, MediaPlayer> B = new HashMap<>();
private static volatile MediaPlayer C = null;
private static final Object D = new Object();
private static final Object E = new Object();
private static MediaRecorder F = null;
private static final Object G = new Object();
private static Object H = new Object();
private static volatile boolean I = false;
private static c.f.a.b<com.joaomgcd.taskerm.notification.aw, c.s> aq = null;
private PendingIntent L = null;
private BroadcastReceiver N = null;
private int O = 1;
private TextToSpeech Q = null;
private long R = -1;
private AudioManager.OnAudioFocusChangeListener S = null;
private File T = null;
private boolean U = false;
private boolean V = false;
private boolean W = false;
private Location X = null;
private int Y = 0;
public com.joaomgcd.taskerm.util.dk f11020a = new com.joaomgcd.taskerm.util.dk();
private int Z = 0;
private Boolean aa = false;
private List<a> ab = new ArrayList();
private d ac = null;
private volatile Set<String> ad = new HashSet();
private Map<String, ft> ae = new HashMap();
private Map<String, Long> af = new HashMap();
private int ag = -1;
private long ah = 0;
private Handler al = null;
private HashMap<Integer, bf> am = new HashMap<>();
public com.joaomgcd.taskerm.helper.n f11023d = new com.joaomgcd.taskerm.helper.n(this);
private Runnable ao = new Runnable() {
@Override
public void run() {
int i2;
ft ftVar;
Exception exc;
ap apVar;
boolean z2;
boolean z3;
c.a aVar;
boolean contains;
boolean z4;
Exception exc2;
ft ftVar2;
Bundle c2;
boolean z5;
int i3;
c.a aVar2;
boolean z6;
boolean z7;
Throwable th;
boolean z8;
Exception exc3;
bo.b("E", "run");
boolean z9 = true;
boolean z10 = false;
int i4 = 0;
int i5 = 0;
while (!z10 && !ExecuteService.this.aa.booleanValue()) {
int i6 = ExecuteService.this.Z;
int i7 = i4 + 1;
if (i4 > 500) {
try {
ExecuteService.this.A();
i7 = 0;
} catch (Exception e2) {
exc3 = e2;
i2 = i6;
ExecuteService.this.a(z9 ? 1 : 0, "ttl: " + ExecuteService.this.aa, exc3);
ExecuteService.this.t();
i4 = i7;
ftVar = null;
if (ftVar == null) {
}
synchronized (ExecuteService.this.f11020a) {
}
}
}
ExecuteService.this.B();
synchronized (ExecuteService.this.f11020a) {
try {
ftVar = ExecuteService.this.C();
i2 = ExecuteService.this.Z;
} catch (Throwable th2) {
th = th2;
i2 = i6;
}
try {
} catch (Throwable th3) {
th = th3;
Throwable th4 = th;
try {
throw th4;
} catch (Exception e3) {
exc3 = e3;
ExecuteService.this.a(z9 ? 1 : 0, "ttl: " + ExecuteService.this.aa, exc3);
ExecuteService.this.t();
i4 = i7;
ftVar = null;
if (ftVar == null) {
}
synchronized (ExecuteService.this.f11020a) {
}
}
}
}
i4 = i7;
if (ftVar == null) {
bo.b("E", "nothing chosen, check exit");
try {
} catch (Exception e4) {
e = e4;
z7 = z10;
}
if (ExecuteService.this.ad.isEmpty()) {
if (ExecuteService.this.N()) {
if (ExecuteService.this.M()) {
if (ExecuteService.this.w() == 0) {
bo.b("E", "exe sync stoplock");
synchronized (ExecuteService.f11019f) {
try {
bo.b("E", "exe insync stoplock");
z7 = ExecuteService.this.h(ExecuteService.this.Z);
} catch (Throwable th5) {
th = th5;
z7 = z10;
}
try {
bo.b("E", "stopSelf: " + ExecuteService.this.Z + " alldone: " + z7 + " eqtimes: " + i5);
if (z7) {
z8 = false;
} else {
i5++;
if (i5 > 5) {
ExecuteService.this.ac.f11050b = z9;
bo.b("E", "no intents arrived for half a second, stop");
try {
} catch (Throwable th6) {
th = th6;
z7 = true;
throw th;
}
} else {
z8 = true;
}
}
} catch (Throwable th7) {
th = th7;
th = th;
throw th;
}
}
try {
bo.b("E", "exe postsync stoplock");
if (z8) {
ExecuteService.this.a(100L);
}
} catch (Exception e5) {
e = e5;
ExecuteService.this.a(10, "checkExit", e);
z10 = z7;
synchronized (ExecuteService.this.f11020a) {
}
}
z10 = z7;
} else {
bo.b("E", "something in queue but nothing chosen, wait a bit");
ExecuteService.this.a(300L);
}
} else {
bo.b("E", "Fix (continued) not finished, wait a little");
ExecuteService.this.a(1000L);
}
} else {
bo.b("E", "TTS (continued) not finished, wait a little");
ExecuteService.this.a(200L);
}
} else {
ExecuteService.this.W();
}
} else {
bo.b("E", "execute task: " + ftVar.ah());
if (ftVar.ab() == 0) {
ftVar.a(System.currentTimeMillis());
}
ftVar.a("%qtime", Integer.toString(ftVar.ad()));
int M = ftVar.M();
ftVar.a("%tasker_current_action_number", Integer.toString(M + 1));
net.dinglisch.android.taskerm.c L = ftVar.L();
c.a aVar3 = L.s() ? c.a.OK : c.a.Disabled;
try {
try {
ExecuteService.this.a(ftVar.an(), M, L.i(), ftVar.X());
bo.a(Thread.currentThread().getId(), L.L());
apVar = ExecuteService.this.a(ftVar, L, M, i2);
try {
} catch (Exception e6) {
exc = e6;
RunLog.a(ExecuteService.this, ExecuteService.this.an, ftVar, M, L, apVar == null ? null : apVar.f12023b, c.a.Exception);
ExecuteService.this.a(5, "call", exc);
if (!ExecuteService.a()) {
ExecuteService.this.d("Proxy Group");
}
if (ftVar != null) {
ftVar.e(z9);
}
ftVar.a(M, c.a.Exception);
ExecuteService.this.a(ftVar, ftVar.an(), M, L.i(), c.a.Exception, L.K(), ftVar.X(), ftVar.M(), ftVar.r(), L);
bo.a();
i5 = 0;
synchronized (ExecuteService.this.f11020a) {
}
}
} catch (Throwable th8) {
bo.a();
throw th8;
}
} catch (Exception e7) {
exc = e7;
apVar = null;
}
switch (apVar.f12022a) {
case -7:
bo.b("E", "result: condition failure");
ftVar.Z();
aVar3 = c.a.IfFail;
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
int i8 = apVar.f12024c.i();
if (ftVar.V()) {
bo.b("E", "skipping substitute action " + i8 + ", would ruin tracking");
} else {
bo.b("E", "insert substitute action " + i8);
ftVar.a(apVar.f12024c, ftVar.M());
}
} else if (apVar.f12025d != null) {
ft ftVar3 = apVar.f12025d;
boolean z11 = ftVar3.H() >= ftVar.H();
Intent b2 = ExecuteService.b(ExecuteService.this, ftVar3, ftVar.V() ? 8 : 0, ftVar.ao(), -1, null, gx.b(ftVar.r()), ft.a(ftVar, "task"), ftVar3.q() ? ftVar3.r() : null);
synchronized (ExecuteService.this.f11020a) {
ft a2 = ExecuteService.this.a(b2.getExtras(), false);
if (a2 == null) {
bo.b("E", "child rejected");
ftVar.e(z9);
aVar3 = c.a.Err;
} else if (z11) {
bo.b("E", "child accepted, exe ID " + a2.an());
ftVar.m(a2.an());
a2.b(ftVar.ac());
}
}
}
aVar = aVar3;
if (z2) {
RunLog.a(ExecuteService.this, ExecuteService.this.an, ftVar, M, L, apVar.f12023b, aVar);
}
boolean z12 = apVar.f12022a != -2;
if (aVar != c.a.Disabled) {
if (aVar != c.a.OK || apVar.f12022a != -1 || z3) {
ftVar.r(aVar == c.a.OK ? 0 : 1);
}
if (!z12 && ftVar.P()) {
if (ftVar.M() < ftVar.aj()) {
ftVar.c(z9);
}
}
}
synchronized (ExecuteService.this.ad) {
contains = ExecuteService.this.ae.values().contains(ftVar);
}
if (!contains && !z12) {
ftVar.a(M, aVar);
ExecuteService.this.a(ftVar, ftVar.an(), M, L.i(), aVar, L.K(), ftVar.X(), ftVar.M(), ftVar.r(), L);
}
bo.a();
i5 = 0;
break;
case -6:
ExecuteService.this.a(ftVar, 39, -1, 40, true);
ftVar.Z();
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
case -5:
bo.b("E", "result: ok (ignore wait)");
ftVar.Z();
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
case -4:
bo.b("E", "result: stop task no error");
ftVar.e(false);
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
case -3:
bo.b("E", "result: stop task (error)");
if (L.t()) {
aVar3 = c.a.Err;
ftVar.e(z9);
} else {
bo.b("E", "action has continue-on-error set");
ftVar.r(z9 ? 1 : 0);
ftVar.Z();
aVar3 = c.a.ErrIgnore;
}
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
case -2:
bo.b("E", "result: do again");
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
case -1:
String a3 = n.a(ExecuteService.this, L, ftVar.r(), ftVar.an());
synchronized (ExecuteService.this.ad) {
if (a3 != null) {
if (!ExecuteService.this.ad.contains(a3)) {
boolean z13 = (a3.startsWith("JSI") || a3.startsWith("EasyAction") || a3.startsWith("KillApp") || a3.startsWith("AccessibilityGlobal") || n.s(L.i())) ? false : true;
bo.b("E", z13, "no wait data for " + a3 + ", " + (" task: " + ftVar.ah() + " action: " + ftVar.M()));
ftVar.Z();
z2 = true;
} else {
bo.b("E", "add wait task");
ExecuteService.this.ae.put(a3, ftVar);
z2 = false;
}
z3 = false;
} else {
try {
bo.b("E", "no wait key, next action");
ftVar.Z();
z2 = true;
z3 = true;
} finally {
}
}
}
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
default:
int M2 = ftVar.M();
int i9 = apVar.f12022a;
bo.b("E", "goto: " + M2 + " -> " + i9);
if (i9 < M2) {
while (M2 > i9) {
ftVar.d(M2).G();
M2--;
}
net.dinglisch.android.taskerm.c d2 = ftVar.d(i9);
if (d2.i() != 39) {
d2.E();
}
}
ftVar.i(i9);
z2 = true;
z3 = false;
if (apVar.f12024c == null) {
}
aVar = aVar3;
if (z2) {
}
if (apVar.f12022a != -2) {
}
if (aVar != c.a.Disabled) {
}
synchronized (ExecuteService.this.ad) {
}
break;
}
}
synchronized (ExecuteService.this.f11020a) {
if (ExecuteService.this.ae != null) {
if (ExecuteService.this.ae.size() > 0) {
Object[] array = ExecuteService.this.ae.keySet().toArray();
int length = array.length;
int i10 = 0;
while (i10 < length) {
String str = (String) array[i10];
try {
ftVar2 = (ft) ExecuteService.this.ae.get(str);
} catch (Exception e8) {
e = e8;
z4 = z10;
}
if (ftVar2 != null) {
if (ExecuteService.this.i(str)) {
try {
bo.b("E", "still waiting for " + str + ": " + ftVar2.ah());
} catch (Exception e9) {
exc2 = e9;
z4 = z10;
}
} else {
bo.b("E", "finished waiting for " + str + " (task " + ftVar2.ah() + ")");
int M3 = ftVar2.M();
net.dinglisch.android.taskerm.c L2 = ftVar2.L();
int i11 = L2 == null ? 0 : L2.i();
if (!n.e(str) && !n.s(i11) && !n.B(i11)) {
ftVar2.r(0);
}
c.a e10 = (L2 == null || L2.e() == null) ? c.a.OK : L2.e();
if (str.startsWith("Scene Group ")) {
try {
c2 = ew.c(str.replaceFirst(Pattern.quote("Scene Group "), ""));
} catch (Exception e11) {
e = e11;
z4 = z10;
}
if (c2 != null && c2.containsKey("%hide_reason")) {
String string = c2.getString("%hide_reason");
StringBuilder sb = new StringBuilder();
z4 = z10;
try {
sb.append("hide reason: ");
sb.append(string);
bo.b("E", sb.toString());
if (string != null && (string.equals("back") || string.equals("cancel"))) {
bo.b("E", str + " ended with back/cancel, stop task");
ftVar2.e(false);
} else if (string.equals("accept")) {
bo.b("E", str + " ended with accept pressed");
if (str.equals(n.i())) {
if (c2.containsKey("%value")) {
String string2 = c2.getString("%value");
String c3 = ftVar2.L().j(1).c();
fq.b(c3);
fq.a(c3, string2, ExecuteService.this.an);
}
} else if (str.equals(n.k())) {
if (ftVar2.L().h(3).b()) {
ExecuteService.b(ftVar2.L().j(1).c());
}
} else if (str.equals(n.j()) && c2.containsKey("%value")) {
String string3 = c2.getString("%value");
String a4 = ExecuteService.this.a(ftVar2.L(), 1, ftVar2.r());
if (a4 != null) {
gx.a((Context) ExecuteService.this, a4, string3, true, ftVar2.r(), "qWait");
}
}
}
gx.a(ftVar2.r());
ftVar2.Z();
if (str.equals("Proxy Group")) {
aVar2 = e10;
z5 = true;
} else {
try {
synchronized (ExecuteService.H) {
try {
bo.b("E", "proxy result: " + ExecuteService.J);
if (ExecuteService.J != f.Cancelled) {
try {
if (ExecuteService.J != f.Error) {
if (ExecuteService.J != f.NeedRestart) {
if (ExecuteService.K != null) {
ftVar2.b(ExecuteService.K);
}
} else {
if (ftVar2.W()) {
ftVar2.Q();
}
ftVar2.aa();
z5 = false;
}
} else {
if (L2 == null || L2.t()) {
i3 = 1;
ftVar2.e(true);
} else {
i3 = 1;
}
e10 = c.a.Err;
ftVar2.r(i3);
}
} catch (Throwable th9) {
th = th9;
Throwable th10 = th;
try {
try {
} catch (Throwable th11) {
th = th11;
Throwable th102 = th;
throw th102;
}
throw th102;
} catch (Exception e12) {
e = e12;
exc2 = e;
ExecuteService.this.a(9, "waitloop/" + str, exc2);
i10++;
z10 = z4;
}
}
} else {
try {
ftVar2.e(false);
e10 = c.a.Err;
ftVar2.r(1);
} catch (Throwable th12) {
}
}
z5 = true;
} catch (Throwable th13) {
th = th13;
}
}
aVar2 = e10;
} catch (Exception e13) {
e = e13;
}
}
ExecuteService.this.ae.remove(str);
if (L2 == null) {
try {
RunLog.a(ExecuteService.this, ExecuteService.this.an, ftVar2, M3, L2, ftVar2.ah(), aVar2);
} catch (Exception e14) {
e = e14;
exc2 = e;
ExecuteService.this.a(9, "waitloop/" + str, exc2);
i10++;
z10 = z4;
}
}
if (!z5) {
ExecuteService.this.a(ftVar2, ftVar2.an(), M3, i11, aVar2, L2.K(), ftVar2.X(), M3 + 1, ftVar2.r(), L2);
}
} catch (Exception e15) {
e = e15;
exc2 = e;
ExecuteService.this.a(9, "waitloop/" + str, exc2);
i10++;
z10 = z4;
}
i10++;
z10 = z4;
}
}
z4 = z10;
gx.a(ftVar2.r());
ftVar2.Z();
if (str.equals("Proxy Group")) {
}
ExecuteService.this.ae.remove(str);
if (L2 == null) {
}
if (!z5) {
}
i10++;
z10 = z4;
}
ExecuteService.this.a(9, "waitloop/" + str, exc2);
i10++;
z10 = z4;
}
z4 = z10;
i10++;
z10 = z4;
}
}
} else {
bo.c("E", "null wait tasks");
}
z6 = z10;
}
z10 = z6;
z9 = true;
}
ExecuteService.this.u();
bo.b("E", "run: exited");
}
};
private boolean ar = false;
public interface a {
void a(int i, int i2);
void a(int i, int i2, int i3);
void a(int i, int i2, int i3, int i4);
void a(int i, int i2, int i3, c.a aVar, SpannableStringBuilder spannableStringBuilder, int i4, int i5);
}
public enum f {
None,
Cancelled,
Error,
NeedRestart
}
public static void a(Boolean bool) throws Exception {
}
public static void a(Throwable th) throws Exception {
}
private String p(String str) {
return str;
}
static int r(ExecuteService executeService) {
int i2 = executeService.Y;
executeService.Y = i2 + 1;
return i2;
}
public static void a(Context context, Intent intent) {
synchronized (x) {
x = true;
hf.a(context, "E", true, false);
try {
com.joaomgcd.taskerm.util.aa.a(intent);
context.startService(intent);
} catch (Exception e2) {
bo.a("E", "startService", e2);
x = false;
}
}
}
public static boolean a(Context context, String str) {
return a(context, str, (Bundle) null);
}
public static boolean a(Context context, String str, String str2, String str3) {
return a(context, str, str2, str3, (String) null);
}
public static boolean a(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(ft.b(1), str2);
bundle2.putString(ft.b(2), str3);
if (!TextUtils.isEmpty(str4)) {
bundle2.putString("%caller1", str4);
}
bundle = bundle2;
}
return a(context, str, bundle);
}
public static boolean a(Context context, String str, Bundle bundle) {
ft i2;
if (str == null || (i2 = fy.e(context).i(str)) == null) {
return false;
}
i2.g(1000);
a(context, i2, bundle);
return true;
}
public static void a(Context context, ft ftVar) {
a(context, ftVar, (Bundle) null);
}
public static void a(Context context, ft ftVar, Bundle bundle) {
if (bundle == null) {
bundle = new Bundle();
}
Bundle bundle2 = bundle;
String string = bundle2.getString("%caller1");
a(context, ftVar, 1, -1, -1, -1, -1, (String) null, (List<String>) null, !TextUtils.isEmpty(string) ? string : "launch", bundle2);
}
public static void a(Context context, ft ftVar, int i2, int i3, int i4, int i5, String str, List<String> list, String str2, Bundle bundle) {
a(context, ftVar, i2, i3, i4, i5, -1, str, list, str2, bundle);
}
public static void a(Context context, ft ftVar, int i2, int i3, int i4, int i5, int i6, String str, List<String> list, String str2, Bundle bundle) {
a(context, b(context, ftVar, i2, i4, i5, i6, str, list, str2, bundle));
}
public static Intent b(Context context, ft ftVar, int i2, int i3, int i4, String str, List<String> list, String str2, Bundle bundle) {
return b(context, ftVar, i2, i3, i4, -1, str, list, str2, bundle);
}
private static Intent b(Context context, ft ftVar, int i2, int i3, int i4, int i5, String str, List<String> list, String str2, Bundle bundle) {
if (bundle != null && com.joaomgcd.taskerm.util.g.p()) {
bundle = bundle.deepCopy();
}
Intent intent = new Intent(context, (Class<?>) ExecuteService.class);
if (str2 != null || list != null) {
if (bundle == null) {
bundle = new Bundle();
}
gx.a(str2, list, bundle);
}
intent.putExtra("mcro", ftVar.a(0).c());
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 static void a(Context context, ft ftVar, List<String> list, String str, boolean z2) {
a(context, ftVar, z2 ? 1 : 0, -1, -1, -1, (String) null, list, str, (Bundle) null);
}
public static void a(Context context, net.dinglisch.android.taskerm.c[] cVarArr, int i2, boolean z2) {
a(context, cVarArr, i2, z2, (List<String>) null, (String) null, (Bundle) null, (String) null);
}
public static void a(Context context, net.dinglisch.android.taskerm.c[] cVarArr, boolean z2) {
a(context, cVarArr, 5, z2, (List<String>) null, (String) null, (Bundle) null, (String) null);
}
public static void a(Context context, net.dinglisch.android.taskerm.c[] cVarArr, int i2, boolean z2, List<String> list, String str, Bundle bundle, String str2) {
ft d2 = fy.d();
d2.g(i2 + 0);
for (int i3 = 0; i3 < cVarArr.length; i3++) {
net.dinglisch.android.taskerm.c cVar = cVarArr[i3];
if (cVar == null) {
bo.d("E", "lass: skipping null action index " + i3);
} else {
d2.a(cVar);
}
}
if (d2.E() > 0) {
a(context, d2, z2 ? 1 : 0, -1, -1, -1, str2, list, str, bundle);
} else {
bo.d("E", "lass: no actions to execute");
}
}
public static boolean a() {
boolean z2;
synchronized (H) {
z2 = I;
}
return z2;
}
private static void a(boolean z2, String str) {
synchronized (H) {
I = z2;
}
bo.b("E", "set proxy: " + z2 + " (" + str + ")");
}
public static void a(Context context) {
a(context, f.None, (Bundle) null);
}
public static void a(Context context, f fVar, Bundle bundle) {
synchronized (H) {
bo.b("E", "signalProxyExit, result: " + fVar.toString());
J = fVar;
K = bundle;
a(false, "signalProxyExit");
}
}
private static void b(boolean z2) {
if (F != null) {
F.reset();
if (z2) {
F.release();
F = null;
}
}
}
private static void a(Context context, boolean z2, String str) {
if (C != null) {
bo.b("E", "stopMediaPlayer: " + str);
if (C.isPlaying()) {
C.stop();
}
if (z2) {
C.release();
C = null;
} else {
C.reset();
}
gx.f(context);
}
}
private static int a(Context context, net.dinglisch.android.taskerm.c cVar, int i2, boolean z2, boolean z3, Bundle bundle) {
int g2;
int j2;
net.dinglisch.android.taskerm.h g3 = cVar.g(i2);
if (g3.e()) {
int b2 = g3.b(context, bundle);
if (b2 == Integer.MAX_VALUE) {
bo.d("E", "var " + g3.f() + ": non-numeric or extreme value");
return b2;
}
int i3 = cVar.i();
if (z2 && b2 < (j2 = n.j(i3, i2))) {
bo.d("E", "action " + cVar.n() + ": param " + i2 + "var: " + g3.f() + ": value " + b2 + " too small, min is " + j2);
b2 = Integer.MAX_VALUE;
}
if (!z3 || b2 <= (g2 = n.g(i3, i2)) || i3 == 810) {
return b2;
}
bo.d("E", "action " + cVar.n() + ": param " + i2 + "var: " + g3.f() + ": value " + b2 + " too large, max is " + g2);
return Integer.MAX_VALUE;
}
return g3.h();
}
public static void b(Context context) {
synchronized (D) {
a(context, true, "stopRunningActions");
}
synchronized (G) {
b(true);
}
synchronized (B) {
Iterator<MediaPlayer> it = B.values().iterator();
while (it.hasNext()) {
b(it.next());
}
B.clear();
}
MyVpnService.a(context);
}
private static void b(MediaPlayer mediaPlayer) {
if (mediaPlayer != null) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.release();
}
}
public static synchronized int a(Context context, net.dinglisch.android.taskerm.c cVar, boolean z2, Bundle bundle, ft ftVar) {
int i2;
int a2;
Long valueOf;
Integer num;
Integer[] numArr;
Integer num2;
Double g2;
synchronized (ExecuteService.class) {
int i3 = cVar.i();
String a3 = a(context, cVar, 0, bundle);
i2 = -3;
if (a3 != null) {
long j2 = 0L;
if (gx.e(context, a3, bundle)) {
String d2 = gx.d(context, a3, bundle);
if (d2.length() > 0) {
if (d2.indexOf(bj.a()) != -1 && (g2 = gs.g(d2)) != null) {
d2 = String.valueOf(Math.round(g2.doubleValue()));
}
j2 = gs.e(d2);
}
}
Long l2 = j2;
if (l2 != null && (a2 = a(context, cVar, 1, false, false, bundle)) != Integer.MAX_VALUE) {
long a4 = a(context, cVar, 2, false, false, bundle);
if (i3 == 890) {
valueOf = Long.valueOf(l2.longValue() - a2);
if (a4 > 0 && valueOf.longValue() < 0) {
valueOf = Long.valueOf(a4 - ((0 - valueOf.longValue()) % a4));
}
} else {
if (a4 == 0) {
a4 = Long.MAX_VALUE;
}
valueOf = Long.valueOf((l2.longValue() + a2) % a4);
}
if (ftVar != null) {
num = Integer.valueOf(ftVar.ay());
num2 = Integer.valueOf(ftVar.G());
numArr = new Integer[]{Integer.valueOf(ftVar.w())};
} else {
num = null;
numArr = null;
num2 = null;
}
gx.a(context, a3, Long.toString(valueOf.longValue()), z2, bundle, "incdec", num, numArr, num2);
i2 = -1;
}
}
}
return i2;
}
public static String a(Context context, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a(context, cVar, i2, bundle, false);
}
public static String a(Context context, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, boolean z2) {
String c2 = cVar.j(i2).c();
String n2 = cVar.n();
String a2 = gx.a(context, c2, bundle, true, n2);
if (a2 != null) {
a2 = gx.b(context, a2, bundle, "exe/gvna");
}
if (!z2 && gy.b(a2)) {
bo.c("E", "Can't write values to variable structure " + a2);
return null;
}
bo.a("E", a2 == null, n2 + ": " + c2 + " -> " + a2);
return a2;
}
public static synchronized int a(Context context, String str, net.dinglisch.android.taskerm.c cVar, boolean z2, Bundle bundle, ft ftVar) {
int i2;
synchronized (ExecuteService.class) {
String a2 = a(context, cVar, 0, bundle);
String str2 = null;
if (a2 != null) {
boolean b2 = cVar.h(2).b();
int i3 = 3;
boolean b3 = cVar.h(3).b();
int a3 = a(context, cVar, 5, false, false, bundle);
try {
if (a3 == 0) {
net.dinglisch.android.taskerm.h g2 = cVar.g(5);
String b4 = gx.b(context, g2.j(), bundle);
if (g2.g()) {
if (!"0".equals(b4)) {
}
}
String c2 = cVar.j(1).c();
int i4 = i3;
String a4 = gx.a(context, c2, b3, false, true, b2, (ga.a) null, bundle);
if (b3) {
Double a5 = as.a(a4, true, "dsv/" + str + "/" + c2, i4);
if (a5 != null) {
a4 = gs.a(a5.doubleValue(), i4).replace((char) 8722, '-');
}
}
str2 = a4;
}
String a42 = gx.a(context, c2, b3, false, true, b2, (ga.a) null, bundle);
if (b3) {
}
str2 = a42;
} catch (OutOfMemoryError unused) {
bo.d("E", str + ": oom");
}
i3 = a3;
String c22 = cVar.j(1).c();
int i42 = i3;
}
String str3 = str2;
if (str3 != null) {
try {
if (cVar.h(4).b() && gx.e(context, a2, bundle)) {
str3 = gx.d(context, a2, bundle) + str3;
}
String str4 = str3;
gx.a(context, a2, str4, z2, bundle, str, com.joaomgcd.taskerm.structuredoutput.c.a(cVar));
if (ftVar != null) {
com.joaomgcd.taskerm.util.an.a(fy.e(context), ftVar, a2, str4);
}
i2 = -1;
} catch (OutOfMemoryError unused2) {
bo.d("E", str + ": oom");
}
}
i2 = -3;
}
return i2;
}
public static Intent c(Context context) {
Intent intent = new Intent(context, (Class<?>) ReceiverStaticAlwaysOn.class);
intent.setAction("net.dinglisch.android.tasker.WILLYUM");
return intent;
}
public static void a(Context context, String str, String str2, boolean z2) {
Intent intent = new Intent("net.dinglisch.android.tasker.ACTION_TASK_COMPLETE");
intent.setData(Uri.fromParts("task", str, null));
intent.putExtra("success", z2);
if (str2 != null) {
intent.putExtra("output", hi.a(str2));
com.joaomgcd.taskerm.util.aa.a(intent, false, false);
}
context.sendBroadcast(intent);
}
public static List<String> b() {
ArrayList<String> b2;
synchronized (z) {
b2 = gs.b(z);
}
return b2;
}
public static String c() {
StringBuilder sb = new StringBuilder();
synchronized (z) {
if (z.size() > 0) {
sb.append(",");
}
Iterator<String> it = z.iterator();
while (it.hasNext()) {
sb.append(it.next());
sb.append(",");
}
}
return sb.toString();
}
public static String a(Context context, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return a(context, i2, cVar, bundle, true);
}
public static String a(Context context, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle, boolean z2) {
try {
if (cVar.h() <= i2 || cVar.m(i2) != 1) {
return null;
}
return z2 ? gx.b(context, cVar.j(i2).c(), bundle) : cVar.j(i2).c();
} catch (Throwable th) {
bo.b("E", "can't get variable", th);
return null;
}
}
public static boolean a(String str) {
boolean contains;
synchronized (y) {
contains = y.contains(str);
}
return contains;
}
public static void d() {
synchronized (y) {
y.clear();
}
}
public static void b(String str) {
synchronized (y) {
y.add(str);
}
}
public static Bitmap a(boolean z2) {
Bitmap bitmap;
synchronized (g) {
if (z2) {
try {
i = true;
} catch (Throwable th) {
throw th;
}
}
bitmap = h;
}
return bitmap;
}
public static boolean e() {
boolean z2;
synchronized (g) {
z2 = h != null;
}
return z2;
}
public static String c(int i2, String str) {
StringBuilder sb = new StringBuilder();
if (str == null) {
str = "";
}
sb.append(str);
sb.append("\n");
sb.append(i2);
return sb.toString();
}
@Override
public void onCreate() {
com.joaomgcd.taskerm.util.h.a(this, "E");
super.onCreate();
bo.b("E", "oncreate");
com.joaomgcd.a.b.a.a.a(this, this.f11023d.A(), fy.c(this), this.f11020a);
this.an = gs.g(this);
RunLog.b(this, this.an, RunLog.c.Start);
a(new Runnable() {
@Override
public final void run() {
bo.b("E", "------------------ EXECUTE ASYNC STARTUP COMPLETE -----------------");
}
}, "onCreate");
}
private synchronized b.a.b q() {
if (this.ap == null) {
this.ap = com.joaomgcd.taskerm.util.al.d(this).g().b(com.joaomgcd.taskerm.rx.h.f8693a).c(r()).d();
}
return this.ap;
}
private void a(Runnable runnable, String str) {
bo.b("E", "Doing in background after init execute: " + str);
this.f11023d.a(q().a(com.joaomgcd.taskerm.rx.h.f8693a), runnable);
}
private b.a.b r() {
return com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
ExecuteService.this.ac();
}
});
}
public void ac() {
if (t.a()) {
t.b();
}
cy.a(this, "E");
bj.b(getBaseContext());
this.ak = new h(this);
if (gs.t()) {
this.al = new c(this);
}
this.f11022c = new b(this);
this.f11021b = new i(this);
this.ai = new g(this);
this.aj = new e();
if (bw.c.d() && Settings.o(this)) {
d(true);
}
this.f11023d.n();
}
@Override
public void onDestroy() {
bo.b("E", "ondestroy");
d(false);
RunLog.b(this, gs.g(this), RunLog.c.Stop);
fd.a();
if (t.a()) {
t.d();
}
s();
Z();
this.ab.clear();
this.f11023d.b();
super.onDestroy();
b((AlarmManager) null, "onDestroy");
if (Kid.a(this) && fy.e(this).y() == 0 && ew.a() == 0 && gx.e() == 0) {
bo.b("E", "onDestroy: disable monitor, not needed");
MonitorService.b((Context) this, true);
}
synchronized (x) {
if (x.booleanValue()) {
bo.b("E", "not releasing wakelock, service start pending");
} else {
hf.c(this, "E");
}
}
bo.b("E", "destroyed");
}
public void f() {
synchronized (this.aa) {
if (this.aa.booleanValue()) {
bo.b("E", "kick workthread: ignoring, time to leave");
} else if (this.ac == null) {
bo.b("E", "kick workthread: ignoring, null");
} else {
synchronized (this) {
Thread.State a2 = gs.a((Thread) this.ac);
if (a2 != null && !a2.equals(Thread.State.TIMED_WAITING)) {
bo.b("E", "kick workthread: ignoring, thread state not null or timed wait");
}
this.ac.interrupt();
}
}
}
}
public final void s() {
synchronized (this.aa) {
bo.b("E", "join: set timeToLeave");
this.aa = true;
if (this.ac == null) {
bo.b("E", "joinWorkThread: null, maybe it was never created");
} else {
this.ac.interrupt();
Thread.State a2 = gs.a((Thread) this.ac);
if (a2 != null && (a2.equals(Thread.State.BLOCKED) || a2.equals(Thread.State.WAITING) || a2.equals(Thread.State.TIMED_WAITING))) {
bo.b("E", "workthread blocked, try again in 500ms");
new Handler().postDelayed(new Runnable() {
@Override
public final void run() {
ExecuteService.this.s();
}
}, 500L);
} else {
while (this.ac != null) {
try {
bo.b("E", "join");
this.ac.join();
bo.b("E", "joined");
this.ac = null;
} catch (InterruptedException unused) {
bo.b("E", "interrupted during thread join");
}
}
}
}
}
}
@Override
public void onStart(Intent intent, int i2) {
b(intent, i2);
}
@Override
public int onStartCommand(Intent intent, int i2, int i3) {
b(intent, i3);
return 3;
}
private void a(ft ftVar, ft.b bVar) {
RunLog.a(this, this.an, bVar, ftVar);
if (v()) {
b("Not running task \"" + ftVar.ah() + "\": " + bVar.a(this), new Object[0]);
}
}
private void b(final Intent intent, final int i2) {
a(new Runnable() {
@Override
public final void run() {
ExecuteService.this.c(intent, i2);
}
}, "handleStartAfterInit");
}
public void c(Intent intent, int i2) {
synchronized (this.f11020a) {
com.joaomgcd.taskerm.util.aa.b(intent);
this.aa = false;
x = false;
bo.b("E", "++++ on start, ID: " + i2);
if (intent == null) {
bo.b("E", "onStart: null intent");
} else {
String action = intent.getAction();
if (action != null && action.equals("net.dinglisch.android.tasker.WILLYUM")) {
bo.b("E", "got wait alarm ");
f();
} else if (action != null && action.equals("net.dinglisch.android.tasker.RECCY")) {
b(intent);
} else if (action != null && action.equals("net.dinglisch.android.tasker.ACTION_PLUGIN_FINISHED")) {
c(intent);
} else {
Bundle extras = intent.getExtras();
if (extras == null) {
bo.b("E", "onStart: null extras");
} else {
a(extras, true);
}
}
}
if (this.f11020a.size() == 0) {
if (v()) {
bo.b("E", "queue empty but not stopping, have bound client(s)");
} else {
bo.b("E", "onStart: queue empty, stop self " + i2);
if (h(i2)) {
bo.b("E", "nothing waiting set timeToLeave");
this.aa = true;
} else {
bo.b("E", "onStart: queue empty but not stopping, new intent waiting");
}
}
}
this.Z = i2;
bo.b("E", "onstart done: " + i2);
}
}
public ft a(Bundle bundle, boolean z2) {
Set<String> set;
Bundle b2;
Bundle bundle2 = bundle.getBundle("mcro");
if (bundle2 == null) {
bo.b("E", "handleNewTask: null task bundle");
return null;
}
ft ftVar = new ft(new dh(bundle2));
int i2 = bundle == null ? 0 : bundle.getInt("flags", 0);
int i3 = bundle == null ? -1 : bundle.getInt("gid", -1);
bo.b("E", "handleNewTask: fromUI: " + z2);
if ((i2 & 1) == 0 && !MonitorService.a((Context) this)) {
b(R.string.msg_tasker_disabled, new Object[0]);
a(ftVar, ft.b.RejOff);
return null;
}
if (ftVar.I() == 0 && a(ftVar, false)) {
bo.b("E", "onStart: ignoring new abort-type task " + ftVar.ah() + ", already in queue");
bo.b("E", ftVar.b(getResources()));
a(ftVar, ft.b.RejCopy);
try {
a(ftVar.G(), ftVar.an(), 16);
e(ftVar.an(), ftVar.X());
return null;
} catch (Throwable unused) {
bo.b("E", "Could notify action finished on rejected task");
return null;
}
}
if (ftVar.E() == 0) {
bo.c("E", "onStart: ignoring no-actions task " + ftVar.ah());
bo.b("E", ftVar.b(getResources()));
RunLog.a(this, this.an, ft.b.RejBad, ftVar);
a(ftVar, ft.b.RejBad);
return null;
}
if (!ftVar.ai()) {
bo.c("E", "onStart: ignoring task with mismatched elses" + ftVar.ah());
a(ftVar, ft.b.RejBad);
return null;
}
if (!ftVar.g(true)) {
bo.c("E", "onStart: ignoring overlapping-blocks task " + ftVar.ah());
a(ftVar, ft.b.RejBad);
return null;
}
ftVar.b(System.currentTimeMillis());
if (ftVar.I() == 1 && a(ftVar, true)) {
bo.b("E", "onStart: replaced existing task " + ftVar.ah());
}
if (this.f11020a.size() >= this.an.getInt("mqt", 10)) {
b(R.string.fi_tasks_queued, Integer.valueOf(this.f11020a.size()), ftVar.ah());
x();
a(ftVar, ft.b.RejMaxQ);
return null;
}
int i4 = this.O;
this.O = i4 + 1;
ftVar.p(i4);
if (i3 == -1) {
i3 = i4;
}
ftVar.q(i3);
if ((i2 & 2) > 0) {
ftVar.R();
}
if ((i2 & 4) > 0) {
ftVar.S();
}
if ((i2 & 16) > 0) {
ftVar.d(true);
}
if ((i2 & 8) > 0) {
ftVar.T();
}
if (bundle.containsKey("ppi")) {
ftVar.c(bundle.getInt("ppi"));
}
if (bundle.containsKey("ppri")) {
ftVar.t(bundle.getInt("ppri"));
}
if (bo.j()) {
bo.b("E", "got task " + ftVar.ah() + " pID: " + ftVar.w() + " exeID " + i4 + " Pri: " + ftVar.H() + " " + ftVar.a(getResources(), false));
}
ftVar.i(0);
ftVar.j(2);
if (bundle.containsKey("sc") && (b2 = ew.b(bundle.getString("sc"))) != null) {
ftVar.b(b2);
}
if (bundle.containsKey("lvars")) {
Bundle bundle3 = bundle.getBundle("lvars");
if (bundle3 == null) {
bo.d("E", "ignoring LOCAL_VARS extra with null bundle");
} else {
try {
set = bundle3.keySet();
} catch (IllegalArgumentException e2) {
bo.b("E", "handleNewTask/localVars", e2);
set = null;
if (set != null) {
}
ftVar.a("%priority", String.valueOf(ftVar.H()));
this.f11023d.c(ftVar);
this.f11023d.d(ftVar);
this.f11020a.add(ftVar);
Q();
z();
x();
RunLog.a(this, this.an, ft.b.Running, ftVar);
bo.b("E", "check work thread, timeToLeave: " + this.aa);
if (z2) {
}
a(ftVar.G(), i4, ftVar.X());
return ftVar;
} catch (Exception e3) {
bo.b("E", "handleNewTask/localVars", e3);
set = null;
if (set != null) {
}
ftVar.a("%priority", String.valueOf(ftVar.H()));
this.f11023d.c(ftVar);
this.f11023d.d(ftVar);
this.f11020a.add(ftVar);
Q();
z();
x();
RunLog.a(this, this.an, ft.b.Running, ftVar);
bo.b("E", "check work thread, timeToLeave: " + this.aa);
if (z2) {
}
a(ftVar.G(), i4, ftVar.X());
return ftVar;
}
if (set != null) {
for (String str : set) {
if (str == null) {
bo.d("E", "handleNewTask: ignoring null paramName");
} else if (str.equals("return")) {
ftVar.g(bundle3.getString(str));
} else if (str.equals("allow_child_ovvvreeeww")) {
ftVar.a(Boolean.valueOf(bundle3.getBoolean(str)));
} else if (str.equals("structure_return_var")) {
ftVar.b(Boolean.valueOf(bundle3.getBoolean(str)));
} else if (gy.c(str)) {
int i5 = bundle3.getInt(str);
if (i5 == 0) {
ftVar.b(str);
} else {
ftVar.a(str, i5);
}
} else {
String string = bundle3.getString(str);
if (string == null) {
ftVar.b(str);
} else {
ftVar.a(str, string);
}
}
}
}
}
}
ftVar.a("%priority", String.valueOf(ftVar.H()));
this.f11023d.c(ftVar);
this.f11023d.d(ftVar);
this.f11020a.add(ftVar);
Q();
z();
x();
RunLog.a(this, this.an, ft.b.Running, ftVar);
bo.b("E", "check work thread, timeToLeave: " + this.aa);
if (z2) {
a(ftVar);
}
a(ftVar.G(), i4, ftVar.X());
return ftVar;
}
private void a(ft ftVar) {
synchronized (this.aa) {
if (!this.aa.booleanValue()) {
boolean z2 = false;
if (this.ac == null) {
bo.b("E", "workthread null");
z2 = true;
} else {
bo.b("E", "ui sync stoplock");
synchronized (f11019f) {
bo.b("E", "ui insync stoplock");
Thread.State a2 = gs.a((Thread) this.ac);
bo.b("E", "tstate: " + a2);
if (a2 == null) {
bo.d("E", "receive task " + ftVar.ah() + ": t unknown, try join, start new ");
try {
this.ac.join(200L);
} catch (Exception e2) {
bo.a("E", "join exception", (Throwable) e2);
}
z2 = true;
} else {
if (!a2.equals(Thread.State.TERMINATED)) {
if (a2.equals(Thread.State.TIMED_WAITING)) {
this.ac.interrupt();
} else if (a2.equals(Thread.State.WAITING)) {
this.ac.interrupt();
} else if (this.ac.f11050b) {
bo.b("E", "workthread exiting, join");
try {
this.ac.join();
} catch (InterruptedException e3) {
bo.a("E", "join exception", (Throwable) e3);
}
}
}
z2 = true;
}
}
bo.b("E", "ui postsync stoplock");
}
if (z2) {
this.ac = new d(null, this.ao, ExecuteService.class.getSimpleName());
this.ac.setPriority(1);
this.ac.start();
bo.b("E", "started new thread");
}
}
}
}
public void a(int i2, String str, Throwable th) {
a("code " + i2 + ": " + th.toString(), new Object[0]);
StringBuilder sb = new StringBuilder();
sb.append("prefsException/");
sb.append(str);
bo.b("E", sb.toString(), th);
}
public void a(int i2, Object... objArr) {
a(true, ct.a(this, i2, new Object[0]), objArr);
}
private void a(String str, Object... objArr) {
a(true, str, objArr);
}
private void a(boolean z2, int i2, Object... objArr) {
a(z2, ct.a(this, i2, new Object[0]), objArr);
}
private void a(boolean z2, String str, Object... objArr) {
String a2 = gs.a(str + ".", objArr);
if (z2 && this.an.getBoolean("tEnable", true)) {
a(ct.a(this, R.string.word_error, new Object[0]), a2, 1);
}
bo.b("E", z2, a2);
}
public boolean h(int i2) {
boolean stopSelfResult;
synchronized (f11019f) {
stopSelfResult = stopSelfResult(i2);
}
return stopSelfResult;
}
public void b(int i2, Object... objArr) {
b(ct.a(this, i2, new Object[0]), objArr);
}
private void b(String str, Object... objArr) {
String a2 = gs.a(str + ".", objArr);
if (this.an.getBoolean("tEnable", true)) {
a(ct.a(this, R.string.word_warning, new Object[0]), a2, 0);
}
bo.d("E", a2);
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, int i2, String str2, int i3, Bundle bundle) {
if (cVar.i() == 129) {
}
String scriptFromAction = bf.getScriptFromAction(this, cVar, bundle);
String b2 = b(cVar, 1, bundle);
boolean b3 = cVar.h(2).b();
int a2 = a(cVar, 3, true, false, bundle);
if (a2 != Integer.MAX_VALUE && scriptFromAction != null) {
if (!bf.scriptHasDialogs(scriptFromAction)) {
synchronized (this.am) {
Message obtainMessage = this.f11022c.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", b3);
bundle2.putString("l", b2);
bundle2.putInt(bf.EXTRA_ID, i3);
obtainMessage.setData(bundle2);
b(n.J(i3), a2);
this.f11022c.sendMessage(obtainMessage);
}
return -1;
}
if (a(1, i2, a2, cVar, bundle)) {
return -1;
}
}
return -3;
}
private void a(String str, String str2, int i2) {
Message obtainMessage = this.f11021b.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.f11021b.sendMessage(obtainMessage);
gr.a(this, 20000L);
}
public void t() {
synchronized (this.f11020a) {
this.f11020a.clear();
Q();
}
}
public void u() {
bo.b("E", "exe thread tidy up");
a(true, true, true, true);
a("exeThreadTidy", (String) null, false);
if (this.aa.booleanValue()) {
for (String str : this.ad) {
if (str.startsWith("Scene Group ")) {
String substring = str.substring("Scene Group ".length());
bo.b("E", "exeThreadTidyUp: timetoleave, destroy waiting: " + substring);
o(substring);
}
}
}
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
RunLog.a(this, this.an, ft.b.ExitKill, it.next());
}
}
Looper myLooper = Looper.myLooper();
if (myLooper != null) {
myLooper.quit();
}
}
public void c(String str) {
b(str, Integer.MAX_VALUE);
}
public void d(String str) {
synchronized (this.f11020a) {
h(str);
}
}
private void h(String str) {
if (this.af.containsKey(str)) {
l("removeWait: " + str);
this.ad.remove(str);
if (str.equals("Fix Group")) {
return;
}
this.af.remove(str);
}
}
private void b(String str, int i2) {
l("add wait type " + str + " time " + i2);
if (this.ad.contains(str)) {
bo.d("E", "already waiting for " + str);
} else {
this.ad.add(str);
this.af.put(str, Long.valueOf(n(i2)));
}
l("add wait type " + str + " done");
}
public boolean i(String str) {
bo.b("E", "stillWaiting: test " + str);
synchronized (this.ad) {
if (!this.ad.contains(str)) {
return false;
}
if (System.currentTimeMillis() > this.af.get(str).longValue()) {
bo.b("E", "wait timeout type " + str);
d(str);
if (str.equals("Proxy Group")) {
a(false, "stillWaiting");
} else if (str.equals("Voice Group")) {
gx.a(this, 92);
} else if (n.f(str)) {
bo.b("E", "plugin timeout, key " + str);
ft ftVar = this.ae.get(str);
if (ftVar != null) {
net.dinglisch.android.taskerm.c L = ftVar.L();
if (L.t()) {
ftVar.e(true);
L.a(c.a.Err);
ftVar.r(2);
ftVar.c(getString(R.string.plugin_timeout_error));
} else {
ftVar.r(2);
ftVar.a("%errmsg", "timeout");
L.a(c.a.ErrIgnore);
}
}
} else if (str.startsWith("JSI")) {
int parseInt = Integer.parseInt(str.substring("JSI".length()));
bo.b("E", "jsi timeout, id " + parseInt);
ft ftVar2 = this.ae.get(str);
net.dinglisch.android.taskerm.c L2 = ftVar2.L();
if (L2.t()) {
ftVar2.e(true);
L2.a(c.a.Err);
} else {
L2.a(c.a.ErrIgnore);
}
ftVar2.r(2);
bf.sendMessageWithID(this.f11022c, 3, parseInt);
} else if (str.equals(n.e())) {
o(ex.h());
} else if (str.equals(n.i())) {
o(ex.b());
} else if (str.equals(n.f())) {
o(ex.f());
} else if (str.equals(n.g())) {
o(ex.e());
} else if (str.equals(n.h())) {
o(ex.d());
} else if (str.equals(n.j())) {
dt d2 = ew.d(ex.g());
if (d2 != null) {
d2.n("TextEdit1");
}
o(ex.g());
}
}
if (str.equals("Proxy Group")) {
if (!a()) {
d(str);
}
} else if (str.equals("Speech Group")) {
synchronized (t) {
if (this.Q == null || (System.currentTimeMillis() - this.R > 5000 && !this.Q.isSpeaking())) {
a("stillWaiting", (String) null, false);
}
}
} else if (str.equals("Fix Group")) {
M();
} else if (str.equals(n.e())) {
if (!ew.a(ex.h())) {
d(str);
}
} else if (str.equals(n.f())) {
if (!ew.a(ex.f())) {
d(str);
}
} else if (str.equals(n.g())) {
if (!ew.a(ex.e())) {
d(str);
}
} else if (str.equals(n.j())) {
if (!ew.a(ex.g())) {
d(str);
}
} else if (str.equals(n.h())) {
if (!ew.a(ex.d())) {
d(str);
}
} else if (str.equals(n.i())) {
if (!ew.a(ex.b())) {
d(str);
}
} else if (str.startsWith("Shell")) {
if (fd.c(Integer.parseInt(str.substring("Shell".length())))) {
e(this.ae.get(str));
d(str);
}
} else if (str.startsWith("Scene Group ")) {
String substring = str.substring("Scene Group ".length());
if (!ew.a(substring) || (!ew.e(substring) && ew.f(substring) > 2000)) {
d(str);
}
}
return this.ad.contains(str);
}
}
public int w() {
int size;
synchronized (this.f11020a) {
size = this.f11020a.size();
}
return size;
}
private void x() {
for (int i2 = 0; i2 < this.f11020a.size(); i2++) {
ft ftVar = this.f11020a.get(i2);
StringBuilder sb = new StringBuilder();
sb.append("q");
sb.append(Integer.toString(i2));
sb.append(": id: ");
sb.append(ftVar.G());
sb.append(ftVar.n() ? " n: " + ftVar.m() : "");
sb.append(" eid: ");
sb.append(ftVar.an());
sb.append(" gid: ");
sb.append(ftVar.ao());
sb.append(" p: ");
sb.append(ftVar.H());
sb.append(ftVar.O() ? "P" : "");
sb.append(" a: ");
sb.append(ftVar.M());
sb.append(" qt: ");
sb.append(ftVar.ad());
sb.append(ftVar.a(getResources(), 3, true));
bo.b("E", sb.toString());
}
}
private boolean a(ft ftVar, boolean z2) {
int G2 = ftVar.G();
boolean n2 = ftVar.n();
String m2 = n2 ? ftVar.m() : null;
for (int i2 = 0; i2 < this.f11020a.size(); i2++) {
ft ftVar2 = this.f11020a.get(i2);
if (!ftVar2.W() && ((G2 == ftVar2.G() && !fy.b(G2)) || (n2 && ftVar2.n() && ftVar2.m().equals(m2)))) {
if (z2) {
this.f11020a.c(i2);
RunLog.a(this, this.an, ft.b.ExitRep, ftVar2);
Q();
z();
e(ftVar2.an(), ftVar2.X());
}
return true;
}
}
return false;
}
private boolean y() {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
if (it.next().ae()) {
return true;
}
}
return false;
}
private void z() {
if (hf.a("E")) {
hf.b(this, "E", !y());
}
}
public void A() {
synchronized (this.f11020a) {
LinkedList linkedList = null;
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.O() && next.N() > 600000) {
if (linkedList == null) {
linkedList = new LinkedList();
}
bo.b("E", "task" + next.an() + ", paused > 600000");
linkedList.add(Integer.valueOf(next.ao()));
}
}
if (!gs.a((Collection<?>) linkedList)) {
Iterator it2 = linkedList.iterator();
while (it2.hasNext()) {
a(((Integer) it2.next()).intValue(), true, false);
}
}
}
}
private void c(boolean z2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
it.next().e(z2);
}
}
}
public void B() {
synchronized (this.f11020a) {
boolean z2 = false;
for (int size = this.f11020a.size() - 1; size >= 0; size--) {
ft ftVar = this.f11020a.get(size);
if (ftVar.W()) {
bo.b("E", "remove finished task from q: " + ftVar.ah());
this.f11020a.c(size);
RunLog.a(this, this.an, ftVar.l(2) ? ft.b.ExitErr : ft.b.ExitOK, ftVar);
c(ftVar);
z();
a(this, ftVar.ah(), ftVar.av(), !ftVar.l(2));
e(ftVar.an(), ftVar.X());
z2 = true;
}
}
if (z2) {
Q();
}
}
}
public ft C() {
int i2;
int i3;
String a2;
if (this.f11020a.size() <= 0) {
return null;
}
HashMap hashMap = new HashMap();
int O = O();
HashMap hashMap2 = new HashMap();
Iterator<ft> it = this.f11020a.iterator();
while (true) {
i2 = -1;
if (!it.hasNext()) {
break;
}
ft next = it.next();
if (!next.O()) {
hashMap2.put(Integer.valueOf(next.an()), Integer.valueOf(b(next)));
int w2 = next.w();
if (w2 != -1) {
long longValue = hashMap.containsKey(Integer.valueOf(w2)) ? ((Long) hashMap.get(Integer.valueOf(w2))).longValue() : Long.MAX_VALUE;
long ac = next.ac();
if (ac < longValue) {
hashMap.put(Integer.valueOf(w2), Long.valueOf(ac));
}
}
}
}
long j2 = Long.MAX_VALUE;
int i4 = 0;
int i5 = -1;
int i6 = -1;
while (true) {
if (i4 >= 2) {
i3 = -1;
break;
}
int size = this.f11020a.size() - 1;
while (size >= 0) {
ft ftVar = this.f11020a.get(size);
if (!ftVar.O()) {
int w3 = ftVar.w();
net.dinglisch.android.taskerm.c L = ftVar.L();
int i7 = L.i();
int i8 = ((i7 == 30 || i7 == 35) && L.s()) ? 1 : 0;
int H2 = ftVar.H();
if (w3 != i2 && ftVar.ac() > ((Long) hashMap.get(Integer.valueOf(w3))).longValue()) {
bo.b("E", "qc: reject: earlier received from same profile id (" + w3 + ") in queue " + ftVar.ah());
} else if (ftVar.am() && ((Integer) hashMap2.get(Integer.valueOf(ftVar.an()))).intValue() >= H2) {
bo.b("E", "qc: REJ: have higher pri child " + ftVar.ah());
} else if (i4 == i8) {
if (i4 == 0) {
if (H2 > i6 && H2 >= O && (((a2 = n.a(this, L, ftVar.r(), ftVar.an())) == null || !a2.equals("Speech Group") || this.Q == null || !this.ad.contains("Speech Group")) && ((a2 == null || !a2.equals("Fix Group") || (!this.U && !this.V)) && (a2 == null || !this.ae.containsKey(a2))))) {
i5 = size;
i6 = H2;
}
} else {
long c2 = c(ftVar.L(), ftVar.r());
if (c2 >= j2) {
bo.b("E", "qc: REJ: wait: not lowest " + ftVar.ah());
} else {
bo.b("E", "qc: ACC: wait: " + c2 + "ms " + ftVar.ah());
i5 = size;
j2 = c2;
}
}
}
}
size--;
i2 = -1;
}
i3 = -1;
if (i5 != -1) {
break;
}
i4++;
i2 = -1;
}
if (i5 == i3) {
return null;
}
if (i6 <= 1051) {
try {
this.f11020a.add(0, this.f11020a.c(i5));
i5 = 0;
} catch (Exception e2) {
bo.b("E", "choosingQueueTaskA", e2);
}
}
try {
return this.f11020a.get(i5);
} catch (Exception e3) {
bo.b("E", "choosingQueueTaskB", e3);
return null;
}
}
private int b(ft ftVar) {
int i2 = -1;
if (ftVar.am()) {
Set<Integer> al = ftVar.al();
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (al.contains(Integer.valueOf(next.an())) && next.H() > i2) {
i2 = next.H();
}
}
}
return i2;
}
public int a(int i2, int i3, net.dinglisch.android.taskerm.c cVar) {
AudioManager audioManager = (AudioManager) df.a(this, "audio", "E", "doSetVol");
if (i2 == Integer.MAX_VALUE) {
return -3;
}
if (audioManager == null) {
a(R.string.err_no_audio_manager, new Object[0]);
return -3;
}
if (audioManager.getStreamVolume(i3) != i2) {
boolean b2 = cVar.h(1).b();
boolean b3 = cVar.h(2).b();
int i4 = b2 ? 1 : 0;
if (b3) {
i4 |= 4;
}
try {
audioManager.setStreamVolume(i3, i2, i4);
gs.b(this, i3);
} catch (SecurityException unused) {
bo.d("E", "no service interface, notification access service enabled in Android settings?");
this.f11023d.a(cVar.i(), new com.joaomgcd.taskerm.notification.ae(this));
return -3;
}
}
return -1;
}
private void a(String str, Intent intent, String str2, gt gtVar, Bundle bundle) {
String[] split = str2.split(ConstantsCommonTaskerServer.ID_SEPARATOR, 2);
if (split.length == 2) {
String trim = split[0].trim();
String trim2 = split[1].trim();
if (TextUtils.isEmpty(trim) || TextUtils.isEmpty(trim2)) {
bo.c("E", "action/component intent: empty extra key/val");
return;
}
String str3 = null;
bg.a((Context) this);
bg.c a2 = bg.a((Context) null, trim2, bg.a.Obj, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, str);
if (a2 != null) {
if (a2.f12197b != null && !a2.f12199d) {
String name = a2.f12197b.getClass().getName();
bo.b("E", "attempt to put java object as parcelable (class " + name + ")");
try {
intent.putExtra(trim, (Parcelable) a2.f12197b);
str3 = "parcelable(" + name + ")";
} catch (Exception unused) {
bo.d("E", str + ": Java object extra: class " + name + " not parcelable");
}
}
if (a2.h != null) {
trim2 = a2.h;
}
}
if (a2.f12196a != null) {
if (Uri.class.getName().equals(a2.f12196a)) {
trim2 = a2.h;
intent.putExtra(trim, Uri.parse(trim2));
str3 = "parcelable(uri)";
} else if (a2.f12197b != null) {
Class<?> cls = a2.f12197b.getClass();
if (cls == Integer.class) {
intent.putExtra(trim, (Integer) a2.f12197b);
str3 = "int";
} else if (cls == Long.class) {
intent.putExtra(trim, (Long) a2.f12197b);
str3 = "long";
} else if (cls == Float.class) {
intent.putExtra(trim, (Float) a2.f12197b);
str3 = "float";
} else if (cls == Double.class) {
intent.putExtra(trim, (Double) a2.f12197b);
str3 = "double";
} else if (cls == Boolean.class) {
intent.putExtra(trim, (Boolean) a2.f12197b);
str3 = "bool";
}
}
}
if (str3 == null) {
intent.putExtra(trim, trim2);
str3 = "string";
}
bo.b("E", "added " + str3 + " extra: " + trim + "/" + trim2);
return;
}
bo.d("E", "ignoring bad extra format: " + str2);
}
private boolean a(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, ap apVar) {
Set<String> a2 = gs.a((Context) this, cVar.a((Context) this, (HashMap<String, List<String>>) null, false).keySet());
if (a2 != null) {
if (a2.contains("android.permission.WRITE_SETTINGS") && bq.a()) {
if (bq.a(this)) {
a2.remove("android.permission.WRITE_SETTINGS");
} else {
bo.b("E", str + ": missing 'modify system settings' permission, start proxy");
this.f11023d.a(new String[]{"android.permission.WRITE_SETTINGS"});
apVar.f12022a = -3;
return true;
}
}
if (a2.contains("android.permission.SYSTEM_ALERT_WINDOW") && bq.c()) {
if (bq.d(this)) {
a2.remove("android.permission.SYSTEM_ALERT_WINDOW");
} else {
bo.b("E", str + ": missing 'draw over other apps' permission, start proxy");
if (a(4, ftVar.H(), 20, cVar, ftVar.r())) {
cVar.b(2);
apVar.f12022a = -1;
} else {
apVar.f12022a = -3;
}
return true;
}
}
if (com.joaomgcd.taskerm.util.g.h() && a2.contains(bq.f12299a) && com.joaomgcd.taskerm.util.ds.c()) {
a2.remove(bq.f12299a);
}
if (a2.size() > 0) {
this.f11023d.a((String[]) a2.toArray(new String[a2.size()]));
ArrayList<String> b2 = gs.b(a2);
ArrayList arrayList = new ArrayList();
Iterator<String> it = b2.iterator();
while (it.hasNext()) {
arrayList.add(com.joaomgcd.taskerm.util.bx.a(it.next(), this));
}
bo.d("E", str + ": don't have permission(s): " + gs.d(arrayList));
apVar.f12022a = -3;
return true;
}
}
this.f11023d.d();
return false;
}
private net.dinglisch.android.taskerm.ap a(net.dinglisch.android.taskerm.c r36, net.dinglisch.android.taskerm.ft r37, int r38, int r39) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ExecuteService.a(net.dinglisch.android.taskerm.c, net.dinglisch.android.taskerm.ft, int, int):net.dinglisch.android.taskerm.ap");
}
public Boolean a(boolean[] zArr, net.dinglisch.android.taskerm.c cVar, ft ftVar, int i2, Integer num) {
boolean z2 = true;
try {
zArr[0] = ew.a(this, a(cVar, 0, ftVar), a(cVar, 1, ftVar), eh.a.values()[i2], a(cVar, 3, ftVar));
} catch (Throwable unused) {
z2 = false;
}
if (!z2) {
bo.b("E", "Need retry setElementMapControl: " + num);
}
return Boolean.valueOf(z2);
}
public Integer a(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, Context context) {
return Integer.valueOf(o(str, cVar, bundle));
}
public Integer a(ft ftVar, net.dinglisch.android.taskerm.c cVar, String str, String str2, Bundle bundle, Context context) {
return a(ftVar, cVar, str, str2, bundle);
}
public Integer a(ft ftVar, String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, Context context) {
return Integer.valueOf(a(ftVar, str, cVar, bundle));
}
public void a(ft ftVar, com.joaomgcd.taskerm.helper.actions.execute.m mVar, net.dinglisch.android.taskerm.c cVar, String str) {
if (this.ar) {
long currentTimeMillis = System.currentTimeMillis();
a("Wait is pending. Waiting for DoingWait", ftVar);
this.f11023d.a(500);
a("Waited " + (System.currentTimeMillis() - currentTimeMillis) + "ms for DoingWait", ftVar);
}
int g2 = mVar.g();
if (g2 == -3) {
cVar.a(c.a.Err);
if (cVar.t()) {
ftVar.e(true);
}
} else if (g2 == -4) {
ftVar.e(false);
}
d(str);
f();
}
private void a(net.dinglisch.android.taskerm.c cVar, ft ftVar, String str, Bundle bundle, String str2, String str3) {
String b2 = b(cVar.j(2).c(), ftVar);
b(cVar.j(3).c(), ftVar);
a(com.joaomgcd.taskerm.util.dr.a(this, str2, str3, b2, false, null), false);
}
public File a(String str, String str2, boolean z2, boolean z3, boolean z4) {
return a(str, str2, true, false, z2, z3, z4);
}
public File a(String str, String str2, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6) {
File b2 = b(str2, str, z2);
if (b2 == null || a(b2, str2, z2, z3, z4, z5, z6)) {
return b2;
}
return null;
}
private File a(String str, String str2) {
return b(str, str2, true);
}
private File b(String str, String str2, boolean z2) {
File h2 = gs.h();
if (h2 == null) {
a(z2, R.string.fi_no_sd, str);
} else if (str2.length() == 0) {
a(z2, R.string.fi_need_path, str);
} else {
if (str2.startsWith(File.separator)) {
return new File(str2);
}
return new File(h2, str2);
}
return null;
}
private boolean a(File file, String str, boolean z2, boolean z3, boolean z4, boolean z5) {
return a(file, str, true, z2, z3, z4, z5);
}
public boolean a(File file, String str, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6) {
boolean z7;
boolean exists;
boolean isFile;
boolean isDirectory;
boolean z8 = false;
if (file != null) {
bo.b("E", "checkSDPath: " + file + " useRoot: " + z3 + " there: " + z4 + " file: " + z5 + " dir: " + z6);
if (!z3) {
if (at.a((Context) this, file, false, str + "/checkSDPath")) {
z7 = true;
bo.b("E", str + ": checkSDPath: " + file + " useDocFile: " + z7);
ae aeVar = null;
if (z7) {
if (!com.joaomgcd.taskerm.util.dq.c(file, this)) {
a(z2, R.string.fi_not_external_storage, str, file);
return false;
}
if (!at.a((Context) this, file, true, false)) {
bo.b("E", "checkSDPath: no df read access for " + file);
return true;
}
aeVar = at.b(this, file, "checkSDPath", z6);
}
if (!z3) {
} else if (!z7) {
exists = file.exists();
}
if (exists) {
if (z4) {
a(z2, R.string.fi_file_not_found, str, file);
z8 = false;
}
z8 = true;
} else {
if (z3) {
StringBuilder sb = new StringBuilder();
sb.append("test -f ");
sb.append(gs.o(file.toString()));
isFile = fd.a(true, 3000L, sb.toString(), true) == 0;
} else if (z7) {
isFile = aeVar.f();
} else {
isFile = file.isFile();
}
if (!isFile || z5) {
if (z3) {
StringBuilder sb2 = new StringBuilder();
sb2.append("test -d ");
sb2.append(gs.o(file.toString()));
isDirectory = fd.a(true, 3000L, sb2.toString(), true) == 0;
} else if (z7) {
isDirectory = aeVar.e();
} else {
isDirectory = file.isDirectory();
}
if (isDirectory && !z6) {
a(z2, R.string.fi_is_dir, str, file);
}
z8 = true;
} else {
a(z2, R.string.fi_not_dir, str, file);
}
z8 = false;
}
}
}
z7 = false;
bo.b("E", str + ": checkSDPath: " + file + " useDocFile: " + z7);
ae aeVar2 = null;
if (z7) {
}
if (!z3) {
}
if (exists) {
}
}
bo.b("E", str + ": checkSDPath: " + file + " ok " + z8);
return z8;
}
public boolean a(boolean z2, int i2) {
return b(z2 ? 1 : 0, i2) == 1;
}
private int b(int i2, int i3) {
if (i3 != 2) {
return i3;
}
if (i2 != -1) {
return 1 - i2;
}
bo.d("E", "ignoring toggle of unknown value");
return -1;
}
public boolean a(Intent intent) {
return a(intent, true);
}
public boolean a(Intent intent, boolean z2) {
return a(intent, z2, false);
}
public boolean a(Intent intent, boolean z2, boolean z3) {
intent.addFlags(268435456);
intent.addFlags(4);
intent.addFlags(536870912);
if (z2) {
intent.addFlags(8388608);
}
return gs.a(this, intent, z3);
}
private boolean a(int i2, int i3, int i4, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return a(i2, i3, i4, cVar.a(0), 0, bundle);
}
private boolean a(int i2, int i3, int i4, dh dhVar, int i5, Bundle bundle) {
boolean z2;
boolean z3;
if (a()) {
bo.c("E", "startProxy: already running.. ");
return false;
}
Class cls = null;
boolean z4 = true;
switch (i2) {
case 0:
cls = CameraProxy.class;
z2 = false;
z3 = false;
break;
case 1:
cls = ProxyTransparent.class;
z2 = false;
z3 = true;
break;
case 2:
default:
bo.c("E", "startProxy: bad proxy type: " + i2);
z2 = false;
z3 = false;
break;
case 3:
cls = CameraProxyDiscrete.class;
z2 = false;
z3 = false;
break;
case 4:
cls = ProxyTransparent.class;
z2 = true;
z3 = false;
break;
}
String simpleName = cls == null ? Build.UNKNOWN : cls.getSimpleName();
if (cls != null) {
Intent intent = new Intent(this, (Class<?>) cls);
intent.putExtra("aci", dhVar.c());
intent.putExtra("flags", i5);
intent.putExtra("pri", i3);
if (bundle != null) {
intent.putExtra("lvars", bundle);
}
gs.a(intent, z2);
if (i4 == Integer.MAX_VALUE) {
bo.b("E", "start proxy " + simpleName + ", wait, no time limit");
c("Proxy Group");
a(true, "startProxy");
} else if (i4 > 0) {
bo.b("E", "start proxy " + simpleName + ", wait, time limit " + i4 + "s");
b("Proxy Group", i4);
a(true, "startProxy");
} else {
bo.b("E", "start proxy " + simpleName + ", no wait");
}
if (z3) {
com.joaomgcd.taskerm.util.aa.a(intent);
}
}
z4 = false;
if (!z4) {
bo.d("E", "proxy " + simpleName + ": failed to start");
a(false, "startProxy (failed)");
d("Proxy Group");
}
return z4;
}
private int a(net.dinglisch.android.taskerm.c cVar) {
return a(new Intent("android.intent.action.SHOW_ALARMS"), true) ? -1 : -3;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean z2 = false;
n.b bVar = n.b.values()[b(cVar, 0)];
Intent intent = null;
if (bVar == n.b.SnoozeCurrent) {
int d2 = d(cVar, 2, bundle);
if (d2 != Integer.MAX_VALUE) {
intent = new Intent("android.intent.action.SNOOZE_ALARM");
intent.putExtra("android.intent.extra.alarm.SNOOZE_DURATION", d2);
}
} else {
switch (bVar) {
case DisableCurrentOrNext:
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.next");
break;
case DisableByLabel:
String b2 = b(cVar, 3, bundle);
if (TextUtils.isEmpty(b2)) {
bo.d("E", str + ": disableByTime: no time specified");
break;
} 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", b2);
break;
}
case DisableByTime:
int d3 = d(cVar, 1, bundle);
int d4 = d(cVar, 2, bundle);
if (d3 < 0 && d3 > 23) {
bo.d("E", str + ": bad hour: " + d3);
break;
} else if (d4 < 0 && d4 > 59) {
bo.d("E", str + ": bad minute: " + d3);
break;
} else {
if (d3 > 12) {
d3 -= 12;
z2 = true;
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": ");
sb.append(d3);
sb.append(".");
sb.append(d4);
sb.append(" ");
sb.append(z2 ? "pm" : "am");
bo.b("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", z2);
intent.putExtra("android.intent.extra.alarm.HOUR", d3);
intent.putExtra("android.intent.extra.alarm.MINUTES", d4);
break;
}
break;
default:
intent = new Intent("android.intent.action.DISMISS_ALARM");
intent.putExtra("android.intent.extra.alarm.SEARCH_MODE", "android.all");
break;
}
}
return (intent == null || !a(intent)) ? -3 : -1;
}
private int a(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Intent intent;
int i2 = cVar.i();
String str = n.b().get(Integer.valueOf(i2));
if (str == null) {
return -3;
}
if (i2 == 216) {
String b2 = b(cVar, 0, bundle);
if (!TextUtils.isEmpty(b2)) {
intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.fromParts("package", b2, null));
} else {
intent = new Intent(str);
}
} else if (str.equals("android.intent.action.POWER_USAGE_SUMMARY")) {
intent = new Intent("android.intent.action.POWER_USAGE_SUMMARY");
} else if (str.equals("com.android.settings.fuelgauge.PowerUsageSummary")) {
intent = n.d("com.android.settings.fuelgauge.PowerUsageSummary");
} else {
intent = new Intent(str);
}
intent.addFlags(1073741824);
return !a(intent) ? -3 : -1;
}
private void b(boolean z2, int i2) {
if (C == null || !C.isPlaying()) {
return;
}
int i3 = i2 * 1000;
int currentPosition = C.getCurrentPosition();
if (z2) {
int i4 = currentPosition + i3;
if (i4 < C.getDuration()) {
C.seekTo(i4);
return;
}
return;
}
int i5 = currentPosition - i3;
if (i5 < 0) {
i5 = 0;
}
C.seekTo(i5);
}
private boolean a(String str, int i2, int i3) {
String l2 = n.l(i2);
if (i2 == 808 && !gs.a(getContentResolver(), l2)) {
bo.b("E", "putIntSetting: no auto-brightness found, try hero version");
l2 = "screen_auto";
}
return b(str, l2, i3);
}
private boolean b(String str, String str2, int i2) {
boolean z2;
int i3;
try {
ContentResolver contentResolver = getContentResolver();
if (str2.equals("wifi_sleep_policy")) {
i3 = Settings.System.getInt(contentResolver, str2, 0);
} else {
i3 = Settings.System.getInt(contentResolver, str2);
}
bo.b("E", str + ": curval: " + i3 + " new: " + i2);
if (i3 == i2) {
return true;
}
if (Settings.System.putInt(contentResolver, str2, i2)) {
z2 = true;
} else {
bo.d("E", str + ": putInt " + str2 + "/" + i2 + " failed");
z2 = false;
}
try {
a(100L);
return z2;
} catch (Settings.SettingNotFoundException unused) {
b(R.string.fi_sysset_not_found, str2);
return z2;
} catch (SecurityException unused2) {
a(R.string.fi_permissions, str);
return z2;
} catch (Exception e2) {
e = e2;
bo.b("E", "putIntSetting", e);
return z2;
}
} catch (Settings.SettingNotFoundException unused3) {
z2 = false;
} catch (SecurityException unused4) {
z2 = false;
} catch (Exception e3) {
e = e3;
z2 = false;
}
}
public boolean a(long j2) {
return a(j2, (ft) null);
}
public boolean a(long j2, ft ftVar) {
try {
synchronized (this) {
if (j2 > 0) {
if (j2 >= 100) {
a("wait for " + j2 + "ms", ftVar);
}
wait(j2);
if (j2 >= 100) {
a("wait finished", ftVar);
}
} else {
a("No need to wait for " + j2 + "ms", ftVar);
}
}
return true;
} catch (InterruptedException unused) {
a("wait int", ftVar);
return !this.aa.booleanValue();
} catch (Exception unused2) {
a("wait e", ftVar);
return !this.aa.booleanValue();
}
}
@Override
public void onError(MediaRecorder mediaRecorder, int i2, int i3) {
b(R.string.fi_media_recorder_unknown, new Object[0]);
synchronized (G) {
if (F != null) {
F.release();
F = null;
}
}
}
private void a(NotificationManager notificationManager, int i2) {
if (a(i2)) {
bb.a(this, c(i2), i2);
b(i2);
} else {
notificationManager.cancel(i2);
}
}
private void a(NotificationManager notificationManager) {
h();
for (Map.Entry<String, ?> entry : R().getAll().entrySet()) {
bb.a(this, (String) entry.getValue(), Integer.parseInt(entry.getKey()));
}
g();
notificationManager.cancelAll();
}
@TargetApi(g.a.MapAttrs_latLngBoundsNorthEastLongitude)
private Integer a(ft ftVar, net.dinglisch.android.taskerm.c cVar, final String str, final String str2, Bundle bundle) {
net.dinglisch.android.taskerm.g gVar;
int i2;
boolean z2;
Bitmap bitmap;
boolean z3;
int i3;
int i4;
Bundle bundle2;
int i5;
long[] jArr;
int d2;
PendingIntent pendingIntent;
Integer num;
String b2;
int i6;
Uri uri;
int i7;
int i8;
Notification.Builder builder;
PendingIntent pendingIntent2;
Uri uri2;
int i9;
String str3;
String str4;
String str5;
String str6;
Bitmap bitmap2;
int identifier;
int i10 = cVar.i();
boolean f2 = dc.f();
int a2 = f2 ? a(cVar, 3, true, false, bundle) : 0;
final NotificationManager notificationManager = (NotificationManager) df.a(this, "notification", "E", "setupn");
int i11 = -3;
if (notificationManager == null) {
a(R.string.err_no_notification_manager, new Object[0]);
} else if (a2 != Integer.MAX_VALUE) {
Notification.Builder builder2 = new Notification.Builder(this);
boolean z4 = i10 == 523 && cVar.h(4).b();
net.dinglisch.android.taskerm.g e2 = cVar.e(2);
boolean z5 = bw.ac.b() && bw.af.e();
if (e2.c()) {
gVar = e2;
i2 = -1;
z2 = false;
bitmap = null;
} else {
if (e2.h()) {
bitmap2 = a(false);
} else {
String e3 = e2.e();
try {
bitmap2 = e2.a(this, 128, 128, "executeservice");
} catch (Exception e4) {
bo.a("E", "Error getting bitmap for notification icon", (Throwable) e4);
bitmap2 = null;
}
String b3 = gx.b(this, e3, bundle);
if (bitmap2 == null) {
bitmap2 = com.joaomgcd.taskerm.m.b.b(this, b3, 128, 128);
}
if (bitmap2 == null && b3 != null && !b3.startsWith("http")) {
bitmap2 = com.joaomgcd.taskerm.m.a.a(this, b3);
}
}
Bitmap bitmap3 = bitmap2;
if (e2.i()) {
e2 = e2.b(this, bundle);
Uri b4 = e2.b(this);
bo.b("E", "notify: manual uri: " + b4);
if (gs.a(b4, "android.resource")) {
String authority = b4.getAuthority();
String lastPathSegment = b4.getLastPathSegment();
StringBuilder sb = new StringBuilder();
bitmap = bitmap3;
sb.append("pkg: ");
sb.append(authority);
sb.append(" name: ");
sb.append(lastPathSegment);
bo.b("E", sb.toString());
if (!TextUtils.isEmpty(lastPathSegment)) {
if (authority == null || authority.equals(getPackageName())) {
bo.b("E", "convert local resource");
e2 = new net.dinglisch.android.taskerm.g(lastPathSegment);
} else {
bo.b("E", "convert to ipack");
e2 = new net.dinglisch.android.taskerm.g();
e2.a(authority, lastPathSegment);
}
}
if (!e2.n()) {
String r2 = e2.r();
String a3 = go.a(this, r2);
bo.b("E", "name: " + r2 + " noteName " + a3);
if (r2.equals(a3)) {
if (Kid.a(this)) {
identifier = e2.a(this, cr.b());
bo.b("E", " id " + identifier);
} else {
bo.b("E", "get id from name");
identifier = e2.d(this);
}
} else {
identifier = getResources().getIdentifier(a3, "drawable", Kid.a(this) ? cr.b() : getPackageName());
}
i2 = identifier;
builder2.setColor(e2.x());
gVar = e2;
} else if (e2.l()) {
String r3 = e2.r();
if (z5) {
r3 = r3 + "_";
}
i2 = bb.a(getPackageManager(), e2.q(), r3);
gVar = e2;
z2 = true;
} else {
bo.d("E", "setupNot: bad icon type for notification");
gVar = e2;
i2 = -1;
}
z2 = false;
}
}
bitmap = bitmap3;
if (!e2.n()) {
}
z2 = false;
}
bo.b("E", "iconID1: " + i2);
if (i2 == -1) {
i2 = com.joaomgcd.taskerm.util.al.M(this);
z3 = false;
z2 = false;
} else {
z3 = true;
}
if (i2 == -1 || i2 == 0) {
bo.b("E", "still no icon, use warning");
i2 = R.drawable.cust_warning;
z3 = false;
z2 = false;
}
bo.b("E", "iconID2: " + i2);
if (z2 && z5) {
bo.b("E", "canSetNonIDs");
bw.af.a(builder2, bw.ac.a(gVar.q(), i2));
z2 = false;
} else if (!z3 && com.joaomgcd.taskerm.util.g.o() && bitmap != null) {
builder2.setSmallIcon(Icon.createWithBitmap(bitmap));
} else {
bo.b("E", "set normal");
builder2.setSmallIcon(i2);
}
builder2.setWhen(System.currentTimeMillis());
builder2.setShowWhen(true);
builder2.setContentTitle(str);
builder2.setTicker(str);
builder2.setGroup("user");
if (str.length() > 0 && e(str)) {
i3 = g(str);
if (z2 != a(i3)) {
a(notificationManager, i3);
}
} else {
if (A < 0) {
A = T() + 20;
bo.b("E", "initialized notify IDs to " + A);
}
i3 = A;
A = i3 + 1;
a(str, i3);
}
final int i12 = i3;
if (z4) {
builder2.setOngoing(true);
} else {
builder2.setAutoCancel(true);
}
if (f2) {
builder2.setNumber(a2);
}
int i13 = 6;
int i14 = i10 == 523 ? 6 : -1;
boolean z6 = i10 == 538;
boolean z7 = i10 == 525;
boolean z8 = i10 == 536;
if (z7) {
i4 = -1;
i13 = 7;
} else {
if (!z6 && !z8) {
i13 = i14;
}
i4 = -1;
}
builder2.setOnlyAlertOnce(i13 == i4 || !a(cVar, i13));
Intent intent = new Intent(this, (Class<?>) ReceiverStaticNotification.class);
intent.setAction("net.dinglisch.android.tasker.NOTORUM");
intent.setData(Uri.fromParts(ExecuteService.class.getName(), Integer.toString(i12), null));
intent.putExtra("title", (CharSequence) str);
intent.putExtra("pkg", getPackageName());
PendingIntent broadcast = PendingIntent.getBroadcast(this, i12, intent, com.joaomgcd.taskerm.util.ds.a(0));
builder2.setContentText(str2);
if (str2 != null && str2.length() > 30 && !com.joaomgcd.taskerm.util.ds.k()) {
builder2.setStyle(new Notification.BigTextStyle().bigText(str2));
}
builder2.setContentIntent(broadcast);
if (z8 || i10 == 523) {
bundle2 = bundle;
String b5 = gx.b(this, cVar.j(z8 ? 4 : 10).c(), bundle2);
if (b5.length() > 0) {
String str7 = getString(R.string.an_notify_vibrate_2) + " " + b5;
long[] a4 = n.a(b5);
builder2.setVibrate(a4);
jArr = a4;
i5 = 0;
if (!z7 || i10 == 523) {
int i15 = z7 ? 4 : 7;
d2 = d(cVar, z7 ? 5 : 8, bundle2);
if (d2 != Integer.MAX_VALUE || d2 <= 0) {
pendingIntent = broadcast;
if (z7) {
i5 |= 4;
}
} else {
int h2 = cVar.g(i15).h();
StringBuilder sb2 = new StringBuilder();
sb2.append(getString(R.string.an_notify_led));
sb2.append(" ");
pendingIntent = broadcast;
sb2.append(getResources().getStringArray(R.array.led_colours)[h2]);
sb2.append(" ");
sb2.append(d2);
sb2.toString();
Integer valueOf = Integer.valueOf(n.x(h2));
builder2.setLights(valueOf.intValue(), d2, d2);
num = valueOf;
if (z6) {
}
b2 = gx.b(this, cVar.j(!z6 ? 4 : 9).c(), bundle2);
if (b2.length() == 0) {
i6 = 1;
uri = null;
i7 = i10;
i8 = 523;
builder = builder2;
pendingIntent2 = pendingIntent;
File a5 = a(b2, cVar.n(), true, true, false);
if (a5 != null) {
String str8 = getString(R.string.an_notify_sound_2) + " " + b2;
Uri parse = Uri.parse(a5.toString());
builder.setSound(parse);
uri2 = parse;
i9 = i5;
builder.setDefaults(i9);
final Notification.Builder builder3 = builder;
a(cVar, builder3, i12, z2, bundle);
Integer a6 = a(cVar, builder, bundle);
final boolean z9 = z2;
final net.dinglisch.android.taskerm.g gVar2 = gVar;
final PendingIntent pendingIntent3 = pendingIntent2;
Notification.Builder builder4 = builder;
Runnable runnable = new Runnable() {
@Override
public final void run() {
ExecuteService.this.a(builder3, z9, gVar2, i12, str, str2, pendingIntent3, notificationManager);
}
};
if (!com.joaomgcd.taskerm.notification.ax.a(this)) {
}
i11 = -1;
}
uri2 = uri;
i9 = i5;
builder.setDefaults(i9);
final Notification.Builder builder32 = builder;
a(cVar, builder32, i12, z2, bundle);
Integer a62 = a(cVar, builder, bundle);
final boolean z92 = z2;
final net.dinglisch.android.taskerm.g gVar22 = gVar;
final PendingIntent pendingIntent32 = pendingIntent2;
Notification.Builder builder42 = builder;
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ExecuteService.this.a(builder32, z92, gVar22, i12, str, str2, pendingIntent32, notificationManager);
}
};
if (!com.joaomgcd.taskerm.notification.ax.a(this)) {
}
i11 = -1;
} else {
if (z6) {
builder = builder2;
i7 = i10;
i9 = i5 | 1;
pendingIntent2 = pendingIntent;
i8 = 523;
i6 = 1;
uri = null;
uri2 = null;
builder.setDefaults(i9);
final Notification.Builder builder322 = builder;
a(cVar, builder322, i12, z2, bundle);
Integer a622 = a(cVar, builder, bundle);
final boolean z922 = z2;
final net.dinglisch.android.taskerm.g gVar222 = gVar;
final PendingIntent pendingIntent322 = pendingIntent2;
Notification.Builder builder422 = builder;
Runnable runnable22 = new Runnable() {
@Override
public final void run() {
ExecuteService.this.a(builder322, z922, gVar222, i12, str, str2, pendingIntent322, notificationManager);
}
};
if (!com.joaomgcd.taskerm.notification.ax.a(this)) {
int i16 = i7 == i8 ? 11 : -1;
try {
cVar.d(i16);
str3 = b(cVar, i16, bundle);
} catch (Exception unused) {
str3 = uri;
}
if (TextUtils.isEmpty(str3)) {
this.f11023d.a();
}
if (TextUtils.isEmpty(str3)) {
str5 = "super_tasker_notifications_created_by_me_the_developer";
str6 = ct.a(this, R.string.dc_user_notification, new Object[0]);
str4 = ct.a(this, R.string.dc_user_notification_description, new Object[0]);
} else {
str4 = "User created notification category";
str5 = str3;
str6 = str5;
}
boolean z10 = a622.intValue() > 0;
new com.joaomgcd.taskerm.notification.an(str5, str6, str4, com.joaomgcd.taskerm.notification.aw.a(a622), num, jArr, z10, Integer.valueOf(i6), z10, uri2, com.joaomgcd.taskerm.notification.aw.D()).a(this);
builder422.setChannelId(str5);
runnable22.run();
} else {
runnable22.run();
}
i11 = -1;
}
builder = builder2;
i7 = i10;
pendingIntent2 = pendingIntent;
i8 = 523;
i6 = 1;
uri = null;
uri2 = uri;
i9 = i5;
builder.setDefaults(i9);
final Notification.Builder builder3222 = builder;
a(cVar, builder3222, i12, z2, bundle);
Integer a6222 = a(cVar, builder, bundle);
final boolean z9222 = z2;
final net.dinglisch.android.taskerm.g gVar2222 = gVar;
final PendingIntent pendingIntent3222 = pendingIntent2;
Notification.Builder builder4222 = builder;
Runnable runnable222 = new Runnable() {
@Override
public final void run() {
ExecuteService.this.a(builder3222, z9222, gVar2222, i12, str, str2, pendingIntent3222, notificationManager);
}
};
if (!com.joaomgcd.taskerm.notification.ax.a(this)) {
}
i11 = -1;
}
}
} else {
pendingIntent = broadcast;
}
num = null;
if (z6) {
}
b2 = gx.b(this, cVar.j(!z6 ? 4 : 9).c(), bundle2);
if (b2.length() == 0) {
}
} else if (z8) {
i5 = 2;
jArr = null;
if (z7) {
}
if (z7) {
}
d2 = d(cVar, z7 ? 5 : 8, bundle2);
if (d2 != Integer.MAX_VALUE) {
}
pendingIntent = broadcast;
if (z7) {
}
num = null;
if (z6) {
}
b2 = gx.b(this, cVar.j(!z6 ? 4 : 9).c(), bundle2);
if (b2.length() == 0) {
}
}
} else {
bundle2 = bundle;
}
i5 = 0;
jArr = null;
if (z7) {
}
if (z7) {
}
d2 = d(cVar, z7 ? 5 : 8, bundle2);
if (d2 != Integer.MAX_VALUE) {
}
pendingIntent = broadcast;
if (z7) {
}
num = null;
if (z6) {
}
b2 = gx.b(this, cVar.j(!z6 ? 4 : 9).c(), bundle2);
if (b2.length() == 0) {
}
}
return Integer.valueOf(i11);
}
public void a(Notification.Builder builder, boolean z2, net.dinglisch.android.taskerm.g gVar, int i2, CharSequence charSequence, CharSequence charSequence2, PendingIntent pendingIntent, NotificationManager notificationManager) {
Notification a2 = bw.af.a(builder);
if (z2) {
bb.a(this, gVar.q(), i2, a2, charSequence.toString(), charSequence2.toString(), pendingIntent);
a(i2, gVar.q());
} else {
notificationManager.notify(i2, a2);
}
}
private void a(net.dinglisch.android.taskerm.c cVar, Notification.Builder builder, int i2, boolean z2, Bundle bundle) {
PendingIntent pendingIntent;
int i3;
int i4;
int d2;
if (cVar.v() && bw.af.c()) {
List<bm> w2 = cVar.w();
int i5 = 0;
int i6 = 0;
while (i6 < w2.size()) {
bm bmVar = w2.get(i6);
String str = null;
if (bmVar.f()) {
String str2 = cr.b() + ".ReceiverStaticInternal";
Intent intent = new Intent("net.dinglisch.android.tasker.WIDICKYUM");
intent.setClassName(getPackageName(), str2);
if (bundle != null) {
Bundle a2 = gs.a(bundle, cVar.n());
gx.a(gx.a("nbutton", bmVar.l()), (List<String>) null, a2);
intent.putExtra("lvars", a2);
}
ft d3 = fy.d();
d3.a(bmVar.k());
intent.putExtra("mcro", d3.a(i5).c());
int i7 = (i2 * 3) + 90000 + i6;
String a3 = com.joaomgcd.taskerm.util.aa.a(intent, true);
if (a3 != null) {
builder.setDeleteIntent(new com.joaomgcd.taskerm.notification.h(this, a3).b());
}
intent.setData(Uri.fromParts(ExecuteService.class.getSimpleName(), Integer.toString(i7), null));
pendingIntent = PendingIntent.getBroadcast(this, i7, intent, com.joaomgcd.taskerm.util.ds.a(134217728));
} else {
pendingIntent = null;
}
net.dinglisch.android.taskerm.g j2 = bmVar.j();
if (j2 == null || j2.c() || ex.a().equals(j2.r())) {
i3 = 0;
} else {
if (Kid.a(this)) {
d2 = j2.a(this, cr.b());
} else {
d2 = j2.d(this);
}
i3 = d2;
}
if (bmVar.g()) {
i4 = i3;
str = gx.a((Context) this, bmVar.l(), false, false, true, false, (ga.a) null, bundle);
} else {
i4 = i3;
}
bw.af.a(builder, i4, str, pendingIntent);
if (z2) {
builder.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.hd_zzz_note_navigation_expand));
}
i6++;
i5 = 0;
}
}
}
private Integer a(net.dinglisch.android.taskerm.c cVar, Notification.Builder builder, Bundle bundle) {
if (bw.af.a()) {
int i2 = cVar.i();
int i3 = 5;
if (i2 != 523) {
if (i2 == 525) {
i3 = 6;
} else if (i2 != 536 && i2 != 538) {
bo.c("E", "unhandled not code: " + i2);
i3 = -1;
}
}
if (i3 > -1) {
int d2 = d(cVar, i3, bundle);
if (d2 == 0) {
d2 = n.h(i2, i3);
}
int j2 = (d2 - n.j(i2, i3)) - 2;
Integer valueOf = Integer.valueOf(j2);
bw.af.a(builder, j2);
return valueOf;
}
}
return null;
}
private void a(SharedPreferences sharedPreferences) {
String str = "";
for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
String key = entry.getKey();
if (key.equals("*")) {
key = ct.a(this, R.string.word_all, new Object[0]);
}
if (str.length() > 0) {
str = str + "\n";
}
str = str + key + " --> " + entry.getValue();
}
String a2 = ct.a(this, R.string.dt_diversions, new Object[0]);
if (str.length() <= 0) {
str = ct.a(this, R.string.word_none, new Object[0]);
}
a(a2, str, 1);
}
private boolean a(File file, int i2, boolean z2, int i3) {
List<File> list;
com.joaomgcd.taskerm.j.d a2 = com.joaomgcd.taskerm.j.a.a(file, this);
synchronized (D) {
gx.f(this);
boolean z3 = true;
if (!a2.k()) {
bo.d("E", "musicplay: file doesn't exist: " + a2.c());
a((Context) this, true, "pmf1");
return false;
}
final FileInputStream p2 = a2.p();
if (C == null) {
bo.b("E", "init mediaplayer creation");
this.aj.sendEmptyMessage(0);
bo.b("E", "wait for mediaplayer creation");
synchronized (D) {
long currentTimeMillis = System.currentTimeMillis();
while (true) {
if (this.aa.booleanValue() || System.currentTimeMillis() - currentTimeMillis >= 10000) {
break;
}
synchronized (E) {
if (C != null) {
break;
}
}
a(200L);
}
if (C != null) {
C.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public final void onCompletion(MediaPlayer mediaPlayer) {
ExecuteService.this.a(p2, mediaPlayer);
}
});
C.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public final boolean onError(MediaPlayer mediaPlayer, int i4, int i5) {
boolean a3;
a3 = ExecuteService.a(mediaPlayer, i4, i5);
return a3;
}
});
}
}
} else {
a((Context) this, false, "pmf2");
}
if (this.aa.booleanValue() && k == null) {
bo.b("E", "playMusicFile: time to leave, not playing dir, abort");
a((Context) this, true, "pmf3");
} else if (C == null) {
bo.d("E", "no media player");
} else {
C.setLooping(z2);
C.setAudioStreamType(i3);
try {
try {
if (p2 == null) {
C.setDataSource(a2.toString());
} else {
C.setDataSource(p2.getFD());
}
C.prepare();
if (i2 > 0) {
int i4 = i2 * 1000;
if (i4 > C.getDuration()) {
b(R.string.fi_seek, new Object[0]);
} else if (com.joaomgcd.taskerm.util.g.p()) {
C.seekTo(i4, 3);
} else {
C.seekTo(i4);
}
}
C.start();
} catch (IllegalArgumentException e2) {
bo.d("E", "playmusic: bad argument: " + e2.toString());
C = null;
}
} catch (IOException e3) {
bo.d("E", "playmusic: IO exception: " + e3.toString());
C = null;
} catch (IllegalStateException e4) {
bo.d("E", "playmusic: illegal state: " + e4.toString());
C = null;
}
if (C == null) {
bo.d("E", "playmusic: failed to init music player for " + a2.toString());
} else {
gx.h(this, a(a2.g()));
if (o && (list = l) != null && list.size() > 0 && m < list.size()) {
a((String) null, a(list.get(m)), 1);
}
bo.b("E", "playmusic: started track: " + a2.c());
return z3;
}
}
z3 = false;
return z3;
}
}
public void a(FileInputStream fileInputStream, MediaPlayer mediaPlayer) {
synchronized (D) {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException unused) {
bo.b("E", "playMusicFile: inputStream couldn't close");
}
}
StringBuilder sb = new StringBuilder();
sb.append("playMusicFile: onCompletion: have player: ");
sb.append(C != null);
bo.b("E", sb.toString());
if (C != null) {
gx.f(this);
if (k == null) {
bo.b("E", "no playing dir, release");
d("Music");
C.release();
C = null;
} else {
bo.b("E", "start dir player loop");
D();
}
}
}
}
public static boolean a(MediaPlayer mediaPlayer, int i2, int i3) {
bo.d("E", "playMusicFile: media player onError: " + i2 + "," + i3);
return false;
}
private void D() {
if (!E()) {
return;
}
while (!a(l.get(m), 0, false, 3) && E()) {
}
}
private boolean E() {
if (r >= l.size()) {
return false;
}
if (n) {
Random random = new Random();
if (l.size() > 1) {
int i2 = m;
while (i2 == m) {
i2 = random.nextInt(l.size());
}
m = i2;
} else {
m = 0;
}
} else {
m = (m + 1) % l.size();
}
r++;
bo.b("E", "picktrack: track no " + r + " index: " + m + " name " + l.get(m).getName() + " count now: " + r);
return true;
}
public String a(File file, String str, int i2) {
String a2 = gs.a(getContentResolver(), MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "_data", file.toString(), str);
return (i2 == -1 || !TextUtils.isEmpty(a2)) ? a2 : ct.a(this, i2, new Object[0]);
}
private String a(File file) {
String a2 = a(file, "title", -1);
if (!TextUtils.isEmpty(a2)) {
return a2;
}
String name = file.getName();
return name.substring(0, name.length() - gs.a(name, true).length());
}
private boolean i(int i2) {
AudioManager audioManager = (AudioManager) df.a(this, "audio", "E", "saf");
if (audioManager == null) {
return true;
}
this.S = new AudioManager.OnAudioFocusChangeListener() {
@Override
public final void onAudioFocusChange(int i3) {
ExecuteService.this.o(i3);
}
};
if (audioManager.requestAudioFocus(this.S, i2, 3) != 0) {
return true;
}
bo.b("E", "audio focus denied, stop");
F();
return false;
}
public void o(int i2) {
bo.b("E", "focusChange: " + i2);
switch (i2) {
case -3:
case -2:
case -1:
a("lostFocus", (String) null, false);
return;
default:
return;
}
}
public void d(int i2, String str) {
bo.b("E", "set TTSStatus to " + i2 + " by " + str);
this.P = i2;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, String str2, String str3, float f2, float f3, Bundle bundle) {
String str4;
String str5;
boolean z2;
Locale locale;
boolean z3;
int c2;
final String str6 = str + ": ";
boolean z4 = cVar.i() == 559;
boolean b2 = cVar.h(z4 ? 7 : 6).b();
a(str6 + ".speechStart", (String) null, false);
int h2 = cVar.g(2).h();
boolean a2 = a(cVar, 5);
boolean z5 = (z4 && a(cVar, 6)) || (!z4 && a(cVar, 5));
if (!bw.ap.b() || (c2 = bw.ap.c()) <= 0 || str2.length() <= c2) {
str4 = str2;
} else {
bo.d("E", str6 + "speech exceeds engine max chars (" + c2 + ") truncated");
str4 = str2.substring(0, c2);
}
String str7 = "default";
if (str3.contains(ConstantsCommonTaskerServer.ID_SEPARATOR)) {
bo.b("E", str6 + "spec: " + str3 + " contains :");
String[] split = str3.split(ConstantsCommonTaskerServer.ID_SEPARATOR);
if (split == null || split.length != 2) {
bo.d("E", str6 + "bad split engine:voice format");
} else {
str7 = split[0];
str5 = split[1];
TextToSpeech.OnInitListener onInitListener = new TextToSpeech.OnInitListener() {
@Override
public void onInit(int i2) {
bo.b("E", str6 + "got TTS init, status: " + i2);
ExecuteService.this.d(i2, "on init listener");
}
};
z2 = str7 != null || str7.equals("default");
bo.b("E", str6 + " engine: " + str7 + " locale data: " + str5 + " default engine: " + z2);
d(-34234, "doSpeech: init");
if (!z2) {
this.Q = new TextToSpeech(getApplicationContext(), onInitListener);
} else {
this.Q = new TextToSpeech(getApplicationContext(), onInitListener, str7);
}
long currentTimeMillis = System.currentTimeMillis();
bo.b("E", str6 + "start init loop");
while (this.P == -34234 && System.currentTimeMillis() - currentTimeMillis < 20000 && !this.aa.booleanValue()) {
a(50L);
}
bo.b("E", str6 + "oof: status; " + this.P + " elapsed: " + (System.currentTimeMillis() - currentTimeMillis));
if (!this.aa.booleanValue()) {
bo.b("E", str6 + "skipping speech, time to leave");
} else {
if (this.P == -34234) {
d(-34235, "doSpeech: post init");
z3 = false;
a(R.string.fi_tts_init, new Object[0]);
} else if (this.P != 0) {
a(R.string.fi_tts_init_failed, new Object[0]);
} else {
if (str5.equals("default")) {
bo.b("E", str6 + "acquire engine lang loop");
locale = this.Q.getLanguage();
if (locale == null) {
bo.b("E", str6 + "null locale from tts, use system config");
locale = G();
}
} else if (str5.contains("-")) {
locale = com.joaomgcd.taskerm.util.ao.a(str5);
} else {
locale = new Locale(str5);
}
bo.b("E", str6 + "tts engine: " + str7 + " voice data: " + str5 + " loclang: " + locale.getLanguage());
HashMap<String, String> hashMap = new HashMap<>();
if (a(this.Q, locale)) {
this.Q.setPitch(f2);
this.Q.setSpeechRate(f3);
if (z5) {
hashMap.put("networkTts", String.valueOf(true));
}
if (!a(this.Q)) {
bo.c("E", str6 + "failed to register completion/progress listener");
} else {
bo.b("E", str6 + "set locale to " + locale.toString() + ", support status: " + this.Q.setLanguage(locale));
hashMap.put("utteranceId", str4);
if (z4) {
hashMap.put("streamType", String.valueOf(h2));
if (a2 && !i(h2)) {
return -3;
}
if (this.Q.speak(str4, 0, hashMap) == 0) {
bo.b("E", str6 + "made succesful call to speak()");
this.R = System.currentTimeMillis();
z3 = true;
} else {
a(R.string.fi_tts_failed, new Object[0]);
}
} else {
File a3 = a(gx.b(this, cVar.j(2).c(), bundle), cVar.n(), false, true, false);
if (a3 != null) {
if (this.Q.synthesizeToFile(str4, hashMap, a3.toString()) == 0) {
this.R = System.currentTimeMillis();
z3 = true;
} else {
a(R.string.fi_tts_failed, new Object[0]);
}
}
}
}
} else {
z3 = false;
a(R.string.fi_tts_bad_locale, str3 + " = " + str7 + ConstantsCommonTaskerServer.ID_SEPARATOR + locale.toString());
}
}
if (z3) {
gx.a(this, 76, str4);
if (b2) {
return -5;
}
c("Speech Group");
return -1;
}
bo.b("E", str6 + "not started, shutdown");
if (Settings.c(this)) {
this.f11023d.a(this.Q);
}
this.Q = null;
this.T = null;
F();
return -3;
}
z3 = false;
if (z3) {
}
}
}
str5 = str3;
TextToSpeech.OnInitListener onInitListener2 = new TextToSpeech.OnInitListener() {
@Override
public void onInit(int i2) {
bo.b("E", str6 + "got TTS init, status: " + i2);
ExecuteService.this.d(i2, "on init listener");
}
};
if (str7 != null) {
}
bo.b("E", str6 + " engine: " + str7 + " locale data: " + str5 + " default engine: " + z2);
d(-34234, "doSpeech: init");
if (!z2) {
}
long currentTimeMillis2 = System.currentTimeMillis();
bo.b("E", str6 + "start init loop");
while (this.P == -34234) {
a(50L);
}
bo.b("E", str6 + "oof: status; " + this.P + " elapsed: " + (System.currentTimeMillis() - currentTimeMillis2));
if (!this.aa.booleanValue()) {
}
z3 = false;
if (z3) {
}
}
private boolean a(TextToSpeech textToSpeech) {
boolean z2;
if (bw.ap.d()) {
Class<?> b2 = bw.b(cr.b() + ".MyUtteranceProgressListener");
try {
Object newInstance = b2.newInstance();
bw.a(bw.b(b2, "setHandler", (Class<?>[]) new Class[]{Handler.class}), newInstance, -1, this.ak);
bw.ap.a(textToSpeech, newInstance);
z2 = true;
} catch (Exception e2) {
bo.b("E", "setProgressListener", e2);
}
if (z2 && bw.ap.e()) {
Class<?> b3 = bw.b(cr.b() + ".MyUtteranceCompletedListener");
try {
Object newInstance2 = b3.newInstance();
bw.a(bw.b(b3, "setHandler", (Class<?>[]) new Class[]{Handler.class}), newInstance2, -1, this.ak);
if (bw.ap.b(textToSpeech, newInstance2) == 0) {
return true;
}
bo.c("E", "failed to register for utterance completed");
return z2;
} catch (Exception e3) {
bo.b("E", "setCompletedListener", e3);
return z2;
}
}
}
z2 = false;
return z2 ? z2 : z2;
}
private boolean a(TextToSpeech textToSpeech, Locale locale) {
int i2;
try {
i2 = textToSpeech.isLanguageAvailable(locale);
} catch (Throwable unused) {
i2 = -1;
}
bo.b("E", "tts: loc " + locale.toString() + " available: " + i2);
return i2 == 0 || i2 == 1 || i2 == 2;
}
private void F() {
synchronized (t) {
if (this.S != null) {
bo.b("E", "abandon speech audio focus");
try {
((AudioManager) df.a(this, "audio", "E", "asaf")).abandonAudioFocus(this.S);
} catch (Exception e2) {
bo.b("E", "exception: " + e2.getMessage());
}
this.S = null;
}
}
}
private Locale G() {
Locale b2 = he.b(getResources().getConfiguration());
if (b2 != null) {
return b2;
}
bo.b("E", "tts: still no locale, use eng-usa");
return new Locale("eng-usa");
}
private ft b(String str, String str2) {
fy e2 = fy.e(this);
if (e2 == null) {
return null;
}
return e2.i(str2);
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, StringBuilder sb, int i2, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, false)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (!a(g2, str, false, true, true, false)) {
return -3;
}
try {
String j2 = at.j(this, g2);
if (j2 == null) {
return -3;
}
if (cVar.j(1).c().length() > 0) {
String a2 = a(this, cVar, 1, bundle);
if (TextUtils.isEmpty(a2)) {
return -3;
}
gx.a((Context) this, a2, j2, true, bundle, str, com.joaomgcd.taskerm.structuredoutput.c.a(cVar));
} else if (sb != null) {
sb.append(j2);
}
return -5;
} catch (Throwable th) {
bo.b("E", "Error reading file", th);
return -3;
}
}
private boolean a(ft ftVar, net.dinglisch.android.taskerm.c cVar, String str, int i2, File file, int i3, String str2, Bundle bundle) {
StringBuilder sb;
String str3;
int i4;
boolean z2 = false;
try {
BufferedReader bufferedReader = new BufferedReader(at.i(this, file));
if (i3 == 0) {
i4 = s.containsKey(file) ? s.get(file).intValue() + 1 : 1;
} else {
i4 = i3;
}
sb = null;
str3 = null;
boolean z3 = false;
boolean z4 = true;
int i5 = 0;
while (!z3) {
try {
String readLine = bufferedReader.readLine();
if (readLine != null) {
try {
if (readLine.length() > 0) {
if (z4 && (i5 = i5 + 1) == i4) {
sb = new StringBuilder(1024);
}
if (sb != null) {
sb.append(readLine.trim());
sb.append("\n");
}
if (i2 == 416) {
z4 = false;
}
} else {
z4 = true;
}
if (sb == null || !z4) {
str3 = readLine;
}
} catch (Exception unused) {
str3 = readLine;
b(R.string.fi_file_read_error, str, file.toString());
if (str3 == null) {
s.remove(file);
}
return z2;
}
}
str3 = readLine;
z3 = true;
} catch (Exception unused2) {
}
}
bufferedReader.close();
StructureType a2 = com.joaomgcd.taskerm.structuredoutput.c.a(cVar);
if (sb == null) {
a(str2, "EOF", ftVar, str, a2);
} else {
s.put(file, Integer.valueOf(i5));
a(str2, sb.toString().trim(), ftVar, str, a2);
}
z2 = true;
} catch (Exception unused3) {
sb = null;
str3 = null;
}
if (str3 == null && sb == null) {
s.remove(file);
}
return z2;
}
private int c(String str, String str2, int i2) {
Intent intent = new Intent(this, (Class<?>) MonitorService.class);
intent.setAction("net.dinglisch.android.tasker.ANDPROFTUM");
if (fy.c(this).m(str2)) {
intent.putExtra("pfname", str2);
intent.putExtra("pfttp", i2);
intent.putExtra("eventType", 9986);
MonitorService.b(this, intent);
return -1;
}
bo.d("E", str + ": unknown profile '" + str2 + "'");
return -3;
}
private void j(String str) {
if (n.z(332)) {
Intent n2 = gs.n();
n2.setData(Uri.parse(str));
try {
sendBroadcast(n2);
} catch (Exception unused) {
}
}
}
private SSLSocketFactory H() {
SSLSocketFactory defaultSSLSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
TrustManager[] trustManagerArr = {new X509TrustManager() {
@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];
}
}};
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, trustManagerArr, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
return defaultSSLSocketFactory;
} catch (Exception e2) {
bo.b("E", "trustAllHosts", e2);
return null;
}
}
private int a(String str, String str2, String str3, String str4, boolean z2, int i2, String str5, String str6, String str7, File file, Bundle bundle, boolean z3, boolean z4, boolean z5) {
Throwable th;
HttpURLConnection httpURLConnection;
SSLSocketFactory sSLSocketFactory;
String str8;
SocketException socketException;
String str9;
ProtocolException protocolException;
String str10;
String str11;
NumberFormatException numberFormatException;
HttpURLConnection httpURLConnection2;
IOException iOException;
HttpURLConnection httpURLConnection3;
HttpURLConnection httpURLConnection4;
HttpURLConnection httpURLConnection5;
HttpURLConnection httpURLConnection6;
HttpURLConnection httpURLConnection7;
boolean z6;
boolean z7;
boolean z8;
File file2;
String str12;
int i3;
int i4;
Map<String, List<String>> headerFields;
Throwable th2;
?? r14;
Writer writer;
OutOfMemoryError outOfMemoryError;
BufferedWriter bufferedWriter;
BufferedReader bufferedReader;
InputStream errorStream;
String readLine;
Throwable th3;
DataInputStream dataInputStream;
FileOutputStream fileOutputStream;
int read;
String str13;
Throwable th4;
InputStream inputStream;
File file3;
?? r142;
gx.a(this, 42, "");
gx.a(this, 41, "-1");
gx.k(this, "%header", bundle);
try {
try {
try {
boolean startsWith = str2.startsWith("https://");
URL url = new URL(str2);
if (startsWith && z3) {
try {
sSLSocketFactory = H();
} catch (MalformedURLException unused) {
str11 = str2;
httpURLConnection7 = null;
sSLSocketFactory = null;
a(z5, R.string.fi_bad_url, str11);
if (httpURLConnection7 != null) {
}
} catch (ProtocolException e2) {
protocolException = e2;
str10 = str2;
httpURLConnection6 = null;
sSLSocketFactory = null;
a(z5, R.string.fi_prot_err, str10, protocolException.toString());
if (httpURLConnection6 != null) {
}
} catch (SocketException e3) {
socketException = e3;
str9 = str2;
httpURLConnection5 = null;
sSLSocketFactory = null;
a(z5, R.string.fi_socket_err, str9, socketException.getMessage());
if (httpURLConnection5 != null) {
}
} catch (UnknownHostException unused2) {
str8 = str2;
httpURLConnection4 = null;
sSLSocketFactory = null;
a(z5, R.string.fi_unknown_host, str8);
if (httpURLConnection4 != null) {
}
}
} else {
sSLSocketFactory = null;
}
try {
httpURLConnection = (HttpURLConnection) url.openConnection();
if (startsWith && z4) {
try {
try {
((HttpsURLConnection) httpURLConnection).setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String str14, SSLSession sSLSession) {
return true;
}
});
} catch (IOException e4) {
iOException = e4;
httpURLConnection3 = httpURLConnection;
a(z5, R.string.fi_io_err, str2, iOException.toString());
if (httpURLConnection3 != null) {
httpURLConnection3.disconnect();
}
} catch (NumberFormatException e5) {
numberFormatException = e5;
httpURLConnection2 = httpURLConnection;
bo.a("E", z5, "nfe, using a proxy ? " + numberFormatException.toString());
if (httpURLConnection2 != null) {
httpURLConnection2.disconnect();
}
} catch (Throwable th5) {
th = th5;
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
if (sSLSocketFactory == null) {
throw th;
}
HttpsURLConnection.setDefaultSSLSocketFactory(sSLSocketFactory);
throw th;
}
} catch (MalformedURLException unused3) {
str11 = str2;
httpURLConnection7 = httpURLConnection;
a(z5, R.string.fi_bad_url, str11);
if (httpURLConnection7 != null) {
}
} catch (ProtocolException e6) {
protocolException = e6;
str10 = str2;
httpURLConnection6 = httpURLConnection;
a(z5, R.string.fi_prot_err, str10, protocolException.toString());
if (httpURLConnection6 != null) {
}
} catch (SocketException e7) {
socketException = e7;
str9 = str2;
httpURLConnection5 = httpURLConnection;
a(z5, R.string.fi_socket_err, str9, socketException.getMessage());
if (httpURLConnection5 != null) {
}
} catch (UnknownHostException unused4) {
str8 = str2;
httpURLConnection4 = httpURLConnection;
a(z5, R.string.fi_unknown_host, str8);
if (httpURLConnection4 != null) {
}
}
}
try {
if (TextUtils.isEmpty(str5)) {
z6 = false;
z7 = true;
} else {
boolean B2 = com.joaomgcd.taskerm.util.ao.B(str5);
if (str.equals("POST")) {
httpURLConnection.setRequestProperty(HttpConnection.CONTENT_TYPE, str5);
}
z7 = B2;
z6 = true;
}
if (!TextUtils.isEmpty(str6)) {
httpURLConnection.setRequestProperty("Cookie", str6);
}
httpURLConnection.setRequestProperty("User-Agent", str7.length() == 0 ? gs.a(true) : str7);
httpURLConnection.setRequestMethod(str);
if (str4 != null) {
httpURLConnection.setRequestProperty("Connection", "close");
}
if (!TextUtils.isEmpty(str3)) {
httpURLConnection.setRequestProperty("Authorization", "Basic " + u.a(str3));
}
String str14 = "body isfile: " + z2 + " cont: " + str4;
bo.b("E", str14);
if (str4 != null) {
if (z2) {
file3 = new File(str4);
z8 = z7;
r142 = file3.length();
} else {
z8 = z7;
file3 = null;
r142 = str4.getBytes().length;
}
bo.b("E", "set content-length: " + r142);
httpURLConnection.setRequestProperty("Content-Length", String.valueOf((long) r142));
httpURLConnection.setFixedLengthStreamingMode((int) r142);
file2 = file3;
str12 = r142;
} else {
z8 = z7;
file2 = null;
str12 = str14;
}
httpURLConnection.setDoOutput(str4 != null);
httpURLConnection.setDoInput(true);
httpURLConnection.setReadTimeout(i2);
httpURLConnection.setConnectTimeout(i2);
String str15 = str12;
if (str4 != null) {
if (z2) {
bo.b("E", "write postBody file");
try {
OutputStream outputStream = httpURLConnection.getOutputStream();
?? bufferedInputStream = new BufferedInputStream(new FileInputStream(file2));
try {
byte[] bArr = new byte[8192];
while (true) {
int read2 = bufferedInputStream.read(bArr);
if (read2 <= 0) {
break;
}
outputStream.write(bArr, 0, read2);
}
outputStream.flush();
outputStream.close();
gs.a((InputStream) bufferedInputStream);
str13 = bufferedInputStream;
} catch (Throwable th6) {
th4 = th6;
inputStream = bufferedInputStream;
if (inputStream == null) {
throw th4;
}
gs.a(inputStream);
throw th4;
}
} catch (Throwable th7) {
th4 = th7;
inputStream = null;
}
} else {
bo.b("E", "write postBody string");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(httpURLConnection.getOutputStream());
outputStreamWriter.write(str4);
outputStreamWriter.flush();
outputStreamWriter.close();
str13 = str12;
}
bo.b("E", "done post body");
str15 = str13;
}
int responseCode = httpURLConnection.getResponseCode();
gx.a(this, 41, String.valueOf(responseCode));
StringBuilder sb = new StringBuilder();
boolean z9 = responseCode >= 200 && responseCode <= 299;
boolean z10 = responseCode >= 400 && responseCode <= 499;
?? r3 = (responseCode < 500 || responseCode > 599) ? 0 : 1;
if (!str.equals("HEAD") && (z9 || z10 || r3 != 0)) {
String contentType = httpURLConnection.getContentType();
if (!z6 || str.equals("POST")) {
bo.b("E", "user didn't specify content type, server said " + contentType);
if (com.joaomgcd.taskerm.util.ao.B(contentType)) {
z8 = true;
}
}
try {
if (!z8 && !z10 && r3 == 0) {
if (file != null) {
at.a(file);
try {
dataInputStream = new DataInputStream(httpURLConnection.getInputStream());
} catch (Throwable th8) {
th3 = th8;
dataInputStream = null;
}
try {
FileOutputStream fileOutputStream2 = new FileOutputStream(file);
try {
byte[] bArr2 = new byte[8192];
int i5 = -1;
while (!this.aa.booleanValue() && (read = dataInputStream.read(bArr2)) > 0) {
fileOutputStream2.write(bArr2, 0, read);
i5 += read;
}
if (i5 != -1) {
i5--;
}
i3 = i5;
gs.a((InputStream) dataInputStream);
fileOutputStream2.flush();
fileOutputStream2.close();
if (this.aa.booleanValue()) {
if (sb.length() > 0) {
String sb2 = sb.toString();
if (sb2.endsWith("\n")) {
sb2 = sb2.substring(0, sb2.length() - 1);
}
this.f11023d.a("%httpd", sb2, bundle, "E");
gx.a(this, 42, sb2);
} else {
gx.a(this, 42);
}
int contentLength = httpURLConnection.getContentLength();
i4 = -1;
if (contentLength == -1) {
contentLength = i3;
}
gx.a(this, 43, String.valueOf(contentLength));
} else {
i4 = -1;
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
for (Map.Entry<String, List<String>> entry : headerFields.entrySet()) {
String key = entry.getKey();
if (key == null) {
key = "Status";
}
List<String> value = entry.getValue();
if (value != null) {
Iterator<String> it = value.iterator();
while (it.hasNext()) {
gx.a((Context) this, "%header", Integer.MAX_VALUE, key + ": " + it.next(), true, bundle);
}
}
}
}
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
if (sSLSocketFactory != null) {
return i4;
}
HttpsURLConnection.setDefaultSSLSocketFactory(sSLSocketFactory);
return i4;
} catch (Throwable th9) {
fileOutputStream = fileOutputStream2;
th3 = th9;
gs.a((InputStream) dataInputStream);
if (fileOutputStream != null) {
throw th3;
}
fileOutputStream.flush();
fileOutputStream.close();
throw th3;
}
} catch (Throwable th10) {
th3 = th10;
fileOutputStream = null;
gs.a((InputStream) dataInputStream);
if (fileOutputStream != null) {
}
}
}
}
int i6 = this.an.getInt("hfSz", 256000);
if (!z10 && r3 == 0) {
errorStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(errorStream, gs.p(contentType)));
if (file == null) {
try {
at.a(file);
bufferedWriter = new BufferedWriter(new FileWriter(file, false), 8192);
} catch (OutOfMemoryError e8) {
outOfMemoryError = e8;
bufferedWriter = null;
bufferedReader = bufferedReader2;
bo.b("E", z5, "sendHTTPReq:" + outOfMemoryError.getMessage());
gs.a((Reader) bufferedReader);
gs.a((Writer) bufferedWriter);
i3 = sb.length();
if (this.aa.booleanValue()) {
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
}
if (httpURLConnection != null) {
}
if (sSLSocketFactory != null) {
}
} catch (Throwable th11) {
th2 = th11;
writer = null;
r14 = bufferedReader2;
gs.a((Reader) r14);
gs.a(writer);
throw th2;
}
} else {
bufferedWriter = null;
}
while (!this.aa.booleanValue() && (readLine = bufferedReader2.readLine()) != null) {
try {
if (bufferedWriter != null) {
bufferedWriter.write(readLine);
bufferedWriter.write("\n");
}
if (sb.length() >= i6) {
sb.append(readLine);
sb.append('\n');
}
} catch (OutOfMemoryError e9) {
outOfMemoryError = e9;
bufferedReader = bufferedReader2;
bo.b("E", z5, "sendHTTPReq:" + outOfMemoryError.getMessage());
gs.a((Reader) bufferedReader);
gs.a((Writer) bufferedWriter);
i3 = sb.length();
if (this.aa.booleanValue()) {
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
}
if (httpURLConnection != null) {
}
if (sSLSocketFactory != null) {
}
}
}
bo.b("E", "got: " + sb.toString());
gs.a((Reader) bufferedReader2);
gs.a((Writer) bufferedWriter);
i3 = sb.length();
if (this.aa.booleanValue()) {
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
}
if (httpURLConnection != null) {
}
if (sSLSocketFactory != null) {
}
}
errorStream = httpURLConnection.getErrorStream();
BufferedReader bufferedReader22 = new BufferedReader(new InputStreamReader(errorStream, gs.p(contentType)));
if (file == null) {
}
while (!this.aa.booleanValue()) {
if (bufferedWriter != null) {
}
if (sb.length() >= i6) {
}
}
bo.b("E", "got: " + sb.toString());
gs.a((Reader) bufferedReader22);
gs.a((Writer) bufferedWriter);
i3 = sb.length();
if (this.aa.booleanValue()) {
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
}
if (httpURLConnection != null) {
}
if (sSLSocketFactory != null) {
}
} catch (Throwable th12) {
th2 = th12;
writer = r3;
r14 = str15;
}
}
i3 = -1;
if (this.aa.booleanValue()) {
}
headerFields = httpURLConnection.getHeaderFields();
if (headerFields != null) {
}
if (httpURLConnection != null) {
}
if (sSLSocketFactory != null) {
}
} catch (MalformedURLException unused5) {
httpURLConnection7 = httpURLConnection;
str11 = str2;
a(z5, R.string.fi_bad_url, str11);
if (httpURLConnection7 != null) {
httpURLConnection7.disconnect();
}
} catch (ProtocolException e10) {
protocolException = e10;
httpURLConnection6 = httpURLConnection;
str10 = str2;
a(z5, R.string.fi_prot_err, str10, protocolException.toString());
if (httpURLConnection6 != null) {
httpURLConnection6.disconnect();
}
} catch (SocketException e11) {
socketException = e11;
httpURLConnection5 = httpURLConnection;
str9 = str2;
a(z5, R.string.fi_socket_err, str9, socketException.getMessage());
if (httpURLConnection5 != null) {
httpURLConnection5.disconnect();
}
} catch (UnknownHostException unused6) {
httpURLConnection4 = httpURLConnection;
str8 = str2;
a(z5, R.string.fi_unknown_host, str8);
if (httpURLConnection4 != null) {
httpURLConnection4.disconnect();
}
}
} catch (NumberFormatException e12) {
numberFormatException = e12;
httpURLConnection2 = null;
} catch (MalformedURLException unused7) {
str11 = str2;
httpURLConnection7 = null;
} catch (ProtocolException e13) {
protocolException = e13;
str10 = str2;
httpURLConnection6 = null;
} catch (SocketException e14) {
socketException = e14;
str9 = str2;
httpURLConnection5 = null;
} catch (UnknownHostException unused8) {
str8 = str2;
httpURLConnection4 = null;
} catch (IOException e15) {
iOException = e15;
httpURLConnection3 = null;
} catch (Throwable th13) {
th = th13;
httpURLConnection = null;
}
} catch (IOException e16) {
iOException = e16;
httpURLConnection3 = null;
sSLSocketFactory = null;
} catch (NumberFormatException e17) {
numberFormatException = e17;
httpURLConnection2 = null;
sSLSocketFactory = null;
} catch (Throwable th14) {
th = th14;
httpURLConnection = null;
sSLSocketFactory = null;
}
} catch (MalformedURLException unused9) {
str11 = str2;
} catch (ProtocolException e18) {
protocolException = e18;
str10 = str2;
} catch (SocketException e19) {
socketException = e19;
str9 = str2;
} catch (UnknownHostException unused10) {
str8 = str2;
}
} catch (Throwable th15) {
th = th15;
httpURLConnection = 1;
}
}
private void a(boolean z2, boolean z3, boolean z4) {
Intent intent = new Intent("com.google.code.apndroid.intent.action.CHANGE_REQUEST");
intent.putExtra("com.google.code.apndroid.intent.extra.TARGET_MMS_STATE", z3 ? 1 : 0);
intent.putExtra("com.google.code.apndroid.intent.extra.TARGET_STATE", z2 ? 1 : 0);
intent.putExtra("com.google.code.apndroid.intent.extra.SHOW_NOTIFICATION", z4);
if (a(intent)) {
return;
}
bo.d("E", "Mobile Data: APNDroid not installed");
}
private int a(net.dinglisch.android.taskerm.c cVar, ft ftVar, Bundle bundle) {
Intent intent;
boolean z2;
int i2;
char c2;
Intent a2;
String M;
int an = ftVar.an();
if (gx.c(this)) {
int i3 = cVar.i();
String m2 = cVar.m();
net.dinglisch.android.taskerm.f i4 = cVar.i(0);
int a3 = a(cVar, 3, true, true, bundle);
boolean z3 = a3 > 0;
if (z3) {
Intent a4 = di.a((Context) this, di.a.Action, i3, i4.c(), true);
if (a4 != null) {
intent = a4;
z2 = true;
if (intent != null) {
try {
c2 = 1;
i2 = a3;
try {
a2 = di.a(this, di.a.Action, i3, i4.c(), false, true);
} catch (SecurityException e2) {
e = e2;
if (bundle != null) {
bundle.putString("%errmsg", e.getMessage());
}
a2 = intent;
if (a2 == null) {
}
if (a2 == null) {
}
return -3;
}
} catch (SecurityException e3) {
e = e3;
i2 = a3;
c2 = 1;
}
if (a2 == null && i2 != Integer.MAX_VALUE) {
if (i4.g()) {
ga.c.e(i4.c());
Bundle a5 = i4.a(this, m2, bundle);
a2.putExtras(a5);
bo.b("E", "FIRE PLUGIN: " + m2 + " / " + a2.getAction() + ": " + a5.size() + " bundle keys");
} else {
bo.b("E", "FIRE PLUGIN: " + m2 + " / " + a2.getAction() + ": no extras");
}
ComponentName component = a2.getComponent();
if (component == null) {
bo.c("E", m2 + ": null component name");
} else {
bo.b("E", m2 + ": plugin comp: " + component.getPackageName() + "/" + component.getClassName());
}
ga.c.b(a2, i2 * 1000);
if (z3) {
String a6 = n.a(this, cVar, bundle, an);
try {
if (i2 == di.b()) {
c(a6);
} else {
b(a6, i2);
}
ga.c.a(a2, di.a(this, an), z2 ? new ComponentName(this, (Class<?>) ServicePluginFinished.class) : null, false);
} catch (Exception e4) {
e = e4;
an = 2;
}
try {
if (!z2) {
an = 2;
sendOrderedBroadcast(a2, null, new AnonymousClass14(ftVar), null, -1, null, null);
} else {
an = 2;
com.joaomgcd.taskerm.util.h.a(this, a2, a2.getIntExtra("net.dinglisch.android.tasker.EXTRA_TARGET_API", Build.VERSION.SDK_INT));
a(3, (Bundle) null, ftVar);
}
return -1;
} catch (Exception e5) {
e = e5;
Object[] objArr = new Object[an];
objArr[0] = m2;
objArr[c2] = e.toString();
a(R.string.fi_plugin_err, objArr);
d(a6);
return -3;
}
}
sendBroadcast(a2, null);
} else if (a2 == null && (M = cVar.M()) != null) {
String y2 = com.joaomgcd.taskerm.util.ao.y(M);
com.joaomgcd.taskerm.notification.aw awVar = new com.joaomgcd.taskerm.notification.aw(this);
awVar.c(M + "missing");
awVar.a(R.string.dt_missing_app);
String[] strArr = new String[2];
strArr[0] = ct.a(this, R.string.cn_plugin, new Object[0]).toLowerCase();
strArr[c2] = y2;
awVar.a(R.string.dc_missing_component_can_download, strArr);
awVar.a(new com.joaomgcd.taskerm.notification.d(this, M, false));
awVar.a(new com.joaomgcd.taskerm.notification.an("missingapp", getApplicationContext().getString(R.string.dt_missing_app), "Notifications for when a required plugin is missing."));
awVar.c().b();
}
return -3;
}
i2 = a3;
c2 = 1;
a2 = intent;
if (a2 == null) {
}
if (a2 == null) {
String y22 = com.joaomgcd.taskerm.util.ao.y(M);
com.joaomgcd.taskerm.notification.aw awVar2 = new com.joaomgcd.taskerm.notification.aw(this);
awVar2.c(M + "missing");
awVar2.a(R.string.dt_missing_app);
String[] strArr2 = new String[2];
strArr2[0] = ct.a(this, R.string.cn_plugin, new Object[0]).toLowerCase();
strArr2[c2] = y22;
awVar2.a(R.string.dc_missing_component_can_download, strArr2);
awVar2.a(new com.joaomgcd.taskerm.notification.d(this, M, false));
awVar2.a(new com.joaomgcd.taskerm.notification.an("missingapp", getApplicationContext().getString(R.string.dt_missing_app), "Notifications for when a required plugin is missing."));
awVar2.c().b();
}
return -3;
}
intent = a4;
} else {
intent = null;
}
z2 = false;
if (intent != null) {
}
a2 = intent;
if (a2 == null) {
}
if (a2 == null) {
}
return -3;
}
return -5;
}
public class AnonymousClass14 extends BroadcastReceiver {
final ft f11035a;
AnonymousClass14(ft ftVar) {
this.f11035a = ftVar;
}
@Override
public void onReceive(Context context, Intent intent) {
bo.b("E", "plugin handler, onReceive");
final ft ftVar = this.f11035a;
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
ExecuteService.AnonymousClass14.this.a(ftVar);
}
});
}
public void a(ft ftVar) {
ExecuteService.this.a(getResultCode(), getResultExtras(true), ftVar);
}
}
private int d(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a((Context) this, cVar, i2, true, true, bundle);
}
private int a(net.dinglisch.android.taskerm.c cVar, int i2, boolean z2, boolean z3, Bundle bundle) {
return a(this, cVar, i2, z2, z3, bundle);
}
private void a(BluetoothAdapter bluetoothAdapter, int i2) {
long currentTimeMillis = System.currentTimeMillis();
bo.b("E", "wait for BT state " + i2);
boolean z2 = false;
while (!z2 && !this.aa.booleanValue()) {
z2 = (bluetoothAdapter.isEnabled() ? 12 : 10) == i2 || System.currentTimeMillis() - currentTimeMillis > 10000;
if (!z2) {
a(100L);
}
}
bo.b("E", "done");
}
private int I() {
long currentTimeMillis = System.currentTimeMillis();
bo.b("E", "wait for stable wimax state...");
int i2 = -1;
while (!this.aa.booleanValue() && System.currentTimeMillis() - currentTimeMillis < 12000 && (i2 = bw.be.c(this)) != 1 && i2 != 3) {
bo.b("E", "wimax state: " + i2);
a(500L);
}
bo.b("E", "done wimax wait, state: " + i2);
return i2;
}
private void a(WifiManager wifiManager, int i2, boolean z2) {
long currentTimeMillis = System.currentTimeMillis();
if (z2) {
bo.b("E", "wait for wifi tether state " + i2);
} else {
bo.b("E", "wait for wifi state " + i2);
}
boolean z3 = false;
while (!z3 && !this.aa.booleanValue() && System.currentTimeMillis() - currentTimeMillis < 10000) {
z3 = (!z2 && wifiManager.getWifiState() == i2) || (z2 && bw.bd.b(wifiManager) == i2);
if (!z3) {
a(200L);
}
}
bo.b("E", "timout/timetoleave");
}
@Override
public void onLowMemory() {
super.onLowMemory();
bo.d("E", "low memory reported");
synchronized (D) {
if (k != null) {
J();
System.gc();
bo.d("E", "low mem, cleared music dir records");
}
}
}
private int a(net.dinglisch.android.taskerm.c cVar, String str, String str2, Bundle bundle) {
int i2;
int d2;
int h2 = cVar.g(0).h();
boolean z2 = !TextUtils.isEmpty(str);
String str3 = h2 == 0 ? "geo:" : h2 == 1 ? "google.streetview:cbll=" : "google.navigation:q=";
if (!z2) {
String b2 = gx.b(this, cVar.j(2).c(), bundle);
if (b2.split(Pattern.quote(",")).length == 2) {
if (h2 == 0 && str2.length() > 0) {
str3 = str3 + "0,0?q=" + b2 + " (" + str2 + ")";
} else {
str3 = str3 + b2;
}
i2 = -1;
} else {
b(R.string.fi_bad_lat_long, cVar.n(), b2);
i2 = -3;
}
} else if (h2 == 1) {
bo.c("E", "Open Map: addresses not supported for streetview");
i2 = -3;
} else {
if (h2 == 2) {
str3 = str3 + str;
} else {
str3 = str3 + "0,0?q=" + str;
if (str2.length() > 0) {
str3 = str3 + " (" + str2 + ")";
}
}
i2 = -1;
}
if (i2 == -1 && (d2 = d(cVar, 3, bundle)) != Integer.MAX_VALUE && d2 != 1) {
if (h2 == 2) {
bo.d("E", "Open Map: zoom not valid for Navigate mode ");
} else if (h2 == 1) {
if (z2) {
bo.d("E", "Open Map: zoom not valid for StreetView / Address");
} else {
str3 = str3 + "&mz=" + String.valueOf(d2);
}
} else if (z2) {
bo.d("E", "Open Map: zoom not valid for Point / Address");
} else if (str2.length() > 0) {
bo.d("E", "OpenMap: zoom not valid with label");
} else {
str3 = str3 + "?z=" + String.valueOf(d2);
}
}
if (i2 != -1) {
return i2;
}
try {
a(new Intent("android.intent.action.VIEW", Uri.parse(str3)));
return i2;
} catch (Exception e2) {
bo.d("E", "Open Map: " + e2.toString());
return -3;
}
}
private int k(String str) {
Intent intent = new Intent(this, (Class<?>) ActionEdit.class);
if (str.length() > 0) {
int b2 = n.b(str);
if (b2 == -1) {
a(R.string.fi_bad_action, str);
} else {
intent.putExtra("actionindex", b2);
}
}
intent.putExtra("raf", ActionEdit.b.Exe.toString());
intent.addFlags(262144);
c("Proxy Group");
a(true, "doQueryAction");
if (a(intent)) {
return -1;
}
a(false, "doQueryAction (failed)");
d("Proxy Group");
return -4;
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2 = b(cVar, 1, bundle);
hh.a a2 = hh.a(b(cVar, 0));
if (!hh.a(a2, str)) {
if (b2.equals("STORED")) {
System.gc();
if (hh.d(this, a2)) {
return -1;
}
} else {
if (TextUtils.isEmpty(b2)) {
hh.c(this, a2);
return -1;
}
Bitmap bitmap = null;
int c2 = hh.c(this);
int b3 = hh.b(this);
if (b2.startsWith("android.resource://")) {
String lastPathSegment = Uri.parse(b2).getLastPathSegment();
try {
net.dinglisch.android.taskerm.g gVar = new net.dinglisch.android.taskerm.g();
gVar.a(lastPathSegment, true);
bitmap = gVar.a(this, c2, b3, str);
} catch (Exception e2) {
bo.d("E", str + ": " + e2.getMessage());
}
} else {
File a3 = a(b2, str, true, true, false);
if (a3 != null) {
bitmap = ca.a(a3.toString(), c2, b3);
}
}
System.gc();
if (bitmap == null) {
b(R.string.fi_load_bitmap, str);
} else {
boolean a4 = a(cVar, 2);
boolean a5 = a(cVar, 3);
if (a4) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
if (width < c2 || height < b3) {
bitmap = ca.b(bitmap, c2, b3);
}
}
if (a5) {
int width2 = bitmap.getWidth();
int height2 = bitmap.getHeight();
if (width2 > c2 || height2 > b3) {
bitmap = ca.a(bitmap, c2, b3);
}
}
System.gc();
if (hh.a(this, bitmap, a2)) {
return -1;
}
}
}
}
return -3;
}
private int a(int i2, String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, ft ftVar) {
int i3;
boolean a2;
boolean z2;
int callState;
boolean disableDataConnectivity;
int i4;
ITelephony a3 = gc.a(this, "do handle phone exec service");
if (a3 == null) {
bo.d("E", str + ": no telephony service");
return -1;
}
if (i2 == 732) {
try {
a2 = a(a3.isRadioOn(), cVar.h(0).h());
z2 = a2;
i3 = -1;
} catch (Exception unused) {
bo.b("E", str + ": couldn't get current value");
i3 = -3;
z2 = false;
if (i3 == -1) {
}
return i3;
} catch (NoSuchMethodError unused2) {
bo.b("E", str + ": couldn't get current value: no method");
i3 = -3;
z2 = false;
if (i3 == -1) {
}
return i3;
}
} else if (i2 == 433) {
a2 = a(gs.a((Context) this, 0), cVar.h(0).h());
bo.b("E", "cur data status: " + a2);
z2 = a2;
i3 = -1;
} else {
i3 = -1;
z2 = false;
}
if (i3 == -1) {
try {
callState = ((TelephonyManager) df.a(this, "phone", "E", "dhp")).getCallState();
} catch (Exception e2) {
bo.c("E", str + ": " + e2.toString());
}
if (i2 != 433) {
if (i2 != 734) {
switch (i2) {
case 732:
try {
try {
try {
} catch (NoSuchMethodError unused3) {
bo.d("E", "doHandlePhone: no such method setRadio");
}
} catch (SecurityException e3) {
bo.d("E", "doHandlePhone: security exception from telephony service: " + e3.toString());
}
} catch (Exception e4) {
bo.d("E", str + "exception setting radio to " + z2 + ": " + e4.getMessage());
}
if (!a3.setRadio(z2)) {
bo.d("E", str + ": failed");
i4 = -3;
if (i4 == -3) {
if (!bw.x.a((ConnectivityManager) df.a(this, "connectivity", "E", "dhp"), 0, z2)) {
}
}
return i4;
}
i4 = -1;
if (i4 == -3 && bw.x.b()) {
if (!bw.x.a((ConnectivityManager) df.a(this, "connectivity", "E", "dhp"), 0, z2)) {
return -1;
}
bo.d("E", str + ": setRadio failed");
}
return i4;
}
bo.c("E", str + ": " + e2.toString());
return -3;
}
if (callState == 1) {
a3.silenceRinger();
if (i2 == 731) {
if (com.joaomgcd.taskerm.util.h.c(this)) {
AcceptCallActivity.a(this);
} else {
a3.answerRingingCall();
}
}
} else {
bo.b("E", str + ": not in call");
}
} else {
if (z2) {
disableDataConnectivity = a3.enableDataConnectivity();
} else {
disableDataConnectivity = a3.disableDataConnectivity();
}
if (!disableDataConnectivity) {
bo.d("E", str + ": " + z2 + ": failed");
return -3;
}
}
}
return i3;
}
private void c(String str, String str2) {
if (gs.a(getPackageManager(), "sms")) {
bo.b("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) {
bo.d("E", "storage of SMS sent to " + str + " failed");
}
bo.b("E", "stored");
return;
} catch (Exception e2) {
bo.d("E", "failed to write to messaging DB: " + e2.toString());
return;
}
}
bo.d("E", "no messaging app");
}
private void a(String str, net.dinglisch.android.taskerm.c cVar) {
if (bo.j()) {
Resources resources = getResources();
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(" / ");
sb.append(cVar.a(resources, true));
if (cVar.l()) {
if (cVar.i() != 37) {
sb.append(" If ");
} else {
sb.append(' ');
}
sb.append(cVar.o().c(resources));
}
bo.b("E", sb.toString());
}
}
private boolean e(int i2, String str) {
if (n.z(i2)) {
return true;
}
if (gs.a(i2, n.d()) != -1) {
b(ct.a(this, R.string.dc_need_secure_settings, n.u(i2), "4.2+"), new Object[0]);
} else {
com.joaomgcd.taskerm.util.ad a2 = com.joaomgcd.taskerm.util.bh.e().a(i2);
if (!a2.a()) {
b(R.string.tip_need_min_api, com.joaomgcd.taskerm.util.g.a(a2.b()));
} else {
b(R.string.fi_action_unavailable, str);
}
}
return false;
}
private int a(net.dinglisch.android.taskerm.c cVar, ft ftVar, String str, int i2, boolean z2, String str2, String str3, String str4, int i3, boolean z3, Bundle bundle, boolean z4, boolean z5) {
if (str2 == null || str3 == null || str4 == null) {
bo.d("E", "runShell: variable name error");
return -3;
}
boolean z6 = z3 || str2.length() > 0;
boolean z7 = str3.length() > 0;
if (str2.length() > 0) {
gx.a((Context) this, str2, false, true, bundle);
}
if (z7) {
gx.a((Context) this, str3, false, true, bundle);
}
if (i2 == Integer.MAX_VALUE) {
return -3;
}
if (z2 && !ba.a((Context) this, (Boolean) true)) {
bo.d("E", "shell: no root");
return -3;
}
int i4 = i2 == 0 ? -1 : (int) (i2 * 1000);
if (!z5) {
fd.a(this, i3, z2, i4, z6, z7, new String[]{str}, z4);
c(n.A(i3));
return -1;
}
String a2 = fd.a(this, z2, str);
if (a2 == null) {
return -3;
}
return this.f11023d.a(cVar, bundle, ftVar, a2, i4, z2, z4, str2, str3);
}
private void a(String str, boolean z2, String str2, Bundle bundle) {
File file = new File(new File(Environment.getExternalStorageDirectory(), "sl4a/scripts"), str);
if (file.exists()) {
Intent intent = new Intent(z2 ? "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());
bo.b("E", "ACTION: " + intent.getAction());
bo.b("E", "COMPONENT: " + intent.getComponent().toString());
bo.b("E", "EXTRA SCRIPT KEY/PATH: com.googlecode.android_scripting.extra.SCRIPT_PATH / " + file);
if (!TextUtils.isEmpty(str2)) {
String[] split = str2.split(",");
if (gs.a((Object[]) split)) {
bo.d("E", "couldn't get any variable definitions from spec");
} else {
for (String str3 : split) {
String trim = str3.trim();
String f2 = gx.f(this, trim, bundle);
if (f2 != null) {
bo.b("E", "EXTRA: VAR: " + trim + " value: |" + f2 + "|");
intent.putExtra(trim, f2);
}
}
}
}
a(intent);
return;
}
a(R.string.fi_no_script, str);
}
private void a(String str, String str2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
File a2 = a(str2, str, true, false, true);
if (a2 == null) {
b(R.string.fi_dir_not_exist, str, str2);
return;
}
synchronized (D) {
if (k != null && k.equals(a2)) {
if (r == l.size()) {
J();
synchronized (D) {
a((Context) this, true, "doMusicPlayDir");
}
}
if (k != null) {
D();
}
}
Integer valueOf = Integer.valueOf(d(cVar, 5, bundle));
if (valueOf != null) {
boolean b2 = cVar.h(3).b();
boolean b3 = cVar.h(1).b();
boolean b4 = cVar.h(2).b();
if (valueOf.intValue() != 0 && !b2) {
i2 = valueOf.intValue();
l = gs.a(a2, b3, b4, i2, 0);
if (b2 && valueOf.intValue() > 0) {
Random random = new Random();
while (l.size() > valueOf.intValue()) {
l.remove(random.nextInt(l.size()));
}
}
}
i2 = Integer.MAX_VALUE;
l = gs.a(a2, b3, b4, i2, 0);
if (b2) {
Random random2 = new Random();
while (l.size() > valueOf.intValue()) {
}
}
}
if (l != null) {
if (l.size() == 0) {
a(R.string.fi_no_files, a2);
} else {
k = a2;
n = cVar.h(3).b();
m = -1;
o = cVar.h(4).b();
r = 0;
}
}
if (k != null) {
}
}
}
private void j(int i2) {
bo.b("E", "WIDGET CONTROL index " + i2);
String[] a2 = ct.a(this, R.array.actionedit_array_action_choices_mediaplayer_commands);
Intent intent = new Intent("com.android.music.musicservicecommand");
intent.putExtra("command", a2[i2]);
intent.addFlags(1073741824);
sendBroadcast(intent);
}
private int k(int i2) {
if (i2 == 1) {
return 127;
}
if (i2 == 5) {
return 126;
}
return f11018e[i2];
}
private void J() {
k = null;
l = null;
}
private void a(int i2, net.dinglisch.android.taskerm.d dVar) {
AudioManager audioManager;
if (i2 == 1 && (audioManager = (AudioManager) df.a(this, "audio", "E", "dmcvb")) != null && !audioManager.isMusicActive()) {
bo.b("E", "buttonMediaControl: music not active, don't toggle pause");
return;
}
int k2 = k(i2);
String i3 = (dVar == null || !dVar.g()) ? null : dVar.i();
bo.b("E", "BUTTON CONTROL index " + i2 + " code " + k2);
long uptimeMillis = SystemClock.uptimeMillis();
long j2 = uptimeMillis - 1;
String str = i3;
df.a(this, str, j2, j2, 0, k2, 0);
df.a(this, str, j2, uptimeMillis, 1, k2, 0);
}
public String a(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a(this, cVar, i2, bundle);
}
public String a(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, boolean z2) {
return a(this, cVar, i2, bundle, z2);
}
private void l(String str) {
a(str, (ft) null);
}
private void a(String str, ft ftVar) {
if (ftVar == null) {
bo.b("Ew", str);
return;
}
bo.b("Ew", "Task " + ftVar.ah() + ": " + str);
}
private int a(net.dinglisch.android.taskerm.c cVar, int i2, int i3, Bundle bundle, final ft ftVar) {
boolean y2;
boolean z2;
int i4 = i2 == 30 ? -1 : -2;
long c2 = c(cVar, bundle);
long currentTimeMillis = System.currentTimeMillis();
a("need wait for " + c2 + "ms (task elapsed time: " + cVar.A() + ")", ftVar);
if (c2 == Long.MIN_VALUE) {
i4 = -3;
} else {
if (!this.ad.isEmpty()) {
Iterator<Long> it = this.af.values().iterator();
while (it.hasNext()) {
long longValue = it.next().longValue();
if (currentTimeMillis < longValue) {
long j2 = longValue - currentTimeMillis;
if (j2 < c2) {
a("doWaitAction: have nearer wait flag expiry, use that (" + j2 + "ms)", ftVar);
c2 = j2;
}
}
}
}
if (c2 > 10) {
b(10 + c2);
synchronized (this.f11020a) {
y2 = y();
}
if (!y2 && hf.a("E")) {
a("wait: release wakelock E", ftVar);
hf.c(this, "E");
}
synchronized (this.f11020a) {
if (i3 != this.Z) {
a("doWaitAction: new task since queue choice, go back and choose again", ftVar);
z2 = true;
} else {
z2 = false;
}
}
int[] iArr = null;
if (!z2) {
a("do wait", ftVar);
this.f11023d.a(new Runnable() {
@Override
public final void run() {
ExecuteService.this.f(ftVar);
}
});
a("getting queue exe ids", ftVar);
iArr = K();
a("doing wait for " + c2 + "ms", ftVar);
z2 = a(c2, ftVar);
a("finished wait, ok: " + z2, ftVar);
}
hf.a(this, "E", !y2, false);
if (z2) {
a("set do again", ftVar);
i4 = -2;
}
this.ar = z2;
a(System.currentTimeMillis() - currentTimeMillis, iArr);
b(0L);
}
}
if (i4 == -1) {
cVar.B();
this.ar = false;
}
return i4;
}
public void f(ft ftVar) {
a("marking wait pending as false", ftVar);
this.ar = false;
a("Posting DoingWait", ftVar);
com.joaomgcd.taskerm.rx.b.c(new n.a());
a("Posted DoingWait", ftVar);
}
private int[] K() {
int[] iArr;
synchronized (this.f11020a) {
iArr = new int[this.f11020a.size()];
for (int i2 = 0; i2 < this.f11020a.size(); i2++) {
iArr[i2] = this.f11020a.get(i2).an();
}
}
return iArr;
}
private void a(long j2, int[] iArr) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (!next.am() && (iArr == null || gs.a(next.an(), iArr) != -1)) {
net.dinglisch.android.taskerm.c L = next.L();
if (L != null) {
L.a(j2);
}
}
}
}
}
private long b(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int a2 = a(cVar, 0, true, false, bundle);
int a3 = a(cVar, 1, true, false, bundle);
int a4 = a(cVar, 2, true, false, bundle);
int a5 = a(cVar, 3, true, false, bundle);
int a6 = a(cVar, 4, true, false, bundle);
if (a2 == Integer.MAX_VALUE || a3 == Integer.MAX_VALUE || a4 == Integer.MAX_VALUE || a5 == Integer.MAX_VALUE || a6 == Integer.MAX_VALUE) {
return Long.MIN_VALUE;
}
return a2 + (a3 * 1000) + (a4 * 60000) + (a5 * 3600000) + (a6 * 86400000);
}
private long c(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
long b2 = b(cVar, bundle);
if (b2 == Long.MIN_VALUE) {
return Long.MIN_VALUE;
}
return b2 - cVar.A();
}
private int a(ft ftVar, final String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, int i2) {
int i3;
boolean z2;
int i4;
com.joaomgcd.taskerm.helper.actions.execute.w wVar;
int i5;
if (bw.x.a(this)) {
WifiManager wifiManager = (WifiManager) df.a(this, "wifi", "E", "dtw");
if (wifiManager == null) {
bo.c("E", ct.a(this, R.string.err_no_wifi_manager, new Object[0]));
} else {
int b2 = bw.bd.b(wifiManager);
bo.b("E", "current state: " + b2);
if (b2 == 4) {
bo.d("E", str + ": skip, current AP state failed");
} else {
if (b2 == 3 || b2 == 2) {
i3 = i2;
z2 = true;
} else {
i3 = i2;
z2 = false;
}
boolean a2 = a(z2, i3);
bo.b("E", str + ": cur: " + z2 + " new: " + a2);
if (z2 != a2) {
com.joaomgcd.taskerm.helper.actions.execute.w wVar2 = new com.joaomgcd.taskerm.helper.actions.execute.w(this, cVar, new c.f.a.b() {
@Override
public final Object invoke(Object obj) {
c.s e2;
e2 = ExecuteService.e(str, (String) obj);
return e2;
}
});
if (a2) {
if (cVar.h(1).b()) {
wVar = wVar2;
i5 = -1;
} else {
wVar = wVar2;
i5 = a(ftVar, cVar, bundle, n.u(425), 0, false);
a(200L);
}
if (this.aa.booleanValue()) {
bo.b("E", str + "skipping, time to leave");
} else if (i5 != -1 && i5 != -5) {
bo.d("E", str + ": wifi disable failed");
} else if (b2 == 2) {
a(wifiManager, 3, true);
} else {
if (b2 == 0) {
a(wifiManager, 1, true);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else {
bo.b("E", str + ": setWifiEnabled()");
com.joaomgcd.taskerm.util.cr a3 = wVar.a(wifiManager, true);
if (a3.b()) {
a(wifiManager, 3, true);
} else {
bo.c("E", ((com.joaomgcd.taskerm.util.cs) a3).c());
i5 = -3;
}
}
}
i4 = i5;
return i4;
}
if (b2 == 0) {
a(wifiManager, 1, true);
} else {
if (b2 == 2) {
a(wifiManager, 3, true);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else {
com.joaomgcd.taskerm.util.cr a4 = wVar2.a(wifiManager, false);
if (a4.b()) {
a(wifiManager, 1, true);
} else {
bo.c("E", ((com.joaomgcd.taskerm.util.cs) a4).c());
}
}
}
}
i4 = -1;
return i4;
}
}
i4 = -3;
return i4;
}
bo.b("E", str + ": not supported");
bo.b("E", str + ": haveApi: " + bw.bd.c());
bo.b("E", str + " supported: " + bw.x.h(this));
bo.b("E", str + " regex: " + gs.a(bw.x.e(this), ","));
return -3;
}
public static c.s e(String str, String str2) {
bo.b("E", str + ": " + str2);
return c.s.f2131a;
}
private int c(String str, int i2) {
if (bw.x.b(this)) {
String g2 = bw.x.g(this);
if (g2 == null) {
bo.d("E", str + ": no regexs");
return -3;
}
boolean z2 = gs.b(g2, bw.x.d(this)) != -1;
String[] c2 = bw.x.c(this);
for (String str2 : c2) {
bo.b("E", "tetherable: " + str2);
}
gs.b(g2, c2);
boolean a2 = a(z2, i2);
bo.b("E", str + ": " + z2 + " -> " + a2);
return (z2 == a2 || new com.joaomgcd.taskerm.helper.actions.execute.v(this).a(a2).b()) ? -1 : -3;
}
bo.b("E", str + ": not supported");
return -3;
}
private int a(ft ftVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle, String str, int i2, boolean z2) {
WifiManager wifiManager = (WifiManager) df.a(this, "wifi", "E", "doWifiStatus");
if (wifiManager == null) {
bo.c("E", ct.a(this, R.string.err_no_wifi_manager, new Object[0]));
return -3;
}
m(str + ": preAP");
bo.b("E", "check AP state");
int b2 = (z2 && bw.x.a(this)) ? bw.bd.b(wifiManager) : 1;
bo.b("E", "AP state: " + b2);
int i3 = -5;
if (b2 == 2 || b2 == 3) {
bo.b("E", "skipping wifi enable, wifi tether enabl(ed|ing)");
return -5;
}
m(str + ": postAP");
int wifiState = wifiManager.getWifiState();
bo.b("E", "current state: " + wifiState);
if (wifiState == 4) {
bo.b("E", str + ": current wifi state unknown, continue anyway");
} else if (wifiState == 3 && !wifiManager.pingSupplicant()) {
bo.b("E", "action wifi: wifi supplicant not responding, continuing anyway");
}
boolean z3 = wifiState == 3 || wifiState == 2;
bo.b("E", "curval: " + wifiState);
boolean a2 = a(z3, i2);
bo.b("E", str + ": cur: " + z3 + " new: " + a2);
if (z3 == a2) {
if (a2) {
MonitorService.a("E/doWifiStatus2");
}
return -5;
}
if (!a2) {
if (wifiState == 0) {
a(wifiManager, 1, false);
return -5;
}
if (wifiState == 2) {
a(wifiManager, 3, false);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
return -5;
}
return a(wifiManager, ftVar, cVar, bundle, false);
}
if (wifiState == 2) {
a(wifiManager, 3, false);
} else {
if (wifiState == 0) {
a(wifiManager, 1, false);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else {
bo.b("E", str + ": setWifiEnabled()");
i3 = a(wifiManager, ftVar, cVar, bundle, true);
}
}
MonitorService.a("E/doWifiStatus1");
return i3;
}
private int a(WifiManager wifiManager, ft ftVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle, final boolean z2) {
if (com.joaomgcd.taskerm.util.g.m() || com.joaomgcd.taskerm.util.g.b(this)) {
if (wifiManager.setWifiEnabled(z2)) {
a(wifiManager, z2 ? 3 : 1, false);
return -5;
}
bo.d("E", cVar.m() + ": enable failed");
return -3;
}
return this.f11023d.a(cVar, bundle, ftVar, "Couldn't toggle wifi: ", new c.f.a.b() {
@Override
public final Object invoke(Object obj) {
b.a.l a2;
a2 = ExecuteService.this.a(z2, (Context) obj);
return a2;
}
});
}
public b.a.l a(final boolean z2, final Context context) {
return ba.a((Context) this, true).a(new b.a.d.g() {
@Override
public final Object apply(Object obj) {
b.a.p a2;
a2 = ExecuteService.a(z2, context, (Boolean) obj);
return a2;
}
});
}
public static b.a.p a(boolean z2, Context context, Boolean bool) throws Exception {
if (bool.booleanValue()) {
StringBuilder sb = new StringBuilder();
sb.append("svc wifi ");
sb.append(z2 ? "enable" : bf.DISABLE_LABEL);
return com.joaomgcd.taskerm.util.cq.a(sb.toString()).c(new b.a.d.g() {
@Override
public final Object apply(Object obj) {
return ((com.joaomgcd.taskerm.util.cl) obj).d();
}
});
}
return net.dinglisch.android.tasker.d.a(context, new InputToggleWifi(z2));
}
private void m(String str) {
while (MonitorService.a() < 1000) {
bo.b("E", str + ": monitor just disabled wifi, give wifi manager time to effect");
a(100L);
}
}
private int e(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a(1, i2, 20, cVar, bundle) ? -1 : -3;
}
private int f(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return !a((cVar.h(4).b() || ck.b(this)) ? 3 : 0, i2, (cVar.h(3).b() ? (int) (((long) 10) + 5) : 10) + this.an.getInt("csnipD", 2), cVar, bundle) ? -3 : -1;
}
private void b(long j2) {
AlarmManager alarmManager = (AlarmManager) df.a(this, NotificationCompat.CATEGORY_ALARM, "E", "setWA");
bo.b("E", "set wait alarm for " + j2 + "ms");
if (alarmManager != null) {
synchronized (j) {
try {
if (j2 == 0) {
b(alarmManager, "setWaitAlarm");
} else if (j2 < 0) {
bo.b("E", "not setting wait alarm for negative time " + j2 + "ms");
} else if (j2 < 2000) {
bo.b("E", "don't bother setting wait alarm for < 2s");
} else {
this.L = PendingIntent.getBroadcast(this, 0, c((Context) this), com.joaomgcd.taskerm.util.ds.a(268435456));
this.M = System.currentTimeMillis() + j2;
a(alarmManager, "set");
}
} finally {
}
}
}
}
public void a(AlarmManager alarmManager, String str) {
a(alarmManager, gh.a(this, L()), str);
}
private boolean L() {
return ((PowerManager) df.a(getApplicationContext(), "power", "E", "screenOn")).isScreenOn();
}
private void a(AlarmManager alarmManager, boolean z2, String str) {
gh.a(alarmManager, 0, this.M, this.L, z2, "E/" + str);
}
public boolean M() {
boolean z2;
synchronized (u) {
z2 = true;
if ((this.U || this.V) && (!this.af.containsKey("Fix Group") || System.currentTimeMillis() > this.af.get("Fix Group").longValue())) {
bo.b("E", "fix timed out, force stop");
a(true, true, true, true);
}
if (this.U || this.V) {
z2 = false;
} else {
bo.b("E", "fix finished, remove wait flag");
d("Fix Group");
}
}
return z2;
}
public void a(String str, String str2, boolean z2) {
ft ftVar;
File file;
bo.b("E", "onUtteranceCompleted: " + str + " id: " + str2 + " err: " + z2);
synchronized (t) {
if (this.Q != null) {
bo.b("E", "TTS shutdown");
gx.a(this, 76);
if (this.T != null) {
file = new File(this.T.toString() + ".save");
this.T.renameTo(file);
} else {
file = null;
}
if (Settings.c(this)) {
this.f11023d.a(this.Q);
}
this.Q = null;
if (file != null) {
file.renameTo(this.T);
}
}
this.T = null;
F();
}
if (z2 && (ftVar = this.ae.get("Speech Group")) != null && ftVar.L().t()) {
ftVar.e(true);
}
d("Speech Group");
}
public boolean N() {
boolean z2;
synchronized (t) {
z2 = false;
if (this.Q != null) {
if (System.currentTimeMillis() - this.R < 500) {
bo.b("E", "TTS just started speech, let it get moving");
} else if (this.P == -34234) {
bo.b("E", "TTS still initializing");
} else if (this.Q.isSpeaking()) {
bo.b("E", "TTS still speaking");
} else {
a("stopTTSIfFinished", (String) null, false);
}
}
z2 = true;
}
return z2;
}
public ap a(ft ftVar, net.dinglisch.android.taskerm.c cVar, int i2, int i3) {
int i4;
int i5;
int i6;
int i7;
ap apVar = new ap(-1);
if (cVar == null) {
bo.c("E", "null action, end macro");
ftVar.e(false);
return apVar;
}
int i8 = cVar.i();
a("exe: " + ftVar.ah(), cVar);
boolean z2 = i8 == 30 && cVar.A() != 0;
if (!cVar.s()) {
apVar.f12022a = -5;
return apVar;
}
if (i8 == 43 && a(ftVar, i2)) {
a(ftVar, 37, -1, 38, false);
apVar.f12022a = -1;
return apVar;
}
if (!z2) {
if (bg.a((Context) this)) {
i7 = 37;
if (cVar.a((Context) this, true, ftVar.v(), ftVar.r(), "doRunAction[" + cVar.n() + "]")) {
i4 = 43;
i5 = 39;
i6 = 35;
}
} else {
i7 = 37;
}
if (i8 == i7) {
cVar.c(false);
a(ftVar, 37, 43, 38, false);
apVar.f12022a = -1;
return apVar;
}
if (i8 == 43) {
a(ftVar, i2, false);
a(ftVar, 37, 43, 38, false);
apVar.f12022a = -1;
return apVar;
}
if (i8 == 39) {
a(ftVar, 39, -1, 40, true);
apVar.f12022a = -1;
return apVar;
}
if (i8 == 35) {
cVar.B();
return a(cVar, ftVar, i2, i3);
}
bo.b("E", "condition failed");
apVar.f12022a = -7;
return apVar;
}
i4 = 43;
i5 = 39;
i6 = 35;
i7 = 37;
if (i8 == 40) {
a(ftVar, i5, 40, true);
apVar.f12022a = -2;
return apVar;
}
if (i8 == i6) {
apVar.f12022a = -1;
return apVar;
}
if (i8 == i7) {
cVar.c(true);
apVar.f12022a = -1;
return apVar;
}
if (i8 == i4) {
a(ftVar, i2, true);
apVar.f12022a = -1;
return apVar;
}
return a(cVar, ftVar, i2, i3);
}
private boolean a(ft ftVar, int i2) {
List<net.dinglisch.android.taskerm.c> a2 = ftVar.a(i2, false, false, true);
if (a2.isEmpty()) {
bo.c("E", "task position " + i2 + ": else without header if");
return true;
}
return a2.get(0).F();
}
private void a(ft ftVar, int i2, boolean z2) {
List<net.dinglisch.android.taskerm.c> a2 = ftVar.a(i2, false, false, true);
if (a2.isEmpty()) {
bo.c("E", "task position " + i2 + ": else without header if");
return;
}
a2.get(0).c(z2);
}
public void a(ft ftVar, int i2, int i3, int i4, boolean z2) {
int i5 = 1;
while (true) {
int J2 = ftVar.J();
if (J2 != i2) {
if (J2 != i4) {
if (J2 == i3) {
if (i5 == 1) {
break;
}
}
if (J2 == -1) {
break;
}
} else {
i5--;
if (i5 == 0) {
ftVar.Z();
break;
}
}
} else {
i5++;
}
ftVar.Z();
if (z2) {
bo.b("E", "in-between action: " + J2 + ": clear state");
ftVar.L().G();
}
}
bo.b("E", "skipToEndOfBlock, " + i2 + ", new action " + ftVar.M());
}
private void a(ft ftVar, int i2, int i3, boolean z2) {
bo.b("E", "skipToStartOfBlock, " + i2);
int i4 = 1;
while (true) {
int K2 = ftVar.K();
if (K2 == i3) {
i4++;
} else if (K2 == i2) {
i4--;
if (i4 == 0) {
ftVar.aa();
return;
}
} else if (K2 == -1) {
return;
}
ftVar.aa();
if (z2) {
ftVar.L().G();
}
}
}
private int O() {
int H2;
Iterator<String> it = this.ad.iterator();
int i2 = Integer.MIN_VALUE;
while (it.hasNext()) {
ft ftVar = this.ae.get(it.next());
if (ftVar != null && !ftVar.O() && (H2 = ftVar.H()) > i2) {
i2 = H2;
}
}
return i2;
}
public void a(boolean z2, boolean z3, boolean z4, boolean z5) {
synchronized (u) {
LocationManager locationManager = (LocationManager) df.a(this, "location", "E", "sgf");
if (z3) {
if (z4 && v != null) {
bo.b("E", "remove Net listener");
locationManager.removeUpdates(v);
v = null;
}
if (z5) {
this.V = false;
}
}
if (z2) {
if (z4 && w != null) {
bo.b("E", "remove GPS listener");
locationManager.removeUpdates(w);
w = null;
}
if (z5) {
this.U = false;
}
}
}
}
private void d(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int h2 = cVar.g(0).h();
a(h2 == 0 || h2 == 2, h2 == 1 || h2 == 2, true, true);
}
private int a(ft ftVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int h2 = cVar.g(0).h();
int a2 = a(cVar, 1, true, false, bundle);
boolean a3 = a(cVar, 2);
this.W = a(cVar, 3);
boolean z2 = h2 == 0 || h2 == 2;
boolean z3 = h2 == 1 || h2 == 2;
if (!a3) {
this.f11023d.b(ftVar);
}
this.X = null;
this.Y = 0;
LocationManager locationManager = (LocationManager) df.a(this, "location", "E", "dgf");
if (a2 != Integer.MAX_VALUE) {
if (locationManager == null) {
bo.c("E", "no location manager");
} else {
if (z3) {
if (v == null) {
bo.b("E", "register net listener");
v = new LocationListener() {
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public void onStatusChanged(String str, int i2, Bundle bundle2) {
}
@Override
public void onLocationChanged(Location location) {
bo.b("E", "FIX: net: " + bn.a(location) + " acc " + location.getAccuracy());
ExecuteService.this.a(false, true, ExecuteService.this.W ^ true, true);
bn.a(ExecuteService.this, location);
gx.e(ExecuteService.this);
ExecuteService.this.f();
}
};
locationManager.requestLocationUpdates("network", 0L, 0.0f, v, Looper.getMainLooper());
this.V = true;
} else {
bo.c("E", "couldn't start net fixes, already have location listener");
}
}
if (z2) {
if (w == null) {
bo.b("E", "register GPS listener");
w = new LocationListener() {
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public void onStatusChanged(String str, int i2, Bundle bundle2) {
}
@Override
public void onLocationChanged(Location location) {
bo.b("E", "fix: GPS: " + bn.a(location) + " acc " + location.getAccuracy() + " alt " + location.getAltitude() + " spd " + location.getSpeed());
long currentTimeMillis = System.currentTimeMillis();
gx.a(currentTimeMillis - location.getTime());
location.setTime(currentTimeMillis);
if (!bn.a(ExecuteService.this.X, location)) {
ExecuteService.this.Y = 0;
} else {
ExecuteService.r(ExecuteService.this);
bo.b("E", "acc worse, count " + ExecuteService.this.Y);
if (ExecuteService.this.Y > 1) {
ExecuteService.this.a(true, false, !ExecuteService.this.W, true);
}
}
bn.b(ExecuteService.this, location);
gx.d(ExecuteService.this);
ExecuteService.this.X = location;
ExecuteService.this.f();
}
};
locationManager.requestLocationUpdates("gps", 0L, 0.0f, w, Looper.getMainLooper());
this.U = true;
} else {
bo.c("E", "couldn't start GPS fixes, already have location listener");
}
}
if (P()) {
if (a3) {
this.af.put("Fix Group", Long.valueOf(n(a2)));
return -5;
}
b("Fix Group", a2);
return -1;
}
}
}
return -3;
}
private int c(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Intent a2 = cr.a(getPackageManager(), cr.a.Service, new Intent("com.teslacoilsw.intent.FLASHLIGHT"));
if (a2 == null) {
bo.d("E", str + ": failed to resolve service intent com.teslacoilsw.intent.FLASHLIGHT");
} else {
String[] strArr = {"off", "on", "toggle"};
int h2 = cVar.g(0).h();
int d2 = h2 == 1 ? d(cVar, 1, bundle) : 0;
if (d2 != Integer.MAX_VALUE) {
String str2 = strArr[h2];
if (d2 > 0) {
a2.putExtra("strobe", d2);
} else {
a2.putExtra(str2, true);
}
if (startService(a2) != null) {
return -1;
}
bo.b("E", cVar.n() + ": failed to start service");
}
}
return -3;
}
private int b(boolean z2, String str) {
Intent intent = new Intent("android.intent.action.RUN");
intent.setClassName("com.lslk.sleepbot", "com.lslk.sleepbot.IntentAPI");
intent.putExtra("key", "tasker@dinglisch.net");
intent.putExtra("api", 1);
intent.putExtra("debug", "alarm1");
if (z2) {
intent.putExtra("Sleep", true);
} else {
intent.putExtra("Wake up", true);
if (str.length() > 0) {
intent.putExtra("Note", str);
}
}
intent.putExtra("DialogFree", true);
return !a(intent) ? -3 : -1;
}
private boolean P() {
return (w == null && v == null) ? false : true;
}
private void Q() {
synchronized (z) {
z.clear();
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.n()) {
z.add(next.m());
}
}
}
gx.g(this, 77);
}
private Intent n(String str) {
return new Intent("net.dinglisch.android.zoom.ACTION_MAKE_CHANGES").setData(Uri.parse("widget://" + str));
}
private void l(int i2) {
TelephonyManager telephonyManager = (TelephonyManager) df.a(this, "phone", "E", "doNM");
int phoneType = telephonyManager != null ? telephonyManager.getPhoneType() : 0;
int c2 = gs.c(getContentResolver(), "preferred_network_mode");
int p2 = i2 >= 256 ? i2 - 256 : n.p(i2, phoneType);
bo.b("E", "current mode: " + c2 + " wanted: " + p2 + " phone type: " + phoneType);
if (p2 != c2) {
bo.b("E", "send network modification broadcast");
sendBroadcast(new Intent("com.android.internal.telephony.MODIFY_NETWORK_MODE").putExtra("networkMode", p2));
}
}
private boolean a(int i2, String str, String str2, int i3, int i4, int i5, long j2) {
return ew.a(this, i2, str, str2, i3 < 2, i3 == 0 || i3 == 2, i4, i5, j2);
}
private int a(int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i3;
boolean z2 = true;
int h2 = cVar.g(1).h();
int i4 = 0;
boolean z3 = h2 < 2;
if (h2 != 0 && h2 != 2) {
z2 = false;
}
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
if (i2 == 794) {
if (z3) {
arrayList.add("xPort");
arrayList2.add(Integer.valueOf(d(cVar, 2, bundle)));
arrayList.add("yPort");
arrayList2.add(Integer.valueOf(d(cVar, 3, bundle)));
}
if (z2) {
arrayList.add("xLand");
arrayList2.add(Integer.valueOf(d(cVar, 2, bundle)));
arrayList.add("yLand");
arrayList2.add(Integer.valueOf(d(cVar, 3, bundle)));
}
} else if (i2 == 795) {
if (z3) {
arrayList.add("widthPort");
arrayList2.add(Integer.valueOf(d(cVar, 2, bundle)));
arrayList.add("heightPort");
arrayList2.add(Integer.valueOf(d(cVar, 3, bundle)));
}
if (z2) {
arrayList.add("widthLand");
arrayList2.add(Integer.valueOf(d(cVar, 2, bundle)));
arrayList.add("heightLand");
arrayList2.add(Integer.valueOf(d(cVar, 3, bundle)));
}
} else {
bo.c("E", "unknown action code " + i2);
}
Intent n2 = n(cVar.j(0).c().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;
}
n2.putExtra((String) arrayList.get(i4), intValue);
i4++;
}
if (i3 == -1) {
sendBroadcast(n2);
}
return i3;
}
private int b(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:
bo.c("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 n2 = n(gx.b(this, cVar.j(0).c(), bundle).replaceFirst(" / ", "/"));
int i3 = -3;
if (str5 != null) {
int d2 = d(cVar, 1, bundle);
if (d2 != Integer.MAX_VALUE) {
n2.putExtra(str5, d2);
i3 = -1;
}
} else {
if (str2 != null) {
n2.putExtra(str2, gx.b(this, cVar.j(1).c(), bundle));
} else if (str != null) {
n2.putExtra(str, cVar.h(1).b());
}
i3 = -1;
}
if (str3 != null) {
n2.putExtra(str3, gx.b(this, cVar.j(2).c(), bundle));
}
if (i3 == -1) {
sendBroadcast(n2);
}
return i3;
}
private int d(String str, int i2) {
int i3;
int i4 = i2;
if (str.length() == 0) {
bo.d("E", "doType: empty string");
return -3;
}
if (i4 == Integer.MAX_VALUE) {
return -3;
}
if (i4 == 0) {
i4 = 1;
}
KeyCharacterMap load = KeyCharacterMap.load(-1);
ArrayList arrayList = new ArrayList();
int i5 = -1;
for (int i6 = 0; i6 < i4; i6++) {
String[] split = str.split("\\s+");
boolean z2 = !gs.a((Object[]) split);
int i7 = 0;
int i8 = 0;
while (true) {
if (i7 < str.length()) {
String str2 = null;
if (!z2 || i8 >= split.length) {
i3 = -1;
} else {
str2 = split[i8];
i3 = str2.length();
}
if (str2 != null) {
int i9 = i3 + i7;
if (str.substring(i7, i9).equals(str2)) {
arrayList.add("input text '" + str2 + "'");
i8++;
i7 = i9;
}
}
int i10 = i7 + 1;
char charAt = str.charAt(i7);
KeyEvent[] events = load.getEvents(new char[]{charAt});
if (gs.a((Object[]) events)) {
bo.d("E", "no key events for character " + charAt);
i5 = -3;
break;
}
arrayList.add("input keyevent " + events[0].getKeyCode());
i7 = i10;
}
}
}
if (i5 == -1) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
if (fd.a(true, 8000L, (String) it.next(), false) != 0) {
return -3;
}
}
}
return i5;
}
private SharedPreferences R() {
return getSharedPreferences(bh.i, 0);
}
public boolean a(int i2) {
return R().contains(String.valueOf(i2));
}
public void b(int i2) {
R().edit().remove(String.valueOf(i2)).commit();
}
public String c(int i2) {
return R().getString(String.valueOf(i2), null);
}
public void a(int i2, String str) {
R().edit().putString(String.valueOf(i2), str).commit();
}
public void g() {
R().edit().clear().commit();
}
private SharedPreferences S() {
return getSharedPreferences(bh.h, 0);
}
public boolean e(String str) {
return S().contains(str);
}
private int T() {
Iterator<Map.Entry<String, ?>> it = S().getAll().entrySet().iterator();
int i2 = 0;
while (it.hasNext()) {
int intValue = ((Integer) it.next().getValue()).intValue();
if (intValue > i2) {
i2 = intValue;
}
}
return i2;
}
public void f(String str) {
S().edit().remove(str).commit();
}
public int g(String str) {
return S().getInt(str, -1);
}
public void a(String str, int i2) {
S().edit().putInt(str, i2).commit();
}
public void h() {
S().edit().clear().commit();
}
private void a(String str, boolean z2) {
Intent intent;
if (TextUtils.isEmpty(str)) {
intent = new Intent("com.mobitobi.android.gentlealarm.POWER");
intent.putExtra("power", z2);
} else {
Intent intent2 = new Intent("com.mobitobi.android.gentlealarm.ENABLE_ALARM");
intent2.putExtra("enable", z2);
intent2.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
intent = intent2;
}
bo.a(intent.getAction(), intent);
sendBroadcast(intent);
}
private int c(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 fd.a(true, 8000L, strArr, null, null, false) != 0 ? -3 : -1;
}
private int a(String str, int i2, String str2, int i3, int i4) {
return (i3 != Integer.MAX_VALUE && i4 != Integer.MAX_VALUE && v.a(i2, str2, true) && v.a(i2, i3) && v.a(i2, i4) && v.a(i2, str2, i3, i4)) ? -1 : -3;
}
private int a(ft ftVar, net.dinglisch.android.taskerm.c cVar, int i2) {
String str = "reboot";
switch (i2) {
case 1:
str = "reboot recovery";
break;
case 2:
str = "reboot bootloader";
break;
case 3:
str = "reboot -p";
break;
}
bo.b("E", str);
if (fd.a(true, 10000L, str, false) == 0) {
return -1;
}
ftVar.a(cVar, "Reboot action failed. Your device needs to be rooted for it to work.");
return -3;
}
private int U() {
if (MyDeviceAdminReceiver.c(this)) {
if (MyDeviceAdminReceiver.d(this)) {
return -1;
}
} else {
bo.d("E", "device admin disabled");
this.f11023d.a(com.joaomgcd.taskerm.util.bw.w(), new com.joaomgcd.taskerm.notification.v(this));
}
return -3;
}
private void d(int i2, int i3) {
a(i2, ct.a(this, i3), false);
}
private void a(int i2, int i3, ComponentName componentName) {
a(i2, ct.a(this, i3), false, componentName);
}
private void a(int i2, String[] strArr, boolean z2) {
a(i2, strArr, z2, (ComponentName) null);
}
private void a(int i2, String[] strArr, boolean z2, ComponentName componentName) {
Intent intent = new Intent(strArr[i2]);
if (componentName != null) {
intent.setComponent(componentName);
}
if (z2) {
bo.b("E", "send: (activity) " + strArr[i2]);
a(intent, true);
return;
}
bo.b("E", "send (receiver): " + strArr[i2]);
sendBroadcast(intent);
}
private void d(int i2, boolean z2) {
UiModeManager uiModeManager = (UiModeManager) df.a(this, "uimode", "E", "dcm");
int currentModeType = uiModeManager.getCurrentModeType();
boolean z3 = currentModeType == 3;
boolean a2 = a(z3, i2);
bo.b("E", "car: cur: " + currentModeType + " curBool: " + z3 + " set: " + i2 + " newbool: " + a2);
if (a2) {
uiModeManager.enableCarMode(z2 ? 1 : 0);
} else {
uiModeManager.disableCarMode(z2 ? 1 : 0);
}
}
private void m(int i2) {
UiModeManager uiModeManager = (UiModeManager) df.a(this, "uimode", "E", "dnm");
int nightMode = uiModeManager.getNightMode();
int i3 = i2 != 0 ? i2 == 1 ? 2 : 0 : 1;
bo.b("E", "night: cur: " + nightMode + " wanted: " + i3);
if (nightMode != i3) {
uiModeManager.setNightMode(i3);
}
}
private int e(String str, int i2) {
if (bk.a(str)) {
bk.a(str, i2);
return -1;
}
bo.d("E", "unknown light or bad configuration: " + str);
return -3;
}
private void b(Intent intent) {
if (!this.ad.contains("Voice Group")) {
bo.b("E", "ignoring voice results, not waiting for them");
return;
}
boolean z2 = false;
StringBuilder sb = new StringBuilder();
if (intent.hasExtra("android.speech.extra.RESULTS")) {
ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("android.speech.extra.RESULTS");
if (stringArrayListExtra == null) {
bo.b("E", "handleVoiceResults: null extra");
} else {
bo.b("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);
}
ft ftVar = this.ae.get("Voice Group");
if (ftVar == null) {
bo.b("E", "no wait task for voice");
} else {
ftVar.h(sb.toString());
}
gx.a(this, 92, sb.toString());
z2 = true;
}
} else {
bo.b("E", "no voice recognition results");
}
if (!z2) {
this.ae.get("Voice Group").e(true);
gx.a(this, 92);
}
d("Voice Group");
}
public void a(int i2, Bundle bundle, ft ftVar) {
boolean z2;
c.a aVar;
String string;
synchronized (this.ad) {
bo.b("E", "handlePluginFinish: taskExeID: " + ftVar.an() + " result " + i2);
z2 = false;
if (i2 == 3) {
bo.b("E", "pending result code");
} else {
h(n.a(ftVar.an()));
try {
di.a(bundle, ftVar.r());
} catch (ConcurrentModificationException e2) {
bo.c("E", "Couldn't write variables to result: " + e2.toString());
}
net.dinglisch.android.taskerm.c L = ftVar.L();
if (i2 != 0 && i2 != 2 && i2 < 10) {
if (i2 != 3 && i2 != -1 && i2 != 1 && i2 != 4) {
bo.d("E", "unknown result code: " + i2);
ftVar.r(0);
aVar = c.a.OK;
com.joaomgcd.taskerm.structuredoutput.c.a(ftVar.r(), ftVar.L());
if (L == null) {
bo.d("E", "handlePluginFinish: no current action, index " + ftVar.M());
} else {
L.a(aVar);
}
z2 = true;
}
Uri uri = (Uri) bundle.getParcelable("net.dinglisch.android.tasker.EXTRA_RESULT_CALL_URI");
if (uri != null) {
com.joaomgcd.taskerm.util.al.a((Context) this, uri.toString(), false);
}
ftVar.r(0);
aVar = c.a.OK;
com.joaomgcd.taskerm.structuredoutput.c.a(ftVar.r(), ftVar.L());
if (L == null) {
}
z2 = true;
}
String str = "<none>";
if (ftVar.q()) {
Bundle r2 = ftVar.r();
if (r2.containsKey("%errmsg") && (string = r2.getString("%errmsg")) != null) {
str = string;
}
}
bo.b("E", "failure result code: " + i2 + " errmsg: " + str);
ftVar.r(i2);
aVar = c.a.Err;
if (L == null) {
bo.d("E", "handlePluginFinish: no current action, exeID " + ftVar.an());
ftVar.e(true);
} else if (L.t()) {
ftVar.e(true);
}
if (L == null) {
}
z2 = true;
}
}
if (z2) {
f();
}
}
private void c(Intent intent) {
ft ftVar;
int b2 = di.b(intent);
bo.b("E", "handlePluginFinishFromIntent: id " + b2);
if (b2 != Integer.MAX_VALUE) {
String a2 = n.a(b2);
synchronized (this.ad) {
ftVar = this.ae.get(a2);
}
long currentTimeMillis = System.currentTimeMillis();
while (ftVar == null && System.currentTimeMillis() - currentTimeMillis < 1000) {
bo.b("E", "plugin result before initialisation ? loop-a-little");
a(50L);
synchronized (this.ae) {
ftVar = this.ae.get(a2);
}
}
if (ftVar == null) {
bo.b("E", "no wait task for plugin exe ID " + b2);
return;
}
a(ga.c.a(intent), intent.getExtras(), ftVar);
}
}
private int a(ft ftVar, String str, String str2, int i2, int i3, boolean z2, String str3, Bundle bundle) {
String a2 = gx.a((Context) this, str2, (String) null, true, bundle);
int i4 = -3;
if (str2 != null) {
if (str3 == null) {
bo.d("E", str + ": store result var error");
} else if (a2 == null) {
bo.d("E", str + ": " + str2 + ": no value");
} else if (i2 == Integer.MAX_VALUE) {
bo.d("E", str + ": " + str2 + ": bad from index");
} else if (i3 == Integer.MAX_VALUE) {
bo.d("E", str + ": " + str2 + ": bad part length");
} else if (i2 > a2.length()) {
bo.d("E", str + ": " + str2 + ": only " + str2.length() + " chars, from index " + i2);
} else {
bo.b("E", "FROM: " + i2 + " LENGTH " + i3);
int i5 = i2 + (-1);
int i6 = i3 + i5;
if (i6 > a2.length()) {
if (z2) {
i6 = a2.length();
} else {
bo.d("E", str + ": " + str2 + ": only " + str2.length() + " chars, last request " + i6);
if (i4 == -1) {
if (str3.length() != 0) {
str2 = str3;
}
a(str2, a2.substring(i5, i6), ftVar, str);
}
}
}
i4 = -1;
if (i4 == -1) {
}
}
}
return i4;
}
private int a(ft ftVar, String str, String str2, int i2, int i3, String str3, StringBuilder sb, Bundle bundle) {
String valueOf;
String a2;
String a3 = gx.a((Context) this, str2, (String) null, true, bundle);
if (str2 != null) {
if (a3 == null) {
a(str + ": " + str2 + ": no value", new Object[0]);
} else {
switch (i2) {
case 0:
Long e2 = gs.e(a3);
if (e2 != null) {
valueOf = String.valueOf(e2.longValue() / 1024);
break;
}
valueOf = null;
break;
case 1:
Double g2 = gs.g(a3);
if (g2 != null) {
double doubleValue = g2.doubleValue() / 1048576.0d;
a2 = gs.a("%f", Double.valueOf(doubleValue));
char a4 = bj.a();
int indexOf = a2.indexOf(a4);
if (indexOf != -1) {
if (doubleValue > 10.0d || a2.charAt(indexOf + 1) == '0') {
a2 = a2.substring(0, indexOf);
} else {
a2 = a2.substring(0, indexOf + 2);
if (a4 != '.') {
a2 = a2.replace(a4, '.');
}
}
}
valueOf = a2;
break;
}
valueOf = null;
break;
case 2:
Double g3 = gs.g(a3);
if (g3 != null) {
a2 = gs.a("%f", Double.valueOf(g3.doubleValue() / 1.073741824E9d));
char a5 = bj.a();
int indexOf2 = a2.indexOf(a5);
if (indexOf2 != -1) {
if (a2.charAt(indexOf2 + 1) == '0') {
a2 = a2.substring(0, indexOf2);
} else {
a2 = a2.substring(0, indexOf2 + 2);
if (a5 != '.') {
a2 = a2.replace(a5, '.');
}
}
}
valueOf = a2;
break;
}
valueOf = null;
break;
case 3:
Calendar a6 = cb.a(this, a3);
if (a6 != null) {
valueOf = String.valueOf(a6.getTimeInMillis() / 1000);
break;
}
valueOf = null;
break;
case 4:
Long e3 = gs.e(a3);
if (e3 != null) {
Calendar c2 = cb.c(e3.longValue() * 1000);
valueOf = cb.a(this, c2) + " " + cb.a(c2);
break;
}
valueOf = null;
break;
case 5:
case 6:
Long e4 = gs.e(a3);
if (e4 != null) {
valueOf = DateFormat.format(i2 == 6 ? "EEEE, MMMM dd, yyyy hh:mmaa" : "MMM dd, yyyy kk:mm", e4.longValue() * 1000).toString();
break;
}
valueOf = null;
break;
case 7:
valueOf = Html.fromHtml(a3).toString();
break;
case 8:
Double g4 = gs.g(a3);
if (g4 != null) {
valueOf = String.valueOf(((g4.doubleValue() * 9.0d) / 5.0d) + 32.0d);
break;
}
valueOf = null;
break;
case 9:
Double g5 = gs.g(a3);
if (g5 != null) {
valueOf = String.valueOf(((g5.doubleValue() - 32.0d) * 5.0d) / 9.0d);
break;
}
valueOf = null;
break;
case 10:
valueOf = a(a3, 0.4d);
break;
case 11:
valueOf = a(a3, 2.5d);
break;
case g.a.MapAttrs_uiZoomControls:
valueOf = a(a3, 3.28083d);
break;
case g.a.MapAttrs_uiZoomGestures:
valueOf = a(a3, 0.3048d);
break;
case g.a.MapAttrs_useViewLifecycle:
valueOf = a(a3, 2.2046226218d);
break;
case g.a.MapAttrs_zOrderOnTop:
valueOf = a(a3, 0.45359237d);
break;
case 16:
valueOf = a(a3, 0.621371192d);
break;
case g.a.MapAttrs_ambientEnabled:
valueOf = a(a3, 1.60934d);
break;
case g.a.MapAttrs_cameraMinZoomPreference:
valueOf = gs.l(a3);
break;
case g.a.MapAttrs_cameraMaxZoomPreference:
valueOf = gs.k(a3);
break;
case g.a.MapAttrs_latLngBoundsSouthWestLatitude:
case g.a.MapAttrs_latLngBoundsSouthWestLongitude:
case g.a.MapAttrs_latLngBoundsNorthEastLatitude:
case g.a.MapAttrs_latLngBoundsNorthEastLongitude:
try {
if (i2 == 21) {
a2 = Long.toBinaryString(Long.parseLong(a3, 10));
} else if (i2 == 23) {
a2 = Long.toHexString(Long.parseLong(a3, 10));
} else if (i2 == 22) {
a2 = String.valueOf(Long.parseLong(a3, 16));
} else {
a2 = String.valueOf(Long.parseLong(a3, 2));
}
valueOf = a2;
break;
} catch (Exception e5) {
bo.a("E", str, e5);
break;
}
case 24:
valueOf = Base64.encodeToString(a3.getBytes(), 2);
break;
case NotificationCompat.MessagingStyle.MAXIMUM_RETAINED_MESSAGES:
byte[] decode = Base64.decode(a3, i3 == 1 ? 8 : 0);
if (decode != null) {
valueOf = new String(decode);
break;
}
valueOf = null;
break;
case 26:
valueOf = ah.b(a3);
break;
case 27:
valueOf = ah.a(a3);
break;
case 28:
valueOf = a3.toLowerCase();
break;
case 29:
valueOf = a3.toUpperCase();
break;
case 30:
valueOf = gs.a(a3);
break;
default:
bo.c("E", "bad conversion: " + i2);
valueOf = null;
break;
}
if (valueOf == null) {
a(str + ": " + str2 + ": failed", new Object[0]);
} else {
if (sb != null) {
sb.append(valueOf);
}
if (TextUtils.isEmpty(str3)) {
a(str2, valueOf, ftVar, str);
return -1;
}
a(str3, valueOf, ftVar, str);
return -1;
}
}
}
return -3;
}
private String a(String str, double d2) {
Double g2 = gs.g(str);
if (g2 == null) {
return null;
}
return String.valueOf(g2.doubleValue() * d2);
}
private int b(String str, int i2, int i3) {
int i4;
int i5;
int i6;
int i7;
int i8;
int i9;
int b2;
String str2;
int i10;
int i11;
int i12 = (i2 == 258 || i2 == 256) ? -5 : -1;
AudioManager audioManager = (AudioManager) df.a(this, "audio", "E", "dbaa");
if (audioManager == null) {
a(R.string.err_no_audio_manager, new Object[0]);
return -3;
}
String str3 = null;
if (i2 == 296) {
i11 = audioManager.isBluetoothScoOn();
} else if (i2 == 254) {
i11 = audioManager.isSpeakerphoneOn();
} else if (i2 == 301) {
i11 = audioManager.isMicrophoneMute();
} else {
if (i2 == 258) {
str3 = "vibrate_when_notifying";
i4 = 1;
} else {
str3 = "vibrate_when_ringing";
i4 = 0;
}
if (gs.l() < 16) {
if (!bw.e.b()) {
bo.d("E", "no getVibrateSetting");
i5 = i4;
i6 = 0;
i8 = i3;
i9 = i6;
b2 = b(i9, i8);
if (i9 != b2) {
if (i2 == 296) {
audioManager.setBluetoothScoOn(b2 == 1);
} else if (i2 == 254) {
audioManager.setSpeakerphoneOn(b2 == 1);
if (com.joaomgcd.taskerm.util.g.e()) {
this.f11023d.a(com.joaomgcd.taskerm.notification.aw.a(this, "speakerphoneandroid10", getString(R.string.an_speakerphone_status), "Starting with Android 10 the Speakerphone action will no longer work on some devices due to internal Android changes. Unfortunately there's nothing Tasker can do about it,"));
}
} else if (i2 == 301) {
audioManager.setMicrophoneMute(b2 == 1);
} else if (gs.l() >= 16) {
if (b2 == 1) {
str2 = str;
i10 = 1;
} else {
str2 = str;
i10 = 0;
}
if (!b(str2, str3, i10)) {
return -3;
}
if (i2 == 256 && com.joaomgcd.taskerm.util.g.e()) {
com.joaomgcd.taskerm.securesettings.s sVar = new com.joaomgcd.taskerm.securesettings.s(com.joaomgcd.taskerm.securesettings.q.System, "ring_vibration_intensity", Integer.toString(b2 == 1 ? 2 : 0), false, 29, 999);
if (net.dinglisch.android.tasker.f.a(this)) {
this.f11023d.a(com.joaomgcd.taskerm.securesettings.ab.a((Context) this, sVar), new b.a.d.f() {
@Override
public final void accept(Object obj) {
ExecuteService.a((Boolean) obj);
}
}, new b.a.d.f() {
@Override
public final void accept(Object obj) {
ExecuteService.a((Throwable) obj);
}
});
}
}
} else if (bw.e.c()) {
bw.e.a(audioManager, i5, b2 != 1 ? 0 : 1);
}
}
return i12;
}
}
i5 = i4;
i6 = i7;
i8 = i3;
i9 = i6;
b2 = b(i9, i8);
if (i9 != b2) {
}
return i12;
}
i8 = i3;
i5 = -1;
i9 = i11;
b2 = b(i9, i8);
if (i9 != b2) {
}
return i12;
}
private int a(ft ftVar, String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
ge geVar;
int i3 = cVar.i();
boolean t2 = cVar.t();
int b2 = b(cVar, 0);
int i4 = 1;
String b3 = b(cVar, 1, bundle);
String a2 = a(cVar, 2, bundle);
try {
switch (i3) {
case 341:
geVar = gd.e.a(this, str, b2, b3, bundle);
if (!geVar.f13493c) {
if (geVar.f13492b != null) {
gx.k(this, a2, bundle);
Iterator<String> it = geVar.f13492b.iterator();
while (it.hasNext()) {
a(a2 + String.valueOf(i4), it.next(), ftVar, str);
i4++;
}
} else if (geVar.f13491a != null) {
a(a2, geVar.f13491a, ftVar, str);
} else {
gx.a((Context) this, a2, false, false, bundle, Integer.valueOf(ftVar.G()));
return -3;
}
}
return -5;
case 342:
boolean a3 = a(cVar, 3);
boolean a4 = a(cVar, 4);
File g2 = g(str, cVar, 1, bundle);
if (at.a((Context) this, g2, a3, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
geVar = null;
if (!geVar.f13493c) {
}
return -5;
}
geVar = gd.c.a(this, str, b2, g2, t2, a3, a4, bundle);
if (!geVar.f13493c) {
}
return -5;
case 343:
geVar = gd.d.a(this, str, b2, b3, D, C, t2, bundle);
if (!geVar.f13493c) {
}
return -5;
case 344:
geVar = gd.a.a(this, str, b2, b3, bundle, a2);
if (!geVar.f13493c) {
}
return -5;
case 345:
geVar = gd.i.a(this, str, b2, b3, bundle);
if (!geVar.f13493c) {
}
return -5;
case 346:
geVar = gd.f.a(this, str, b2, b3, bundle);
if (!geVar.f13493c) {
}
return -5;
case 347:
geVar = gd.h.a(this, ftVar, str, b2, b3, bundle);
if (!geVar.f13493c) {
}
return -5;
case 348:
geVar = gd.b.a(this, str, b2, b3, bundle);
if (!geVar.f13493c) {
}
return -5;
case 349:
geVar = gd.g.a(this, str, b2, b3, bundle);
if (!geVar.f13493c) {
}
return -5;
default:
geVar = null;
if (!geVar.f13493c) {
}
return -5;
}
} catch (OutOfMemoryError e2) {
bo.c("E", "Can't perform test operation because of memory constraints: " + e2.getMessage());
return -3;
} catch (Throwable th) {
bo.b("E", "error testing", th);
return -3;
}
}
private int f(String str, int i2) {
int i3;
int i4;
if (bw.be.b(this)) {
int I2 = I();
if (I2 == 3) {
i3 = -1;
i4 = 1;
} else {
if (I2 == 1) {
i3 = -1;
} else {
bo.d("E", str + ": failed: wimax state unstable");
i3 = -3;
}
i4 = 0;
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else if (i3 == -1) {
int b2 = b(i4, i2);
bo.b("E", str + ": state: " + I2 + " cur: " + i4 + " new: " + b2);
if (i4 != b2) {
boolean z2 = b2 == 1;
bw.be.a(this, z2);
int I3 = I();
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else if ((z2 && I3 != 3) || (!z2 && I3 != 1)) {
bo.b("E", str + ": set " + z2 + ": state still not correct: " + I3);
}
}
}
return i3;
}
bo.d("E", str + ": no wimax available");
return -1;
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, StringBuilder sb, int i2, Bundle bundle) {
String str2;
File file;
int i3;
String[] a2;
int i4 = 1;
final String b2 = b(cVar, 1, bundle);
final boolean a3 = a(cVar, 2);
boolean a4 = a(cVar, 3);
int b3 = b(cVar, 4);
boolean a5 = a(cVar, 6);
String a6 = a(cVar, 5, bundle);
boolean z2 = !a4;
File g2 = g(str, cVar, 0, bundle);
at.a aVar = at.a.values()[b3];
if (at.a((Context) this, g2, a4, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a6 != null && a(g2, str, a4, z2, false, true)) {
gx.k(this, a6, bundle);
final boolean z3 = !TextUtils.isEmpty(b2);
if (a4) {
ArrayList<String> arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
i3 = 0;
String[] strArr = {"ls " + g2.toString()};
str2 = a6;
int a7 = fd.a(true, 10000L, strArr, arrayList, arrayList2, a5);
if (a7 == 0) {
ArrayList arrayList3 = new ArrayList();
for (String str3 : arrayList) {
if (str3.length() > 0 && a(str3, a3, z3, b2)) {
arrayList3.add(str3);
}
}
if (arrayList3.size() > 0) {
a2 = gs.a((List<String>) arrayList3);
} else {
a2 = new String[0];
}
file = g2;
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append(": ");
file = g2;
sb2.append(file);
sb2.append(": code ");
sb2.append(a7);
sb2.append(" ");
sb2.append(gs.a((List<?>) arrayList2, '\n'));
bo.d("E", sb2.toString());
a2 = null;
}
} else {
str2 = a6;
file = g2;
i3 = 0;
bo.b("E", str + ": run listWrapper");
a2 = at.a(this, file, new FilenameFilter() {
@Override
public final boolean accept(File file2, String str4) {
boolean a8;
a8 = ExecuteService.this.a(a3, z3, b2, file2, str4);
return a8;
}
});
if (a2 == null) {
a2 = new String[0];
}
bo.b("E", str + " found " + a2.length + " matching files");
}
if (a2 != null) {
String[] a8 = at.a(this, file, a2, aVar);
String str4 = file.toString() + File.separator;
int length = a8.length;
while (i3 < length) {
String str5 = a8[i3];
if (str2.length() > 0) {
gx.a((Context) this, str2 + String.valueOf(i4), str4 + str5, false, bundle, str);
str2 = str2;
i4++;
} else if (sb != null) {
if (sb.length() > 0) {
sb.append('\n');
}
sb.append(str4);
sb.append(str5);
}
i3++;
}
gx.g(this, str2, bundle);
return -5;
}
}
return -3;
}
public boolean a(boolean z2, boolean z3, String str, File file, String str2) {
return a(str2, z2, z3, str);
}
private boolean a(String str, boolean z2, boolean z3, String str2) {
bo.b("E", "fa: " + str + " haveMatch: " + z3 + " match " + str2);
return (z2 || !str.startsWith(".")) && (!z3 || as.d(str2, str));
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, int i2, Bundle bundle) {
int i3;
switch (b(cVar, 0)) {
case 0:
int a2 = a(cVar, 1, true, false, bundle);
if (a2 != Integer.MAX_VALUE) {
i3 = a2 - 1;
break;
}
i3 = -1;
break;
case 1:
String a3 = a(cVar, 2, ftVar);
if (TextUtils.isEmpty(a3)) {
bo.d("E", str + ": empty label");
i3 = -1;
break;
} else {
i3 = ftVar.a(this, a3, bundle);
break;
}
case 2:
i3 = ftVar.c(i2 - 1, 39);
break;
case 3:
i3 = ftVar.b(i2 + 1, 40) + 1;
break;
case 4:
i3 = ftVar.b(i2 + 1, 38);
break;
default:
i3 = -1;
break;
}
if (i3 != -1) {
return i3;
}
ftVar.c("Target action doesn't exist.");
return -3;
}
private int a(int i2, String str, String str2, int i3, String str3, boolean z2, Bundle bundle) {
if (i3 != Integer.MAX_VALUE && str2 != null) {
if (i3 < 1) {
bo.d("E", str + ": bad position: " + i3);
} else {
gx.a(this, str2, i3, str3, z2, bundle);
return -1;
}
}
return -3;
}
private int a(int i2, String str, String str2, int i3, String str3, Bundle bundle) {
if (i3 != Integer.MAX_VALUE && str2 != null) {
if (i3 < 1) {
bo.d("E", str + ": bad position: " + i3);
} else {
gx.a(this, str2, i3, str3, bundle);
return -1;
}
}
return -3;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, gt gtVar, Bundle bundle, ft ftVar) {
long j2;
int i2;
boolean z2;
String str2;
String str3;
int i3;
int i4;
String[] strArr;
long j3;
String[] split;
?? r10;
int parseInt;
int parseInt2;
boolean z3;
int i5;
String b2;
int i6;
char c2 = 0;
String c3 = cVar.j(0).c();
char c4 = 1;
String c5 = cVar.j(1).c();
long C2 = cVar.C();
bo.b("E", "dofor " + c3 + " loop, current index " + C2);
String[] split2 = c5.split("\\s*,\\s*");
if (gs.a((Object[]) split2)) {
bo.d("E", str + "no loop values");
gx.a((Context) this, c3, false, false, bundle);
cVar.E();
j2 = C2;
i2 = -3;
} else {
if (p == null) {
q = Pattern.compile("-?\\d+");
p = Pattern.compile("^(-?\\d+|%+[\\w&&[^_]][\\w0-9\\.]+[\\w0-9&&[^_]](?:\\((#|#<|#>|<|>)\\))?):(-?\\d+|%+[\\w&&[^_]][\\w0-9\\.]+[\\w0-9&&[^_]](?:\\((#|#<|#>|<|>)\\))?)(:(-?\\d+|%+[\\w&&[^_]][\\w0-9\\.]+[\\w0-9&&[^_]](?:\\((#|#<|#>|<|>)\\))?))?$");
}
int length = split2.length;
String str4 = null;
int i7 = 0;
int i8 = 0;
while (i8 < length) {
String str5 = split2[i8];
if (str5.contains(ConstantsCommonTaskerServer.ID_SEPARATOR)) {
String[] split3 = str5.split(Pattern.quote(ConstantsCommonTaskerServer.ID_SEPARATOR));
String a2 = gy.a(split3[c2]);
String a3 = gy.a(split3[c4]);
if (a2 != null && a3 != null) {
if (p.matcher(a2 + ConstantsCommonTaskerServer.ID_SEPARATOR + a3).matches()) {
z2 = true;
if (!p.matcher(str5).matches() || z2) {
str2 = c3;
int i9 = i7;
str3 = str4;
i3 = i8;
i4 = length;
strArr = split2;
j3 = C2;
split = str5.split(Pattern.quote(ConstantsCommonTaskerServer.ID_SEPARATOR));
if (!q.matcher(split[0]).matches()) {
parseInt = Integer.parseInt(split[0]);
r10 = 1;
} else {
r10 = 1;
parseInt = Integer.parseInt(gx.a((Context) this, split[0], true, bundle));
}
if (!q.matcher(split[r10]).matches()) {
parseInt2 = Integer.parseInt(split[r10]);
} else {
parseInt2 = Integer.parseInt(gx.a(this, split[r10], (boolean) r10, bundle));
}
if (split.length <= 2) {
if (q.matcher(split[2]).matches()) {
i5 = Integer.parseInt(split[2]);
} else {
i5 = Integer.parseInt(gx.a((Context) this, split[2], true, bundle));
}
z3 = i5 >= 0;
} else {
z3 = parseInt <= parseInt2;
i5 = z3 ? 1 : -1;
}
bo.b("E", "range: " + parseInt + " -> " + parseInt2 + " jump " + i5 + " positive= " + z3);
if (i5 != 0) {
bo.d("E", str + ": 0 increment specifier in " + str5);
} else {
while (true) {
if (z3) {
if (parseInt > parseInt2) {
break;
}
int i10 = i9 + 1;
if (i9 != j3) {
str3 = String.valueOf(parseInt);
i9 = i10;
break;
}
parseInt += i5;
i9 = i10;
} else {
if (parseInt < parseInt2) {
break;
}
int i102 = i9 + 1;
if (i9 != j3) {
}
}
}
}
i7 = i9;
} else if (gx.e(str5) && str5.endsWith(")")) {
List<String> c6 = gx.c(this, str5, bundle).c();
bo.b("E", "expand variable value: " + str5 + " elements: " + String.valueOf(c6.size()));
Iterator<String> it = c6.iterator();
while (true) {
if (!it.hasNext()) {
i6 = i7;
break;
}
String next = it.next();
i6 = i7 + 1;
if (i7 == C2) {
str4 = next;
break;
}
i7 = i6;
}
str2 = c3;
i7 = i6;
str3 = str4;
i3 = i8;
i4 = length;
strArr = split2;
j3 = C2;
} else {
bg.a((Context) this);
int i11 = i7;
str3 = str4;
i3 = i8;
i4 = length;
strArr = split2;
str2 = c3;
j3 = C2;
bg.c a4 = bg.a((Context) null, str5, bg.a.Obj, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, str);
if (a4 == null || a4.f12197b == null) {
i7 = i11 + 1;
if (i11 == j3) {
b2 = gx.b(this, str5, bundle);
}
} else {
String[] b3 = bg.b(a4.f12197b);
if (b3 == null) {
i7 = i11 + 1;
if (i11 == j3) {
str3 = a4.f12197b.toString();
}
} else {
int length2 = b3.length;
i7 = i11;
int i12 = 0;
while (i12 < length2) {
b2 = b3[i12];
int i13 = i7 + 1;
if (i7 == j3) {
if (b2 == null) {
b2 = "";
}
i7 = i13;
} else {
i12++;
i7 = i13;
}
}
}
b2 = str3;
}
str3 = b2;
}
i8 = i3 + 1;
str4 = str3;
C2 = j3;
length = i4;
c3 = str2;
split2 = strArr;
c2 = 0;
c4 = 1;
}
}
}
z2 = false;
if (!p.matcher(str5).matches()) {
}
str2 = c3;
int i92 = i7;
str3 = str4;
i3 = i8;
i4 = length;
strArr = split2;
j3 = C2;
split = str5.split(Pattern.quote(ConstantsCommonTaskerServer.ID_SEPARATOR));
if (!q.matcher(split[0]).matches()) {
}
if (!q.matcher(split[r10]).matches()) {
}
if (split.length <= 2) {
}
bo.b("E", "range: " + parseInt + " -> " + parseInt2 + " jump " + i5 + " positive= " + z3);
if (i5 != 0) {
}
i7 = i92;
i8 = i3 + 1;
str4 = str3;
C2 = j3;
length = i4;
c3 = str2;
split2 = strArr;
c2 = 0;
c4 = 1;
}
String str6 = c3;
String str7 = str4;
long j4 = C2;
if (str7 == null) {
bo.b("E", "no value found, clear var and stop loop");
gx.a((Context) this, str6, false, false, bundle);
cVar.E();
j2 = j4;
i2 = -6;
} else {
bo.b("E", "new value: " + str7);
j2 = j4;
a(str6, str7, ftVar, str, com.joaomgcd.taskerm.structuredoutput.c.a(cVar));
i2 = -1;
}
}
bo.b("E", "dofor END, current index now " + j2 + " return status " + i2);
return i2;
}
public String b(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return gx.b(this, cVar.j(i2).c(), bundle);
}
public String c(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return gx.a((Context) this, cVar.j(i2).c(), false, true, true, false, (ga.a) null, bundle, false);
}
private String a(net.dinglisch.android.taskerm.c cVar, int i2, ft ftVar) {
return b(cVar, i2, ftVar.r());
}
public boolean a(net.dinglisch.android.taskerm.c cVar, int i2) {
return cVar.h(i2).b();
}
public int b(net.dinglisch.android.taskerm.c cVar, int i2) {
return cVar.g(i2).h();
}
private String b(String str, ft ftVar) {
return gx.b(this, str, ftVar.r());
}
private void a(String str, String str2, ft ftVar, String str3) {
a(str, str2, ftVar, str3, (StructureType) null);
}
private void a(String str, String str2, ft ftVar, String str3, StructureType structureType) {
a(str, str2, ftVar, str3, true, structureType);
}
private void a(String str, String str2, ft ftVar, String str3, boolean z2, StructureType structureType) {
gx.a(this, str, str2, z2, ftVar.r(), str3, Integer.valueOf(ftVar.ay()), new Integer[]{Integer.valueOf(ftVar.w())}, Integer.valueOf(ftVar.G()), structureType);
}
private void c(ft ftVar) {
int an = ftVar.an();
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next != ftVar && next.o(an)) {
next.n(an);
if (ftVar.am()) {
next.a(ftVar);
return;
}
return;
}
}
}
private int c(String str, String str2, boolean z2) {
return !fd.a(str2, z2) ? -3 : -1;
}
private int a(net.dinglisch.android.taskerm.c cVar, ft ftVar) {
String str;
boolean z2;
boolean z3;
boolean z4;
String str2;
String str3;
String substring;
int lastIndexOf;
String str4;
int i2;
String str5;
String str6;
String b2;
String str7;
boolean z5;
boolean z6;
String str8;
String b3;
int d2;
int i3;
int i4;
int i5;
int i6;
File file;
String str9;
String str10;
String file2;
boolean z7;
this.f11023d.a(ftVar);
switch (cVar.i()) {
case 116:
str = "POST";
z2 = true;
z3 = false;
z4 = false;
break;
case 117:
str = "HEAD";
z2 = false;
z3 = false;
z4 = true;
break;
case 118:
str = "GET";
z2 = false;
z3 = true;
z4 = false;
break;
default:
z2 = false;
z3 = false;
z4 = false;
str = null;
break;
}
StringBuilder sb = new StringBuilder();
String a2 = a(this, 0, cVar, ftVar.r());
String a3 = a(this, 1, cVar, ftVar.r());
boolean a4 = a(cVar, z4 ? 6 : 8);
boolean t2 = cVar.t();
if (a2.startsWith("https://")) {
str3 = "https://";
substring = a2.substring("https://".length());
} else if (a2.startsWith("http://")) {
substring = a2.substring("http://".length());
str3 = "http://";
} else {
str2 = a2;
str3 = null;
lastIndexOf = str2.lastIndexOf(64);
if (lastIndexOf != -1) {
str4 = str2;
i2 = -1;
str5 = null;
} else if (lastIndexOf >= str2.length() - 1 || lastIndexOf == 0) {
bo.b("E", t2, "@ at start/end of server-port spec " + ((String) null));
str4 = null;
str5 = null;
i2 = -3;
} else {
str4 = str2.substring(lastIndexOf + 1);
str5 = str2.substring(0, lastIndexOf);
i2 = -1;
}
if (str3 == null) {
str3 = "http://";
}
sb.append(str3);
sb.append(str4);
if (a3.length() > 0) {
if (!a3.startsWith("/")) {
sb.append("/");
}
sb.append(a3.replace(" ", "%20"));
}
if (z4) {
String b4 = b(cVar.j(6).c(), ftVar);
if (z2 && TextUtils.isEmpty(b4)) {
b4 = HttpConnection.FORM_URL_ENCODED;
}
str6 = b4;
} else {
str6 = null;
}
b2 = b(cVar.j(2).c(), ftVar);
bo.b("E", "prot: " + str3 + " serverport: " + str4 + " contenttype: " + str6);
if (b2.length() <= 0) {
if (z2 && b2.startsWith(File.separator) && !b2.contains("\n") && !b2.contains("=")) {
str7 = str5;
z5 = t2;
File a5 = a(b2, cVar.n(), true, true, false);
bo.b("E", "handle post from file " + b2);
if (a5 == null) {
file2 = null;
z7 = false;
i2 = -3;
} else {
file2 = a5.toString();
z7 = true;
}
str8 = file2;
z6 = z7;
} else {
str8 = b2;
str7 = str5;
z5 = t2;
if (z3 || z4 || str6.equals(HttpConnection.FORM_URL_ENCODED)) {
bo.b("E", "get/head or null");
StringBuilder sb2 = new StringBuilder();
if (str8.length() > 0) {
String[] split = str8.split("\n");
for (int i7 = 0; i7 < split.length; i7++) {
String[] split2 = split[i7].split(Pattern.quote("="), 2);
if (split2.length == 2) {
if (sb2.length() > 0) {
sb2.append("&");
}
sb2.append(gs.k(split2[0]));
sb2.append("=");
sb2.append(gs.k(split2[1]));
} else {
bo.a("E", z5, "bad attribute: no = :" + split[i7]);
}
}
}
if (z3 || z4) {
if (sb2.length() > 0) {
sb.append("?");
sb.append(sb2.toString());
}
} else if (sb2.length() > 0) {
str10 = sb2.toString();
str8 = str10;
}
str10 = null;
str8 = str10;
}
z6 = false;
}
b3 = b(cVar, 3, ftVar.r());
if (!TextUtils.isEmpty(b3)) {
b3 = b3.replaceAll("Set-Cookie: ", "");
}
String str11 = b3;
String b5 = b(cVar, 4, ftVar.r());
d2 = d(cVar, 5, ftVar.r());
if (d2 == Integer.MAX_VALUE) {
i4 = -3;
i3 = -3;
} else {
i3 = i2;
i4 = -3;
}
if (i3 != i4) {
int i8 = d2 * 1000;
if (z4) {
i5 = i8;
i6 = i3;
file = null;
str9 = null;
} else {
str9 = b(cVar.j(7).c(), ftVar);
if (str9.length() > 0) {
i5 = i8;
i6 = i3;
file = a(str9, cVar.n(), false, true, false);
} else {
i5 = i8;
i6 = i3;
file = null;
}
}
if (!z4 && str9.length() != 0 && file == null) {
return i6;
}
StringBuilder sb3 = new StringBuilder();
sb3.append("method: ");
sb3.append(str);
sb3.append(" url: ");
sb3.append((Object) sb);
sb3.append(" timout: ");
int i9 = i5;
sb3.append(i9);
sb3.append(" dataisfile ");
sb3.append(z6);
sb3.append(" save ");
sb3.append(file);
bo.b("E", sb3.toString());
i3 = a(str, sb.toString(), str7, str8, z6, i9, str6, str11, b5, file, ftVar.r(), a4, a4, z5);
}
return i3;
}
str7 = str5;
z5 = t2;
z6 = false;
str8 = null;
b3 = b(cVar, 3, ftVar.r());
if (!TextUtils.isEmpty(b3)) {
}
String str112 = b3;
String b52 = b(cVar, 4, ftVar.r());
d2 = d(cVar, 5, ftVar.r());
if (d2 == Integer.MAX_VALUE) {
}
if (i3 != i4) {
}
return i3;
}
str2 = substring;
lastIndexOf = str2.lastIndexOf(64);
if (lastIndexOf != -1) {
}
if (str3 == null) {
}
sb.append(str3);
sb.append(str4);
if (a3.length() > 0) {
}
if (z4) {
}
b2 = b(cVar.j(2).c(), ftVar);
bo.b("E", "prot: " + str3 + " serverport: " + str4 + " contenttype: " + str6);
if (b2.length() <= 0) {
}
z6 = false;
str8 = null;
b3 = b(cVar, 3, ftVar.r());
if (!TextUtils.isEmpty(b3)) {
}
String str1122 = b3;
String b522 = b(cVar, 4, ftVar.r());
d2 = d(cVar, 5, ftVar.r());
if (d2 == Integer.MAX_VALUE) {
}
if (i3 != i4) {
}
return i3;
}
private int d(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2 = b(cVar, 2, bundle);
String b3 = b(cVar, 3, bundle);
int b4 = b(cVar, 4);
boolean a2 = a(cVar, 5);
int d2 = d(cVar, 0, bundle);
int d3 = d(cVar, 1, bundle);
if (d2 < 0 && d2 > 23) {
bo.d("E", str + ": bad hour: " + d2);
} else if (d3 < 0 && d3 > 59) {
bo.d("E", str + ": bad minute: " + d2);
} else if (a(n.a(this, d2, d3, b2, b3, b4, a2), true)) {
return -1;
}
return -3;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, boolean z2, String str2, int i2, boolean z3, boolean z4, Bundle bundle, ft ftVar) {
fy e2;
boolean z5;
dt B2;
boolean z6;
int i3;
String p2 = p(b(cVar, 0, bundle));
dt.b bVar = dt.b.values()[cVar.g(1).h()];
int a2 = a(cVar, 2, false, false, bundle);
int a3 = a(cVar, 3, false, false, bundle);
boolean a4 = a(cVar, 8);
boolean z7 = dt.b(bVar) && a(cVar, 9);
boolean c2 = dt.c(bVar);
boolean z8 = z7 || (c2 && a(cVar, 10));
if (!this.f11023d.a(str, z8, p2)) {
return -3;
}
if (c2 && com.joaomgcd.taskerm.util.g.f()) {
this.f11023d.a(com.joaomgcd.taskerm.util.al.aI(this));
}
dt.a aVar = dt.a.values()[cVar.g(4).h()];
boolean a5 = a(cVar, 5);
boolean a6 = a(cVar, 6);
boolean a7 = a(cVar, 7);
if (a2 != Integer.MAX_VALUE && a3 != Integer.MAX_VALUE) {
if (z4 && fy.a(fy.a.Passive) && fy.b(this).t(p2)) {
e2 = fy.d(this);
} else {
e2 = fy.e(this);
}
if (!e2.t(p2)) {
bo.d("E", "doShowScene: " + p2 + ": not defined in data");
} else {
dt u2 = e2.u(p2);
if (dt.a(bVar) && !bq.d(this)) {
bo.c("E", "no permission to display scene as an overlay: " + p2);
this.f11023d.a(com.joaomgcd.taskerm.util.bw.x(), new com.joaomgcd.taskerm.notification.y(this));
return -3;
}
if (!u2.ag() && u2.Z()) {
bo.c("E", "scene " + p2 + " not suitable for overlay");
} else {
if (ew.a(p2)) {
B2 = ew.d(p2);
if (!B2.X() || dt.a(bVar) == B2.Z()) {
z5 = a7;
} else {
bo.b("E", "scene display type of " + p2 + " changed, hide and destroy old");
if (ew.e(p2)) {
ew.a(this, p2, (dt.a) null, "E#doShowScene");
if (B2.aa()) {
z5 = a7;
a(200L);
ew.a((Context) this, p2, false);
B2 = u2.B();
}
}
z5 = a7;
ew.a((Context) this, p2, false);
B2 = u2.B();
}
} else {
z5 = a7;
B2 = u2.B();
}
dt dtVar = B2;
if (dtVar.Z() && !dtVar.ag()) {
a(R.string.f_overlay_restricted_elements, new Object[0]);
} else if (!ew.a(this, dtVar)) {
bo.d("E", "doShowScene: not existing and failed to create: " + p2);
} else if (dtVar.U()) {
bo.d("E", "doShowScene: scene already visible: " + p2);
} else {
if (z4) {
dtVar.ar();
}
dtVar.f(i2);
List<String> b2 = gx.b(bundle);
dtVar.a(bundle);
gx.a(dtVar.r(), 1);
gx.a("task=" + str2, b2, dtVar.r());
ex.a(this, a5, dtVar);
dtVar.W();
if (dt.a(bVar)) {
ew.a(this, p2, bVar, a2, a3, Integer.valueOf(ftVar.G()), a4, z8, cVar.r(2), cVar.r(3));
z6 = z5;
} else {
ab();
z6 = z5;
ew.a(this, 268435460, p2, bVar, a2, a3, aVar, a6, ftVar);
}
if (!z6) {
if (!z3 && z2) {
i3 = -5;
if (!z2) {
return i3;
}
dtVar.a(2000L, 100L);
return i3;
}
cVar.b(1);
c(n.a(p2, z6));
}
i3 = -1;
if (!z2) {
}
}
}
}
}
return -3;
}
private int a(String str, dt.a aVar) {
return ew.a(this, str, aVar, "E#doHideScene") ? -1 : -3;
}
private int a(ft ftVar, String str, int i2, String str2, Bundle bundle) {
String str3;
dt d2 = ew.d(str);
int i3 = -1;
switch (dt.g.values()[i2]) {
case Height:
if (d2 != null) {
str3 = String.valueOf(d2.E());
break;
}
i3 = -3;
str3 = null;
break;
case Width:
if (d2 != null) {
str3 = String.valueOf(d2.D());
break;
}
i3 = -3;
str3 = null;
break;
case HorizontalOffset:
if (d2 != null) {
str3 = String.valueOf(d2.ad() - 100);
break;
}
i3 = -3;
str3 = null;
break;
case VerticalOffset:
if (d2 != null) {
str3 = String.valueOf(d2.ae() - 100);
break;
}
i3 = -3;
str3 = null;
break;
case Status:
if (d2 == null) {
if (fy.e(this).t(str)) {
str3 = "uncreated";
break;
}
i3 = -3;
str3 = null;
break;
} else if (!d2.U()) {
str3 = "hidden";
break;
} else if (!d2.as()) {
str3 = "background";
break;
} else {
str3 = "visible";
break;
}
default:
i3 = -3;
str3 = null;
break;
}
String str4 = str3;
if (str4 == null) {
gx.a((Context) this, str2, false, true, bundle, Integer.valueOf(ftVar.G()));
} else {
gx.a((Context) this, str2, str4, true, bundle, "testScene", (Integer) null, new Integer[]{Integer.valueOf(ftVar.w())}, Integer.valueOf(ftVar.G()));
}
return i3;
}
private int a(String str, String str2, Bundle bundle) {
fy e2 = fy.e(this);
if (!e2.t(str2)) {
bo.d("E", str + ": unknown scene " + str2);
} else {
if (ew.b(getApplicationContext(), e2.y(str2))) {
dt d2 = ew.d(str2);
if (d2 != null) {
d2.a(bundle);
}
return -1;
}
bo.d("E", str + ": failed to create scene " + str2);
}
return -3;
}
private int o(String str) {
if (ew.a(str)) {
return ew.a((Context) this, str, true) ? -1 : -3;
}
bo.b("E", "doDestroyScene: " + str + ": doesn't exist");
return -1;
}
private long n(int i2) {
return System.currentTimeMillis() + (i2 * 1000);
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, ft ftVar) {
Pattern pattern;
int i2;
int i3;
Matcher matcher;
String a2 = a((Context) this, cVar, 0, bundle, true);
String a3 = a(this, cVar, 5, bundle);
if (a2 != null && a3 != null) {
if (!gx.e(this, a2, bundle)) {
bo.d("E", str + ": undefined variable: " + a2);
} else {
String b2 = b(cVar, 1, bundle);
boolean a4 = a(cVar, 2);
boolean a5 = a(cVar, 3);
boolean a6 = a(cVar, 4);
boolean z2 = a3.length() > 0;
boolean a7 = a(cVar, 6);
if (z2) {
gx.k(this, a3, bundle);
}
String f2 = gx.f(this, a2, bundle);
int i4 = a4 ? 2 : 0;
if (a5) {
i4 |= 8;
}
try {
pattern = Pattern.compile(b2, i4);
i2 = -1;
} catch (PatternSyntaxException unused) {
bo.d("E", str + ": bad search pattern: " + b2);
pattern = null;
i2 = -3;
}
if (i2 == -1) {
Matcher matcher2 = pattern.matcher(f2);
int i5 = 0;
while (true) {
if (!matcher2.find()) {
i3 = i2;
matcher = matcher2;
break;
}
String group = matcher2.group();
int i6 = i5 + 1;
if (z2) {
i3 = i2;
matcher = matcher2;
gx.a((Context) this, a3, Integer.MAX_VALUE, group, false, bundle);
} else {
i3 = i2;
matcher = matcher2;
}
if (a6) {
i5 = i6;
break;
}
i5 = i6;
i2 = i3;
matcher2 = matcher;
}
if (a7 && i5 > 0) {
String b3 = b(cVar, 7, bundle);
matcher.reset();
try {
String replaceFirst = a6 ? matcher.replaceFirst(b3) : matcher.replaceAll(b3);
if (TextUtils.isEmpty(replaceFirst)) {
gx.a((Context) this, a2, false, true, bundle, Integer.valueOf(ftVar.G()));
} else {
gx.a((Context) this, a2, replaceFirst, true, bundle, str, Integer.valueOf(ftVar.ay()), new Integer[]{Integer.valueOf(ftVar.w())}, Integer.valueOf(ftVar.G()));
}
} catch (Throwable th) {
bo.b("E", "Couldn't replace variable", th);
}
}
} else {
i3 = i2;
}
return i3;
}
}
return -3;
}
private int a(net.dinglisch.android.taskerm.c cVar, int i2, int i3, int i4, int i5, Bundle bundle, ft ftVar) {
dt a2;
int d2 = d(cVar, i2, bundle);
if (d2 != Integer.MAX_VALUE) {
ab();
String b2 = b(cVar, i3, bundle);
if (b2.length() == 0) {
b2 = n.w(cVar.i(), i3);
}
fz c2 = fy.c(this);
int i6 = cVar.i();
if (c2.t(b2)) {
a2 = c2.y(b2);
ch a3 = n.a(getResources(), i6, i3, a2);
if (a3 != null) {
a3.a(this, "E");
a2 = null;
}
} else {
a2 = n.a(this, b2);
}
dt dtVar = a2;
if (dtVar == null) {
bo.c("E", "unknown scene: " + b2);
} else {
String w2 = n.w(i6, i3);
n.a(this, fy.c(this), dtVar, cVar, i3, bundle);
dtVar.a(w2);
if (ew.a(this, dtVar)) {
dtVar.f(i5);
dtVar.a(bundle);
dtVar.W();
ew.a(this, 268435460, dtVar.m(), dt.b.DialogDimBehind, 100, 100, dt.f12837a, i4 == -1 ? true : a(cVar, i4), ftVar);
g(n.a(this, cVar, bundle, -1), d2);
return -1;
}
}
}
return -3;
}
private void g(String str, int i2) {
if (i2 == 600) {
c(str);
} else {
b(str, i2);
}
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, ft ftVar) {
dt e2;
String b2 = b(cVar, 1, bundle);
if (b2.length() == 0) {
bo.d("E", str + ": empty code");
return -3;
}
if (a(b2)) {
return -5;
}
if (TextUtils.isDigitsOnly(b2)) {
String b3 = b(cVar, 6, bundle);
if (TextUtils.isEmpty(b3)) {
b3 = ex.c();
}
fz c2 = fy.c(this);
if (c2.t(b3)) {
e2 = c2.y(b3);
} else {
e2 = ex.e(this);
}
dt dtVar = e2;
dtVar.a(n.w(cVar.i(), 6));
if (!ew.a(this, dtVar)) {
return -3;
}
n.a(this, fy.c(this), dtVar, cVar, 6, bundle);
dtVar.a("%bpar", b2);
dtVar.f(i2);
dtVar.W();
ew.a(this, dtVar.m(), cVar.h(4).b() ? dt.b.OverlayBlockingFullDisplay : dt.b.OverlayBlocking, 100, 100, Integer.valueOf(ftVar.G()), false, false, false, false);
c(n.k());
return -1;
}
bo.d("E", cVar.n() + ": not showing, code has non-numerics");
return -3;
}
private int V() {
return this.an.getInt("lmp", 1000);
}
public void W() {
a(V());
}
private int a(String str, int i2, String str2, int i3, int i4, String str3) {
int b2 = ds.b(i2);
if (str2.length() == 0) {
str2 = ds.a(this, b2);
}
Uri a2 = ds.a(this, b2, str2);
if (a2 == null) {
bo.d("E", str + "couldn't get Uri, type " + b2 + " title " + str2);
return -3;
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append("uri: ");
sb.append(a2 == null ? null : a2.toString());
bo.b("E", sb.toString());
Message obtainMessage = this.ai.obtainMessage();
Bundle bundle = new Bundle();
bundle.putString("uri", a2.toString());
bundle.putInt("stream", i3);
bundle.putInt("exeid", i4);
bundle.putString("tname", str3);
obtainMessage.setData(bundle);
this.ai.sendMessage(obtainMessage);
return -1;
}
private int e(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Integer c2;
Integer num;
String b2 = b(cVar, 0, bundle);
if (TextUtils.isEmpty(b2)) {
c2 = 0;
num = 0;
} else if (b2.contains("/")) {
String[] split = b2.split(Pattern.quote("/"));
if (split.length == 2) {
Integer c3 = gs.c(split[0].trim());
num = gs.c(split[1].trim());
c2 = c3;
} else {
c2 = null;
num = null;
}
} else {
c2 = gs.c(b2);
num = 0;
}
if (c2 == null || num == null) {
bo.d("E", "calendar Insert: bad start: " + b2);
return -3;
}
if (num.intValue() == 0) {
num = 1;
}
long currentTimeMillis = System.currentTimeMillis() / 1000;
String b3 = b(cVar, 2, bundle);
if (cb.a(getContentResolver(), (c2.intValue() * 60) + currentTimeMillis, num.intValue() * 60, b(cVar, 1, bundle), b3, b(cVar, 3, bundle), b(cVar, 4, bundle), a(cVar, 5), a(cVar, 6))) {
return -1;
}
b(R.string.fi_calendar_insert_failed, b3);
return -3;
}
private int e(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String a2 = a(cVar, 0, bundle);
String b2 = b(cVar, 1, bundle);
String b3 = b(cVar, 2, bundle);
if (a2 == null) {
return -3;
}
gx.k(this, a2, bundle);
return a(str, a2, b2, b3, false, bundle, false);
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, Bundle bundle) {
String b2;
boolean z2;
String a2 = a(cVar, 0, bundle);
if (a2 == null) {
return -3;
}
boolean b3 = cVar.h(2).b();
gx.k(this, a2, bundle);
if (gx.e(this, a2, bundle)) {
b2 = gx.d(this, a2, bundle);
z2 = true;
} else {
b2 = b(a2, ftVar);
if (b2.equals(a2)) {
b2 = "";
}
z2 = false;
}
return a(str, a2, b2, b(cVar, 1, bundle), z2 && b3, bundle, cVar.h(3).b());
}
private int a(String str, String str2, String str3, String str4, boolean z2, Bundle bundle, boolean z3) {
if (str3.length() > 0) {
if (TextUtils.isEmpty(str4)) {
str4 = "\\s+";
} else if (!z3) {
str4 = Pattern.quote(str4);
}
String[] split = str3.split(str4);
SharedPreferences.Editor edit = gx.o(str2) ? null : gx.a(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 (z2) {
gx.a((Context) this, str2, true, true, bundle);
}
gx.g(this, str2, bundle);
return -1;
}
bo.d("E", str + ": can't split unset value to set " + str2);
return -3;
}
private int f(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String str2;
int i2;
String str3;
int i3;
String str4;
int i4;
Intent intent = new Intent(this, (Class<?>) ReceiverStaticInternal.class);
intent.setAction("net.dinglisch.android.tasker.SMSEY");
int i5 = 0;
String b2 = b(cVar, 0, bundle);
String[] split = b2.split(",");
String b3 = b(cVar, 3, bundle);
boolean a2 = a(cVar, 4);
SmsManager a3 = com.joaomgcd.taskerm.k.a.a(this, b3);
if (split == null) {
bo.d("E", "SMS Send: bad number list: " + b2);
return -1;
}
if (a3 == null) {
bo.c("E", "no SMS Manager available");
return -1;
}
int i6 = 1;
String b4 = b(cVar, 1, bundle);
ArrayList<String> divideMessage = a3.divideMessage(b4);
int i7 = 0;
while (i7 < split.length) {
String trim = split[i7].trim();
if (trim.length() == 0) {
b(R.string.fi_empty_sms, new Object[i5]);
} else {
intent.setData(Uri.parse("tel:" + trim));
PendingIntent broadcast = PendingIntent.getBroadcast(this, i5, intent, com.joaomgcd.taskerm.util.ds.a(134217728));
if (broadcast == null) {
bo.c("E", str + ": couldn't get pending intent");
} else {
try {
bo.b("E", str + ": sending " + divideMessage.size() + " part(s)");
if (divideMessage.size() == i6) {
i3 = 2;
str4 = trim;
i4 = i7;
str3 = b4;
try {
a3.sendTextMessage(trim, null, b4, broadcast, null);
} catch (NullPointerException e2) {
e = e2;
str2 = str4;
i2 = i4;
if (TextUtils.isEmpty(str3)) {
}
i7 = i2 + 1;
b4 = str3;
i5 = 0;
i6 = 1;
}
} else {
str4 = trim;
i4 = i7;
str3 = b4;
i3 = 2;
ArrayList<PendingIntent> arrayList = new ArrayList<>();
for (int i8 = 0; i8 < divideMessage.size(); i8++) {
arrayList.add(broadcast);
}
a3.sendMultipartTextMessage(str4, null, divideMessage, arrayList, null);
}
if (a2) {
try {
n.b e3 = this.f11023d.e();
if (!e3.a()) {
bo.c("E", "SMS not sent: " + e3.a(this));
return -3;
}
} catch (Exception unused) {
}
}
if (cVar.h(i3).b()) {
str2 = str4;
try {
c(str2, str3);
} catch (NullPointerException e4) {
e = e4;
i2 = i4;
if (TextUtils.isEmpty(str3)) {
Object[] objArr = new Object[i3];
objArr[0] = str;
objArr[1] = str2;
a(R.string.fi_sms_empty_body, objArr);
} else if (TextUtils.isEmpty(str2)) {
Object[] objArr2 = new Object[i3];
objArr2[0] = str;
objArr2[1] = str2;
a(R.string.fi_sms_empty_num, objArr2);
} else {
Object[] objArr3 = new Object[i3];
objArr3[0] = str;
objArr3[1] = str2;
a(R.string.fi_sms_unknown, objArr3);
bo.a("E", str, (Exception) e);
}
i7 = i2 + 1;
b4 = str3;
i5 = 0;
i6 = 1;
}
} else {
str2 = str4;
}
i2 = i4;
if (i2 < split.length - 1) {
try {
a(200L);
} catch (NullPointerException e5) {
e = e5;
if (TextUtils.isEmpty(str3)) {
}
i7 = i2 + 1;
b4 = str3;
i5 = 0;
i6 = 1;
}
}
} catch (NullPointerException e6) {
e = e6;
str2 = trim;
i2 = i7;
str3 = b4;
i3 = 2;
}
i7 = i2 + 1;
b4 = str3;
i5 = 0;
i6 = 1;
}
}
i2 = i7;
str3 = b4;
i7 = i2 + 1;
b4 = str3;
i5 = 0;
i6 = 1;
}
return -1;
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, ft ftVar) {
boolean z2;
String str2;
String b2 = b(cVar, 0, bundle);
int b3 = b(cVar, 4);
if (b3 == 4) {
b3 = 2;
}
String str3 = n.o[b3];
int i2 = n.l[b3];
int b4 = this.f11023d.b(i2);
int i3 = 0;
while (true) {
z2 = true;
if (i3 >= n.o.length) {
break;
}
if (b2.endsWith("." + n.o[i3])) {
b2 = b2.substring(0, (b2.length() - n.o[i3].length()) - 1);
break;
}
i3++;
}
File a2 = a(b2 + "." + str3, str, false, true, false);
int d2 = d(cVar, 2, bundle);
int i4 = -3;
if (a2 != null && d2 != Integer.MAX_VALUE) {
bo.b("E", "record sync");
synchronized (G) {
if (F == null) {
F = new MediaRecorder();
if (F == null) {
b(R.string.fi_no_media_recorder, new Object[0]);
} else {
F.setOnErrorListener(this);
}
} else {
b(false);
}
if (F != null) {
try {
F.setAudioSource(cVar.g(1).h());
if (i2 == 2 && b4 == 3) {
F.setAudioEncodingBitRate(128000);
F.setAudioChannels(1);
F.setAudioSamplingRate(48000);
}
F.setOutputFormat(i2);
F.setAudioEncoder(b4);
long j2 = d2;
if (j2 > 0) {
F.setMaxFileSize(j2 * 1024);
}
FileDescriptor b5 = com.joaomgcd.taskerm.util.dq.b(a2, this);
if (b5 != null) {
F.setOutputFile(b5);
} else {
F.setOutputFile(a2.toString());
}
F.prepare();
} catch (Exception e2) {
str2 = str + ": " + e2.toString();
if (cVar.t()) {
bo.c("E", str2);
}
}
try {
F.start();
str2 = null;
} catch (RuntimeException unused) {
str2 = com.joaomgcd.taskerm.util.an.a(R.string.fi_bad_audio_source, this, str);
if (cVar.t()) {
a(str2, new Object[0]);
}
z2 = false;
if (!z2) {
}
i4 = -1;
return i4;
}
if (!z2) {
if (C != null) {
C.release();
C = null;
}
if (str2 != null) {
ftVar.c(str2);
}
if (cVar.t()) {
b(R.string.fi_init_media_recorder, new Object[0]);
}
}
}
i4 = -1;
}
}
return i4;
}
private void g(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2;
Intent intent;
String str2;
String a2;
boolean z2 = cVar.i() == 111;
boolean z3 = gs.l() >= 19;
String b3 = b(cVar, 0, bundle);
if (z2) {
b2 = b(cVar, 2, bundle);
} else {
b2 = b(cVar, 1, bundle);
}
String str3 = null;
if (z3) {
if (b3.length() == 0) {
intent = new Intent("android.intent.action.SEND");
if (!TextUtils.isEmpty(b2)) {
intent.putExtra("android.intent.extra.TEXT", b2);
str3 = "text/plain";
}
if (z2) {
String b4 = b(cVar, 3, bundle);
if (b4.length() > 0) {
str2 = a(intent, str, b4);
}
}
str2 = str3;
if (str2 != null) {
intent.setType(str2);
}
if (bw.ar.b() && (a2 = bw.ar.a(this)) != null) {
intent.setPackage(a2);
}
} else {
intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse("smsto:" + Uri.encode(b3)));
}
if (z2) {
String b5 = b(cVar, 1, bundle);
if (!TextUtils.isEmpty(b5)) {
intent.putExtra("android.intent.extra.SUBJECT", b5);
}
}
} else {
intent = new Intent(z2 ? "android.intent.action.SEND" : "android.intent.action.VIEW");
intent.putExtra("address", b3);
intent.putExtra("sms_body", b2);
intent.putExtra("exit_on_sent", true);
if (z2) {
String b6 = b(cVar, 1, bundle);
if (!TextUtils.isEmpty(b6)) {
intent.putExtra("subject", b6);
}
String b7 = b(cVar, 3, bundle);
if (b7.length() > 0 && a(intent, str, b7) == null) {
intent = null;
}
} else {
intent.setType("vnd.android-dir/mms-sms");
}
}
if (intent != null) {
a(intent, false);
}
}
private String a(Intent intent, String str, String str2) {
File a2 = a(str2, str, true, true, false);
if (a2 == null) {
return null;
}
String c2 = gs.c(a2);
if (c2.length() > 0) {
intent.putExtra("android.intent.extra.STREAM", Uri.parse("file://" + a2.toString()));
intent.setType(c2);
return c2;
}
bo.d("E", "couldn't determine MIME type of " + a2.toString());
return null;
}
private int h(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int d2 = d(cVar, 1, bundle);
if (d2 != Integer.MAX_VALUE) {
String b2 = b(cVar, 2, bundle);
byte[] decode = Base64.decode(b2, 0);
if (decode == null) {
bo.d("E", "base64decode failed: " + b2);
} else if (decode.length > 133) {
bo.d("E", str + ": binary data " + decode.length + "bytes , max 133");
} else {
String[] split = b(cVar, 0, bundle).split(",");
if (!gs.a((Object[]) split)) {
for (String str2 : split) {
SmsManager.getDefault().sendDataMessage(str2, null, (short) d2, decode, null, null);
bo.b("E", str + ": sent " + b2 + " as " + decode.length + " bytes ");
}
return -1;
}
bo.d("E", str + ": no recipients");
}
}
return -3;
}
private int a(String str, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (VpnService.prepare(this) != null) {
if (a(4, i2, 20, cVar, bundle)) {
return -1;
}
} else {
if (MyVpnService.a(this, MyVpnService.a.values()[cVar.g(0).h()], cVar.a(this, 1, bundle).k())) {
return -5;
}
}
return -3;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, gt gtVar, Bundle bundle) {
boolean z2;
String b2 = b(cVar, 0, bundle);
Intent intent = b2.length() == 0 ? new Intent() : new Intent(b2);
String b3 = b(cVar, 7, bundle);
String b4 = b(cVar, 8, bundle);
if (b3.length() > 0) {
if (b4.length() > 0) {
intent.setComponent(new ComponentName(b3, b4));
} else {
intent.setPackage(b3);
}
z2 = false;
} else {
z2 = true;
}
String w2 = n.w(cVar.g(1).h());
if (w2 != null) {
intent.addCategory(w2);
}
String b5 = b(cVar, 3, bundle);
String b6 = b(cVar, 2, bundle);
boolean z3 = !TextUtils.isEmpty(b5);
boolean z4 = b6.length() > 0;
if (z4) {
if (bw.ae.b()) {
b6 = bw.ae.a(b6);
} else {
b6 = b6.toLowerCase();
}
}
if (com.joaomgcd.taskerm.util.ao.d(b5)) {
b5 = com.joaomgcd.taskerm.util.dq.a(a("Sent Intent", com.joaomgcd.taskerm.util.ao.b(b5)), this, (String[]) null, intent).toString();
}
if (z3 && z4) {
intent.setDataAndType(Uri.parse(b5), b6);
} else if (z3) {
intent.setData(Uri.parse(b5));
} else if (z4) {
intent.setType(b6);
}
String b7 = b(cVar, 4, bundle);
if (!TextUtils.isEmpty(b7)) {
a(str, intent, b7, gtVar, bundle);
}
String b8 = b(cVar, 5, bundle);
if (!TextUtils.isEmpty(b8)) {
a(str, intent, b8, gtVar, bundle);
}
String b9 = b(cVar, 6, bundle);
if (!TextUtils.isEmpty(b9)) {
a(str, intent, b9, gtVar, bundle);
}
cr.a aVar = cr.a.values()[cVar.g(9).h()];
try {
switch (aVar) {
case Receiver:
bo.b("E", "send broadcast...");
sendBroadcast(intent, null);
return -1;
case Service:
if (z2) {
bo.b("E", "resolve implicit intent");
intent = cr.a(getPackageManager(), aVar, intent);
}
if (intent == null) {
return -3;
}
bo.b("E", "start service...");
bo.a("E", intent, false);
Integer a2 = com.joaomgcd.taskerm.util.al.a(this, intent.getComponent());
com.joaomgcd.taskerm.util.h.a(this, intent, a2 == null ? com.joaomgcd.taskerm.util.al.e(this) : a2.intValue(), true);
return -1;
case Activity:
bo.b("E", "start activity...");
a(intent);
return -1;
default:
return -3;
}
} catch (SecurityException unused) {
a(R.string.fi_permissions, str);
return -3;
}
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, a2, true, false)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (a(g2, str, a2, true, true, true)) {
File g3 = g(str, cVar, 1, bundle);
if (at.a((Context) this, g3, a2, false, true)) {
if (g(cVar, i2, bundle)) {
}
} else if (a(g2, str, a2, false, true, true) && !g2.equals(g3)) {
if (a2) {
if (fd.a(true, 7000L, "mv " + gs.o(g2.toString()) + " " + gs.o(g3.toString()), a3) == 0) {
return -5;
}
} else {
File file = at.e(this, g3) ? new File(g3, g2.getName()) : g3;
if (at.a(this, g2, file)) {
return -5;
}
a(R.string.fi_rename_failed, g2.toString(), file.toString());
}
}
}
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
boolean t2 = cVar.t();
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, a2, true, true)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, a2, true, true, false)) {
int d2 = d(cVar, 1, bundle);
if (d2 > 0 && d2 != Integer.MAX_VALUE) {
if (at.a((Context) this, g2, true)) {
bo.b("E", str + ": shredding unsupported on Android 21+ external SD");
} else if (!gs.a(g2, d2)) {
bo.a("E", t2, str + ": failed to shred " + g2);
}
}
if (a2) {
String o2 = gs.o(g2.toString());
if (fd.a(true, 7000L, "rm -f " + o2, a3) == 0) {
return -5;
}
if (fd.a(true, 7000L, "rm " + o2, a3) == 0) {
return -5;
}
} else {
if (at.g(this, g2)) {
return -5;
}
if (t2) {
b(R.string.fi_failed_delete_file, g2.toString());
}
}
}
return -3;
}
private boolean a(File file, boolean z2, boolean z3, boolean z4, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return at.a(this, file, z2, z3, z4) && g(cVar, i2, bundle);
}
private int c(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
String b2 = b(cVar, 0, bundle);
String b3 = b(cVar, 1, bundle);
File a4 = a(str, b2);
File a5 = a(str, b3);
if (a(a4, a2, true, false, cVar, i2, bundle) || a(a5, a2, false, true, cVar, i2, bundle)) {
return -1;
}
if (a2) {
StringBuilder sb = new StringBuilder();
sb.append("cp ");
sb.append(gs.o(a4.toString()));
sb.append(" ");
sb.append(gs.o(a5.toString()));
return fd.a(true, 7000L, sb.toString(), a3) == 0 ? -5 : -3;
}
try {
com.joaomgcd.taskerm.util.dq.c(this, b2, b3);
return -5;
} catch (com.joaomgcd.taskerm.util.aj e2) {
bo.b("E", true, e2.a(this, str));
return -3;
} catch (Exception e3) {
bo.b("E", true, e3.getMessage());
return -3;
}
}
private int d(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, a2, true, false)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (a(g2, str, a2, true, false, true)) {
File g3 = g(str, cVar, 1, bundle);
if (at.a((Context) this, g3, a2, false, true)) {
if (g(cVar, i2, bundle)) {
}
} else if (a(g2, str, a2, false, false, true) && !g2.equals(g3)) {
if (a2) {
if (fd.a(true, 60000L, "cp -r " + gs.o(g2.toString()) + " " + gs.o(g3.toString()), a3) == 0) {
return -5;
}
} else {
if (at.b((Context) this, g2, at.f(this, g3) ? new File(g3, g2.getName()) : g3, true)) {
return -5;
}
}
}
}
}
private int e(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
boolean t2 = cVar.t();
File g2 = g(str, cVar, 0, bundle);
int i3 = -3;
if (at.a((Context) this, g2, a2, true, true)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (!a(g2, str, a2, true, false, true)) {
return -3;
}
boolean a4 = a(cVar, 1);
if (g2.equals(File.separator)) {
bo.a("E", t2, "refusing to attempt root deletion");
return -3;
}
if (!a4 && at.b(this, g2)) {
a(t2, R.string.fi_dir_not_empty, g2.toString());
return -3;
}
if (a2) {
StringBuilder sb = new StringBuilder();
sb.append(a4 ? "rm -r -f " : "rmdir ");
sb.append(gs.o(g2.toString()));
}
if (i3 == -5) {
return i3;
}
a(t2, R.string.fi_dir_delete, g2.toString());
return i3;
}
private int f(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
boolean a2 = a(cVar, 2);
boolean a3 = a(cVar, 3);
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, a2, true, true)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (!a(g2, str, a2, false, false, true)) {
return -3;
}
boolean a4 = a(cVar, 1);
int i3 = -5;
if (a2) {
StringBuilder sb = new StringBuilder();
sb.append(a4 ? "mkdir -p " : "mkdir ");
sb.append(gs.o(g2.toString()));
}
}
private void X() {
boolean z2;
synchronized (g) {
z2 = false;
if (h != null) {
if (!i) {
h.recycle();
}
h = null;
i = false;
z2 = true;
}
}
if (z2) {
System.gc();
}
}
private int i(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
X();
int d2 = cVar.g(1).g() ? d(cVar, 1, bundle) : 0;
int i3 = -3;
if (d2 != Integer.MAX_VALUE) {
net.dinglisch.android.taskerm.g b2 = cVar.e(0).b(this, bundle);
if (d2 > 0) {
i2 = d2;
} else {
d2 = -1;
i2 = -1;
}
try {
synchronized (g) {
h = b2.a(this, d2, i2, "exe/doLoadImage");
if (h == null) {
bo.d("E", "no bitmap from icon " + b2.c(this));
} else {
Uri c2 = b2.c(this);
i3 = (c2 != null && "file".equals(c2.getScheme()) && a(cVar, 2)) ? a(str, c2, bundle) : -1;
}
}
} catch (Exception e2) {
bo.a("E", str, e2);
} catch (OutOfMemoryError unused) {
bo.d("E", str + ": oom");
}
}
return i3;
}
private int a(String str, Uri uri, Bundle bundle) {
int i2;
int attributeInt;
int i3;
int i4;
String path = uri.getPath();
bo.b("E", "check orientation for " + path);
String a2 = gs.a(path, false);
if (a2.length() <= 0 || !ca.a(a2)) {
return -1;
}
bo.b("E", "is jpg");
ExifInterface exifInterface = null;
int i5 = -3;
try {
exifInterface = new ExifInterface(path);
i2 = -1;
} catch (IOException e2) {
bo.a("E", "applyExif", (Exception) e2);
i2 = -3;
}
if (exifInterface == null || (attributeInt = exifInterface.getAttributeInt("Orientation", 1)) == 1) {
return i2;
}
bo.b("E", "has non-normal ori " + attributeInt);
int i6 = 3;
if (attributeInt == 2) {
i5 = i2;
i3 = 0;
i4 = 1;
} else if (attributeInt == 4) {
i5 = i2;
i3 = 0;
i4 = 0;
} else {
if (attributeInt == 6) {
i5 = i2;
i3 = 0;
} else {
if (attributeInt == 3) {
i5 = i2;
i3 = 0;
i4 = -1;
if (i6 == -1) {
if (i4 == -1) {
return i5;
}
bo.b("E", "flip: " + i4);
net.dinglisch.android.taskerm.c cVar = new net.dinglisch.android.taskerm.c(190);
cVar.a(0, i4);
return l(str, cVar, bundle);
}
bo.b("E", "rotate: " + i6 + " dir " + i3);
net.dinglisch.android.taskerm.c cVar2 = new net.dinglisch.android.taskerm.c(191);
cVar2.a(0, i3);
cVar2.a(1, i6);
return l(str, cVar2, bundle);
}
if (attributeInt == 8) {
i5 = i2;
i3 = 1;
} else {
bo.b("E", "unhandled exif orientation " + attributeInt);
i3 = 0;
i4 = -1;
}
}
i4 = -1;
i6 = 1;
if (i6 == -1) {
}
}
i6 = -1;
if (i6 == -1) {
}
}
private int j(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
synchronized (g) {
i2 = -3;
if (h == null) {
bo.d("E", str + ": no image loaded");
} else {
Bitmap bitmap = null;
int d2 = d(cVar, 1, bundle);
if (d2 != Integer.MAX_VALUE) {
try {
switch (b(cVar, 0)) {
case 0:
bitmap = ca.a(h, d2);
break;
case 1:
bitmap = ca.a(h, 3, false, d2);
break;
case 2:
bitmap = ca.a(h, 2, false, d2);
break;
case 3:
bitmap = ca.a(h, 1, false, d2);
break;
case 4:
bitmap = ca.a(h);
break;
case 5:
bitmap = ca.a(h, 0, true, d2);
break;
default:
bo.d("E", str + ": unknown mode");
break;
}
if (bitmap != null) {
h = bitmap;
i2 = -1;
}
} catch (OutOfMemoryError unused) {
bo.d("E", str + ": oom");
}
}
}
}
return i2;
}
private int k(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
synchronized (g) {
i2 = -3;
if (h == null) {
bo.d("E", str + ": no image loaded");
} else {
boolean a2 = a(cVar, 2);
File a3 = a(b(cVar, 0, bundle), str, false, true, false);
int a4 = a((Context) this, cVar, 1, true, true, bundle);
if (a4 >= 1 && a4 <= 100) {
if (a4 != Integer.MAX_VALUE && a3 != null && ca.a(h, a3, ca.a(a3), a4)) {
i2 = -1;
if (a2) {
X();
}
}
}
bo.d("E", str + ": bad quality " + a4);
}
}
return i2;
}
private int l(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
int i3;
int i4;
int i5;
int i6;
Matrix matrix;
int i7;
Bitmap createBitmap;
synchronized (g) {
if (h == null) {
bo.d("E", str + ": no image loaded");
i6 = -3;
} else {
int width = h.getWidth();
int height = h.getHeight();
Matrix matrix2 = new Matrix();
boolean z2 = true;
switch (cVar.i()) {
case 189:
int a2 = a((Context) this, cVar, 0, true, true, bundle);
float f2 = width;
int i8 = (int) ((a2 / 100.0f) * f2);
int a3 = (width - ((int) ((a((Context) this, cVar, 1, true, true, bundle) / 100.0f) * f2))) - i8;
float f3 = height;
int a4 = (int) ((a((Context) this, cVar, 2, true, true, bundle) / 100.0f) * f3);
int a5 = (height - ((int) ((a((Context) this, cVar, 3, true, true, bundle) / 100.0f) * f3))) - a4;
if (a5 > 0 && a3 > 0) {
z2 = true;
i2 = a4;
i3 = i8;
i4 = a3;
i5 = a5;
i6 = -3;
matrix = null;
break;
}
bo.d("E", str + ": bad resolved dimensions: " + i8 + "," + a4 + " " + a3 + "x" + a5);
z2 = false;
i2 = a4;
i3 = i8;
i4 = a3;
i5 = a5;
i6 = -3;
matrix = null;
case 190:
if (b(cVar, 0) == 0) {
matrix2.preScale(-1.0f, 1.0f);
} else {
matrix2.preScale(1.0f, -1.0f);
}
matrix = matrix2;
i4 = width;
i5 = height;
z2 = true;
i6 = -3;
i3 = 0;
i2 = 0;
break;
case 191:
int b2 = b(cVar, 0);
int b3 = (b(cVar, 1) + 1) * 45;
if (b2 == 1) {
b3 = 0 - b3;
}
matrix2.postRotate(b3);
matrix = matrix2;
i4 = width;
i5 = height;
z2 = true;
i6 = -3;
i3 = 0;
i2 = 0;
break;
case 192:
default:
matrix = matrix2;
i4 = width;
i5 = height;
z2 = true;
i6 = -3;
i3 = 0;
i2 = 0;
break;
case 193:
int d2 = d(cVar, 0, bundle);
int d3 = d(cVar, 1, bundle);
if (d2 != Integer.MAX_VALUE && d3 != Integer.MAX_VALUE) {
float f4 = width;
float f5 = height;
float f6 = f4 / f5;
bo.b("E", "old: " + width + "*" + height + " new " + d2 + "*" + d3 + " aspect: " + f6);
if (d2 <= 0) {
if (d3 <= 0) {
z2 = false;
} else {
d2 = (int) (d3 * f6);
}
} else if (d3 <= 0) {
d3 = (int) (d2 / f6);
}
bo.b("E", "new " + d2 + "*" + d3 + " aspect: " + f6);
if (z2) {
if (d2 == width && d3 == height) {
z2 = false;
i7 = -1;
matrix = matrix2;
i4 = width;
i5 = height;
i6 = i7;
i3 = 0;
i2 = 0;
break;
}
matrix2.postScale(d2 / f4, d3 / f5);
}
i7 = -3;
matrix = matrix2;
i4 = width;
i5 = height;
i6 = i7;
i3 = 0;
i2 = 0;
}
matrix = matrix2;
i4 = width;
i5 = height;
z2 = false;
i6 = -3;
i3 = 0;
i2 = 0;
}
if (z2) {
try {
createBitmap = Bitmap.createBitmap(h, i3, i2, i4, i5, matrix, true);
} catch (OutOfMemoryError unused) {
bo.d("E", str + ": oom");
}
if (createBitmap != null) {
h.recycle();
h = createBitmap;
i6 = -1;
}
}
createBitmap = null;
if (createBitmap != null) {
}
}
}
return i6;
}
private void f(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
MonitorService.a((Context) this, cVar.e(0).b(this, bundle).r());
}
private int m(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
boolean z2;
boolean z3;
boolean z4;
boolean z5;
int i3;
int b2 = b(cVar, 0);
int d2 = d(cVar, 1, bundle);
net.dinglisch.android.taskerm.h g2 = cVar.g(1);
boolean g3 = g2.g();
boolean a2 = a(cVar, 2);
long j2 = this.an.getLong("wip", 10L);
long j3 = this.an.getLong("bttp", 15L);
long j4 = this.an.getLong("sows", 60L);
long j5 = this.an.getLong("lfdd", 600L);
switch (b2) {
case 0:
i2 = d2;
if (i2 >= 100) {
str3 = "lperiod";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str2 = "min value 100";
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
}
case 1:
i2 = d2;
if (i2 >= 25) {
if (j2 <= i2 - 15) {
str3 = "btpiod";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str2 = "BT check time must be at least 15 secs greater than BT timeout";
}
} else {
str2 = "BT check time must be at least 25 secs";
}
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
case 2:
i2 = d2;
if (i2 >= 25) {
if (j2 <= i2 - 15) {
str3 = "wfpiod";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str2 = "wifi check time must be at least 15 secs greater than wifi timeout";
}
} else {
str2 = "wifi check time must be at least 25 secs";
}
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
case 3:
i2 = d2;
if (i2 > this.an.getLong("gupt", 90L)) {
str3 = "guped";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str2 = "GPS check time must be > GPS timeout";
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
}
case 4:
i2 = d2;
str3 = "luped";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
case 5:
i2 = d2;
if (i2 < this.an.getLong("guped", 120L)) {
str3 = "gupt";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str2 = "GPS check timeout must be < GPS check time";
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
}
case 6:
if (j4 > d2 - 5) {
str5 = "off check time must be at least 5 seconds > off check timeout";
str2 = str5;
i2 = d2;
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
i2 = d2;
if (i2 < 25) {
str2 = "off check time must be > 25 secs";
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
} else {
str3 = "lfdd";
str4 = str3;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
}
}
case 7:
if (j2 <= j4 - 15) {
if (j4 <= j5 - 5) {
str6 = "sows";
str4 = str6;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str5 = "off check timeout must be minimally 5 secs < off check time";
}
} else {
str5 = "off check timeout must be at least 15 seconds > wifi timeout";
}
str2 = str5;
i2 = d2;
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
case 8:
if (j3 <= this.an.getLong("btpiod", 120L) - 15) {
if (j2 <= j4 - 15) {
str6 = "bttp";
str4 = str6;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str5 = "BT check timeout must be at least 15 secs < off check timeout";
}
} else {
str5 = "BT check timeout must be at least 15 secs < BT check time";
}
str2 = str5;
i2 = d2;
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
case 9:
if (j2 <= this.an.getLong("wfpiod", 120L) - 15) {
if (j2 <= j4 - 15) {
str6 = "wip";
str4 = str6;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
} else {
str5 = "wifi check timeout must be at least 15 secs < off check timeout";
}
} else {
str5 = "wifi check timeout must be at least 15 secs < wifi check time";
}
str2 = str5;
i2 = d2;
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
case 10:
str7 = "csnipD";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case 11:
str8 = "workForLoc";
str4 = str8;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = true;
break;
case g.a.MapAttrs_uiZoomControls:
str8 = "wakeForLoc";
str4 = str8;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = true;
break;
case g.a.MapAttrs_uiZoomGestures:
str8 = "mFn";
break;
case g.a.MapAttrs_useViewLifecycle:
str7 = "accelWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_zOrderOnTop:
str7 = "proxWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case 16:
str7 = "lightWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_ambientEnabled:
str7 = "pressureWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_cameraMinZoomPreference:
str7 = "tempWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_cameraMaxZoomPreference:
str7 = "humidityWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_latLngBoundsSouthWestLatitude:
str7 = "magnetWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_latLngBoundsSouthWestLongitude:
str7 = "stepsWhenOff";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_latLngBoundsNorthEastLatitude:
str7 = "clock_alarm";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case g.a.MapAttrs_latLngBoundsNorthEastLongitude:
str8 = "lpa";
str4 = str8;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = true;
break;
case 24:
str8 = "leEnle";
str4 = str8;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = true;
break;
case NotificationCompat.MessagingStyle.MAXIMUM_RETAINED_MESSAGES:
str8 = "dsd";
str4 = str8;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = true;
break;
case 26:
if (g3 || g2.e()) {
str4 = "lcD";
i2 = d2;
str2 = null;
z2 = false;
} else {
str4 = "lcD";
i2 = d2;
str2 = null;
z2 = true;
}
z3 = true;
z4 = true;
z5 = false;
break;
case 27:
str7 = "appcheckMethod";
str4 = str7;
i2 = d2;
str2 = null;
z2 = false;
z3 = false;
z4 = false;
z5 = false;
break;
case 28:
str8 = "sigmotion";
break;
default:
i2 = d2;
str2 = "unknown pref: " + b2;
str4 = null;
z2 = false;
z3 = false;
z4 = true;
z5 = false;
break;
}
if (str2 != null) {
bo.d("E", str + ": " + str2);
i3 = -3;
} else {
i3 = -1;
}
if (str4 != null) {
SharedPreferences.Editor edit = this.an.edit();
if (z2) {
bo.b("E", "setPref: " + str4 + " -> cleared");
edit.remove(str4);
} else if (z3) {
bo.b("E", "setPref: " + str4 + " -> ???");
edit.putString(str4, String.valueOf(i2));
} else if (z4) {
bo.b("E", "setPref: " + str4 + " -> " + i2);
edit.putLong(str4, (long) i2);
} else if (z5) {
bo.b("E", "setPref: " + str4 + " -> " + a2);
edit.putBoolean(str4, a2);
if (Kid.a() && str4.equals("mFn")) {
bo.b("E", "setPref: mSi -> " + a2);
edit.putBoolean("mSi", a2);
}
} else {
bo.b("E", "setPref: " + str4 + " -> " + i2);
edit.putInt(str4, i2);
}
edit.commit();
if (b2 == 24 || b2 == 25) {
bo.a(this.an);
} else if (b2 != 23 && b2 != 26) {
MonitorService.b(this, str4);
}
if (b2 == 22) {
MonitorService.a((Context) this, true);
}
}
return i3;
}
private int g(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2 = b(cVar, 0, bundle);
Intent intent = new Intent(a(cVar, 1) ? "android.intent.action.CALL" : "android.intent.action.DIAL", Uri.parse("tel:" + Uri.encode(b2)));
com.joaomgcd.taskerm.k.b.a(intent, this, b(cVar, 2, bundle));
return a(intent) ? -1 : -3;
}
private int n(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
File a2 = a(b(cVar, 0, bundle), str, true, true, false);
int a3 = a(cVar, 1, true, false, bundle);
int b2 = b(cVar, 3);
boolean b3 = cVar.h(4).b();
if (a2 != null && a3 != Integer.MAX_VALUE) {
if (a(a2, a3, cVar.h(2).b(), b2)) {
if (b3) {
this.af.put("Music", Long.valueOf(n(99999)));
return -5;
}
b("Music", 99999);
return -1;
}
a(R.string.fi_play_failed, str, a(a2));
}
return -3;
}
private void b(String str, net.dinglisch.android.taskerm.c cVar) {
String str2;
String str3;
ContentValues contentValues;
int update;
int b2 = b(cVar, 0);
if (b2 == 0) {
a(new Intent("com.android.phone.action.RECENT_CALLS"));
return;
}
switch (b2) {
case 1:
str2 = "type=3";
str3 = str2;
contentValues = null;
break;
case 2:
str2 = "type=1";
str3 = str2;
contentValues = null;
break;
case 3:
str2 = "type=2";
str3 = str2;
contentValues = null;
break;
case 4:
default:
contentValues = null;
str3 = null;
break;
case 5:
contentValues = new ContentValues();
contentValues.put("new", (Integer) 0);
str3 = null;
break;
case 6:
contentValues = new ContentValues();
contentValues.put("is_read", (Integer) 1);
str3 = null;
break;
}
ContentResolver contentResolver = getContentResolver();
if (contentValues == null) {
update = contentResolver.delete(CallLog.Calls.CONTENT_URI, str3, null);
} else {
update = contentResolver.update(CallLog.Calls.CONTENT_URI, contentValues, str3, null);
}
bo.b("E", str + ": updated " + update + " records");
}
@SuppressLint({"MissingPermission"})
@TargetApi(26)
private void Y() {
if (gs.l() >= 26 && this.f11023d.a(com.joaomgcd.taskerm.util.bw.u())) {
TelecomManager telecomManager = (TelecomManager) getSystemService(TelecomManager.class);
if (telecomManager == null) {
return;
}
telecomManager.acceptRingingCall();
return;
}
if (ba.a((Context) this, (Boolean) true)) {
com.joaomgcd.taskerm.util.cq.a(5).b();
return;
}
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 void Z() {
synchronized (this.am) {
for (Object obj : this.am.keySet().toArray()) {
e(((Integer) obj).intValue(), false);
}
}
}
public void e(int i2, boolean z2) {
synchronized (this.am) {
bo.b("E", "stop JSI " + i2 + " error: " + z2);
bf bfVar = this.am.get(Integer.valueOf(i2));
if (bfVar != null) {
bfVar._stop();
} else if (!z2) {
bo.d("E", "stopJSI: " + i2 + ": null");
}
String J2 = n.J(i2);
synchronized (this.f11020a) {
ft ftVar = this.ae.get(J2);
int i3 = -1;
if (ftVar != null) {
i3 = ftVar.M();
if (z2) {
ftVar.e(z2);
}
}
d(J2);
if (ftVar != null) {
ftVar.a(i3, z2 ? c.a.Err : c.a.OK);
com.joaomgcd.taskerm.profile.k.a(fy.e(this), ftVar);
}
}
this.am.remove(Integer.valueOf(i2));
bo.b("E", "stopJSI " + i2 + " done");
}
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, int i2, String str2) {
boolean b2 = cVar.h(0).b();
String b3 = b(cVar, 1, bundle);
if (TextUtils.isEmpty(b3)) {
int i3 = b2 ? -3 : -4;
b(String.valueOf(i2), true);
return i3;
}
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.n() && next.m().equals(b3) && !next.W()) {
d(next);
next.e(b2);
}
}
}
return -1;
}
private void d(ft ftVar) {
bo.b("E", "end wait stuff " + ftVar.ah() + "/" + ftVar.an());
if (ftVar.n()) {
b(ftVar.m(), false);
}
if (ftVar.L().i() == 123) {
fd.a(ftVar.an());
}
}
private void b(String str, boolean z2) {
synchronized (B) {
ArrayList arrayList = new ArrayList();
Iterator<Map.Entry<String, MediaPlayer>> it = B.entrySet().iterator();
while (it.hasNext()) {
String key = it.next().getKey();
String[] split = key.split("\n");
if ((z2 ? split[1] : split[0]).equals(str)) {
arrayList.add(key);
}
}
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
b(B.remove((String) it2.next()));
}
}
}
private int h(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String a2 = a(cVar, 0, bundle);
if (a2 == null) {
return -3;
}
n.a aVar = n.a.values()[b(cVar, 1)];
boolean z2 = aVar != n.a.Squash;
boolean z3 = aVar == n.a.Squash || aVar == n.a.RotateLeft || aVar == n.a.RotateRight || aVar == n.a.Reverse || aVar == n.a.RemoveDuplicates;
boolean z4 = aVar == n.a.Squash || aVar == n.a.RemoveDuplicates;
List<String> b2 = gx.b(this, a2, z2, bundle);
List<String> b3 = gx.b(this, a2, z3, z4, bundle);
bo.b("E", "names: " + gs.d(b2));
bo.b("E", "values: " + gs.d(b3));
switch (AnonymousClass10.f11028d[aVar.ordinal()]) {
case 2:
ArrayList arrayList = new ArrayList();
HashSet hashSet = new HashSet();
for (int i2 = 0; i2 < b3.size(); i2++) {
String str = b3.get(i2);
if (hashSet.contains(str)) {
arrayList.add(Integer.valueOf(i2));
} else {
hashSet.add(str);
}
}
Collections.sort(arrayList, new Comparator<Integer>() {
@Override
public int compare(Integer num, Integer num2) {
return num2.compareTo(num);
}
});
Iterator it = arrayList.iterator();
while (it.hasNext()) {
int intValue = ((Integer) it.next()).intValue();
b2.remove(intValue);
b3.remove(intValue);
}
bo.b("E", "new names: " + gs.d(b2));
bo.b("E", "new values: " + gs.d(b3));
break;
case 3:
Collections.reverse(b3);
break;
case 4:
Collections.rotate(b3, -1);
break;
case 5:
Collections.rotate(b3, 1);
break;
case 6:
Collections.shuffle(b2);
break;
case 7:
Collections.sort(b3);
break;
case 8:
Collections.sort(b3);
Collections.reverse(b3);
break;
case 9:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
return str2.compareToIgnoreCase(str3);
}
});
break;
case 10:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
Double g2 = gs.g(str2);
Double g3 = gs.g(str3);
if (g2 == null) {
g2 = gs.r(str2);
}
if (g3 == null) {
g3 = gs.r(str3);
}
if (g2 == null) {
if (g3 == null) {
return str2.compareToIgnoreCase(str3);
}
return 1;
}
if (g3 == null) {
return -1;
}
return g2.compareTo(g3);
}
});
break;
case 11:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
Long e2 = gs.e(str2);
Long e3 = gs.e(str3);
if (e2 == null) {
e2 = gs.s(str2);
}
if (e3 == null) {
e3 = gs.s(str3);
}
if (e2 == null) {
if (e3 == null) {
return str2.compareToIgnoreCase(str3);
}
return 1;
}
if (e3 == null) {
return -1;
}
return e2.compareTo(e3);
}
});
break;
case g.a.MapAttrs_uiZoomControls:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
return str3.compareToIgnoreCase(str2);
}
});
break;
case g.a.MapAttrs_uiZoomGestures:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
return new Integer(str2.length()).compareTo(new Integer(str3.length()));
}
});
break;
case g.a.MapAttrs_useViewLifecycle:
Collections.sort(b3, new Comparator<String>() {
@Override
public int compare(String str2, String str3) {
return new Integer(str3.length()).compareTo(new Integer(str2.length()));
}
});
break;
}
if (aVar == n.a.Squash) {
gx.a(this, a2, b3, bundle);
} else if (gx.o(a2)) {
gx.a(b2, b3, bundle);
} else {
gx.a(this, b2, b3);
}
gx.g(this, a2, bundle);
return -1;
}
private int i(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String a2 = a(cVar, 0, bundle);
if (a2 == null) {
return -3;
}
if (gx.k(this, a2, bundle) > 0) {
gx.h(this, a2, bundle);
}
return -1;
}
private boolean g(net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a(4, i2, 20, cVar, bundle);
}
private void b(net.dinglisch.android.taskerm.c cVar) {
a(Settings.a((Context) this, true, b(cVar, 0)), true);
}
private void c(net.dinglisch.android.taskerm.c cVar) {
a(RunLog.a(this), true);
}
private File g(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
return a(str, b(cVar, i2, bundle));
}
private int b(String str, int i2, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, false, true)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, false, true, false)) {
String b2 = b(cVar, 1, bundle);
if (a(cVar, 3)) {
b2 = b2 + "\n";
}
if (at.a((Context) this, b2, g2, a(cVar, 2), true)) {
return -5;
}
}
return -3;
}
private int c(String str, net.dinglisch.android.taskerm.c cVar) {
BluetoothAdapter aa = aa();
int i2 = -3;
if (aa == null) {
bo.d("E", str + ": no adapter");
return -3;
}
int state = aa.getState();
int i3 = (state == 12 || state == 11) ? 1 : 0;
int b2 = b(i3, cVar.h(0).h());
if (i3 != b2) {
if (b2 == 1) {
if (state == 13) {
a(aa, 10);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else if (state == 11) {
a(aa, 12);
} else if (aa.enable()) {
a(aa, 12);
} else {
b(R.string.fi_action_failed, str);
MonitorService.b();
return i2;
}
i2 = -1;
MonitorService.b();
return i2;
}
if (state == 11) {
a(aa, 12);
}
if (this.aa.booleanValue()) {
bo.b("E", str + ": skipping, time to leave");
} else if (state == 13) {
a(aa, 10);
} else if (aa.disable()) {
a(aa, 10);
} else {
b(R.string.fi_action_failed, str);
}
} else if (b2 == 1) {
MonitorService.b();
}
return -1;
}
private void e(ft ftVar) {
Integer[] numArr;
int i2;
char c2;
ArrayList<String> stringArrayList;
ArrayList<String> arrayList;
StringBuilder au;
Bundle b2 = fd.b(ftVar.an());
if (b2 == null) {
bo.d("E", "no result bundle for taskExeID " + ftVar.an());
return;
}
if (ftVar.W()) {
bo.b("E", "handleRunShell: task finished already (interrupted?), skip");
return;
}
net.dinglisch.android.taskerm.c L = ftVar.L();
Bundle r2 = ftVar.r();
String b3 = b(L, 0, r2);
String a2 = a(L, 3, r2);
String a3 = a(L, 4, r2);
String a4 = a(L, 5, r2);
int i3 = b2.getInt("res");
Integer[] numArr2 = {Integer.valueOf(ftVar.w())};
if (TextUtils.isEmpty(a4) || !b2.containsKey("res")) {
numArr = numArr2;
i2 = i3;
} else {
numArr = numArr2;
i2 = i3;
gx.a((Context) this, a4, String.valueOf(i3), true, r2, "rshellA", Integer.valueOf(ftVar.ay()), numArr, Integer.valueOf(ftVar.G()));
}
if (b2.containsKey("out")) {
ArrayList<String> stringArrayList2 = b2.getStringArrayList("out");
if (stringArrayList2.size() > 0) {
if (TextUtils.isEmpty(a2)) {
arrayList = stringArrayList2;
c2 = '\n';
} else {
arrayList = stringArrayList2;
c2 = '\n';
gx.a((Context) this, a2, com.joaomgcd.taskerm.b.o.a(b3, gs.a((List<?>) stringArrayList2, '\n')), true, r2, "rshellB", Integer.valueOf(ftVar.ay()), numArr, Integer.valueOf(ftVar.G()));
}
if (ftVar.U() && (au = ftVar.au()) != null) {
boolean z2 = true;
for (String str : arrayList) {
if (z2) {
z2 = false;
} else {
au.append(c2);
}
au.append(str);
}
}
if (!TextUtils.isEmpty(a3) && b2.containsKey(NotificationCompat.CATEGORY_ERROR)) {
stringArrayList = b2.getStringArrayList(NotificationCompat.CATEGORY_ERROR);
if (stringArrayList.size() > 0) {
gx.a((Context) this, a3, com.joaomgcd.taskerm.b.o.a(b3, gs.a(stringArrayList, c2)), true, r2, "rshellFin", Integer.valueOf(ftVar.ay()), numArr, Integer.valueOf(ftVar.G()));
}
}
int M = ftVar.M();
ftVar.r(i2);
if (i2 != 0 && L.t()) {
ftVar.e(true);
}
ftVar.a(M, i2 != 0 ? c.a.OK : c.a.Err);
}
}
c2 = '\n';
if (!TextUtils.isEmpty(a3)) {
stringArrayList = b2.getStringArrayList(NotificationCompat.CATEGORY_ERROR);
if (stringArrayList.size() > 0) {
}
}
int M2 = ftVar.M();
ftVar.r(i2);
if (i2 != 0) {
ftVar.e(true);
}
ftVar.a(M2, i2 != 0 ? c.a.OK : c.a.Err);
}
private BluetoothAdapter aa() {
if (t.a()) {
return t.c();
}
return t.b(this);
}
private void j(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
String c2;
Intent a2 = cr.a();
net.dinglisch.android.taskerm.h g2 = cVar.g(0);
if (g2 == null) {
i2 = 0;
} else if (g2.e()) {
i2 = g2.b(this, bundle);
} else {
i2 = g2.h();
}
if (i2 > 0) {
a2.putExtra("net.dinglisch.android.tasker.extras.HOME_PAGE", i2);
a2.putExtra("com.fede.launcher.extra.SCREEN", i2);
}
j j2 = cVar.j(1);
if (j2 != null && (c2 = j2.c()) != null) {
a2.setComponent(com.joaomgcd.taskerm.util.al.w(this, c2));
}
if (a(a2)) {
return;
}
b(R.string.fi_no_home, new Object[0]);
}
private void ab() {
if ((this.ag == 48 || this.ag == 550 || this.ag == 49) && System.currentTimeMillis() - this.ah < 3000) {
bo.b("E", "pre-show-scene wait for cleanup of old");
a(200L);
}
}
private int k(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return ew.a(this, b(cVar, 0, bundle), b(cVar, 3, bundle), a(cVar, 2)) ? -1 : -3;
}
private int h(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
String a2 = a(this, cVar, 1, bundle);
if (a2 == null) {
return -3;
}
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, false)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (!a(g2, str, false, true, true, false)) {
return -3;
}
byte[] k2 = at.k(this, g2);
if (k2 != null) {
String encodeToString = Base64.encodeToString(k2, 0);
if (TextUtils.isEmpty(encodeToString)) {
bo.d("E", str + ": base 64 encoding failed");
return -3;
}
gx.a((Context) this, a2, encodeToString, true, bundle, str);
return -5;
}
bo.d("E", str + ": " + a2 + ": no value");
return -3;
}
private int i(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
String a2 = a(this, cVar, 0, bundle);
if (a2 != null) {
File g2 = g(str, cVar, 1, bundle);
if (at.a((Context) this, g2, false, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, false, true, false)) {
String d2 = gx.d(this, a2, bundle);
if (TextUtils.isEmpty(d2)) {
bo.d("E", str + ": " + a2 + ": no value");
} else {
byte[] decode = Base64.decode(d2.getBytes(), 0);
if (decode == null || decode.length == 0) {
bo.d("E", str + ": decoding failed, is the data base 64 ?");
} else if (at.a(this, decode, g2)) {
return -5;
}
}
}
}
return -3;
}
private int l(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return ew.a(this, b(cVar, 0, bundle), b(cVar, 1, bundle)) ? -1 : -3;
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, String str2) {
if (str2.length() > 0) {
File a2 = a(str2, str, true, false, false, true, true);
bo.b("E", str + ": scan " + a2);
if (a2.exists() && a2.isDirectory()) {
if (a(a2, 12500L)) {
return -1;
}
} else {
cm.a(this, a2);
a(1000L);
return -1;
}
} else {
File h2 = gs.h();
bo.b("E", str + ": no file spec, scan root " + h2);
if (h2 == null) {
b(R.string.fi_no_card, new Object[0]);
} else if (gs.l() >= 19) {
if (a(h2, 12500L)) {
return -1;
}
} else {
sendBroadcast(gs.o());
return -1;
}
}
return -3;
}
private boolean a(File file, long j2) {
if (file != null) {
MediaScannerConnection mediaScannerConnection = new MediaScannerConnection(this, null);
mediaScannerConnection.connect();
bo.b("E", "wait for media scanner connection...");
long currentTimeMillis = System.currentTimeMillis();
while (!mediaScannerConnection.isConnected() && System.currentTimeMillis() - currentTimeMillis < j2 && !this.aa.booleanValue()) {
a(300L);
}
if (mediaScannerConnection.isConnected()) {
bo.b("E", "connected, starting scan");
if (!this.aa.booleanValue()) {
a(file, mediaScannerConnection, currentTimeMillis, j2);
}
bo.b("E", "scan finished, disconnect");
mediaScannerConnection.disconnect();
return true;
}
bo.d("E", "failed to connect to media scanner service");
}
return false;
}
private boolean a(File file, MediaScannerConnection mediaScannerConnection, long j2, long j3) {
if (this.aa.booleanValue()) {
bo.b("E", "scanFileAux: interrupted");
return false;
}
if (System.currentTimeMillis() - j3 < j2) {
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (gs.a((Object[]) listFiles)) {
return true;
}
for (File file2 : listFiles) {
if (!a(file2, mediaScannerConnection, j2, j3)) {
return false;
}
}
return true;
}
mediaScannerConnection.scanFile(file.toString(), null);
return true;
}
bo.d("E", "scanFile: timeout scanning " + file);
return false;
}
private int o(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int a2 = a(cVar, 0, true, false, bundle);
int a3 = a(cVar, 1, true, true, bundle);
int a4 = a(cVar, 2, true, true, bundle);
String b2 = b(cVar, 4, bundle);
int i2 = -3;
if (a2 != Integer.MAX_VALUE && a3 != Integer.MAX_VALUE && a4 != Integer.MAX_VALUE) {
int b3 = b(cVar, 3);
bo.b("E", str + ": freq " + a2 + " dur: " + a3 + " stream: " + b3);
gj gjVar = new gj((double) a2, a3, (short) a4);
if (!TextUtils.isEmpty(b2)) {
Long e2 = gs.e(b2);
if (e2 == null) {
bo.c("E", "Do At Time must be a valid integer number, was " + b2);
return -3;
}
long longValue = e2.longValue() - SystemClock.currentGnssTimeClock().millis();
if (longValue < 0) {
bo.c("E", "Do At Time must be in the future, was " + (-longValue) + " ms in the past");
return -3;
}
if (longValue > 60000) {
bo.c("E", "Do At Time must at most 1 minute in the future, was " + longValue + "ms in the future");
return -3;
}
try {
Thread.sleep(longValue);
bo.b("E", "Waiting " + longValue + "ms to do beep");
} catch (InterruptedException e3) {
e3.printStackTrace();
}
}
if (gjVar.a(b3)) {
bo.b("E", str + ": wait for track to finish");
a(gjVar, 100L);
bo.b("E", str + ": done");
i2 = -1;
}
gjVar.b();
}
return i2;
}
private int p(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
long a2;
int a3 = a(cVar, 1, true, false, bundle);
int a4 = a(cVar, 2, true, true, bundle);
int a5 = a(cVar, 3, true, true, bundle);
if (a3 != Integer.MAX_VALUE && a4 != Integer.MAX_VALUE && a5 != Integer.MAX_VALUE) {
int b2 = b(cVar, 4);
boolean z2 = false;
String b3 = b(cVar, 0, bundle);
if (!TextUtils.isEmpty(b3)) {
double d2 = a3;
short s2 = (short) a5;
gj gjVar = new gj(d2, bx.a(0, a4), s2);
gj gjVar2 = new gj(d2, bx.a(1, a4), s2);
for (Integer num : bx.a(b3)) {
gj gjVar3 = null;
switch (num.intValue()) {
case 0:
gjVar3 = gjVar;
break;
case 1:
gjVar3 = gjVar2;
break;
case 2:
case 3:
case 4:
a2 = bx.a(num.intValue(), a4);
break;
default:
bo.c("E", str + ": unknown morse sign: " + num);
break;
}
a2 = 0;
if (gjVar3 != null) {
if (gjVar3.a(b2)) {
a(gjVar3, 7L);
} else {
gjVar.b();
gjVar2.b();
if (z2) {
return -1;
}
}
} else if (a2 != 0) {
a(a2);
}
if (this.aa.booleanValue()) {
z2 = true;
gjVar.b();
gjVar2.b();
if (z2) {
}
}
}
z2 = true;
gjVar.b();
gjVar2.b();
if (z2) {
}
}
}
return -3;
}
private void a(gj gjVar, long j2) {
long a2 = gjVar.a();
long currentTimeMillis = System.currentTimeMillis();
while (!this.aa.booleanValue() && !gjVar.c() && System.currentTimeMillis() < currentTimeMillis + a2) {
a(j2);
}
}
private void m(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean a2 = a(cVar, 1);
String b2 = b(cVar, 0, bundle);
Intent intent = new Intent(a2 ? "android.intent.action.WEB_SEARCH" : "android.intent.action.SEARCH");
intent.putExtra("query", b2);
a(intent);
}
private int a(net.dinglisch.android.taskerm.c cVar, String str, String str2) {
int i2;
Intent intent = new Intent("android.intent.action.MAIN");
intent.setClassName("net.dinglisch.android.filer", "net.dinglisch.android.filer.Filer");
if (str.length() > 0) {
File h2 = gs.h();
if (h2 == null) {
i2 = -3;
if (i2 != -3) {
if (str2.length() > 0) {
intent.putExtra("file_match", str2);
}
intent.putExtra("show_hidden", cVar.h(2).b());
i2 = -4;
if (!a(intent, false)) {
a(R.string.err_need_filemagic, new Object[0]);
}
}
return i2;
}
intent.putExtra("start_dir", new File(h2, str).toString());
}
i2 = -1;
if (i2 != -3) {
}
return i2;
}
private int q(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
ComponentName componentName;
ActivityInfo a2;
boolean a3 = a(cVar, 3);
Intent intent = new Intent("android.intent.action.MAIN");
String b2 = b(cVar, 1, bundle);
if (cVar.i() == 20) {
net.dinglisch.android.taskerm.d a4 = cVar.a(this, 0, bundle);
if (a4.g()) {
componentName = new ComponentName(a4.i(), a4.f());
if (!TextUtils.isEmpty(b2)) {
intent.setData(Uri.parse(b2));
}
if (componentName != null) {
return -3;
}
intent.setComponent(componentName);
if (a3) {
intent.addFlags(67108864);
intent.addFlags(536870912);
intent.addFlags(32768);
intent.addFlags(268435456);
} else {
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
}
boolean b3 = cVar.h(2).b();
boolean a5 = a(intent, b3, true);
String packageName = componentName.getPackageName();
if (!a5) {
intent.removeCategory("android.intent.category.LAUNCHER");
intent.setAction(null);
a5 = a(intent, b3, true);
}
if (!a5 && !TextUtils.isEmpty(b2) && !TextUtils.isEmpty(packageName) && (a2 = com.joaomgcd.taskerm.util.al.a(this, packageName, Uri.parse(b2))) != null) {
intent.setClassName(a2.packageName, a2.name);
intent.removeCategory("android.intent.category.LAUNCHER");
intent.setAction(null);
a5 = a(intent, b3, true);
}
if (a5) {
return -1;
}
a(R.string.fi_launch_fail, str, componentName.getClassName());
return -3;
}
}
componentName = null;
if (componentName != null) {
}
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, Bundle bundle, ap apVar) {
String b2 = b(cVar, 0, bundle);
ft b3 = b(str, b2);
apVar.f12023b = b2;
int i2 = -3;
if (b3 == null) {
a(R.string.fi_no_task, b2);
} else {
ft af = b3.af();
if (cVar.h(9).b()) {
af.a("allow_child_ovvvreeeww", (Boolean) true);
}
if (cVar.h(10).b()) {
af.a("structure_return_var", (Boolean) true);
}
com.joaomgcd.taskerm.profile.k.a(bundle);
if (cVar.h(6).b()) {
com.joaomgcd.taskerm.util.an.a(bundle, this, af, cVar.j(7).c());
}
int a2 = a(cVar, 1, true, false, ftVar.r());
boolean z2 = cVar.j(4).c().length() > 0;
String a3 = z2 ? a(cVar, 4, bundle) : null;
if ((!z2 || a3 != null) && a2 != Integer.MAX_VALUE) {
i2 = cVar.h(5).b() ? -4 : -1;
af.g(MonitorService.a(ftVar.H()) + a2);
for (int i3 = 2; i3 <= 3; i3++) {
if (cVar.j(i3).c().length() > 0) {
af.a(ft.b((i3 - 2) + 1), a(cVar, i3, ftVar));
}
}
if (z2) {
af.a("return", a3);
if (a(cVar, 8)) {
bundle.remove(a3);
}
}
apVar.f12025d = af;
}
}
return i2;
}
private int r(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
UsbManager a2 = USBHandler.a(this);
int a3 = a(cVar, 2, true, false, bundle);
if (a3 != Integer.MAX_VALUE) {
if (a2 == null) {
bo.d("E", "no USB manager");
} else {
UsbDevice a4 = USBHandler.a(a2, 1, 3);
if (a4 == null) {
bo.d("E", str + ": no midi device");
} else {
bv a5 = MIDIHandler.a(a2, a4);
if (a5 == null) {
bo.d("E", str + ": no midi output device");
} else {
r2 = a(a5, 0, bu.a.values()[b(cVar, 1)], b(cVar, 3, bundle), a3) ? -1 : -3;
a(a3);
a5.a();
}
}
}
}
return r2;
}
public boolean a(bv bvVar, int i2, bu.a aVar, String str, int i3) {
ArrayList arrayList;
int i4;
String[] strArr;
int i5;
int i6;
String str2;
float f2;
String str3;
ArrayList arrayList2;
float f3;
String str4;
int i7;
String[] strArr2;
ArrayList arrayList3;
String[] strArr3;
int i8;
ArrayList arrayList4;
int i9;
String[] strArr4;
String[] strArr5;
bv bvVar2 = bvVar;
int i10 = i2;
int i11 = i3;
bo.b("E", "got score\n" + str);
ArrayList arrayList5 = new ArrayList();
ArrayList<HashMap<Integer, Long>> arrayList6 = new ArrayList<>();
ArrayList arrayList7 = new ArrayList();
ArrayList arrayList8 = new ArrayList();
String[] split = str.split("\n+\\s*\n+");
ArrayList arrayList9 = new ArrayList();
int length = split.length;
int i12 = 0;
while (i12 < length) {
String trim = split[i12].trim();
bo.b("E", "process paragraph: " + trim);
int i13 = 0;
for (int i14 = 0; i14 < arrayList5.size(); i14++) {
int size = ((ArrayList) arrayList5.get(i14)).size();
if (size > i13) {
i13 = size;
}
}
String[] split2 = trim.indexOf(10) == -1 ? new String[]{trim} : trim.split("\n");
int i15 = 0;
while (i15 < split2.length) {
if (i15 >= arrayList9.size() || !((Boolean) arrayList9.get(i15)).booleanValue()) {
String trim2 = split2[i15].trim();
if (trim2.length() > 0) {
strArr3 = split;
if (i15 < arrayList5.size()) {
arrayList4 = (ArrayList) arrayList5.get(i15);
i8 = length;
while (arrayList4.size() < i13) {
arrayList4.add(bu.f12319b);
}
i9 = i13;
} else {
i8 = length;
arrayList4 = new ArrayList();
while (arrayList4.size() < i13) {
arrayList4.add(bu.f12319b);
}
i9 = i13;
arrayList9.add(false);
arrayList5.add(arrayList4);
arrayList6.add(new HashMap<>());
arrayList7.add(100);
arrayList8.add("0.0.0");
a(bvVar2, i10, i15, "0.0.0");
}
String[] split3 = trim2.split("\\s+");
int length2 = split3.length;
int i16 = 0;
while (i16 < length2) {
int i17 = length2;
String str5 = split3[i16];
if (str5.length() > 0) {
strArr4 = split3;
strArr5 = split2;
char charAt = str5.charAt(0);
int indexOf = str5.indexOf(39);
int indexOf2 = str5.indexOf(34);
if (indexOf2 != -1) {
arrayList9.set(i15, true);
String substring = str5.substring(0, indexOf2);
if (substring.length() > 0) {
arrayList4.add(substring);
}
} else {
boolean z2 = false;
if (indexOf != -1) {
String substring2 = str5.substring(0, indexOf);
if (substring2.length() > 0) {
arrayList4.add(substring2);
}
} else {
if (charAt != '|') {
if (str5.length() <= 1 || charAt != '-') {
z2 = true;
} else {
Integer c2 = gs.c(str5.substring(1));
if (c2 == null || c2.intValue() < 0 || c2.intValue() > 256) {
bo.d("E", "bad rest format: " + str5);
} else {
for (int i18 = 0; i18 < c2.intValue(); i18++) {
arrayList4.add(bu.f12319b);
}
}
z2 = false;
}
}
if (z2 && str5.length() > 0) {
arrayList4.add(str5);
}
}
}
i15++;
split = strArr3;
length = i8;
i13 = i9;
split2 = strArr5;
bvVar2 = bvVar;
i10 = i2;
} else {
strArr4 = split3;
strArr5 = split2;
}
i16++;
length2 = i17;
split2 = strArr5;
split3 = strArr4;
}
strArr5 = split2;
i15++;
split = strArr3;
length = i8;
i13 = i9;
split2 = strArr5;
bvVar2 = bvVar;
i10 = i2;
}
}
strArr3 = split;
i8 = length;
i9 = i13;
strArr5 = split2;
i15++;
split = strArr3;
length = i8;
i13 = i9;
split2 = strArr5;
bvVar2 = bvVar;
i10 = i2;
}
i12++;
bvVar2 = bvVar;
i10 = i2;
}
for (int i19 = 0; i19 < arrayList5.size(); i19++) {
bo.b("E", "channel " + i19 + " beats: " + gs.d((List<String>) arrayList5.get(i19)));
}
long j2 = 0;
boolean z3 = false;
while (!z3 && !this.aa.booleanValue()) {
long currentTimeMillis = System.currentTimeMillis();
long j3 = i11;
boolean z4 = currentTimeMillis - j2 >= j3;
long j4 = j2;
int i20 = 0;
int i21 = 0;
while (i21 < arrayList5.size()) {
boolean z5 = z3;
int i22 = i20;
int i23 = i21;
long j5 = j3;
boolean z6 = z4;
int i24 = 0;
a(bvVar, i2, i21, ((Integer) arrayList7.get(i21)).intValue(), currentTimeMillis, arrayList6.get(i21));
if (z6) {
ArrayList arrayList10 = (ArrayList) arrayList5.get(i23);
if (arrayList10.size() > 0) {
String str6 = (String) arrayList10.remove(0);
bo.b("E", "channel " + i23 + " beat " + str6);
if (str6.length() == 0) {
bo.d("E", "ignoring empty beat spec");
} else if (str6.charAt(0) == '-') {
bo.b("E", "rest");
} else {
String[] split4 = str6.indexOf(44) == -1 ? new String[]{str6} : str6.split(Pattern.quote(","));
int length3 = split4.length;
int i25 = 0;
while (i25 < length3) {
String str7 = split4[i25];
if (TextUtils.isEmpty(str7)) {
bo.d("E", "ignoring empty note spec in " + str6);
} else {
if (str7.charAt(i24) == '@') {
if (str7.length() == 1) {
bo.d("E", "ignoring empty voice in " + str6);
} else {
arrayList8.set(i23, str7.substring(1));
a(bvVar, i2, i23, str7.substring(1));
}
} else if (str7.charAt(i24) == '!') {
int f4 = f(i23, str7);
if (f4 != -1) {
arrayList7.set(i23, Integer.valueOf(f4));
}
} else {
while (str7.length() > 0) {
if (str7.length() > 1) {
char charAt2 = str7.charAt(1);
i4 = (charAt2 == '#' || charAt2 == '_') ? 2 : 1;
while (i4 < str7.length() && Character.isDigit(str7.charAt(i4))) {
i4++;
}
} else {
i4 = 1;
}
String str8 = str6;
StringBuilder sb = new StringBuilder();
int i26 = length3;
sb.append("note length: ");
sb.append(i4);
sb.append(" rem: ");
sb.append(str7);
bo.b("E", sb.toString());
int a2 = bu.a(str7.substring(0, i4), aVar);
String substring3 = str7.substring(i4);
if (a2 == -1 || substring3.length() <= 0) {
strArr = split4;
} else {
char charAt3 = substring3.charAt(0);
strArr = split4;
if (charAt3 == '*' || charAt3 == '/') {
int i27 = 1;
while (i27 < substring3.length() && Character.isDigit(substring3.charAt(i27))) {
i27++;
}
Integer c3 = gs.c(substring3.substring(1, i27));
if (c3 == null) {
f3 = 1.0f;
} else if (charAt3 == '/') {
f3 = 1.0f / c3.intValue();
} else {
f3 = c3.intValue();
}
substring3 = substring3.substring(i27);
f2 = f3;
i5 = -1;
i6 = -1;
str2 = null;
if (a2 != i6) {
bo.d("E", "bad note spec: " + substring3);
str3 = substring3;
arrayList2 = arrayList5;
} else {
if (str2 != null && bvVar != null) {
a(bvVar, i2, i23, str2);
}
if (i5 == -1) {
i5 = ((Integer) arrayList7.get(i23)).intValue();
}
StringBuilder sb2 = new StringBuilder();
str3 = substring3;
sb2.append("midi play channel ");
sb2.append(i23);
sb2.append(" note ");
sb2.append(a2);
sb2.append(" vel ");
sb2.append(i5);
bo.b("E", sb2.toString());
if (bvVar != null) {
bvVar.b(i2, i23, a2, i5);
}
arrayList2 = arrayList5;
arrayList6.get(i23).put(Integer.valueOf(a2), Long.valueOf(currentTimeMillis + (i3 * f2)));
if (str2 != null && bvVar != null) {
a(bvVar, i2, i23, (String) arrayList8.get(i23));
}
}
str6 = str8;
length3 = i26;
split4 = strArr;
str7 = str3;
arrayList5 = arrayList2;
} else if (charAt3 == '@') {
int i28 = 1;
while (i28 < substring3.length() && (Character.isDigit(substring3.charAt(i28)) || substring3.charAt(i28) == '.')) {
i28++;
}
str2 = substring3.substring(1, i28);
substring3 = substring3.substring(i28);
i5 = -1;
i6 = -1;
f2 = 1.0f;
if (a2 != i6) {
}
str6 = str8;
length3 = i26;
split4 = strArr;
str7 = str3;
arrayList5 = arrayList2;
} else if (charAt3 == '!') {
int i29 = 1;
while (i29 < substring3.length() && Character.isDigit(substring3.charAt(i29))) {
i29++;
}
Integer valueOf = Integer.valueOf(f(i23, substring3.substring(0, i29)));
i5 = valueOf != null ? valueOf.intValue() : -1;
substring3 = substring3.substring(i29);
i6 = -1;
str2 = null;
f2 = 1.0f;
if (a2 != i6) {
}
str6 = str8;
length3 = i26;
split4 = strArr;
str7 = str3;
arrayList5 = arrayList2;
}
}
i5 = -1;
i6 = -1;
str2 = null;
f2 = 1.0f;
if (a2 != i6) {
}
str6 = str8;
length3 = i26;
split4 = strArr;
str7 = str3;
arrayList5 = arrayList2;
}
}
str4 = str6;
i7 = length3;
strArr2 = split4;
arrayList3 = arrayList5;
i25++;
str6 = str4;
length3 = i7;
split4 = strArr2;
arrayList5 = arrayList3;
i24 = 0;
}
str4 = str6;
i7 = length3;
strArr2 = split4;
arrayList3 = arrayList5;
i25++;
str6 = str4;
length3 = i7;
split4 = strArr2;
arrayList5 = arrayList3;
i24 = 0;
}
}
arrayList = arrayList5;
i22++;
} else {
arrayList = arrayList5;
}
j4 = currentTimeMillis;
} else {
arrayList = arrayList5;
}
i20 = i22;
i21 = i23 + 1;
z4 = z6;
j3 = j5;
z3 = z5;
arrayList5 = arrayList;
}
long j6 = j3;
boolean z7 = z4;
boolean z8 = z3;
ArrayList arrayList11 = arrayList5;
bo.b("E", "roundEnd: processBeats: " + z7 + " activeChannels: " + i20 + " notes#: " + a(arrayList6));
if (z7 && i20 == 0 && a(arrayList6) == 0) {
z8 = true;
} else {
long a3 = a(arrayList6, j4, j6, currentTimeMillis);
if (a3 <= 0) {
a3 = 20;
}
bo.b("E", "--- wait " + a3);
a(a3);
}
j2 = j4;
z3 = z8;
arrayList5 = arrayList11;
i11 = i3;
}
ArrayList arrayList12 = arrayList5;
if (!this.aa.booleanValue()) {
return true;
}
for (int i30 = 0; i30 < arrayList12.size(); i30++) {
a(bvVar, i2, i30, 127, Long.MAX_VALUE, arrayList6.get(i30));
}
return true;
}
private void a(bv bvVar, int i2, int i3, String str) {
Integer[] a2 = bu.a(str);
if (a2 != null) {
for (int i4 = 0; i4 < a2.length; i4++) {
int intValue = a2[i4].intValue();
if (intValue != -1) {
if (i4 == 0) {
bo.b("E", "midi set channel " + i3 + " msb to " + intValue);
if (bvVar != null) {
bvVar.c(i2, i3, 0, intValue);
}
} else if (i4 == 1) {
bo.b("E", "midi set channel " + i3 + " lsb to " + intValue);
if (bvVar != null) {
bvVar.c(i2, i3, 32, intValue);
}
} else {
bo.b("E", "midi set channel " + i3 + " program to " + intValue);
if (bvVar != null) {
bvVar.a(i2, i3, intValue);
}
}
}
}
}
}
private long a(ArrayList<HashMap<Integer, Long>> arrayList) {
Iterator<HashMap<Integer, Long>> it = arrayList.iterator();
int i2 = 0;
while (it.hasNext()) {
i2 += it.next().size();
}
return i2;
}
private long a(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;
}
private int f(int i2, String str) {
if (str.length() == 1) {
bo.d("E", "ignoring empty velocity in " + str);
} else {
String substring = str.substring(1);
Integer c2 = gs.c(substring);
if (c2 == null) {
bo.d("E", "bad o spec: " + substring);
} else if (c2.intValue() < 0 || c2.intValue() > 127) {
bo.d("E", "bad velocity index: " + c2);
} else {
return c2.intValue();
}
}
return -1;
}
private void a(bv bvVar, int i2, int i3, int i4, long j2, HashMap<Integer, Long> hashMap) {
for (Object obj : hashMap.keySet().toArray()) {
int intValue = ((Integer) obj).intValue();
if (hashMap.get(Integer.valueOf(intValue)).longValue() <= j2) {
hashMap.remove(Integer.valueOf(intValue));
bo.b("E", "midi channel " + i3 + " stop note " + intValue);
if (bvVar != null) {
bvVar.a(i2, i3, intValue, i4);
}
}
}
}
private int s(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int d2 = d(cVar, 0, bundle);
if (d2 != Integer.MAX_VALUE) {
String b2 = b(cVar, 1, bundle);
boolean a2 = a(cVar, 2);
Intent intent = new Intent("android.intent.action.SET_TIMER");
if (d2 > 0) {
intent.putExtra("android.intent.extra.alarm.LENGTH", d2);
}
intent.putExtra("android.intent.extra.alarm.SKIP_UI", !a2);
if (b2.length() > 0) {
intent.putExtra("android.intent.extra.alarm.MESSAGE", b2);
}
if (a(intent, true)) {
return -1;
}
}
return -3;
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, Bundle bundle) {
String a2 = a(cVar, 0, bundle);
if (a2 == null) {
return -3;
}
boolean b2 = cVar.h(2).b();
String a3 = a(cVar, 1, ftVar);
StringBuilder sb = new StringBuilder(1024);
List<String> b3 = gx.b((Context) this, a2, true, bundle);
Iterator<String> it = b3.iterator();
while (it.hasNext()) {
String d2 = gx.d(this, it.next(), bundle);
if (sb.length() > 0) {
sb.append(a3);
}
sb.append(d2);
}
if (b2) {
Iterator<String> it2 = b3.iterator();
while (it2.hasNext()) {
gx.a((Context) this, it2.next(), true, true, bundle);
}
}
a(a2, sb.toString(), ftVar, str);
return -1;
}
private int c(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar, Bundle bundle) {
Random random = new Random();
String a2 = a(cVar, 0, bundle);
int a3 = a(cVar, 1, false, false, bundle);
int a4 = a(cVar, 2, false, false, bundle);
if (a2 == null || a3 == Integer.MAX_VALUE || a4 == Integer.MAX_VALUE) {
return -3;
}
if (a4 < a3) {
bo.d("E", str + ": odd range: " + a3 + " - " + a4);
return -3;
}
a(a2, Integer.toString(a3 + random.nextInt((a4 - a3) + 1)), ftVar, str);
return -1;
}
private int b(net.dinglisch.android.taskerm.c cVar, String str, String str2) {
int i2 = cVar.i();
SharedPreferences sharedPreferences = getSharedPreferences(bh.p, 0);
SharedPreferences.Editor edit = sharedPreferences.edit();
boolean contains = sharedPreferences.contains(str);
if (i2 == 99) {
if (str.length() == 0) {
edit.clear();
} else if (contains) {
edit.remove(str);
}
} else if (!contains) {
if (str.length() == 0) {
str = "*";
}
if (i2 == 95) {
edit.putString(str, "block");
} else {
edit.putString(str, str2);
}
}
edit.commit();
gs.a((Context) this, false, "exe");
if (!cVar.h(i2 == 97 ? 2 : 1).b()) {
return -1;
}
a(sharedPreferences);
return -1;
}
private void d(net.dinglisch.android.taskerm.c cVar) {
String str;
int h2 = cVar.g(0).h();
switch (h2) {
case 0:
str = "com.android.contacts.action.LIST_STARRED";
break;
case 1:
str = "com.android.contacts.action.LIST_FREQUENT";
break;
case 2:
str = "com.android.contacts.action.LIST_STREQUENT";
break;
default:
bo.c("E", "contacts: bad type " + h2);
str = null;
break;
}
if (str != null) {
a(new Intent(str));
}
}
private int a(net.dinglisch.android.taskerm.c cVar, String str) {
NotificationManager notificationManager = (NotificationManager) df.a(this, "notification", "E", "execn");
if (notificationManager == null) {
a(R.string.err_no_notification_manager, new Object[0]);
return -3;
}
if (str.length() == 0) {
a(notificationManager);
return -1;
}
int g2 = g(str);
if (g2 != -1) {
f(str);
a(notificationManager, g2);
return -1;
}
if (!cVar.h(1).b()) {
return -1;
}
b(R.string.fi_unknown_notification, str);
return -1;
}
private int j(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, true)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, false, true, false)) {
if (!g2.toString().endsWith(".zip")) {
g2 = gs.c(g2, ".zip");
}
if (!at.f(this, g2)) {
a(R.string.fi_file_not_found, str, g2.toString());
} else {
if (at.l(this, g2)) {
if (cVar.h(1).b() && !at.g(this, g2)) {
b(R.string.fi_failed_delete_zip, g2.toString());
}
return -5;
}
a(R.string.fi_unzip_failed, g2.getName());
}
}
return -3;
}
private int k(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
int i3;
File file;
boolean z2 = false;
String b2 = b(cVar, 0, bundle);
ArrayList arrayList = new ArrayList();
String[] split = b2.split("\n");
File file2 = null;
boolean z3 = true;
if (split != null) {
int length = split.length;
int i4 = 0;
while (i4 < length) {
File a2 = a(str, split[i4]);
if (at.a(this, a2, z2, z3, z2)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
int i5 = i4;
int i6 = length;
i3 = 1;
if (!a(a2, str, false, true, true, true)) {
arrayList = null;
break;
}
arrayList.add(a2);
i4 = i5 + 1;
length = i6;
z3 = true;
z2 = false;
}
}
i3 = 1;
if (b(cVar, 3, bundle).length() > 0) {
file = g(str, cVar, 3, bundle);
if (at.a((Context) this, file, false, (boolean) i3, (boolean) i3)) {
return g(cVar, i2, bundle) ? -1 : -3;
}
if (a(file, str, false, false, true, false)) {
file2 = gs.b(file, ".zip");
}
int a3 = a(cVar, 2, true, true, bundle);
if (arrayList != null || file == null || a3 == Integer.MAX_VALUE) {
return -3;
}
File[] fileArr = new File[arrayList.size()];
for (int i7 = 0; i7 < fileArr.length; i7++) {
fileArr[i7] = (File) arrayList.get(i7);
}
if (at.a(this, fileArr, file, a3)) {
if (cVar.h(i3).b()) {
for (File file3 : fileArr) {
if (at.e(this, file3)) {
if (!at.h(this, file3)) {
Object[] objArr = new Object[i3];
objArr[0] = file3.toString();
b(R.string.fi_failed_delete_orig_file, objArr);
}
} else if (!at.g(this, file3)) {
Object[] objArr2 = new Object[i3];
objArr2[0] = file3.toString();
b(R.string.fi_failed_delete_orig_file, objArr2);
}
}
}
return -5;
}
a(R.string.fi_zip_failed, gs.b(arrayList));
return -3;
}
if (arrayList.size() == i3) {
file2 = gs.c((File) arrayList.get(0), ".zip");
} else {
bo.d("E", str + ": multiple files specified but no archive name give");
}
file = file2;
int a32 = a(cVar, 2, true, true, bundle);
return arrayList != null ? -3 : -3;
}
private int l(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, true, true, false)) {
if (at.c(this, g2, gs.c(g2, ".gz"))) {
if (!cVar.h(1).b() || at.g(this, g2)) {
return -1;
}
b(R.string.fi_failed_delete_orig_file, g2.toString());
return -1;
}
a(R.string.fi_zip_failed, g2.toString());
}
return -3;
}
private int m(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (g2 != null && !g2.toString().endsWith(".gz")) {
g2 = gs.c(g2, ".gz");
}
if (at.a((Context) this, g2, false, true, true)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, true, true, false)) {
if (at.b(this, g2, gs.a(g2, ".gz"))) {
if (!cVar.h(1).b() || at.g(this, g2)) {
return -1;
}
b(R.string.fi_failed_delete_zip, g2.toString());
return -1;
}
a(R.string.fi_unzip_failed, g2.getName());
}
return -3;
}
private int n(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return ew.d(this, b(cVar, 0, bundle), b(cVar, 1, bundle), a(cVar, 2)) ? -1 : -3;
}
private void e(net.dinglisch.android.taskerm.c cVar) {
boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
int b2 = b(masterSyncAutomatically ? 1 : 0, cVar.h(0).h());
if (masterSyncAutomatically != b2) {
ContentResolver.setMasterSyncAutomatically(b2 == 1);
a(300L);
j("99");
}
}
private int t(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return !TaskerAppWidgetConfigure.a(this, fw.b(b(cVar, 1)), b(cVar, 0, bundle), (int[]) null) ? -3 : -1;
}
private int u(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2 = b(cVar, 0, bundle);
int a2 = a(cVar, 1, true, false, bundle);
int a3 = a(cVar, 2, true, false, bundle);
int a4 = a(cVar, 3, true, false, bundle);
int a5 = a(cVar, 4, true, false, bundle);
return (a2 == Integer.MAX_VALUE || a3 == Integer.MAX_VALUE || a4 == Integer.MAX_VALUE || a5 == Integer.MAX_VALUE || !TaskerAppWidgetConfigure.a(this, fw.b.SetTime, b2, new int[]{a5, a4, a3, a2})) ? -3 : -1;
}
private int d(String str, net.dinglisch.android.taskerm.c cVar) {
WifiManager wifiManager = (WifiManager) df.a(this, "wifi", "E", "exewnc");
if (wifiManager == null) {
bo.c("E", ct.a(this, R.string.err_no_wifi_manager, new Object[0]));
return -3;
}
int h2 = cVar.g(0).h();
boolean b2 = cVar.h(2).b();
if (wifiManager.getWifiState() == 3) {
boolean a2 = gs.a((Context) this, 1);
boolean b3 = cVar.h(1).b();
bo.b("E", "wifi ctrl: code" + h2 + " have wifi net: " + a2 + " force: " + b3 + " flash " + b2);
switch (h2) {
case 0:
if (b3 || a2) {
bo.b("E", "wifi net: disconnect");
if (!wifiManager.disconnect()) {
if (!b2) {
return -3;
}
b(R.string.fi_action_failed, str);
return -3;
}
}
break;
case 1:
if (b3 || !a2) {
bo.b("E", "wifi net: reassociate");
if (!wifiManager.reassociate()) {
if (!b2) {
return -3;
}
b(R.string.fi_action_failed, str);
return -3;
}
}
break;
case 2:
if (b3 || a2) {
bo.b("E", "wifi net: reconnect");
if (!wifiManager.reconnect()) {
if (!b2) {
return -3;
}
b(R.string.fi_action_failed, str);
return -3;
}
}
break;
default:
bo.c("E", "bad control code " + h2);
break;
}
} else {
bo.b("E", "wifi net: wifi disabled");
}
return -1;
}
private int a(ft ftVar, String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
ComponentInfo[] componentInfoArr;
int i3 = 2;
String a2 = a(cVar, 2, bundle);
int b2 = b(cVar, 0);
cr.b a3 = cr.a(b2);
int i4 = 1;
String b3 = b(cVar, 1, bundle);
gx.k(this, a2, bundle);
if (a3 == null) {
bo.d("E", str + ": bad list type " + b2);
return -3;
}
if (a2 == null) {
return -3;
}
PackageManager packageManager = getPackageManager();
switch (a3) {
case Packages:
case Applications:
default:
i3 = 0;
break;
case Activities:
i3 = 1;
break;
case Services:
i3 = 4;
break;
case Receivers:
break;
case Providers:
i3 = 8;
break;
}
for (PackageInfo packageInfo : packageManager.getInstalledPackages(i3)) {
String str2 = packageInfo.packageName;
if (!TextUtils.isEmpty(str2)) {
bo.b("E", "test: " + str2);
if (a3 == cr.b.Packages) {
if (b3.length() == 0 || as.d(b3, str2)) {
StringBuilder sb = new StringBuilder();
sb.append(a2);
i2 = i4 + 1;
sb.append(String.valueOf(i4));
a(sb.toString(), str2, ftVar, str);
i4 = i2;
}
} else if (a3 == cr.b.Applications) {
ApplicationInfo applicationInfo = packageInfo.applicationInfo;
if (applicationInfo != null && applicationInfo.enabled && !TextUtils.isEmpty(applicationInfo.className)) {
String str3 = str2 + ConstantsCommonTaskerServer.ID_SEPARATOR + applicationInfo.className;
if (b3.length() == 0 || as.d(b3, str3)) {
StringBuilder sb2 = new StringBuilder();
sb2.append(a2);
i2 = i4 + 1;
sb2.append(String.valueOf(i4));
a(sb2.toString(), str3, ftVar, str);
i4 = i2;
}
}
} else {
if (a3 == cr.b.Activities) {
componentInfoArr = packageInfo.activities;
} else if (a3 == cr.b.Receivers) {
componentInfoArr = packageInfo.receivers;
} else if (a3 == cr.b.Providers) {
componentInfoArr = packageInfo.providers;
} else {
componentInfoArr = packageInfo.services;
}
if (!gs.a((Object[]) componentInfoArr)) {
int i5 = i4;
for (ComponentInfo componentInfo : componentInfoArr) {
ComponentInfo componentInfo2 = componentInfo;
if (componentInfo2.enabled && componentInfo2.exported && !TextUtils.isEmpty(((PackageItemInfo) componentInfo).name)) {
String str4 = str2 + ConstantsCommonTaskerServer.ID_SEPARATOR + ((PackageItemInfo) componentInfo).name;
if (b3.length() == 0 || as.d(b3, str4)) {
a(a2 + String.valueOf(i5), str4, ftVar, str);
i5++;
}
}
}
i4 = i5;
}
}
}
}
return -1;
}
private void e(int i2, int i3) {
synchronized (this.ab) {
for (Object obj : this.ab.toArray()) {
((a) obj).a(i2, i3);
}
}
}
public void a(a aVar) {
synchronized (this.ab) {
int i2 = 0;
while (true) {
if (i2 >= this.ab.size()) {
break;
}
if (this.ab.get(i2) == aVar) {
this.ab.remove(i2);
break;
}
i2++;
}
}
}
public void b(a aVar) {
synchronized (this.ab) {
this.ab.add(aVar);
}
}
private void a(int i2, int i3, int i4) {
synchronized (this.ab) {
Iterator<a> it = this.ab.iterator();
while (it.hasNext()) {
it.next().a(i2, i3, i4);
}
}
}
public void a(int i2, int i3, int i4, int i5) {
synchronized (this.ab) {
Iterator<a> it = this.ab.iterator();
while (it.hasNext()) {
it.next().a(i2, i3, i4, i5);
}
}
}
public void a(ft ftVar, int i2, int i3, int i4, c.a aVar, SpannableStringBuilder spannableStringBuilder, int i5, int i6, Bundle bundle, net.dinglisch.android.taskerm.c cVar) {
if (aVar == c.a.Err || aVar == c.a.Exception) {
String string = bundle.getString("%err");
String string2 = bundle.getString("%errmsg");
bo.a(this, spannableStringBuilder, 2, "E", ct.a(this, R.string.word_error, new Object[0]) + ": " + string);
if (string2 != null) {
bo.a(this, spannableStringBuilder, 2, "E", string2);
}
this.f11023d.a(ftVar, cVar, aVar, i3, i4, string, string2, spannableStringBuilder);
}
synchronized (this.ab) {
Iterator<a> it = this.ab.iterator();
while (it.hasNext()) {
it.next().a(i2, i3, i4, aVar, spannableStringBuilder, i5, i6);
}
}
}
public int d(int i2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
return next.X();
}
}
return 0;
}
}
public int e(int i2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
return next.M();
}
}
return -1;
}
}
public c.a[] a(int i2, int i3) {
c.a[] aVarArr;
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (true) {
if (!it.hasNext()) {
aVarArr = null;
break;
}
ft next = it.next();
if (next.an() == i2) {
aVarArr = next.s(i3);
break;
}
}
}
return aVarArr;
}
public int f(int i2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
return next.G();
}
}
return -1;
}
}
public int g(int i2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
return next.ao();
}
}
return -1;
}
}
public List<Integer> a(int i2, boolean z2) {
LinkedList linkedList;
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
linkedList = null;
while (it.hasNext()) {
ft next = it.next();
if (z2 || !next.W()) {
if ((next.X() & i2) > 0) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(Integer.valueOf(next.an()));
}
}
}
}
return linkedList;
}
public void b(int i2, boolean z2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
next.d(z2);
}
}
}
}
public void c(int i2, boolean z2) {
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
while (it.hasNext()) {
ft next = it.next();
if (next.an() == i2) {
next.c(z2);
}
}
}
}
public void a(int i2, boolean z2, boolean z3) {
boolean z4;
synchronized (this.f11020a) {
Iterator<ft> it = this.f11020a.iterator();
z4 = false;
while (it.hasNext()) {
ft next = it.next();
if (next.ao() == i2) {
bo.b("E", "task " + next.an() + ": in group " + i2 + ", finish");
next.e(z2);
z4 = true;
}
}
}
if (z3 && z4) {
f();
}
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, gt gtVar, Bundle bundle) {
int b2 = b(cVar, 0);
String b3 = b(cVar, 1, bundle);
if (AnonymousClass10.f11030f[bg.a(b2).ordinal()] != 1) {
return -1;
}
if (b3.length() == 0) {
bg.f12182a.a();
gtVar.a();
return -1;
}
gtVar.a(b3);
bg.f12182a.a(b3);
return -1;
}
public static class AnonymousClass10 {
static final int[] f11028d;
static final int[] f11030f = new int[bg.d.values().length];
static {
try {
f11030f[bg.d.Delete.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
f11029e = new int[cr.b.values().length];
try {
f11029e[cr.b.Packages.ordinal()] = 1;
} catch (NoSuchFieldError unused2) {
}
try {
f11029e[cr.b.Applications.ordinal()] = 2;
} catch (NoSuchFieldError unused3) {
}
try {
f11029e[cr.b.Activities.ordinal()] = 3;
} catch (NoSuchFieldError unused4) {
}
try {
f11029e[cr.b.Services.ordinal()] = 4;
} catch (NoSuchFieldError unused5) {
}
try {
f11029e[cr.b.Receivers.ordinal()] = 5;
} catch (NoSuchFieldError unused6) {
}
try {
f11029e[cr.b.Providers.ordinal()] = 6;
} catch (NoSuchFieldError unused7) {
}
f11028d = new int[n.a.values().length];
try {
f11028d[n.a.Squash.ordinal()] = 1;
} catch (NoSuchFieldError unused8) {
}
try {
f11028d[n.a.RemoveDuplicates.ordinal()] = 2;
} catch (NoSuchFieldError unused9) {
}
try {
f11028d[n.a.Reverse.ordinal()] = 3;
} catch (NoSuchFieldError unused10) {
}
try {
f11028d[n.a.RotateLeft.ordinal()] = 4;
} catch (NoSuchFieldError unused11) {
}
try {
f11028d[n.a.RotateRight.ordinal()] = 5;
} catch (NoSuchFieldError unused12) {
}
try {
f11028d[n.a.Shuffle.ordinal()] = 6;
} catch (NoSuchFieldError unused13) {
}
try {
f11028d[n.a.SortAlphaCasefull.ordinal()] = 7;
} catch (NoSuchFieldError unused14) {
}
try {
f11028d[n.a.SortAlphaCasefullReverse.ordinal()] = 8;
} catch (NoSuchFieldError unused15) {
}
try {
f11028d[n.a.SortAlphaCaseless.ordinal()] = 9;
} catch (NoSuchFieldError unused16) {
}
try {
f11028d[n.a.SortNumericFloatingPoint.ordinal()] = 10;
} catch (NoSuchFieldError unused17) {
}
try {
f11028d[n.a.SortNumericInteger.ordinal()] = 11;
} catch (NoSuchFieldError unused18) {
}
try {
f11028d[n.a.SortAlphaCaselessReverse.ordinal()] = 12;
} catch (NoSuchFieldError unused19) {
}
try {
f11028d[n.a.SortLengthShortestFirst.ordinal()] = 13;
} catch (NoSuchFieldError unused20) {
}
try {
f11028d[n.a.SortLengthLongestFirst.ordinal()] = 14;
} catch (NoSuchFieldError unused21) {
}
f11027c = new int[cr.a.values().length];
try {
f11027c[cr.a.Receiver.ordinal()] = 1;
} catch (NoSuchFieldError unused22) {
}
try {
f11027c[cr.a.Service.ordinal()] = 2;
} catch (NoSuchFieldError unused23) {
}
try {
f11027c[cr.a.Activity.ordinal()] = 3;
} catch (NoSuchFieldError unused24) {
}
f11026b = new int[dt.g.values().length];
try {
f11026b[dt.g.Height.ordinal()] = 1;
} catch (NoSuchFieldError unused25) {
}
try {
f11026b[dt.g.Width.ordinal()] = 2;
} catch (NoSuchFieldError unused26) {
}
try {
f11026b[dt.g.HorizontalOffset.ordinal()] = 3;
} catch (NoSuchFieldError unused27) {
}
try {
f11026b[dt.g.VerticalOffset.ordinal()] = 4;
} catch (NoSuchFieldError unused28) {
}
try {
f11026b[dt.g.Status.ordinal()] = 5;
} catch (NoSuchFieldError unused29) {
}
f11025a = new int[n.b.values().length];
try {
f11025a[n.b.DisableCurrentOrNext.ordinal()] = 1;
} catch (NoSuchFieldError unused30) {
}
try {
f11025a[n.b.DisableByLabel.ordinal()] = 2;
} catch (NoSuchFieldError unused31) {
}
try {
f11025a[n.b.DisableByTime.ordinal()] = 3;
} catch (NoSuchFieldError unused32) {
}
}
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, gt gtVar, Bundle bundle, ft ftVar) {
String a2;
String a3;
String b2;
String str2;
String str3;
String str4;
String str5;
Class<?> a4;
String str6;
boolean z2;
Object invoke;
String str7;
boolean z3;
String str8;
Object newInstance;
boolean z4;
boolean z5;
boolean z6;
boolean z7;
Constructor<?> constructor;
Constructor<?> constructor2;
Context context;
int i2;
ArrayList arrayList;
String str9;
Class<?> cls;
Class<?> cls2;
net.dinglisch.android.taskerm.c cVar2 = cVar;
int i3 = -3;
try {
a3 = a(cVar2, 0, bundle, true);
b2 = b(cVar2, 1, bundle);
} catch (Throwable th) {
a2 = com.joaomgcd.taskerm.util.am.a(th);
}
if (a3 != null) {
bg.a((Context) this);
Context a5 = a(str, bundle);
bg.c a6 = bg.a(a5, b2, bg.a.Both, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, "target");
String b3 = b(cVar2, 2, bundle);
String[] s2 = bg.s(b3);
if (s2 == null) {
a2 = str + ": bad function spec: " + b3;
bo.d("E", a2);
} else {
String str10 = s2[0];
String str11 = s2[1];
if (str10.equals("assign")) {
if (a3.startsWith("%")) {
str6 = String.class.getName();
str3 = str11;
str4 = str10;
str5 = b3;
a4 = String.class;
} else {
str3 = str11;
str4 = str10;
str5 = b3;
a4 = bg.a(a5, a3, bg.a.Obj, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, "returnclass").a("retvar");
str6 = a3;
}
} else {
str3 = str11;
str4 = str10;
str5 = b3;
String d2 = bg.d(str3, true);
a4 = bg.a(a5, d2, bg.a.Cls, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, "returnval").a("retnovar");
str6 = d2;
}
Class<?>[] o2 = bg.o(str3);
Class<?> a7 = str4.equals("assign") ? a4 : a6.a("target");
if (a7 == null) {
a2 = str + ": failed to init target class " + b2;
bo.d("E", a2);
} else if (a4 == null) {
a2 = str + ": failed to init return class " + str6;
bo.d("E", a2);
} else if (o2 == null) {
a2 = str + ": failed to init param classes";
bo.d("E", a2);
} else {
ArrayList arrayList2 = new ArrayList();
int i4 = 0;
?? r10 = cVar2;
while (i4 < o2.length) {
String c2 = r10.j(i4 + 3).c();
if (TextUtils.isEmpty(c2)) {
arrayList2.add(null);
str9 = a3;
context = a5;
i2 = i4;
arrayList = arrayList2;
cls = a7;
cls2 = a4;
} else {
Class<?> cls3 = o2[i4];
boolean z8 = o2[i4] == Class.class;
Context context2 = a5;
context = a5;
i2 = i4;
arrayList = arrayList2;
str9 = a3;
cls = a7;
cls2 = a4;
bg.c a8 = bg.a(context2, c2, z8 ? bg.a.Both : bg.a.Obj, gtVar, bundle, cls3, (HashMap<String, String>) null, "param" + i4);
if (z8) {
Class<?> a9 = bw.a(a8.f12196a);
if (a8.a()) {
a9 = bg.a(cls3, a8.g);
}
arrayList.add(a9);
} else {
arrayList.add(a8.f12197b);
}
}
bo.b("E", "param " + i2 + " class: " + o2[i2]);
i4 = i2 + 1;
a7 = cls;
arrayList2 = arrayList;
a5 = context;
a3 = str9;
a4 = cls2;
r10 = cVar;
}
String str12 = a3;
ArrayList arrayList3 = arrayList2;
Class<?> cls4 = a7;
Class<?> cls5 = a4;
str2 = null;
try {
} catch (Exception e2) {
e = e2;
r10 = 0;
}
try {
if (str4.equals("assign")) {
invoke = a6.f12197b;
z2 = true;
r10 = 0;
} else if (str4.equals("new")) {
Class<?> b4 = bg.b(cls4, a6.f12201f);
if (b4 == null) {
b4 = cls4;
}
if (a6.a()) {
try {
z3 = false;
z4 = false;
} catch (Exception e3) {
e = e3;
z3 = false;
}
try {
newInstance = Array.newInstance(b4.getComponentType(), ((Integer) arrayList3.get(0)).intValue());
z5 = true;
z6 = z4;
} catch (Exception e4) {
e = e4;
str8 = str + ": new " + b4.getName();
bo.a("E", str8, e);
z7 = z3;
z5 = false;
str2 = str8;
newInstance = null;
z6 = z7;
invoke = newInstance;
z2 = z5;
r10 = z6;
if (z2) {
}
a2 = str2;
if (a2 != null) {
}
return i3;
}
} else {
z4 = false;
z7 = false;
try {
constructor2 = b4.getConstructor(o2);
} catch (NoSuchMethodException unused) {
constructor = null;
}
if (constructor2 == null) {
try {
constructor = b4.getDeclaredConstructor(o2);
} catch (NoSuchMethodException unused2) {
}
if (constructor != null) {
str8 = str + ": no matching constructor for " + str5;
bo.d("E", str8);
z5 = false;
str2 = str8;
newInstance = null;
z6 = z7;
} else {
bo.b("E", "constructor: " + constructor.toGenericString());
a((List<Object>) arrayList3);
newInstance = constructor.newInstance(arrayList3.toArray());
z5 = true;
z6 = z4;
}
}
constructor = constructor2;
if (constructor != null) {
}
}
invoke = newInstance;
z2 = z5;
r10 = z6;
} else {
String str13 = str5;
r10 = 0;
r10 = 0;
Method b5 = bw.b(cls4, str4, o2);
if (b5 == null) {
b5 = bw.a(cls4, str4, o2);
}
if (b5 == null) {
str7 = str + ": no matching method for " + str13;
bo.d("E", str7);
} else if (a6.f12197b == null && !a6.f12198c) {
str7 = str + ": null object: " + b2;
bo.d("E", str7);
} else {
bo.b("E", "targetClass: " + cls4);
bo.b("E", "object: " + a6.f12197b);
bo.b("E", "method: " + b5.toGenericString());
a((List<Object>) arrayList3);
z2 = true;
b5.setAccessible(true);
invoke = b5.invoke(a6.f12197b, arrayList3.toArray());
}
invoke = null;
z2 = false;
str2 = str7;
}
if (z2) {
bo.b("E", "return class: " + cls5 + " return val: " + invoke);
if (bg.a(this, str12, cls5, invoke, gtVar, bundle, ftVar)) {
i3 = -1;
}
}
} catch (Exception e5) {
e = e5;
a2 = com.joaomgcd.taskerm.util.am.a(e);
bo.a("E", str, e);
bo.a("E", (int) r10, e);
if (a2 != null) {
}
return i3;
}
}
}
if (a2 != null) {
ftVar.a(cVar, a2);
}
return i3;
}
str2 = null;
a2 = str2;
if (a2 != null) {
}
return i3;
}
private Context a(String str, Bundle bundle) {
Context context;
String string;
Context g2;
if (bundle.containsKey("%scene_name") && (g2 = ew.g((string = bundle.getString("%scene_name")))) != null && (g2 instanceof Activity)) {
bo.b("E", str + " use activity context for " + string);
context = g2;
} else {
context = null;
}
if (context != null) {
return context;
}
bo.b("E", str + " use app context");
return this;
}
private void a(List<Object> list) {
if (list.size() == 0) {
bo.b("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 ");
sb.append(obj == null ? "null" : obj.getClass().getName());
sb.append(" value ");
sb.append(obj == null ? "null" : obj.toString());
bo.b("E", sb.toString());
}
}
private int e(String str, net.dinglisch.android.taskerm.c cVar) {
AudioManager audioManager = (AudioManager) df.a(this, "audio", "E", "exesm");
int i2 = 0;
if (audioManager == null) {
a(R.string.err_no_audio_manager, new Object[0]);
return -3;
}
int h2 = cVar.g(0).h();
if (h2 == 1) {
i2 = 1;
} else if (h2 != 2) {
i2 = 2;
}
bo.b("E", str + ": " + gx.c(audioManager.getRingerMode()) + " -> " + gx.c(i2));
if (!gs.q()) {
audioManager.setRingerMode(i2);
} else if (i2 == 0) {
bo.b("E", "lollipop compat, set filter to priority");
dc.a(this, 2);
} else {
int d2 = dc.d(this);
bo.b("E", "current filter " + d2);
audioManager.setRingerMode(i2);
dc.a(this, d2);
}
bo.b("E", "now: " + gx.c(audioManager.getRingerMode()));
return -1;
}
private int v(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int b2 = b(cVar, 0);
String b3 = b(cVar, 2, bundle);
int i2 = -3;
if (TextUtils.isEmpty(b3)) {
bo.d("E", str + ": refusing to load empty config");
return -3;
}
if (b2 == 0) {
synchronized (fy.f13381a[fy.a.Active.ordinal()]) {
ay a2 = fy.e(this).a((Context) this, b3, 0, false);
ft ftVar = (ft) a2.f12149c;
if (!a2.a() && ftVar != null) {
i2 = -1;
}
}
return i2;
}
if (b2 == 1) {
fy fyVar = new fy();
if (fyVar.a(this, str, b3)) {
synchronized (fy.f13381a[fy.a.Active.ordinal()]) {
b((Context) this);
c(true);
fy.a(fy.a.Active, fyVar);
bo.b("E", str + ": finished config load, restart monitor");
MonitorService.a((Context) this, true);
}
return -4;
}
bo.d("E", str + ": failed to load config");
return -3;
}
bo.d("E", str + ": bad data type: " + b2);
return -3;
}
private int w(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
try {
CMStatusBarManager.getInstance(this).removeTile(b(cVar, 0, bundle).hashCode());
return -1;
} catch (Exception e2) {
bo.a("E", str, e2);
return -3;
}
}
private int x(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (ab.a()) {
return z(str, cVar, bundle);
}
bo.d("E", str + " no cyanogen quick setting API available");
return -3;
}
private int y(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (ab.a()) {
return w(str, cVar, bundle);
}
bo.d("E", str + " no cyanogen quick setting API available");
return -3;
}
private int z(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
Bitmap a2;
CustomTile.Builder builder;
int i2;
int i3;
int i4;
int i5;
Bitmap bitmap;
PendingIntent pendingIntent;
Bitmap bitmap2;
List<bm> list;
ArrayList<CustomTile.ExpandedGridItem> arrayList;
CustomTile.Builder builder2;
int i6;
CustomTile.ExpandedGridItem expandedGridItem;
Bitmap bitmap3;
int i7;
int i8;
Bundle bundle2 = bundle;
String b2 = b(cVar, 0, bundle2);
net.dinglisch.android.taskerm.g e2 = cVar.e(1);
Bitmap bitmap4 = null;
try {
if (!e2.c()) {
try {
a2 = e2.a(this, 128, 128, "doQuickSettingAdd");
} catch (Exception e3) {
bo.a("E", str, e3);
}
int M = a2 != null ? com.joaomgcd.taskerm.util.al.M(this) : -1;
int i9 = M != -1 ? R.drawable.cust_warning : M;
int hashCode = b2.hashCode();
Intent intent = new Intent(this, (Class<?>) ReceiverStaticInternal.class);
intent.setAction("net.dinglisch.android.tasker.QSORUM");
intent.setData(Uri.fromParts(ExecuteService.class.getName(), b2, null));
intent.putExtra("title", b2);
CustomTile.Builder builder3 = new CustomTile.Builder(this);
if (!cVar.v()) {
ArrayList<CustomTile.ExpandedGridItem> arrayList2 = new ArrayList<>();
List<bm> w2 = cVar.w();
int i10 = 0;
while (i10 < w2.size()) {
CustomTile.ExpandedGridItem expandedGridItem2 = new CustomTile.ExpandedGridItem();
bm bmVar = w2.get(i10);
if (bmVar.f()) {
String str2 = cr.b() + ".ReceiverStaticInternal";
Intent intent2 = new Intent("net.dinglisch.android.tasker.WIDICKYUM");
intent2.setClassName(getPackageName(), str2);
if (bundle2 != null) {
intent2.putExtra("lvars", gs.a(bundle2, cVar.n()));
}
ft d2 = fy.d();
d2.a(bmVar.k());
i4 = i9;
intent2.putExtra("mcro", d2.a(0).c());
int i11 = (hashCode * 1000) + 1190000 + i10;
i5 = i10;
bitmap = null;
intent2.setData(Uri.fromParts(ExecuteService.class.getSimpleName(), Integer.toString(i11), null));
pendingIntent = PendingIntent.getBroadcast(this, i11, intent2, com.joaomgcd.taskerm.util.ds.a(134217728));
} else {
i4 = i9;
i5 = i10;
bitmap = bitmap4;
pendingIntent = bitmap;
}
net.dinglisch.android.taskerm.g j2 = bmVar.j();
if (j2 != null && !j2.c() && !ex.a().equals(j2.r())) {
bitmap2 = j2.a(this, 128, 128, "quickSettingAddItem");
if (bitmap2 == null) {
expandedGridItem2.setExpandedGridItemBitmap(bitmap2);
} else {
expandedGridItem2.setExpandedGridItemDrawable(R.drawable.cust_warning);
}
if (bmVar.g()) {
list = w2;
arrayList = arrayList2;
builder2 = builder3;
i6 = hashCode;
expandedGridItem = expandedGridItem2;
bitmap3 = bitmap;
i7 = i4;
i8 = i5;
} else {
list = w2;
arrayList = arrayList2;
i6 = hashCode;
builder2 = builder3;
i7 = i4;
bitmap3 = bitmap;
i8 = i5;
expandedGridItem = expandedGridItem2;
expandedGridItem.setExpandedGridItemTitle(gx.a((Context) this, bmVar.l(), false, false, true, false, (ga.a) null, bundle));
}
if (pendingIntent == null) {
expandedGridItem.setExpandedGridItemOnClickIntent(pendingIntent);
}
arrayList.add(expandedGridItem);
i10 = i8 + 1;
arrayList2 = arrayList;
bitmap4 = bitmap3;
w2 = list;
hashCode = i6;
builder3 = builder2;
i9 = i7;
bundle2 = bundle;
}
bitmap2 = bitmap;
if (bitmap2 == null) {
}
if (bmVar.g()) {
}
if (pendingIntent == null) {
}
arrayList.add(expandedGridItem);
i10 = i8 + 1;
arrayList2 = arrayList;
bitmap4 = bitmap3;
w2 = list;
hashCode = i6;
builder3 = builder2;
i9 = i7;
bundle2 = bundle;
}
i2 = i9;
i3 = -1;
CustomTile.GridExpandedStyle gridExpandedStyle = new CustomTile.GridExpandedStyle();
gridExpandedStyle.setGridItems(arrayList2);
builder = builder3;
builder.setExpandedStyle(gridExpandedStyle);
hashCode = hashCode;
} else {
builder = builder3;
i2 = i9;
i3 = -1;
builder.setOnClickIntent(PendingIntent.getBroadcast(this, hashCode, intent, com.joaomgcd.taskerm.util.ds.a(134217728)));
}
builder.shouldCollapsePanel(a(cVar, 2));
if (a2 == null) {
builder.setIcon(a2);
} else {
builder.setIcon(i2);
}
builder.setLabel(b2);
CMStatusBarManager.getInstance(this).publishTile(hashCode, builder.build());
return i3;
}
CustomTile.Builder builder32 = new CustomTile.Builder(this);
if (!cVar.v()) {
}
builder.shouldCollapsePanel(a(cVar, 2));
if (a2 == null) {
}
builder.setLabel(b2);
CMStatusBarManager.getInstance(this).publishTile(hashCode, builder.build());
return i3;
} catch (Exception e4) {
bo.a("E", str, e4);
return -3;
}
a2 = null;
if (a2 != null) {
}
if (M != -1) {
}
int hashCode2 = b2.hashCode();
Intent intent3 = new Intent(this, (Class<?>) ReceiverStaticInternal.class);
intent3.setAction("net.dinglisch.android.tasker.QSORUM");
intent3.setData(Uri.fromParts(ExecuteService.class.getName(), b2, null));
intent3.putExtra("title", b2);
}
private void d(boolean z2) {
if (this.N == null) {
if (z2) {
this.N = new BroadcastReceiver() {
@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) df.a(ExecuteService.this, NotificationCompat.CATEGORY_ALARM, "E", action);
synchronized (ExecuteService.j) {
long currentTimeMillis = ExecuteService.this.M - System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
sb.append(action);
sb.append(": have intent: ");
sb.append(ExecuteService.this.L != null);
sb.append(" time to: ");
sb.append(currentTimeMillis);
bo.b("E", sb.toString());
if (ExecuteService.this.L != null && currentTimeMillis > 1000) {
ExecuteService.this.a(alarmManager, action);
}
}
}
}
};
}
} else if (!z2) {
unregisterReceiver(this.N);
this.N = null;
}
if (z2) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.SCREEN_ON");
registerReceiver(this.N, intentFilter);
}
}
private void b(AlarmManager alarmManager, String str) {
synchronized (j) {
if (this.L != null) {
bo.b("E", "AC cancel wait alarm: " + str);
if (alarmManager == null) {
alarmManager = (AlarmManager) df.a(this, NotificationCompat.CATEGORY_ALARM, "E", "cancelWA");
}
try {
alarmManager.cancel(this.L);
} catch (Exception e2) {
bo.a("E", "cancel wait alarm", e2);
}
this.L = null;
}
}
}
private int o(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
if (df.a(this, "vibrator", "E", "exevib") == null) {
a(R.string.err_no_vibration_service, new Object[0]);
return -3;
}
int d2 = d(cVar, 0, bundle);
if (d2 == Integer.MAX_VALUE) {
return -3;
}
gs.a(this, d2);
return -3;
}
private int a(final int i2, final net.dinglisch.android.taskerm.c cVar, final ft ftVar) {
if (MyAccessibilityService.c()) {
return (MyAccessibilityService.d(i2) && MyAccessibilityService.b(i2)) ? -1 : -3;
}
final String a2 = n.a(this, cVar, ftVar.r(), ftVar.an());
c(a2);
this.f11023d.a(new Runnable() {
@Override
public final void run() {
ExecuteService.this.a(i2, ftVar, cVar, a2);
}
});
return -1;
}
public void a(int i2, ft ftVar, net.dinglisch.android.taskerm.c cVar, String str) {
final String[] strArr = {null};
if (((MyAccessibilityService.d(i2) && com.joaomgcd.taskerm.a.b.a(this, i2).d(new b.a.d.g() {
@Override
public final Object apply(Object obj) {
b.a.p a2;
a2 = ExecuteService.a(strArr, (Throwable) obj);
return a2;
}
}).b().booleanValue()) ? (char) 65535 : (char) 65533) == 65533) {
String str2 = strArr[0];
if (str2 == null) {
str2 = "Error performing global accessibility action";
}
ftVar.a(cVar, 1, str2);
if (cVar.t()) {
ftVar.e(true);
}
}
d(str);
}
public static b.a.p a(String[] strArr, Throwable th) throws Exception {
strArr[0] = th.getMessage();
return b.a.l.a(false);
}
private int a(String str, net.dinglisch.android.taskerm.c cVar, ft ftVar) {
int i2;
boolean z2 = b(cVar, 0) == 0;
bo.b("E", str + ": expand: " + z2);
if (z2 && MyAccessibilityService.b(4, false, str)) {
bo.b("E", str + ": accessibilityservice available, try using it");
i2 = a(4, cVar, ftVar);
} else {
i2 = -3;
}
if (i2 != -3) {
return i2;
}
bo.b("E", str + ": accessibility service unavailable or failed, check SBS");
if (bw.an.b(this)) {
bo.b("E", str + ": SBS available, let's try it");
if (z2) {
if (!bw.an.a(this, true)) {
return i2;
}
} else if (com.joaomgcd.taskerm.util.g.j()) {
if (!bw.an.a(this, false)) {
return i2;
}
} else {
return this.f11023d.a(cVar, ftVar);
}
return -5;
}
bo.b("E", str + ": no SBS");
return i2;
}
private void f(String str, net.dinglisch.android.taskerm.c cVar) {
int h2 = cVar.g(0).h();
Intent a2 = cr.a(getPackageManager(), cr.a.Service, new Intent(ct.a(this, R.array.widgetlocker_intents)[h2]));
if (a2 == null) {
bo.d("E", str + ": couldn't get explicit intent");
return;
}
if (h2 < 4) {
bo.b("E", str + ": start service: " + a2.getAction());
startService(a2);
return;
}
bo.b("E", str + ": start activity: " + a2.getAction());
a(a2);
}
private int b(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle, ft ftVar) {
String str2;
File file;
String str3;
boolean z2;
int i3;
File file2;
File file3;
Object obj;
Cursor cursor;
String str4;
?? r22;
?? r13;
String str5;
int i4;
String str6;
boolean z3;
boolean z4;
String str7;
String str8;
String[] strArr;
String replaceFirst;
File file4;
File file5;
String str9;
Cursor cursor2;
String str10;
int i5;
SQLiteDatabase sQLiteDatabase;
String str11;
String str12;
int i6;
Cursor rawQuery;
Object obj2;
Cursor cursor3;
int b2 = b(cVar, 0);
String b3 = b(cVar, 2, bundle);
String b4 = b(cVar, 3, bundle);
String b5 = b(cVar, 4, bundle);
String b6 = b(cVar, 5, bundle);
String b7 = b(cVar, 6, bundle);
String b8 = b(cVar, 7, bundle);
String a2 = a(cVar, 8, bundle);
boolean a3 = a(cVar, 9);
boolean a4 = a(cVar, 10);
?? r1 = n.e.values()[b2];
if (TextUtils.isEmpty(b8)) {
b8 = ",";
}
if (a2 != null) {
String[] split = b6.length() > 0 ? b6.split("\n") : null;
if (b4.length() > 0) {
String[] split2 = b4.split(",");
if (!gs.a((Object[]) split2)) {
for (int i7 = 0; i7 < split2.length; i7++) {
split2[i7] = split2[i7].trim();
}
}
strArr = split2;
} else {
strArr = null;
}
String replaceFirst2 = b7.length() == 0 ? null : b7.replaceFirst("^\\s*ORDERBY\\s*", "");
if (b5.length() == 0) {
replaceFirst = null;
} else {
replaceFirst = r1 != n.e.Raw ? b5.replaceFirst("^\\s*SELECT\\s*", "") : b5;
}
if (r1 == n.e.TableURIFormatted) {
try {
cursor3 = getContentResolver().query(Uri.parse(b(cVar, 1, bundle)), strArr, replaceFirst, split, replaceFirst2);
obj2 = null;
} catch (Exception e2) {
bo.c("E", str + ": URI cursor exception: " + e2.toString());
obj2 = "Cursor Error";
cursor3 = null;
}
str2 = b8;
r13 = obj2;
file = a3;
str5 = a2;
str6 = replaceFirst;
z2 = a4;
i4 = 4;
file3 = null;
r22 = 0;
cursor = cursor3;
file2 = null;
} else {
boolean z5 = !TextUtils.isEmpty(replaceFirst) && Pattern.compile(".*(insert.*?into|update|create\\s+table|delete\\s+from|alter\\s+table).*", 42).matcher(replaceFirst).find();
File g2 = g(str, cVar, 1, bundle);
if (at.a((Context) this, g2, a3, true, z5)) {
r21 = g(cVar, i2, bundle) ? -1 : -3;
str2 = b8;
r13 = "Need Doc Access";
file = a3;
str5 = a2;
str6 = replaceFirst;
z2 = a4;
file2 = null;
i4 = 4;
file3 = null;
cursor = null;
r22 = 0;
} else {
File file6 = g2;
?? r11 = z5;
str2 = b8;
String[] strArr2 = split;
String str13 = replaceFirst;
z2 = a4;
cursor = null;
if (a(g2, str, a3, true, true, false)) {
boolean canRead = file6.canRead();
boolean canWrite = file6.canWrite();
?? sb = new StringBuilder();
sb.append(str);
sb.append(": canRead: ");
sb.append(canRead);
sb.append(" canWrite: ");
sb.append(canWrite);
sb.append(" needWrite: ");
sb.append(r11);
?? r5 = " useRoot: ";
sb.append(" useRoot: ");
sb.append(a3);
bo.b("E", sb.toString());
if (canRead && (!a3 || r11 == 0 || canWrite)) {
file4 = null;
file = file6;
file6 = null;
} else {
bo.b("E", str + ": copy DB (" + file6.length() + "b) to tmpfile, can't read or need use root");
File j2 = gs.j();
file = j2 != null ? new File(j2, str + ".db") : null;
if (file == null) {
bo.b("E", "couldn't get tmpFile to copy db");
} else if (a3) {
if (fd.a(true, 15000L, "cp " + gs.o(file6.toString()) + " " + gs.o(file.toString()), z2) == 0) {
if (r11 != 0) {
file4 = file;
} else {
file4 = null;
file6 = null;
}
bo.b("E", "copied DB to " + file + " size " + file.length() + " readable: " + file.canRead());
} else {
bo.b("E", "failed to root-copy to tmpfile " + file);
}
} else if (at.a((Context) this, file6, file, false)) {
bo.b("E", "copied to tmpfile " + file);
if (r11 != 0) {
file5 = file6;
file4 = file;
} else {
file4 = null;
file5 = null;
}
file6 = file5;
} else {
bo.b("E", "failed to copy to tmpfile " + file);
file4 = null;
file = null;
file6 = null;
}
file4 = null;
file = null;
file6 = null;
}
if (file != null) {
SQLiteDatabase openDatabase = SQLiteDatabase.openDatabase(file.toString(), null, ~r11 ? 1 : 0);
if (openDatabase == null) {
bo.d("E", "failed to open " + file);
file = a3;
str9 = a2;
cursor2 = null;
str10 = str13;
i5 = 4;
sQLiteDatabase = openDatabase;
} else {
try {
?? r3 = n.e.Formatted;
cursor2 = r1;
try {
if (cursor2 == r3) {
file = a3;
r11 = a2;
cursor2 = null;
String str14 = str13;
r5 = 4;
rawQuery = openDatabase.query(b3, strArr, str14, strArr2, null, null, replaceFirst2);
r3 = str14;
} else {
file = a3;
r11 = a2;
cursor2 = null;
String str15 = str13;
r5 = 4;
rawQuery = openDatabase.rawQuery(str15, strArr2);
r3 = str15;
}
cursor = rawQuery;
sQLiteDatabase = openDatabase;
str10 = r3;
i5 = r5;
str9 = r11;
} catch (Exception e3) {
e = e3;
str12 = r3;
i6 = r5;
str11 = r11;
?? message = e.getMessage();
bo.c("E", str + ": cursor exception: " + message);
cursor = cursor2;
cursor2 = message;
sQLiteDatabase = openDatabase;
str10 = str12;
i5 = i6;
str9 = str11;
file2 = file4;
r22 = sQLiteDatabase;
r13 = cursor2;
file3 = file6;
str6 = str10;
i4 = i5;
str5 = str9;
if (cursor != null) {
}
if (r22 != 0) {
}
if (z4) {
}
if (r13 != 0) {
}
return r21;
}
} catch (Exception e4) {
e = e4;
file = a3;
str11 = a2;
cursor2 = null;
str12 = str13;
i6 = 4;
}
}
} else {
file = a3;
str9 = a2;
cursor2 = null;
str10 = str13;
i5 = 4;
sQLiteDatabase = null;
cursor = null;
}
file2 = file4;
r22 = sQLiteDatabase;
r13 = cursor2;
file3 = file6;
str6 = str10;
i4 = i5;
str5 = str9;
} else {
file = a3;
str3 = a2;
str4 = str13;
i3 = 4;
obj = "Can't access file";
file2 = null;
file3 = null;
cursor = null;
}
}
}
if (cursor != null) {
z3 = z2;
gx.k(this, str5, bundle);
cursor.moveToFirst();
int i8 = 1;
int i9 = i4;
while (!this.aa.booleanValue() && !cursor.isAfterLast()) {
StringBuilder sb2 = new StringBuilder();
int i10 = 0;
while (i10 < cursor.getColumnCount()) {
if (sb2.length() > 0) {
str7 = str2;
sb2.append(str7);
} else {
str7 = str2;
}
try {
int type = cursor.getType(i10);
if (type != 0) {
str8 = type != i9 ? cursor.getString(i10) : "<blob>";
} else {
str8 = "<null>";
}
} catch (SQLiteException unused) {
str8 = "<???>";
}
sb2.append(str8);
i10++;
str2 = str7;
}
gx.a((Context) this, str5 + String.valueOf(i8), sb2.toString(), false, bundle, str);
i8++;
cursor.moveToNext();
str2 = str2;
i9 = 4;
}
cursor.close();
gx.g(this, str5, bundle);
r21 = -5;
z4 = true;
} else {
z3 = z2;
z4 = false;
bo.d("E", str + ": no cursor for query '" + str6 + "'");
}
if (r22 != 0) {
r22.close();
}
if (z4 && file2 != null) {
bo.b("E", "copy back modified DB " + file2 + " -> " + file3);
if (file == null) {
if (fd.a(true, 10000L, "cp " + gs.o(file2.toString()) + " " + gs.o(file3.toString()), z3) != 0) {
bo.d("E", str + ": failed to root overwrite original DB file");
}
} else if (!at.a((Context) this, file2, file3, true)) {
bo.d("E", str + ": failed to overwrite original DB file");
}
}
if (r13 != 0) {
ftVar.c(r13);
}
return r21;
}
str2 = b8;
file = a3;
str3 = a2;
z2 = a4;
i3 = 4;
file2 = null;
file3 = null;
obj = null;
cursor = null;
str4 = b5;
r22 = cursor;
str6 = str4;
i4 = i3;
str5 = str3;
r13 = obj;
if (cursor != null) {
}
if (r22 != 0) {
}
if (z4) {
bo.b("E", "copy back modified DB " + file2 + " -> " + file3);
if (file == null) {
}
}
if (r13 != 0) {
}
return r21;
}
private int b(ft ftVar, String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
Integer num;
String b2 = b(cVar, 1, bundle);
if (a(cVar, 2, bundle) != null) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, true, true, false)) {
if (b2.length() == 0 || b2.startsWith("%")) {
num = 0;
} else {
num = gs.c(b2);
}
if (num == null) {
bo.d("E", str + ": not a number: " + b2);
} else if (a(ftVar, cVar, str, cVar.i(), g2, num.intValue(), cVar.j(2).c(), bundle)) {
return -5;
}
}
}
return -3;
}
private void g(String str, net.dinglisch.android.taskerm.c cVar) {
int b2 = b(cVar, 0);
boolean z2 = b2 == 0;
boolean a2 = a(cVar, 1);
if (gs.t()) {
if (cn.a()) {
bo.b("E", str + ": defaulting to use new API on Android 6.0+ since have existing session");
a2 = true;
}
} else if (a2) {
bo.b("E", str + ": defaulting to not use new API for grab pre-Android.6.0");
a2 = false;
}
bo.b("E", str + ": grab: " + b2 + " useNewAPI: " + a2);
if (a2) {
Message obtainMessage = this.al.obtainMessage();
Bundle bundle = new Bundle();
bundle.putBoolean("grab", z2);
bundle.putBoolean("newAPI", a2);
obtainMessage.setData(bundle);
this.al.sendMessage(obtainMessage);
return;
}
gs.a((Context) this, z2, false);
}
private int n(final String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
File g2 = g(str, cVar, 0, bundle);
if (at.a((Context) this, g2, false, true, false)) {
if (g(cVar, i2, bundle)) {
return -1;
}
} else if (a(g2, str, false, true, true, false)) {
String b2 = b(cVar, 1, bundle);
if (TextUtils.isEmpty(b2)) {
b2 = null;
}
boolean a2 = a(cVar, 2);
String b3 = b(cVar, 3, bundle);
String b4 = b(cVar, 4, bundle);
Intent a3 = com.joaomgcd.taskerm.util.dq.a(g2, this, b2, "android.intent.action.SEND", (c.f.a.b<? super String, c.s>) new c.f.a.b() {
@Override
public final Object invoke(Object obj) {
c.s d2;
d2 = ExecuteService.d(str, (String) obj);
return d2;
}
}, a2, b3);
a3.putExtra("android.intent.extra.CHOOSER_CUSTOM_ACTIONS", this.f11023d.a(b4, bundle));
if (a(a3)) {
return -5;
}
}
return -3;
}
public static c.s d(String str, String str2) {
bo.d("E", str + ": " + str2);
return c.s.f2131a;
}
private int A(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
int a2 = a(cVar, 0, true, false, bundle);
int a3 = a(cVar, 1, true, false, bundle);
int a4 = a(cVar, 2, true, false, bundle);
if (a2 != Integer.MAX_VALUE && a3 != Integer.MAX_VALUE && a4 != Integer.MAX_VALUE) {
if (n.a(cVar)) {
i2 = 2147482;
} else {
i2 = (a4 * 3600) + a2 + (a3 * 60);
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": set to ");
int i3 = i2 * 1000;
sb.append(i3);
sb.append("ms");
bo.b("E", sb.toString());
if (a(str, cVar.i(), i3)) {
bo.b("E", str + ": ok");
return -5;
}
}
return -3;
}
private int o(String str, net.dinglisch.android.taskerm.c cVar, int i2, Bundle bundle) {
int a2 = a(cVar, 0, true, false, bundle);
if (a2 != Integer.MAX_VALUE) {
if (a2 < 20 && !cVar.h(1).b()) {
a2 = 20;
}
boolean z2 = gs.l() < 19 && cVar.h(3).b();
if ((!a(str, cVar.i(), a2) && !cVar.h(2).b()) || !z2) {
return -5;
}
if (a(1, i2, 1, cVar, bundle)) {
a(200L);
j("99");
return -1;
}
}
return -3;
}
private List<String> B(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
ArrayList arrayList = new ArrayList();
fz c2 = fy.c(this);
for (int i2 = 0; i2 < cVar.h(); i2++) {
String b2 = b(cVar, i2, bundle);
if (b2.length() == 0 || c2.j(b2)) {
arrayList.add(b2);
} else {
bo.d("E", str + ": unknown task " + b2);
}
}
if (arrayList.size() == cVar.h()) {
return arrayList;
}
return null;
}
private int C(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
List<String> B2 = B(str, cVar, bundle);
if (B2 == null) {
return -3;
}
for (int i2 = 0; i2 < B2.size(); i2++) {
Settings.j(this, i2, B2.get(i2));
}
fe.a((Context) this, false);
return -1;
}
private int c(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle, ft ftVar) {
int b2 = b(cVar, 0);
int d2 = d(cVar, 2, bundle);
String b3 = b(cVar, 1, bundle);
boolean a2 = a(cVar, 3);
String b4 = b(cVar, 4, bundle);
String b5 = b(cVar, 5, bundle);
String c2 = c(cVar, 6, bundle);
String c3 = c(cVar, 8, bundle);
String c4 = c(cVar, 7, bundle);
String b6 = b(cVar, 9, bundle);
String b7 = b(cVar, 10, bundle);
String b8 = b(cVar, 11, bundle);
String b9 = b(cVar, 12, bundle);
fz c5 = fy.c(this);
if (b3.length() == 0 || c5.j(b3)) {
Settings.a(this, b2, b3);
}
if (!TextUtils.isEmpty(b4) && !c5.j(b4)) {
bo.c("E", str + ": unknown task " + b4);
return -3;
}
Settings.b(this, b2, b4);
if (!TextUtils.isEmpty(b5) && !c5.j(b5)) {
bo.c("E", str + ": unknown task " + b5);
return -3;
}
Settings.c(this, b2, b5);
Settings.f(this, b2, b6);
Settings.g(this, b2, b8);
Settings.h(this, b2, b7);
Settings.i(this, b2, b9);
Settings.d(this, b2, c2);
Settings.e(this, b2, c4);
Settings.k(this, b2, c3);
Settings.a(this, b2, d2);
Settings.a(this, b2, Integer.valueOf(ftVar.G()), Integer.valueOf(ftVar.w()), Integer.valueOf(ftVar.b(fy.e(this))));
com.joaomgcd.taskerm.settings.ai.a(this, b2, a2);
dn.b(b2);
return -5;
}
private int b(ft ftVar, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
boolean a2 = a(cVar, 1);
boolean z2 = false;
String a3 = a(cVar, 0, bundle, a2);
if (a2 && a(cVar, 2)) {
z2 = true;
}
boolean a4 = a(cVar, 3);
if ("".equals(a3) && !a4) {
this.f11023d.c();
}
if (a3 == null) {
return -3;
}
gx.a((Context) this, a3, a2, !z2, false, true, bundle, a4, Integer.valueOf(ftVar.G()));
return -1;
}
private int D(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
String b2 = b(cVar, 0, bundle);
String b3 = b(cVar, 1, bundle);
bo.b("E", str + ": " + b2 + "/" + b3);
if (Main.a()) {
bo.d("E", str + ": UI already active");
} else {
fz b4 = fy.b(this);
if (!b4.j(b2)) {
bo.d("E", str + ": unknown task " + b2);
} else {
ft i3 = b4.i(b2);
Intent intent = new Intent("android.intent.action.MAIN");
if (gn.d(this)) {
b4.a(getPackageManager());
if (i3.i()) {
bo.d("E", str + ": task locked or implicit locked: " + b2);
intent = null;
}
}
if (intent != null && !TextUtils.isEmpty(b3)) {
int a2 = i3.a(getResources(), b3, -1, -1);
if (a2 == -1) {
bo.d("E", str + ": bad action spec: " + b3);
intent = null;
} else {
intent.putExtra(Main.f11313d, String.valueOf(a2));
}
}
if (b(intent, Main.f11310a, b2)) {
i2 = -1;
if (i2 != -1 && !Main.a()) {
fy.a(fy.a.Passive, true);
}
return i2;
}
}
}
i2 = -3;
if (i2 != -1) {
fy.a(fy.a.Passive, true);
}
return i2;
}
private boolean b(Intent intent, String str, String str2) {
if (intent == null) {
return false;
}
intent.setComponent(new ComponentName(this, Main.class.getCanonicalName()));
intent.putExtra(str, str2);
return a(intent);
}
private int E(String str, net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
int i2;
String b2 = b(cVar, 0, bundle);
String b3 = b(cVar, 1, bundle);
bo.b("E", str + ": " + b2 + "/" + b3);
if (Main.a()) {
bo.d("E", str + ": UI already active");
} else {
fz b4 = fy.b(this);
if (!b4.t(b2)) {
bo.d("E", str + ": unknown scene " + b2);
} else {
Intent intent = new Intent("android.intent.action.MAIN");
if (gn.d(this)) {
b4.a(getPackageManager());
if (b4.x(b2)) {
bo.d("E", str + ": scene locked or implicit locked: " + b2);
intent = null;
}
}
if (intent != null && !TextUtils.isEmpty(b3)) {
if (!b4.a(b2, b3, false)) {
bo.d("E", str + ": scene " + b2 + ": unknown element " + b3);
intent = null;
} else {
intent.putExtra(Main.f11313d, b3);
}
}
if (b(intent, Main.f11312c, b2)) {
i2 = -1;
if (i2 != -1 && !Main.a()) {
fy.a(fy.a.Passive, true);
}
return i2;
}
}
}
i2 = -3;
if (i2 != -1) {
fy.a(fy.a.Passive, true);
}
return i2;
}
private int p(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
String b2;
int d2 = d(cVar, 2, bundle);
if (d2 == et.a.Load.ordinal()) {
b2 = cVar.j(3).c();
} else {
b2 = b(cVar, 3, bundle);
}
return ew.a(this, b(cVar, 0, bundle), b(cVar, 1, bundle), et.a.values()[d2], b2) ? -1 : -3;
}
private int q(net.dinglisch.android.taskerm.c cVar, Bundle bundle) {
return ew.a(this, b(cVar, 0, bundle), b(cVar, 1, bundle), eu.a.values()[d(cVar, 2, bundle)], b(cVar, 3, bundle)) ? -1 : -3;
}
public static class i extends Handler {
WeakReference<ExecuteService> f11060a;
i(ExecuteService executeService) {
this.f11060a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService;
String str;
String str2;
Bundle bundle;
Bundle bundle2 = null;
r0 = 0;
?? r0 = 0;
int i = Integer.MIN_VALUE;
r1 = Integer.MIN_VALUE;
r1 = Integer.MIN_VALUE;
r1 = Integer.MIN_VALUE;
r1 = Integer.MIN_VALUE;
r1 = Integer.MIN_VALUE;
int i2 = Integer.MIN_VALUE;
int i3 = Integer.MIN_VALUE;
try {
executeService = this.f11060a.get();
} catch (Exception e2) {
e = e2;
executeService = null;
str = null;
}
try {
if (executeService == null) {
bo.d("E", "flash: no service");
} else {
Bundle data = message.getData();
try {
str = data.getString("ti");
try {
str2 = data.getString("tx");
try {
r0 = data.getInt("l");
if (str2 != null) {
try {
if (str == null) {
?? makeText = Toast.makeText(executeService, str2, (int) r0);
makeText.show();
i3 = makeText;
} else {
gs.b(executeService, str, str2, r0);
}
} catch (Exception e3) {
bundle = data;
e = e3;
i2 = r0;
StringBuilder sb = new StringBuilder();
sb.append("flash failed: haveServ: ");
sb.append(executeService == null);
sb.append(" haveData: ");
sb.append(bundle != null);
sb.append(" title: ");
sb.append(str);
sb.append(" text: ");
sb.append(str2);
sb.append(" dur ");
sb.append(i2);
bo.a("E", sb.toString(), e);
}
}
} catch (Exception e4) {
bundle = data;
e = e4;
}
} catch (Exception e5) {
bundle = data;
e = e5;
str2 = null;
}
} catch (Exception e6) {
str2 = null;
bundle = data;
e = e6;
str = null;
}
}
} catch (Exception e7) {
e = e7;
str = r0;
bundle2 = r0;
i = i3;
str2 = str;
bundle = bundle2;
i2 = i;
StringBuilder sb2 = new StringBuilder();
sb2.append("flash failed: haveServ: ");
sb2.append(executeService == null);
sb2.append(" haveData: ");
sb2.append(bundle != null);
sb2.append(" title: ");
sb2.append(str);
sb2.append(" text: ");
sb2.append(str2);
sb2.append(" dur ");
sb2.append(i2);
bo.a("E", sb2.toString(), e);
}
}
}
public static class e extends Handler {
e() {
}
@Override
public void handleMessage(Message message) {
synchronized (ExecuteService.E) {
if (ExecuteService.C == null) {
MediaPlayer unused = ExecuteService.C = new MediaPlayer();
} else {
bo.d("E", "pc: already have media player");
}
}
}
}
public static class c extends Handler {
WeakReference<Context> f11048a;
c(Context context) {
this.f11048a = new WeakReference<>(context.getApplicationContext());
}
@Override
public void handleMessage(Message message) {
Context context = this.f11048a.get();
if (context == null) {
bo.d("E", "MediaSessionHandler: no context");
} else {
gs.a(context, message.getData().getBoolean("grab"), message.getData().getBoolean("newAPI"));
}
}
}
public static class g extends Handler {
WeakReference<ExecuteService> f11056a;
g(ExecuteService executeService) {
this.f11056a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.f11056a.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 MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mediaPlayer2) {
if (mediaPlayer2 != null) {
try {
mediaPlayer2.release();
} catch (Exception e2) {
bo.a("E", "rtone: onCompletion exception", e2);
}
}
synchronized (ExecuteService.B) {
String str = null;
Iterator it = ExecuteService.B.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Map.Entry entry = (Map.Entry) it.next();
if (((MediaPlayer) entry.getValue()).equals(mediaPlayer2)) {
str = (String) entry.getKey();
break;
}
}
if (str != null) {
ExecuteService.B.remove(str);
}
}
}
});
mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mediaPlayer2, int i3, int i4) {
bo.d("E", "rtone: media player onError: " + i3 + ",!" + i4);
return false;
}
});
try {
mediaPlayer.setLooping(false);
mediaPlayer.setAudioStreamType(i);
mediaPlayer.setDataSource(executeService, Uri.parse(string));
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException e2) {
bo.a("E", "rtone: " + string, (Exception) e2);
}
synchronized (ExecuteService.B) {
ExecuteService.B.put(ExecuteService.c(i2, string2), mediaPlayer);
}
}
}
public static class h extends Handler {
WeakReference<ExecuteService> f11059a;
h(ExecuteService executeService) {
this.f11059a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.f11059a.get();
if (executeService == null) {
bo.b("E", "TTSCompletedHandler: no service");
return;
}
if (message == null) {
bo.d("E", "TTSCompletedHandler: null message");
} else if (message.what == 0) {
executeService.a("ttscompHandler-ok", (String) null, false);
} else if (message.what == 1) {
executeService.a("ttscompHandler-err", (String) null, true);
}
executeService.f();
}
}
public static class b extends Handler {
WeakReference<ExecuteService> f11047a;
b(ExecuteService executeService) {
this.f11047a = new WeakReference<>(executeService);
}
@Override
public void handleMessage(Message message) {
ExecuteService executeService = this.f11047a.get();
Bundle data = message.getData();
int i = data.getInt(bf.EXTRA_ID);
switch (message.what) {
case 0:
synchronized (executeService.am) {
if (executeService.am.get(Integer.valueOf(i)) != null) {
bo.d("E", "found hanging jsi");
executeService.e(i, false);
}
}
bf runPureScript = bf.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) {
synchronized (executeService.am) {
executeService.am.put(Integer.valueOf(i), runPureScript);
}
return;
} else {
bo.d("E", "jsi load failed");
executeService.e(i, true);
return;
}
case 1:
executeService.e(i, false);
executeService.f();
return;
case 2:
bf.flashErrorBundle(executeService, data);
executeService.e(i, true);
executeService.f();
return;
case 3:
executeService.e(i, true);
executeService.f();
return;
case 4:
bo.d("E", "jsi: " + bf.formatConsoleMessageForLog(executeService, data));
return;
default:
return;
}
}
}
public class d extends Thread {
private boolean f11050b;
public d(ThreadGroup threadGroup, Runnable runnable, String str) {
super(threadGroup, runnable, str);
this.f11050b = false;
}
}
}