正在查看: Tasker v6.5.11 应用的 ri.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 ri.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.text.Html;
import android.text.TextUtils;
import android.widget.TextView;
import com.joaomgcd.taskerm.util.TaskerApp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import net.dinglisch.android.taskerm.cm;
import net.dinglisch.android.taskerm.vo;
public class ri {
private static final String[] e;
private static final int[] f;
private static final int[] g;
private static final String[] h;
private static final String[] i;
private static final String[] j;
private static final String[] k;
private static final int[] l;
private static final String[] m;
private static final String[][] n;
private static final int[][] o;
private static final String[][] p;
private static final String a = Pattern.quote("\\n***\\n*!&$*;");
private static final String[] b = {"com.twofortyfouram.locale.intent.action.EDIT_SETTING", "com.twofortyfouram.locale.intent.action.EDIT_CONDITION", "net.dinglisch.android.tasker.ACTION_EDIT_EVENT"};
private static final String[] c = {"action", "condition", "event"};
private static final int[] d = {1000, 1000, 10000};
private static Map<c, List<ResolveInfo>> q = null;
private static Map<c, String[]> r = null;
private static Map<c, int[]> s = null;
private static Map<c, int[]> t = null;
private static boolean u = true;
class a implements Comparator<ResolveInfo> {
final PackageManager i;
a(PackageManager packageManager) {
this.i = packageManager;
}
@Override
public int compare(ResolveInfo resolveInfo, ResolveInfo resolveInfo2) {
return dq.y(resolveInfo.loadLabel(this.i)).compareTo(dq.y(resolveInfo2.loadLabel(this.i)));
}
}
class b implements Comparator<String> {
final c i;
b(c cVar) {
this.i = cVar;
}
@Override
public int compare(String str, String str2) {
if (ri.X(str)) {
str = ri.k(this.i, str);
}
if (ri.X(str2)) {
str2 = ri.k(this.i, str2);
}
return str.compareToIgnoreCase(str2);
}
}
public enum c {
Action,
Condition,
Event
}
static {
String[] strArr = {"AutoCast", "AutoInput", "AutoNotification", "AutoShortcut", "Bluetooth Connect", "DashClock", "FolderSync", "Google Voice Settings", "Minimalistic Text", "MTK Control", "NFC Plugin", "Screenshot Easy", "Secure Settings", "Send/Expect", "Servers Ultimate", "Synchronize Ultimate", "Synker", "Task Light", "TouchTask", "UDP Sender", "Wol Wake on Lan Wan"};
e = strArr;
int[] iArr = {2131890096, 2131890097, 2131890098, 2131890101, 2131890102, 2131890103, 2131890104, 2131890105, 2131890107, 2131890108, 2131890109, 2131890110, 2131890111, 2131890112, 2131890113, 2131890114, 2131890115, 2131890116, 2131890117, 2131890119, 2131890106};
f = iArr;
int[] iArr2 = {2131890095, 2131890114};
g = iArr2;
String[] strArr2 = {"https://play.google.com/store/apps/details?id=org.kman.AquaMail", "https://play.google.com/store/apps/details?id=com.icecoldapps.synchronizeultimate"};
h = strArr2;
String[] strArr3 = {"Aqua Mail", "Synchronize Ultimate"};
i = strArr3;
String[] strArr4 = {"https://play.google.com/store/apps/details?id=com.joaomgcd.autocast", "https://play.google.com/store/apps/details?id=com.joaomgcd.autoinput", "https://play.google.com/store/apps/details?id=com.joaomgcd.autonotification", "https://play.google.com/store/apps/details?id=com.joaomgcd.autoshortcut", "http://code.google.com/p/a2dp-connect/", "https://play.google.com/store/apps/details?id=net.nurik.roman.dashclock", "http://www.tacit.dk/foldersync", "http://steelgirderdev.com/steelgirderdev/gvsettings.html", "http://wiki.devmil.de/tiki-index.php", "https://play.google.com/store/apps/details?id=pt.joaormf.mtkcontrol", "https://play.google.com/store/apps/details?id=se.badaccess.locale.nfc", "https://play.google.com/store/apps/details?id=com.icecoldapps.screenshoteasy", "http://securesettings.intangibleobject.com/", "https://play.google.com/store/apps/details?id=com.asif.plugin.sendexpect", "https://play.google.com/store/apps/details?id=com.icecoldapps.serversultimate", "https://play.google.com/store/apps/details?id=com.icecoldapps.synchronizeultimate", "http://www.afterhoursdevelopers.com/applications/android/synker-android-sync-widget", "https://play.google.com/store/apps/details?id=com.devuni.flashlight.tasklight", "https://play.google.com/store/apps/details?id=com.balda.touchtask", "https://play.google.com/store/apps/details?id=com.hastarin.android.udpsender", "https://play.google.com/store/apps/details?id=com.benfinnigan.wol"};
j = strArr4;
String[] strArr5 = {"AutoRemote", "AutoShare", "Twilight"};
k = strArr5;
int[] iArr3 = {2131890099, 2131890100, 2131890118};
l = iArr3;
String[] strArr6 = {"https://play.google.com/store/apps/details?id=com.joaomgcd.autoremote", "https://play.google.com/store/apps/details?id=com.joaomgcd.autoshare", "https://play.google.com/store/apps/details?id=com.terdelle.twilight"};
m = strArr6;
n = new String[][]{strArr, strArr5, strArr3};
o = new int[][]{iArr, iArr3, iArr2};
p = new String[][]{strArr4, strArr6, strArr2};
}
private static final synchronized int A(c cVar, int i2, boolean z) {
synchronized (ri.class) {
try {
Map<c, int[]> map = t;
if (map == null) {
r7.N("Plugin", z, "getIndexByOldCode: old pluginCodes null, type " + cVar);
} else if (map.get(cVar) == null) {
r7.N("Plugin", z, "getIndexByOldCode: no old pluginCodes, type " + cVar);
} else {
for (int i3 = 0; i3 < t.get(cVar).length; i3++) {
if (t.get(cVar)[i3] == i2) {
return i3;
}
}
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
public static synchronized int B(c cVar, String str, String str2) {
int i2;
String str3;
synchronized (ri.class) {
try {
Map<c, List<ResolveInfo>> map = q;
if (map != null) {
List<ResolveInfo> list = map.get(cVar);
if (list != null) {
i2 = 0;
while (i2 < list.size()) {
ResolveInfo resolveInfo = list.get(i2);
String str4 = resolveInfo.activityInfo.packageName;
if (str4 != null && str4.equals(str) && (str3 = resolveInfo.activityInfo.name) != null && str3.equals(str2)) {
break;
}
i2++;
}
}
} else {
r7.k("Plugin", "getIndexByPackageAndEditClass: no appInfo");
}
i2 = -1;
} catch (Throwable th2) {
throw th2;
}
}
return i2;
}
private static final synchronized List<Integer> C(c cVar, String str) {
LinkedList linkedList;
synchronized (ri.class) {
try {
linkedList = new LinkedList();
Map<c, String[]> map = r;
if (map == null) {
r7.G("Plugin", "getIndicesByLabel: pluginLabels null, type " + cVar);
} else if (map.get(cVar) == null) {
r7.G("Plugin", "getIndicesByLabel: no pluginLabels, type " + cVar);
} else {
for (int i2 = 0; i2 < r.get(cVar).length; i2++) {
if (r.get(cVar)[i2].equals(str)) {
linkedList.add(Integer.valueOf(i2));
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return linkedList;
}
public static synchronized String D(c cVar, int i2) {
synchronized (ri.class) {
int z = z(cVar, i2, true);
if (z != -1) {
return E(cVar, z);
}
r7.G("Plugin", "getIndexByCode: no match: type: " + cVar + " code " + i2);
d0();
StringBuilder sb = new StringBuilder();
sb.append("glbc: code: ");
sb.append(i2);
r7.G("Plugin", sb.toString());
return "*Unknown Plugin*";
}
}
private static synchronized String E(c cVar, int i2) {
String str;
synchronized (ri.class) {
str = r.get(cVar)[i2];
}
return str;
}
public static synchronized String F(c cVar, String str, String str2, String str3) {
synchronized (ri.class) {
int B = B(cVar, str, str2);
if (B != -1) {
return E(cVar, B);
}
r7.G("Plugin", "glpe: unknown pkg/cls: " + str + " / " + str2);
return str3;
}
}
public static Intent G(Activity activity, c cVar, f fVar, int i2, ArrayList<String> arrayList) {
Intent q2 = q(activity.getPackageManager(), cVar, i2, activity.getString(2131886701));
if (q2 == null) {
dq.a0(activity, 2131887699, new Object[0]);
} else {
if (fVar.k()) {
vo.c.d(fVar.x());
q2.putExtras(fVar.w(null, null, null));
}
if (!dq.F(arrayList)) {
for (int size = arrayList.size() - 1; size >= 0; size--) {
String str = arrayList.get(size);
boolean Y = Y(str);
if (Y) {
str = r(str);
}
if (!kq.W0(str)) {
arrayList.remove(size);
} else if (Y) {
arrayList.set(size, str);
}
}
vo.d(q2, dq.w3(arrayList));
}
}
return q2;
}
public static int H() {
return 3600;
}
public static synchronized String I(c cVar, int i2) {
String str;
synchronized (ri.class) {
str = q.get(cVar).get(i2).activityInfo.packageName;
}
return str;
}
public static synchronized List<String> J(c cVar, String str) {
LinkedList linkedList;
synchronized (ri.class) {
try {
List<ResolveInfo> K = K(cVar, str);
linkedList = null;
if (K != null) {
for (ResolveInfo resolveInfo : K) {
if (resolveInfo.activityInfo.name != null) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(resolveInfo.activityInfo.name);
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return linkedList;
}
public static synchronized List<ResolveInfo> K(c cVar, String str) {
LinkedList linkedList;
synchronized (ri.class) {
try {
linkedList = null;
for (ResolveInfo resolveInfo : q.get(cVar)) {
if (str.equals(resolveInfo.activityInfo.packageName)) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(resolveInfo);
}
}
} catch (Throwable th2) {
throw th2;
}
}
return linkedList;
}
private static String[] L(c cVar) {
if (r.get(cVar) != null) {
return r.get(cVar);
}
r7.G("Plugin", "getPluginLabels: null");
return new String[0];
}
public static synchronized List<String> M(c cVar) {
ArrayList arrayList;
synchronized (ri.class) {
try {
arrayList = new ArrayList();
if (r == null) {
r7.G("Plugin", "getPluginPackages: null pluginLabels");
} else {
for (int i2 = 0; i2 < b0(cVar); i2++) {
String I = I(cVar, i2);
if (!arrayList.contains(I)) {
arrayList.add(I);
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return arrayList;
}
public static String[] N(Resources resources, c cVar) {
return vh.s(resources, o[cVar.ordinal()]);
}
public static String[] O(c cVar) {
return n[cVar.ordinal()];
}
public static String P(c cVar, int i2) {
return p[cVar.ordinal()][i2];
}
public static Intent Q(Context context, c cVar, int i2, Bundle bundle) {
return R(context, cVar, i2, bundle, false);
}
public static synchronized Intent R(Context context, c cVar, int i2, Bundle bundle, boolean z) {
Intent S;
synchronized (ri.class) {
S = S(context, cVar, i2, bundle, z, false);
}
return S;
}
public static synchronized android.content.Intent S(android.content.Context r16, net.dinglisch.android.taskerm.ri.c r17, int r18, android.os.Bundle r19, boolean r20, boolean r21) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.ri.S(android.content.Context, net.dinglisch.android.taskerm.ri$c, int, android.os.Bundle, boolean, boolean):android.content.Intent");
}
public static synchronized boolean T(c cVar, int i2) {
boolean z;
synchronized (ri.class) {
z = z(cVar, i2, false) != -1;
}
return z;
}
public static synchronized boolean U(c cVar, String str) {
synchronized (ri.class) {
String[] f2 = f(str);
if (f2 != null) {
return B(cVar, f2[0], f2[1]) != -1;
}
r7.G("Plugin", "hfc: unknown label type " + cVar + " / " + str);
return false;
}
}
public static synchronized boolean V(c cVar, int i2) {
boolean z;
synchronized (ri.class) {
z = A(cVar, i2, false) != -1;
}
return z;
}
public static synchronized boolean W(Context context) {
boolean z;
synchronized (ri.class) {
try {
r7.f("Plugin", "Plugin.init on thread " + Thread.currentThread().getName());
PackageManager packageManager = context.getPackageManager();
int i2 = 1;
z = true;
if (packageManager == null) {
r7.G("Plugin", "init: no package manager");
} else if (u) {
r7.f("Plugin", "reload plugin data");
q = new HashMap();
r = new HashMap();
s = new HashMap();
t = new HashMap();
c[] values = c.values();
int length = values.length;
int i3 = 0;
while (i3 < length) {
c cVar = values[i3];
long currentTimeMillis = System.currentTimeMillis();
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(new Intent(b[cVar.ordinal()]), 0);
Collections.sort(queryIntentActivities, new a(packageManager));
if (queryIntentActivities == null) {
queryIntentActivities = new ArrayList<>();
r7.f("Plugin", "no plugins found");
}
int i4 = 0;
while (i4 < queryIntentActivities.size()) {
ActivityInfo activityInfo = queryIntentActivities.get(i4).activityInfo;
CharSequence loadLabel = activityInfo.loadLabel(packageManager);
if (loadLabel != null && loadLabel.toString() != null && loadLabel.toString().length() != 0) {
if (th.b(packageManager, new ComponentName(activityInfo.packageName, activityInfo.name))) {
i4 += i2;
} else {
r7.f("Plugin", "skipping plugin with unexported edit activity" + activityInfo.packageName);
queryIntentActivities.remove(i4);
i4--;
i4 += i2;
}
}
r7.G("Plugin", "skipping plugin with null or empty label for " + activityInfo.packageName);
queryIntentActivities.remove(i4);
i4--;
i4 += i2;
}
String[] strArr = new String[queryIntentActivities.size()];
int[] iArr = new int[queryIntentActivities.size()];
int[] iArr2 = new int[queryIntentActivities.size()];
r.put(cVar, strArr);
s.put(cVar, iArr);
t.put(cVar, iArr2);
q.put(cVar, queryIntentActivities);
for (int i5 = 0; i5 < queryIntentActivities.size(); i5++) {
ResolveInfo resolveInfo = queryIntentActivities.get(i5);
String charSequence = resolveInfo.activityInfo.loadLabel(packageManager).toString();
strArr[i5] = charSequence;
iArr2[i5] = d(cVar, charSequence);
ActivityInfo activityInfo2 = resolveInfo.activityInfo;
iArr[i5] = e(cVar, activityInfo2.packageName, activityInfo2.name);
}
String str = c[cVar.ordinal()] + ": ";
for (int i6 = 0; i6 < b0(cVar); i6++) {
if (i6 != 0) {
str = str + ", ";
}
str = str + "PLUG " + strArr[i6] + " (" + iArr[i6] + "/" + iArr2[i6] + ")";
}
if (str.length() > 0) {
r7.f("Plugin", str);
}
TaskerApp.r(currentTimeMillis, "Plugin Init " + cVar);
i3++;
i2 = 1;
}
u = false;
z = true;
} else {
z = false;
}
} catch (Throwable th2) {
throw th2;
}
}
return z;
}
public static boolean X(String str) {
return str.contains("\\n***\\n*!&$*;");
}
public static boolean Y(String str) {
return str.indexOf(kq.a) > 0;
}
private static String Z(String str, String str2) {
return str + "\\n***\\n*!&$*;" + str2;
}
public static synchronized void a(c cVar, String str, List<String> list) {
synchronized (ri.class) {
String lowerCase = str.toLowerCase();
String[] v = v(cVar);
String[] L = L(cVar);
for (int i2 = 0; i2 < L.length; i2++) {
if (L[i2].toLowerCase().contains(lowerCase)) {
list.add(v[i2]);
}
}
}
}
public static synchronized int a0(c cVar) {
int size;
synchronized (ri.class) {
size = M(cVar).size();
}
return size;
}
public static void b(TextView textView, Bundle bundle, String str) {
String[] g2 = vo.g(bundle);
if (g2.length > 0) {
StringBuilder sb = new StringBuilder();
for (String str2 : g2) {
if (sb.length() > 0) {
sb.append("<P/>");
}
String[] h0 = h0(str2);
if (h0 != null) {
String str3 = h0[0];
if (str3 != null && str3.startsWith("%")) {
str3 = c0(str3, str);
}
sb.append("<b>");
sb.append(str3);
sb.append("</b><br>");
sb.append(h0[1]);
if (h0.length > 2) {
sb.append("<br>");
sb.append("<i>");
sb.append(h0[2]);
sb.append("</i>");
}
}
}
CharSequence text = textView.getText();
if (text != null && text.length() > 0) {
textView.append("\n\n");
}
textView.append(Html.fromHtml(sb.toString()));
}
}
public static synchronized int b0(c cVar) {
synchronized (ri.class) {
Map<c, String[]> map = r;
if (map == null) {
r7.G("Plugin", "noPlugins: null pluginLabels");
return 0;
}
String[] strArr = map.get(cVar);
if (strArr != null) {
return strArr.length;
}
r7.G("Plugin", "noPlugins: null pluginLabels (" + cVar + ")");
return 0;
}
}
public static void c(Bundle bundle, Bundle bundle2) {
Bundle l2 = vo.c.l(bundle);
if (l2 != null) {
for (String str : l2.keySet()) {
if (vo.j(str)) {
Object obj = l2.get(str);
if (obj == null) {
if (bundle2.containsKey(str)) {
r7.f("Plugin", "getReturnedVars: var: " + str + " null, delete from local vars");
bundle2.remove(str);
} else {
r7.f("Plugin", "getReturnedVars: var: " + str + " null, no simple value, try delete array indices");
kq.x(null, str, bundle2);
}
} else if (obj.getClass() == String.class) {
String str2 = (String) obj;
r7.f("Plugin", "getReturnedVars: var: " + str + " set: " + str2);
bundle2.putString(str, str2);
} else if (obj.getClass() == String[].class) {
i("getReturnedVars: ", str, (String[]) obj, bundle2);
} else if (obj.getClass() == ArrayList.class) {
kq.Z("Plugin/getReturnedVars: ", str, obj, bundle2);
} else {
r7.G("Plugin", "getReturnedVars: var: " + str + ": value not a string");
}
} else {
r7.G("Plugin", "getReturnedVars: invalid variable name: " + str);
}
}
}
}
public static String c0(String str, String str2) {
if (TextUtils.isEmpty(str2)) {
return str;
}
if (str2.startsWith("%")) {
str2 = str2.substring(1);
}
return "%" + str2 + "_" + str.substring(1);
}
public static synchronized int d(c cVar, String str) {
int u2;
synchronized (ri.class) {
try {
if (str == null) {
r7.G("Plugin", "nameToCode: type " + cVar + " null name");
u2 = 0;
} else {
u2 = d[cVar.ordinal()] + dq.u(str);
}
} catch (Throwable th2) {
throw th2;
}
}
return u2;
}
public static synchronized void d0() {
synchronized (ri.class) {
u = true;
}
}
public static synchronized int e(c cVar, String str, String str2) {
int min;
synchronized (ri.class) {
try {
int v = dq.v(cVar.toString().substring(0, 1) + "." + str + "." + str2);
int i2 = d[cVar.ordinal()];
if (v < 0) {
v = Math.abs(v);
}
min = v + Math.min(Integer.MAX_VALUE - v, i2);
r7.f("Plugin", "PLUG: calcCode: " + cVar + ": " + str + "/" + str2 + " -> " + min + " in " + Thread.currentThread().getName());
} catch (Throwable th2) {
throw th2;
}
}
return min;
}
public static void e0(Context context, bm bmVar, c cVar, cm.a aVar, List<cm> list) {
String[] O = O(cVar);
String[] N = N(context.getResources(), cVar);
HashSet hashSet = new HashSet();
String[] strArr = r.get(cVar);
for (int i2 = 0; i2 < O.length; i2++) {
if (bmVar.b(O[i2]) || bmVar.b(N[i2])) {
cm cmVar = new cm(aVar, O[i2] + (" (" + vh.g(context, dq.v3(O[i2], strArr) == -1 ? 2131890125 : 2131890124, new Object[0]) + ")"), true, null);
cmVar.f = N[i2];
list.add(cmVar);
hashSet.add(O[i2]);
}
}
if (strArr != null) {
for (String str : strArr) {
if (!hashSet.contains(str) && bmVar.b(str)) {
list.add(new cm(aVar, str + " (" + vh.g(context, 2131890124, new Object[0]) + ")", true, null));
}
}
}
}
private static String[] f(String str) {
try {
String[] split = str.split(a);
if (split != null) {
if (split.length == 2) {
return split;
}
}
return null;
} catch (Throwable th2) {
r7.k("Plugin", "demakeFakeLabel: " + th2);
return null;
}
}
public static synchronized int f0(b5 b5Var, int i2, c cVar) {
int i3;
String str;
String str2;
int intValue;
int i4;
synchronized (ri.class) {
int ordinal = cVar.ordinal();
int i5 = 2;
if (ordinal == 0 || ordinal == 1 || ordinal == 2) {
i3 = 1;
} else {
i3 = 0;
i5 = 0;
}
String w = b5Var.N(i3).w();
String w2 = b5Var.N(i5).w();
r7.f("Plugin", "PLUG setMetaData: start: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " clsOrLabel: " + w2);
if (TextUtils.isEmpty(w)) {
if (TextUtils.isEmpty(w2)) {
r7.f("Plugin", "PLUG setMetaData: no package or label, derive from code");
if (V(cVar, i2)) {
try {
int A = A(cVar, i2, true);
w = I(cVar, A);
w2 = p(cVar, A);
i4 = n(cVar, A);
} catch (Exception e2) {
e = e2;
i4 = i2;
}
try {
r7.f("Plugin", "PLUG setMetaData: derived pkg/cls/code from old code " + i2);
} catch (Exception e3) {
e = e3;
r7.l("Plugin", "setMetaData, from oldCode " + i2, e);
i2 = i4;
b5Var.k0(i3, w);
b5Var.k0(i5, w2);
r7.f("Plugin", "PLUG setMetaData: end: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " cls: " + w2 + " label: " + D(cVar, i2));
return i2;
}
i2 = i4;
} else if (T(cVar, i2)) {
try {
int z = z(cVar, i2, true);
w = I(cVar, z);
w2 = p(cVar, z);
r7.f("Plugin", "PLUG setMetaData: turned out to be new code without pkg, added pkg/cls");
} catch (Exception e4) {
r7.l("Plugin", "setMetaData, from code " + i2, e4);
}
} else {
r7.f("Plugin", "PLUG setMetaData: not old or new code");
}
} else {
List<Integer> C = C(cVar, w2);
if (C.size() <= 0) {
r7.G("Plugin", "PLUG setMetaData: no label found: " + w2);
} else if (C.size() > 1) {
r7.f("Plugin", "PLUG setMetaData: multiple entries found for label " + w2 + ", using first");
} else {
try {
intValue = C.get(0).intValue();
w = I(cVar, intValue);
str2 = p(cVar, intValue);
} catch (Exception e5) {
e = e5;
str2 = w2;
}
try {
i2 = n(cVar, intValue);
r7.f("Plugin", "PLUG setMetaData: derived pkg/cls/code from label " + w2);
} catch (Exception e6) {
e = e6;
r7.l("Plugin", "setMetaData, from multiple entries " + w2, e);
w2 = str2;
b5Var.k0(i3, w);
b5Var.k0(i5, w2);
r7.f("Plugin", "PLUG setMetaData: end: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " cls: " + w2 + " label: " + D(cVar, i2));
return i2;
}
w2 = str2;
}
}
b5Var.k0(i3, w);
b5Var.k0(i5, w2);
r7.f("Plugin", "PLUG setMetaData: end: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " cls: " + w2 + " label: " + D(cVar, i2));
} else {
if (!T(cVar, i2)) {
r7.f("Plugin", "PLUG setMetaData: unknown code " + i2);
if (TextUtils.isEmpty(w2)) {
r7.G("Plugin", "PLUG setMetaData: unknown code " + i2 + " and no label, I surrender");
} else {
int B = B(cVar, w, w2);
r7.f("Plugin", "index: " + B);
if (B != -1) {
try {
i2 = n(cVar, B);
r7.f("Plugin", "PLUG setMetaData: derived code " + i2 + " from pkg/class" + w + " / " + w2);
} catch (Exception e7) {
r7.l("Plugin", "setMetaData, from names " + w + "/" + w2, e7);
}
} else {
List<Integer> C2 = C(cVar, w2);
if (C2.size() > 0) {
try {
str = p(cVar, C2.get(0).intValue());
try {
i2 = n(cVar, C2.get(0).intValue());
r7.f("Plugin", "PLUG setMetaData: derived cls / code from pkg / label");
} catch (Exception e8) {
e = e8;
r7.l("Plugin", "setMetaData, from names2 " + w2, e);
w2 = str;
b5Var.k0(i3, w);
b5Var.k0(i5, w2);
r7.f("Plugin", "PLUG setMetaData: end: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " cls: " + w2 + " label: " + D(cVar, i2));
return i2;
}
} catch (Exception e9) {
e = e9;
str = w2;
}
w2 = str;
}
}
}
}
b5Var.k0(i3, w);
b5Var.k0(i5, w2);
r7.f("Plugin", "PLUG setMetaData: end: type: " + cVar.toString() + " code: " + i2 + " pkg: " + w + " cls: " + w2 + " label: " + D(cVar, i2));
}
}
return i2;
}
public static synchronized int g(c cVar, String str, String str2) {
synchronized (ri.class) {
try {
if (str2 == null) {
r7.G("Plugin", "editClassNameToCode: ignoring null name");
} else {
List<ResolveInfo> list = q.get(cVar);
if (list == null) {
r7.G("Plugin", "editClassNameToCode: null appInfoEdit");
} else {
int i2 = 0;
for (ResolveInfo resolveInfo : list) {
if ((str == null || str.equals(resolveInfo.activityInfo.packageName)) && resolveInfo.activityInfo.name.equals(str2)) {
return n(cVar, i2);
}
i2++;
}
}
}
int ordinal = cVar.ordinal();
if (ordinal == 0) {
return -1;
}
if (ordinal != 1) {
return ordinal != 2 ? -1 : -1;
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
public static synchronized void g0(c cVar, List<String> list) {
synchronized (ri.class) {
Collections.sort(list, new b(cVar));
}
}
public static String h(c cVar, String str, String str2, String str3) {
String str4;
String str5;
String[] split = str2.split("\n");
if (split == null || split.length <= 0) {
str4 = null;
str5 = null;
} else {
str5 = split[0];
str4 = split.length > 1 ? split[1] : null;
}
if (str5 == null) {
r7.G("Plugin", "encodePluginVarSpec: bad plugin relevant var spec: " + str2);
return null;
}
String c0 = c0(str5, str3);
if (!kq.W0(c0)) {
r7.G("Plugin", "encodePluginVarSpec: not a local var: " + c0);
return null;
}
if (str4 == null) {
return str + " (" + c0 + ")";
}
return str + ": " + str4 + " (" + c0 + ")";
}
public static String[] h0(String str) {
String substring;
String str2;
int i2;
int indexOf = str.indexOf(10);
String[] strArr = null;
if (indexOf == -1) {
r7.G("Plugin", "bad var spec: no newline" + str);
} else if (indexOf == str.length()) {
r7.G("Plugin", "bad var spec: no label" + str);
} else {
String substring2 = str.substring(0, indexOf);
String substring3 = str.substring(indexOf + 1);
int indexOf2 = substring3.indexOf(10);
if (indexOf2 == -1) {
r7.G("Plugin", "bad var spec: no newline" + substring3);
str2 = null;
substring = null;
i2 = 0;
} else {
substring = substring3.substring(0, indexOf2);
if (substring3.length() > indexOf2) {
str2 = substring3.substring(indexOf2 + 1);
i2 = 3;
} else {
str2 = null;
i2 = 2;
}
}
if (i2 > 0) {
strArr = new String[i2];
strArr[0] = substring2;
strArr[1] = substring;
if (i2 > 2) {
strArr[2] = str2;
}
}
}
return strArr;
}
private static void i(String str, String str2, String[] strArr, Bundle bundle) {
r7.f("Plugin", str + "var: " + str2 + " extract string array values");
int i2 = 0;
while (i2 < strArr.length) {
StringBuilder sb = new StringBuilder();
sb.append(str2);
int i3 = i2 + 1;
sb.append(String.valueOf(i3));
String sb2 = sb.toString();
String str3 = strArr[i2];
if (str3 == null) {
bundle.remove(sb2);
} else {
bundle.putString(sb2, str3);
}
i2 = i3;
}
}
public static boolean i0(Bundle bundle) {
Parcel obtain = Parcel.obtain();
bundle.writeToParcel(obtain, 0);
boolean z = obtain.dataSize() < 100000;
obtain.recycle();
return z;
}
public static synchronized int j(c cVar, String str) {
synchronized (ri.class) {
String[] f2 = f(str);
if (f2 != null) {
return n(cVar, B(cVar, f2[0], f2[1]));
}
r7.G("Plugin", "flc: unknown label type " + cVar + " / " + str);
return -1;
}
}
public static boolean j0(PackageManager packageManager, c cVar, int i2) {
return q(packageManager, cVar, i2, "test") != null;
}
public static synchronized String k(c cVar, String str) {
String l2;
synchronized (ri.class) {
l2 = l(cVar, str, false);
}
return l2;
}
public static synchronized boolean k0(Context context, c cVar, int i2) {
boolean z;
synchronized (ri.class) {
z = Q(context, cVar, i2, null) != null;
}
return z;
}
public static synchronized String l(c cVar, String str, boolean z) {
synchronized (ri.class) {
String[] f2 = f(str);
String str2 = z ? str : "*Unknown Plugin*";
if (f2 != null) {
return F(cVar, f2[0], f2[1], str2);
}
r7.f("Plugin", "fltl: type: " + cVar + ": bad fl: " + str);
return str2;
}
}
public static Intent m(Context context, int i2) {
Intent intent = new Intent("net.dinglisch.android.tasker.ACTION_PLUGIN_FINISHED");
intent.setClassName(context.getPackageName(), ReceiverStaticAlwaysOn.class.getName());
intent.setData(Uri.parse("actionid:" + i2));
return intent;
}
public static final synchronized int n(c cVar, int i2) {
synchronized (ri.class) {
if (s.get(cVar) == null) {
r7.G("Plugin", "getCodeByIndex: null pluginCodes");
return 1000;
}
return s.get(cVar)[i2];
}
}
public static Bundle o(String str, Bundle bundle) {
Bundle l2 = vo.c.l(bundle);
if (l2 == null) {
return l2;
}
for (Object obj : l2.keySet().toArray()) {
String str2 = (String) obj;
if (vo.j(str2)) {
Object obj2 = l2.get(str2);
if (obj2 == null) {
r7.G("Plugin", str + ": " + str2 + ": null value");
} else if (obj2.getClass() != String.class) {
if (obj2.getClass() == String[].class) {
i("getReturnedVars: ", str2, (String[]) obj2, l2);
} else if (obj2.getClass() == ArrayList.class) {
kq.Z("getReturnedVars: ", str2, obj2, l2);
} else {
r7.G("Plugin", str2 + ": bad class");
}
}
} else {
r7.G("Plugin", str2 + ": invalid variable name");
}
l2.remove(str2);
}
if (l2.size() != 0) {
return l2;
}
r7.G("Plugin", "no valid variables specified");
return null;
}
public static synchronized String p(c cVar, int i2) {
String str;
synchronized (ri.class) {
str = q.get(cVar).get(i2).activityInfo.name;
}
return str;
}
public static synchronized Intent q(PackageManager packageManager, c cVar, int i2, String str) {
synchronized (ri.class) {
try {
List<ResolveInfo> list = q.get(cVar);
int z = z(cVar, i2, true);
if (z == -1) {
r7.G("Plugin", "getEditIntent: unknown code: " + i2);
} else if (list == null) {
r7.G("Plugin", "getEditIntent: null appInfoEdit");
} else {
ActivityInfo activityInfo = list.get(z).activityInfo;
ComponentName componentName = new ComponentName(activityInfo.packageName, activityInfo.name);
if (!th.c(packageManager, componentName)) {
r7.f("Plugin", "getEditIntent: activity has no icon: " + componentName);
}
if (!th.d(packageManager, componentName.getPackageName())) {
r7.G("Plugin", "getEditIntent: application not enabled: " + componentName.getPackageName());
} else {
if (th.a(packageManager, componentName)) {
Intent intent = new Intent(b[cVar.ordinal()]);
intent.setComponent(componentName);
intent.putExtra("com.twofortyfouram.locale.intent.extra.BREADCRUMB", str);
vo.c.a(intent, 254);
return intent;
}
r7.G("Plugin", "getEditIntent: activity not enabled: " + componentName);
}
}
return null;
} catch (Throwable th2) {
throw th2;
}
}
}
public static String r(String str) {
int lastIndexOf = str.lastIndexOf("%");
if (lastIndexOf != -1) {
return str.substring(lastIndexOf, str.length() - 1);
}
r7.G("Plugin", "bad encoded plugin var " + str);
return str;
}
public static Bundle s(Intent intent) {
Bundle extras;
if (intent == null) {
r7.f("Plugin", "onActivityResult: null intent back");
extras = null;
} else {
extras = intent.getExtras();
}
if (extras == null) {
return new Bundle();
}
r7.f("Plugin", "plugin: has extras");
if (extras.containsKey("com.twofortyfouram.locale.intent.extra.BUNDLE")) {
r7.f("Plugin", "deconstruct com.twofortyfouram.locale.intent.extra.BUNDLE");
Bundle bundle = extras.getBundle("com.twofortyfouram.locale.intent.extra.BUNDLE");
if (bundle == null) {
r7.G("Plugin", "com.twofortyfouram.locale.intent.extra.BUNDLE value is null");
} else {
try {
extras.putAll(bundle);
} catch (Throwable th2) {
r7.k("Plugin", "com.twofortyfouram.locale.intent.extra.BUNDLE contains invalid class. Please contact plugin's developer with this error: " + th2.getMessage());
}
}
extras.remove("com.twofortyfouram.locale.intent.extra.BUNDLE");
extras.putBoolean("net.dinglisch.android.tasker.subbundled", true);
}
try {
Set<String> keySet = extras.keySet();
if (keySet != null && !keySet.isEmpty()) {
Iterator<String> it = keySet.iterator();
ArrayList<String> arrayList = new ArrayList();
ArrayList<String> arrayList2 = new ArrayList();
if (it != null) {
while (it.hasNext()) {
String next = it.next();
Object obj = extras.get(next);
if (next.equals("class")) {
arrayList2.add(next);
} else if (obj == null) {
arrayList.add(next);
}
}
}
for (String str : arrayList) {
extras.remove(str);
extras.putString(str, "<null>");
}
for (String str2 : arrayList2) {
extras.remove(str2);
r7.G("Plugin", "removed reserved key '" + str2 + "'");
}
}
} catch (Exception e2) {
r7.k("Plugin", "exception iterating plugin bundle: " + e2.toString());
}
dq.l2("processed plugin bundle", extras);
return extras;
}
public static synchronized String t(c cVar, int i2) {
synchronized (ri.class) {
int z = z(cVar, i2, true);
if (z != -1) {
return u(cVar, z);
}
r7.G("Plugin", "gflc: type + " + cVar + " unknown code: " + i2);
return Z("pkg", "cls");
}
}
private static synchronized String u(c cVar, int i2) {
String Z;
synchronized (ri.class) {
Z = Z(I(cVar, i2), p(cVar, i2));
}
return Z;
}
private static String[] v(c cVar) {
if (r.get(cVar) == null) {
r7.G("Plugin", "getPluginLabels: null");
return new String[0];
}
int length = s.get(cVar).length;
String[] strArr = new String[length];
for (int i2 = 0; i2 < length; i2++) {
strArr[i2] = u(cVar, i2);
}
return strArr;
}
public static int w(Intent intent) {
Uri data = intent.getData();
if (data == null) {
r7.G("Plugin", "getIDFromIntent: no data in intent");
} else {
String schemeSpecificPart = data.getSchemeSpecificPart();
if (schemeSpecificPart == null) {
r7.G("Plugin", "getIDFromIntent: no ID in uri: " + data);
} else {
Integer E3 = dq.E3(schemeSpecificPart);
if (E3 != null) {
return E3.intValue();
}
r7.G("Plugin", "getIDFromIntent: bad ID: " + schemeSpecificPart);
}
}
return Integer.MAX_VALUE;
}
public static synchronized Drawable x(c cVar, PackageManager packageManager, int i2) {
synchronized (ri.class) {
int z = z(cVar, i2, true);
if (z != -1) {
return y(cVar, packageManager, z);
}
r7.G("Plugin", "getIconByCode: no match: type: " + cVar + " code " + i2);
d0();
return null;
}
}
public static synchronized Drawable y(c cVar, PackageManager packageManager, int i2) {
Drawable loadIcon;
synchronized (ri.class) {
ResolveInfo resolveInfo = q.get(cVar).get(i2);
loadIcon = resolveInfo.activityInfo.loadIcon(packageManager);
if (loadIcon == null) {
loadIcon = resolveInfo.loadIcon(packageManager);
}
}
return loadIcon;
}
private static final synchronized int z(c cVar, int i2, boolean z) {
synchronized (ri.class) {
try {
Map<c, int[]> map = s;
if (map == null) {
r7.N("Plugin", z, "getIndexByCode: pluginCodes null, type " + cVar);
} else if (map.get(cVar) == null) {
r7.N("Plugin", z, "getIndexByCode: no pluginCodes type " + cVar);
} else {
for (int i3 = 0; i3 < s.get(cVar).length; i3++) {
if (s.get(cVar)[i3] == i2) {
return i3;
}
}
r7.N("Plugin", z, "non-existing plugin code type " + cVar + ": " + i2);
}
return -1;
} catch (Throwable th2) {
throw th2;
}
}
}
}