ComeetChat v1.866866806590版本的 MD5 值为:4a7461802cd62adce19de75377dd7ca7
以下内容为反编译后的 di.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.ComponentInfo;
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.os.Process;
import android.text.Html;
import android.text.TextUtils;
import android.widget.TextView;
import androidx.core.app.NotificationCompat;
import java.util.ArrayList;
import java.util.Collection;
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.danlew.android.joda.R;
import net.dinglisch.android.taskerm.fc;
import net.dinglisch.android.taskerm.ga;
public class di {
private static final String f12709a = Pattern.quote("\\n***\\n*!&$*;");
private static final String[] f12710b = {"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[] f12711c = {"action", "condition", NotificationCompat.CATEGORY_EVENT};
private static final int[] f12712d = {1000, 1000, 10000};
private static final String[] f12713e = {"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"};
private static final int[] f12714f = {R.string.plug_descr_autocast, R.string.plug_descr_autoinput, R.string.plug_descr_autonotification, R.string.plug_descr_autoshortcut, R.string.plug_descr_btconnect, R.string.plug_descr_dashclock, R.string.plug_descr_foldersync, R.string.plug_descr_gvsettings, R.string.plug_descr_mintext, R.string.plug_descr_mtkcontrol, R.string.plug_descr_nfc, R.string.plug_descr_screenshot_easy, R.string.plug_descr_securesettings, R.string.plug_descr_sendexpect, R.string.plug_descr_servers_ultimate, R.string.plug_descr_synchronize_ultimate, R.string.plug_descr_synker, R.string.plug_descr_task_light, R.string.plug_descr_touchtask, R.string.plug_descr_udpsender, R.string.plug_descr_lanwan};
private static final int[] g = {R.string.plug_descr_aquamail, R.string.plug_descr_synchronize_ultimate};
private static final String[] h = {"https://play.google.com/store/apps/details?id=org.kman.AquaMail", "https://play.google.com/store/apps/details?id=com.icecoldapps.synchronizeultimate"};
private static final String[] i = {"Aqua Mail", "Synchronize Ultimate"};
private static final String[] j = {"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"};
private static final String[] k = {"AutoRemote", "AutoShare", "Twilight"};
private static final int[] l = {R.string.plug_descr_autoremote, R.string.plug_descr_autoshare, R.string.plug_descr_twilight};
private static final String[] m = {"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"};
private static final String[][] n = {f12713e, k, i};
private static final int[][] o = {f12714f, l, g};
private static final String[][] p = {j, m, h};
private static Map<a, List<ResolveInfo>> q = null;
private static Map<a, String[]> r = null;
private static Map<a, int[]> s = null;
private static Map<a, int[]> t = null;
private static boolean u = true;
public enum a {
Action,
Condition,
Event
}
public static int b() {
return 3600;
}
public static synchronized void a(a aVar, String str, List<String> list) {
synchronized (di.class) {
String lowerCase = str.toLowerCase();
String[] f2 = f(aVar);
String[] e2 = e(aVar);
for (int i2 = 0; i2 < e2.length; i2++) {
if (e2[i2].toLowerCase().contains(lowerCase)) {
list.add(f2[i2]);
}
}
}
}
private static String[] e(a aVar) {
if (r.get(aVar) == null) {
bo.d("Plugin", "getPluginLabels: null");
return new String[0];
}
return r.get(aVar);
}
private static String[] f(a aVar) {
if (r.get(aVar) == null) {
bo.d("Plugin", "getPluginLabels: null");
return new String[0];
}
String[] strArr = new String[s.get(aVar).length];
for (int i2 = 0; i2 < strArr.length; i2++) {
strArr[i2] = j(aVar, i2);
}
return strArr;
}
public static synchronized boolean a(a aVar, int i2) {
boolean z;
synchronized (di.class) {
z = b(aVar, i2, false) != -1;
}
return z;
}
public static synchronized int a(a aVar) {
synchronized (di.class) {
if (r == null) {
bo.d("Plugin", "noPlugins: null pluginLabels");
return 0;
}
String[] strArr = r.get(aVar);
if (strArr == null) {
bo.d("Plugin", "noPlugins: null pluginLabels (" + aVar + ")");
return 0;
}
return strArr.length;
}
}
public static synchronized List<String> b(a aVar) {
ArrayList arrayList;
synchronized (di.class) {
arrayList = new ArrayList();
if (r == null) {
bo.d("Plugin", "getPluginPackages: null pluginLabels");
} else {
for (int i2 = 0; i2 < a(aVar); i2++) {
String f2 = f(aVar, i2);
if (!arrayList.contains(f2)) {
arrayList.add(f2);
}
}
}
}
return arrayList;
}
public static synchronized int c(a aVar) {
int size;
synchronized (di.class) {
size = b(aVar).size();
}
return size;
}
public static synchronized Drawable a(a aVar, PackageManager packageManager, int i2) {
Drawable loadIcon;
synchronized (di.class) {
ResolveInfo resolveInfo = q.get(aVar).get(i2);
loadIcon = resolveInfo.activityInfo.loadIcon(packageManager);
if (loadIcon == null) {
loadIcon = resolveInfo.loadIcon(packageManager);
}
}
return loadIcon;
}
public static Intent a(Context context, a aVar, int i2, Bundle bundle) {
return a(context, aVar, i2, bundle, false);
}
public static synchronized Intent a(Context context, a aVar, int i2, Bundle bundle, boolean z) {
Intent a2;
synchronized (di.class) {
a2 = a(context, aVar, i2, bundle, z, false);
}
return a2;
}
public static synchronized Intent a(Context context, a aVar, int i2, Bundle bundle, boolean z, boolean z2) {
Intent intent;
List<ResolveInfo> list;
synchronized (di.class) {
int b2 = b(aVar, i2, true);
Intent intent2 = null;
if (b2 == -1) {
bo.d("Plugin", "getPluginIntent: unknown code: " + i2);
} else if (q == null) {
bo.d("Plugin", "getPluginIntent: null appInfo");
} else {
PackageManager packageManager = context.getPackageManager();
switch (aVar) {
case Action:
intent = new Intent((bundle == null || !bundle.containsKey("com.twofortyfouram.locale.intent.extra.ACTION_FIRE")) ? "com.twofortyfouram.locale.intent.action.FIRE_SETTING" : bundle.getString("com.twofortyfouram.locale.intent.extra.ACTION_FIRE"));
break;
case Condition:
case Event:
intent = new Intent("com.twofortyfouram.locale.intent.action.QUERY_CONDITION");
break;
default:
bo.c("Plugin", "getReceiverIntent: called unhandled type " + aVar);
return null;
}
String f2 = f(aVar, b2);
int i3 = 0;
try {
if (!z) {
list = packageManager.queryBroadcastReceivers(intent, 0);
} else {
list = packageManager.queryIntentServices(intent, 0);
}
} catch (Exception e2) {
bo.a("Plugin", "getReceiverIntent:" + f2, e2);
list = null;
}
if (!gs.a((Collection<?>) list)) {
Intent intent3 = null;
for (ResolveInfo resolveInfo : list) {
ComponentInfo componentInfo = z ? resolveInfo.serviceInfo : resolveInfo.activityInfo;
if (componentInfo.packageName.equals(f2)) {
String str = z ? resolveInfo.serviceInfo.permission : resolveInfo.activityInfo.permission;
ComponentName componentName = new ComponentName(componentInfo.packageName, componentInfo.name);
if (!cr.e(packageManager, componentInfo.packageName)) {
bo.d("Plugin", "warning: plugin package " + componentInfo.packageName + " is not installed internally");
}
if (!TextUtils.isEmpty(str) && context.checkPermission(str, Process.myPid(), Process.myUid()) != 0) {
String str2 = "receiver " + componentInfo.name + " requires permission " + str + " which we don't have";
bo.d("Plugin", str2);
if (z2) {
throw new SecurityException(str2);
}
if (intent3 != null) {
intent3.putExtra("net.dinglisch.android.tasker.EXTRA_TARGET_API", componentInfo.applicationInfo.targetSdkVersion);
}
i3++;
}
intent.setComponent(new ComponentName(f2, componentInfo.name));
intent.addFlags(4);
ga.c.a(intent, 254);
intent3 = intent;
if (intent3 != null) {
}
i3++;
}
}
if (i3 > 1) {
bo.d("Plugin", "multiple receivers for package " + f2 + ", ignoring");
} else {
intent2 = intent3;
}
} else if (!z) {
bo.d("Plugin", "no receivers for package " + f2 + ", ignoring");
}
if (intent2 == null && !z) {
bo.d("Plugin", "no acceptable receiver for package " + f2);
}
}
return intent2;
}
}
private static synchronized String i(a aVar, int i2) {
String str;
synchronized (di.class) {
str = r.get(aVar)[i2];
}
return str;
}
public static synchronized String b(a aVar, int i2) {
synchronized (di.class) {
int b2 = b(aVar, i2, true);
if (b2 == -1) {
bo.d("Plugin", "getIndexByCode: no match: type: " + aVar + " code " + i2);
a();
StringBuilder sb = new StringBuilder();
sb.append("glbc: code: ");
sb.append(i2);
bo.d("Plugin", sb.toString());
return "*Unknown Plugin*";
}
return i(aVar, b2);
}
}
public static synchronized Drawable b(a aVar, PackageManager packageManager, int i2) {
synchronized (di.class) {
int b2 = b(aVar, i2, true);
if (b2 == -1) {
bo.d("Plugin", "getIconByCode: no match: type: " + aVar + " code " + i2);
a();
return null;
}
return a(aVar, packageManager, b2);
}
}
private static final synchronized int a(a aVar, int i2, boolean z) {
synchronized (di.class) {
if (t == null) {
bo.a("Plugin", z, "getIndexByOldCode: old pluginCodes null, type " + aVar);
} else if (t.get(aVar) == null) {
bo.a("Plugin", z, "getIndexByOldCode: no old pluginCodes, type " + aVar);
} else {
for (int i3 = 0; i3 < t.get(aVar).length; i3++) {
if (t.get(aVar)[i3] == i2) {
return i3;
}
}
}
return -1;
}
}
private static final synchronized int b(a aVar, int i2, boolean z) {
synchronized (di.class) {
if (s == null) {
bo.a("Plugin", z, "getIndexByCode: pluginCodes null, type " + aVar);
} else if (s.get(aVar) == null) {
bo.a("Plugin", z, "getIndexByCode: no pluginCodes type " + aVar);
} else {
for (int i3 = 0; i3 < s.get(aVar).length; i3++) {
if (s.get(aVar)[i3] == i2) {
return i3;
}
}
bo.a("Plugin", z, "non-existing plugin code type " + aVar + ": " + i2);
}
return -1;
}
}
private static final synchronized List<Integer> g(a aVar, String str) {
LinkedList linkedList;
synchronized (di.class) {
linkedList = new LinkedList();
if (r == null) {
bo.d("Plugin", "getIndicesByLabel: pluginLabels null, type " + aVar);
} else if (r.get(aVar) == null) {
bo.d("Plugin", "getIndicesByLabel: no pluginLabels, type " + aVar);
} else {
for (int i2 = 0; i2 < r.get(aVar).length; i2++) {
if (r.get(aVar)[i2].equals(str)) {
linkedList.add(Integer.valueOf(i2));
}
}
}
}
return linkedList;
}
public static final synchronized int c(a aVar, int i2) {
synchronized (di.class) {
if (s.get(aVar) == null) {
bo.d("Plugin", "getCodeByIndex: null pluginCodes");
return 1000;
}
return s.get(aVar)[i2];
}
}
public static synchronized void a() {
synchronized (di.class) {
u = true;
}
}
public static synchronized List<String> a(a aVar, String str) {
LinkedList linkedList;
synchronized (di.class) {
linkedList = null;
List<ResolveInfo> b2 = b(aVar, str);
if (b2 != null) {
for (ResolveInfo resolveInfo : b2) {
if (resolveInfo.activityInfo.name != null) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(resolveInfo.activityInfo.name);
}
}
}
}
return linkedList;
}
public static synchronized List<ResolveInfo> b(a aVar, String str) {
LinkedList linkedList;
synchronized (di.class) {
linkedList = null;
for (ResolveInfo resolveInfo : q.get(aVar)) {
if (str.equals(resolveInfo.activityInfo.packageName)) {
if (linkedList == null) {
linkedList = new LinkedList();
}
linkedList.add(resolveInfo);
}
}
}
return linkedList;
}
public static synchronized boolean a(Context context) {
boolean z;
boolean z2;
synchronized (di.class) {
bo.b("Plugin", "Plugin.init on thread " + Thread.currentThread().getName());
final PackageManager packageManager = context.getPackageManager();
z = true;
if (packageManager == null) {
bo.d("Plugin", "init: no package manager");
} else if (u) {
bo.b("Plugin", "reload plugin data");
q = new HashMap();
r = new HashMap();
s = new HashMap();
t = new HashMap();
for (a aVar : a.values()) {
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(new Intent(f12710b[aVar.ordinal()]), 0);
Collections.sort(queryIntentActivities, new Comparator<ResolveInfo>() {
@Override
public int compare(ResolveInfo resolveInfo, ResolveInfo resolveInfo2) {
return gs.a(resolveInfo.loadLabel(packageManager)).compareTo(gs.a(resolveInfo2.loadLabel(packageManager)));
}
});
if (queryIntentActivities == null) {
queryIntentActivities = new ArrayList<>();
bo.b("Plugin", "no plugins found");
}
int i2 = 0;
while (i2 < queryIntentActivities.size()) {
ActivityInfo activityInfo = queryIntentActivities.get(i2).activityInfo;
CharSequence loadLabel = activityInfo.loadLabel(packageManager);
if (loadLabel != null && loadLabel.toString() != null && loadLabel.toString().length() != 0) {
if (!cr.c(packageManager, new ComponentName(activityInfo.packageName, activityInfo.name))) {
bo.b("Plugin", "skipping plugin with unexported edit activity" + activityInfo.packageName);
z2 = false;
if (cr.c(packageManager, activityInfo.packageName)) {
bo.b("Plugin", "warning: plugin package " + activityInfo.packageName + " is debuggable");
}
if (!cr.f(packageManager, activityInfo.packageName)) {
bo.b("Plugin", "warning: plugin package " + activityInfo.packageName + " has Manifest install location not internalOnly");
}
if (!z2) {
queryIntentActivities.remove(i2);
i2--;
}
i2++;
} else {
z2 = true;
if (cr.c(packageManager, activityInfo.packageName)) {
}
if (!cr.f(packageManager, activityInfo.packageName)) {
}
if (!z2) {
}
i2++;
}
}
bo.d("Plugin", "skipping plugin with null or empty label for " + activityInfo.packageName);
z2 = false;
if (cr.c(packageManager, activityInfo.packageName)) {
}
if (!cr.f(packageManager, activityInfo.packageName)) {
}
if (!z2) {
}
i2++;
}
String[] strArr = new String[queryIntentActivities.size()];
int[] iArr = new int[queryIntentActivities.size()];
int[] iArr2 = new int[queryIntentActivities.size()];
r.put(aVar, strArr);
s.put(aVar, iArr);
t.put(aVar, iArr2);
q.put(aVar, queryIntentActivities);
for (int i3 = 0; i3 < queryIntentActivities.size(); i3++) {
ResolveInfo resolveInfo = queryIntentActivities.get(i3);
strArr[i3] = resolveInfo.activityInfo.loadLabel(packageManager).toString();
iArr2[i3] = f(aVar, strArr[i3]);
iArr[i3] = c(aVar, resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
}
String str = f12711c[aVar.ordinal()] + ": ";
for (int i4 = 0; i4 < a(aVar); i4++) {
if (i4 != 0) {
str = str + ", ";
}
str = str + "PLUG " + strArr[i4] + " (" + iArr[i4] + "/" + iArr2[i4] + ")";
}
if (str.length() > 0) {
bo.b("Plugin", str);
}
}
u = false;
} else {
z = false;
}
}
return z;
}
public static Bundle a(Intent intent) {
Bundle extras;
if (intent == null) {
bo.b("Plugin", "onActivityResult: null intent back");
extras = null;
} else {
extras = intent.getExtras();
}
if (extras == null) {
return new Bundle();
}
bo.b("Plugin", "plugin: has extras");
if (extras.containsKey("com.twofortyfouram.locale.intent.extra.BUNDLE")) {
bo.b("Plugin", "deconstruct com.twofortyfouram.locale.intent.extra.BUNDLE");
Bundle bundle = extras.getBundle("com.twofortyfouram.locale.intent.extra.BUNDLE");
if (bundle == null) {
bo.d("Plugin", "com.twofortyfouram.locale.intent.extra.BUNDLE value is null");
} else {
try {
extras.putAll(bundle);
} catch (Throwable th) {
bo.c("Plugin", "com.twofortyfouram.locale.intent.extra.BUNDLE contains invalid class. Please contact plugin's developer with this error: " + th.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);
bo.d("Plugin", "removed reserved key '" + str2 + "'");
}
}
} catch (Exception e2) {
bo.c("Plugin", "exception iterating plugin bundle: " + e2.toString());
}
gs.a("processed plugin bundle", extras);
return extras;
}
public static synchronized Intent a(PackageManager packageManager, a aVar, int i2, String str) {
synchronized (di.class) {
List<ResolveInfo> list = q.get(aVar);
int b2 = b(aVar, i2, true);
if (b2 == -1) {
bo.d("Plugin", "getEditIntent: unknown code: " + i2);
} else if (list == null) {
bo.d("Plugin", "getEditIntent: null appInfoEdit");
} else {
ResolveInfo resolveInfo = list.get(b2);
ComponentName componentName = new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
if (!cr.e(packageManager, componentName)) {
bo.b("Plugin", "getEditIntent: activity has no icon: " + componentName);
}
if (!cr.a(packageManager, componentName.getPackageName())) {
bo.d("Plugin", "getEditIntent: application not enabled: " + componentName.getPackageName());
} else if (!cr.g(packageManager, componentName)) {
bo.d("Plugin", "getEditIntent: activity not enabled: " + componentName);
} else {
Intent intent = new Intent(f12710b[aVar.ordinal()]);
intent.setComponent(componentName);
intent.putExtra("com.twofortyfouram.locale.intent.extra.BREADCRUMB", str);
ga.c.a(intent, 254);
return intent;
}
}
return null;
}
}
public static synchronized int a(a aVar, String str, String str2) {
synchronized (di.class) {
try {
if (str2 == null) {
bo.d("Plugin", "editClassNameToCode: ignoring null name");
} else {
List<ResolveInfo> list = q.get(aVar);
if (list == null) {
bo.d("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 c(aVar, i2);
}
i2++;
}
}
}
switch (aVar) {
case Action:
return -1;
case Condition:
return -1;
case Event:
return -1;
default:
return -1;
}
} catch (Throwable th) {
throw th;
}
}
}
public static synchronized boolean a(Context context, a aVar, int i2) {
boolean z;
synchronized (di.class) {
z = a(context, aVar, i2, (Bundle) null) != null;
}
return z;
}
public static boolean a(Bundle bundle) {
Parcel obtain = Parcel.obtain();
bundle.writeToParcel(obtain, 0);
boolean z = obtain.dataSize() < 100000;
obtain.recycle();
return z;
}
public static boolean a(PackageManager packageManager, a aVar, int i2) {
return a(packageManager, aVar, i2, "test") != null;
}
public static Bundle a(String str, Bundle bundle) {
boolean z;
Bundle a2 = ga.c.a(bundle);
if (a2 == null) {
return a2;
}
for (Object obj : a2.keySet().toArray()) {
String str2 = (String) obj;
if (ga.a(str2)) {
Object obj2 = a2.get(str2);
if (obj2 == null) {
bo.d("Plugin", str + ": " + str2 + ": null value");
} else if (obj2.getClass() == String.class) {
z = true;
if (z) {
a2.remove(str2);
}
} else if (obj2.getClass() == String[].class) {
a("getReturnedVars: ", str2, (String[]) obj2, a2);
} else if (obj2.getClass() == ArrayList.class) {
gx.b("getReturnedVars: ", str2, obj2, a2);
} else {
bo.d("Plugin", str2 + ": bad class");
}
} else {
bo.d("Plugin", str2 + ": invalid variable name");
}
z = false;
if (z) {
}
}
if (a2.size() != 0) {
return a2;
}
bo.d("Plugin", "no valid variables specified");
return null;
}
private static void a(String str, String str2, String[] strArr, Bundle bundle) {
bo.b("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();
if (strArr[i2] == null) {
bundle.remove(sb2);
} else {
bundle.putString(sb2, strArr[i2]);
}
i2 = i3;
}
}
public static String d(a aVar, int i2) {
return p[aVar.ordinal()][i2];
}
public static String[] d(a aVar) {
return n[aVar.ordinal()];
}
public static String[] a(Resources resources, a aVar) {
return ct.a(resources, o[aVar.ordinal()]);
}
public static Intent a(Activity activity, a aVar, f fVar, int i2, ArrayList<String> arrayList) {
Intent a2 = a(activity.getPackageManager(), aVar, i2, activity.getString(R.string.app_name));
if (a2 == null) {
gs.d(activity, R.string.err_missing_plugin, new Object[0]);
} else {
if (fVar.g()) {
ga.c.e(fVar.c());
a2.putExtras(fVar.a((Context) null, (String) null, (Bundle) null));
}
if (!gs.a((Collection<?>) arrayList)) {
for (int size = arrayList.size() - 1; size >= 0; size--) {
String str = arrayList.get(size);
boolean b2 = b(str);
if (b2) {
str = a(str);
}
if (!gx.o(str)) {
arrayList.remove(size);
} else if (b2) {
arrayList.set(size, str);
}
}
ga.a(a2, gs.a((List<String>) arrayList));
}
}
return a2;
}
public static String a(String str) {
int lastIndexOf = str.lastIndexOf("%");
if (lastIndexOf == -1) {
bo.d("Plugin", "bad encoded plugin var " + str);
return str;
}
return str.substring(lastIndexOf, str.length() - 1);
}
public static boolean b(String str) {
return str.indexOf(gx.f13581a) > 0;
}
public static String b(a aVar, String str, String str2) {
String str3;
String str4;
String[] split = str2.split("\n");
if (split == null || split.length <= 0) {
str3 = null;
str4 = null;
} else {
str4 = split[0];
str3 = split.length > 1 ? split[1] : null;
}
if (str4 != null) {
if (!gx.o(str4)) {
bo.d("Plugin", "encodePluginVarSpec: not a local var: " + str4);
return null;
}
if (str3 != null) {
return str + ": " + str3 + " (" + str4 + ")";
}
return str + " (" + str4 + ")";
}
bo.d("Plugin", "encodePluginVarSpec: bad plugin relevant var spec: " + str2);
return null;
}
public static Intent a(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 void a(Bundle bundle, Bundle bundle2) {
Bundle a2 = ga.c.a(bundle);
if (a2 != null) {
for (String str : a2.keySet()) {
if (ga.a(str)) {
Object obj = a2.get(str);
if (obj == null) {
if (bundle2.containsKey(str)) {
bo.b("Plugin", "getReturnedVars: var: " + str + " null, delete from local vars");
bundle2.remove(str);
} else {
bo.b("Plugin", "getReturnedVars: var: " + str + " null, no simple value, try delete array indices");
gx.k(null, str, bundle2);
}
} else if (obj.getClass() == String.class) {
String str2 = (String) obj;
bo.b("Plugin", "getReturnedVars: var: " + str + " set: " + str2);
bundle2.putString(str, str2);
} else if (obj.getClass() == String[].class) {
a("getReturnedVars: ", str, (String[]) obj, bundle2);
} else if (obj.getClass() == ArrayList.class) {
gx.b("Plugin/getReturnedVars: ", str, obj, bundle2);
} else {
bo.d("Plugin", "getReturnedVars: var: " + str + ": value not a string");
}
} else {
bo.d("Plugin", "getReturnedVars: invalid variable name: " + str);
}
}
}
}
public static int b(Intent intent) {
Uri data = intent.getData();
if (data == null) {
bo.d("Plugin", "getIDFromIntent: no data in intent");
} else {
String schemeSpecificPart = data.getSchemeSpecificPart();
if (schemeSpecificPart == null) {
bo.d("Plugin", "getIDFromIntent: no ID in uri: " + data);
} else {
Integer c2 = gs.c(schemeSpecificPart);
if (c2 == null) {
bo.d("Plugin", "getIDFromIntent: bad ID: " + schemeSpecificPart);
} else {
return c2.intValue();
}
}
}
return Integer.MAX_VALUE;
}
public static void a(Context context, fb fbVar, a aVar, fc.a aVar2, List<fc> list) {
String[] d2 = d(aVar);
String[] a2 = a(context.getResources(), aVar);
HashSet hashSet = new HashSet();
String[] strArr = r.get(aVar);
int i2 = 0;
while (true) {
int length = d2.length;
int i3 = R.string.plugin_installed;
if (i2 >= length) {
break;
}
if (fbVar.a(d2[i2]) || fbVar.a(a2[i2])) {
if (gs.b(d2[i2], strArr) == -1) {
i3 = R.string.plugin_not_installed;
}
fc fcVar = new fc(aVar2, d2[i2] + (" (" + ct.a(context, i3, new Object[0]) + ")"), true, null);
fcVar.f13240f = a2[i2];
list.add(fcVar);
hashSet.add(d2[i2]);
}
i2++;
}
if (strArr != null) {
for (String str : strArr) {
if (!hashSet.contains(str) && fbVar.a(str)) {
list.add(new fc(aVar2, str + " (" + ct.a(context, R.string.plugin_installed, new Object[0]) + ")", true, null));
}
}
}
}
public static String[] c(String str) {
String substring;
String str2;
int i2;
int indexOf = str.indexOf(10);
String[] strArr = null;
if (indexOf == -1) {
bo.d("Plugin", "bad var spec: no newline" + str);
} else if (indexOf == str.length()) {
bo.d("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) {
bo.d("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;
}
public static void a(TextView textView, Bundle bundle) {
String[] a2 = ga.a(bundle);
if (a2.length > 0) {
StringBuilder sb = new StringBuilder();
for (String str : a2) {
if (sb.length() > 0) {
sb.append("<P/>");
}
String[] c2 = c(str);
if (c2 != null) {
sb.append("<b>");
sb.append(c2[0]);
sb.append("</b><br>");
sb.append(c2[1]);
if (c2.length > 2) {
sb.append("<br>");
sb.append("<i>");
sb.append(c2[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 boolean c(a aVar, String str) {
synchronized (di.class) {
String[] e2 = e(str);
if (e2 == null) {
bo.d("Plugin", "hfc: unknown label type " + aVar + " / " + str);
return false;
}
return d(aVar, e2[0], e2[1]) != -1;
}
}
private static synchronized String j(a aVar, int i2) {
String a2;
synchronized (di.class) {
a2 = a(f(aVar, i2), g(aVar, i2));
}
return a2;
}
public static synchronized String e(a aVar, int i2) {
synchronized (di.class) {
int b2 = b(aVar, i2, true);
if (b2 == -1) {
bo.d("Plugin", "gflc: type + " + aVar + " unknown code: " + i2);
return a("pkg", "cls");
}
return j(aVar, b2);
}
}
public static synchronized int d(a aVar, String str) {
synchronized (di.class) {
String[] e2 = e(str);
if (e2 == null) {
bo.d("Plugin", "flc: unknown label type " + aVar + " / " + str);
return -1;
}
return c(aVar, d(aVar, e2[0], e2[1]));
}
}
public static synchronized String e(a aVar, String str) {
String a2;
synchronized (di.class) {
a2 = a(aVar, str, false);
}
return a2;
}
public static synchronized String a(a aVar, String str, boolean z) {
synchronized (di.class) {
String[] e2 = e(str);
String str2 = z ? str : "*Unknown Plugin*";
if (e2 == null) {
bo.b("Plugin", "fltl: type: " + aVar + ": bad fl: " + str);
return str2;
}
return a(aVar, e2[0], e2[1], str2);
}
}
public static boolean d(String str) {
return str.contains("\\n***\\n*!&$*;");
}
private static String[] e(String str) {
try {
String[] split = str.split(f12709a);
if (split != null) {
if (split.length == 2) {
return split;
}
}
return null;
} catch (Throwable th) {
bo.c("Plugin", "demakeFakeLabel: " + th);
return null;
}
}
private static String a(String str, String str2) {
return str + "\\n***\\n*!&$*;" + str2;
}
public static synchronized int c(a aVar, String str, String str2) {
int min;
synchronized (di.class) {
int i2 = gs.i(aVar.toString().substring(0, 1) + "." + str + "." + str2);
int i3 = f12712d[aVar.ordinal()];
if (i2 < 0) {
i2 = Math.abs(i2);
}
min = i2 + Math.min(Integer.MAX_VALUE - i2, i3);
bo.b("Plugin", "PLUG: calcCode: " + aVar + ": " + str + "/" + str2 + " -> " + min + " in " + Thread.currentThread().getName());
}
return min;
}
public static synchronized int f(a aVar, String str) {
int i2;
synchronized (di.class) {
i2 = 0;
try {
if (str == null) {
bo.d("Plugin", "nameToCode: type " + aVar + " null name");
} else {
i2 = gs.j(str) + f12712d[aVar.ordinal()];
}
} catch (Throwable th) {
throw th;
}
}
return i2;
}
public static synchronized String f(a aVar, int i2) {
String str;
synchronized (di.class) {
str = q.get(aVar).get(i2).activityInfo.packageName;
}
return str;
}
public static synchronized void a(final a aVar, List<String> list) {
synchronized (di.class) {
Collections.sort(list, new Comparator<String>() {
@Override
public int compare(String str, String str2) {
if (di.d(str)) {
str = di.e(a.this, str);
}
if (di.d(str2)) {
str2 = di.e(a.this, str2);
}
return str.compareToIgnoreCase(str2);
}
});
}
}
public static synchronized String g(a aVar, int i2) {
String str;
synchronized (di.class) {
str = q.get(aVar).get(i2).activityInfo.name;
}
return str;
}
public static synchronized String a(a aVar, String str, String str2, String str3) {
synchronized (di.class) {
int d2 = d(aVar, str, str2);
if (d2 == -1) {
bo.d("Plugin", "glpe: unknown pkg/cls: " + str + " / " + str2);
return str3;
}
return i(aVar, d2);
}
}
public static synchronized int d(a aVar, String str, String str2) {
int i2;
synchronized (di.class) {
i2 = -1;
if (q == null) {
bo.c("Plugin", "getIndexByPackageAndEditClass: no appInfo");
} else {
List<ResolveInfo> list = q.get(aVar);
if (list != null) {
int i3 = 0;
while (true) {
if (i3 >= list.size()) {
break;
}
ResolveInfo resolveInfo = list.get(i3);
if (resolveInfo.activityInfo.packageName != null && resolveInfo.activityInfo.packageName.equals(str) && resolveInfo.activityInfo.name != null && resolveInfo.activityInfo.name.equals(str2)) {
i2 = i3;
break;
}
i3++;
}
}
}
}
return i2;
}
public static synchronized int a(av avVar, int i2, a aVar) {
int i3;
int i4;
Exception e2;
String str;
Exception e3;
int i5;
Exception e4;
String str2;
int intValue;
String f2;
String g2;
String str3;
int c2;
Exception e5;
int a2;
Exception e6;
String str4;
int b2;
synchronized (di.class) {
int i6 = 2;
switch (aVar) {
case Action:
case Condition:
case Event:
i3 = 1;
break;
default:
i3 = 0;
i6 = 0;
break;
}
String c3 = avVar.j(i3).c();
String c4 = avVar.j(i6).c();
bo.b("Plugin", "PLUG setMetaData: start: type: " + aVar.toString() + " code: " + i2 + " pkg: " + c3 + " clsOrLabel: " + c4);
if (TextUtils.isEmpty(c3)) {
if (TextUtils.isEmpty(c4)) {
bo.b("Plugin", "PLUG setMetaData: no package or label, derive from code");
if (h(aVar, i2)) {
try {
a2 = a(aVar, i2, true);
f2 = f(aVar, a2);
} catch (Exception e7) {
e = e7;
f2 = c3;
}
try {
g2 = g(aVar, a2);
} catch (Exception e8) {
e = e8;
g2 = c4;
e5 = e;
c2 = i2;
bo.b("Plugin", "setMetaData, from oldCode " + i2, e5);
i2 = c2;
c4 = g2;
c3 = f2;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
try {
c2 = c(aVar, a2);
try {
bo.b("Plugin", "PLUG setMetaData: derived pkg/cls/code from old code " + i2);
} catch (Exception e9) {
e5 = e9;
bo.b("Plugin", "setMetaData, from oldCode " + i2, e5);
i2 = c2;
c4 = g2;
c3 = f2;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
} catch (Exception e10) {
e5 = e10;
c2 = i2;
bo.b("Plugin", "setMetaData, from oldCode " + i2, e5);
i2 = c2;
c4 = g2;
c3 = f2;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
i2 = c2;
c4 = g2;
c3 = f2;
} else if (a(aVar, i2)) {
try {
b2 = b(aVar, i2, true);
f2 = f(aVar, b2);
} catch (Exception e11) {
f2 = c3;
e6 = e11;
}
try {
str4 = g(aVar, b2);
} catch (Exception e12) {
e6 = e12;
str4 = c4;
bo.b("Plugin", "setMetaData, from code " + i2, e6);
c4 = str4;
c3 = f2;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
try {
bo.b("Plugin", "PLUG setMetaData: turned out to be new code without pkg, added pkg/cls");
} catch (Exception e13) {
e6 = e13;
bo.b("Plugin", "setMetaData, from code " + i2, e6);
c4 = str4;
c3 = f2;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
c4 = str4;
c3 = f2;
} else {
bo.b("Plugin", "PLUG setMetaData: not old or new code");
}
} else {
List<Integer> g3 = g(aVar, c4);
if (g3.size() > 0) {
if (g3.size() > 1) {
bo.b("Plugin", "PLUG setMetaData: multiple entries found for label " + c4 + ", using first");
} else {
try {
intValue = g3.get(0).intValue();
f2 = f(aVar, intValue);
} catch (Exception e14) {
e = e14;
}
try {
g2 = g(aVar, intValue);
try {
c2 = c(aVar, intValue);
try {
bo.b("Plugin", "PLUG setMetaData: derived pkg/cls/code from label " + c4);
i2 = c2;
c4 = g2;
c3 = f2;
} catch (Exception e15) {
e4 = e15;
str3 = f2;
i5 = c2;
str2 = g2;
c3 = str3;
bo.b("Plugin", "setMetaData, from multiple entries " + c4, e4);
c4 = str2;
i2 = i5;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
} catch (Exception e16) {
str3 = f2;
i5 = i2;
e4 = e16;
}
} catch (Exception e17) {
e = e17;
c3 = f2;
i5 = i2;
e4 = e;
str2 = c4;
bo.b("Plugin", "setMetaData, from multiple entries " + c4, e4);
c4 = str2;
i2 = i5;
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
}
} else {
bo.d("Plugin", "PLUG setMetaData: no label found: " + c4);
}
}
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
} else if (!a(aVar, i2)) {
bo.b("Plugin", "PLUG setMetaData: unknown code " + i2);
if (TextUtils.isEmpty(c4)) {
bo.d("Plugin", "PLUG setMetaData: unknown code " + i2 + " and no label, I surrender");
} else {
int d2 = d(aVar, c3, c4);
bo.b("Plugin", "index: " + d2);
if (d2 != -1) {
try {
i4 = c(aVar, d2);
try {
bo.b("Plugin", "PLUG setMetaData: derived code " + i4 + " from pkg/class" + c3 + " / " + c4);
} catch (Exception e18) {
e2 = e18;
bo.b("Plugin", "setMetaData, from names " + c3 + "/" + c4, e2);
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
} catch (Exception e19) {
i4 = i2;
e2 = e19;
}
} else {
List<Integer> g4 = g(aVar, c4);
if (g4.size() > 0) {
try {
str = g(aVar, g4.get(0).intValue());
} catch (Exception e20) {
e = e20;
str = c4;
}
try {
i4 = c(aVar, g4.get(0).intValue());
} catch (Exception e21) {
e = e21;
Exception exc = e;
i4 = i2;
e3 = exc;
bo.b("Plugin", "setMetaData, from names2 " + c4, e3);
c4 = str;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
try {
bo.b("Plugin", "PLUG setMetaData: derived cls / code from pkg / label");
} catch (Exception e22) {
e3 = e22;
bo.b("Plugin", "setMetaData, from names2 " + c4, e3);
c4 = str;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
return i4;
}
c4 = str;
}
}
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
}
}
i4 = i2;
avVar.b(i3, c3);
avVar.b(i6, c4);
bo.b("Plugin", "PLUG setMetaData: end: type: " + aVar.toString() + " code: " + i4 + " pkg: " + c3 + " cls: " + c4 + " label: " + b(aVar, i4));
}
return i4;
}
public static synchronized boolean h(a aVar, int i2) {
boolean z;
synchronized (di.class) {
z = a(aVar, i2, false) != -1;
}
return z;
}
}