导航菜单

页面标题

页面副标题

Tasker v6.5.11 - Kid.java 源代码

正在查看: Tasker v6.5.11 应用的 Kid.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package net.dinglisch.android.taskerm;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.net.Uri;
import android.os.Bundle;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.dinglisch.android.taskerm.g6;

public class Kid extends Activity {
    private static boolean i = false;
    private static int[] q = {446, 428, 427, 444, 445, 447, 426};
    private static String[] r = {"com.mobitobi.android.gentlealarm", "org.kaloersoftware.kaloerclock", "com.smartmadsoft.openwatch", "net.artifix.pomodroido", "com.ventel.android.radardroid2", "com.gray101.redditnotify", "com.teslacoilsw.widgetlocker"};
    private static int[] s = {2131887619, 2131887622, 2131887639, 2131887647, 2131887650, 2131887654, 2131887675};
    private static int[] t = {450, 112, 558, 371, 555, 568, 599, 911, 456, 395, 556, 643, 442, 553, 444, 458};
    private static String[] u = {fb.a.class.getPackage().getName(), "com.googlecode.android_scripting", "org.damazio.notifier", "com.timsu.astrid", "mobi.beyondpod", "com.dailyroads.v", "com.lakeridge.DueToday", "com.mobitobi.android.gentlealarm", "com.latedroid.juicedefender", "com.latedroid.juicedefender", "com.grazerss", "ocs.android.pro", "com.lslk.sleepbot", "com.zegoggles.smssync", "com.teslacoilsw.flashlight", "com.teslacoilsw.widgetlocker"};
    private static int[] v = {2131886661, 2131890603, 2131886238, 2131886247, 2131886253, 2131886287, 2131886344, 2131886368, 2131888345, 2131888345, 2131886454, 2131886467, 2131886578, 2131886580, 2131886597, 2131886638};
    private static String[] w = {"https://play.google.com/store/apps/details?id=com.codecarpet.apndroid.pro", "https://code.google.com/p/android-scripting/downloads/list", null, null, null, null, null, null, null, null, null, null, null, null, null, null};
    private static Boolean x = null;

    class a implements DialogInterface.OnDismissListener {
        a() {
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            Kid.this.finish();
        }
    }

    class b implements DialogInterface.OnCancelListener {
        b() {
        }

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            Kid.this.finish();
        }
    }

    class c implements DialogInterface.OnClickListener {
        final String i;

        c(String str) {
            this.i = str;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dq.l3(Kid.this, new Intent("android.intent.action.VIEW", Uri.parse(this.i)));
            Kid.this.finish();
        }
    }

    class d implements DialogInterface.OnClickListener {
        final boolean i;
        final String q;

        d(boolean z, String str) {
            this.i = z;
            this.q = str;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            if (this.i) {
                Intent intent = new Intent();
                intent.setData(Uri.parse("market://details?id=" + this.q));
                Kid.this.startActivity(intent);
            }
            Kid.this.finish();
        }
    }

    public static boolean a() {
        Boolean bool = x;
        if (bool == null) {
            return false;
        }
        return bool.booleanValue();
    }

    public static boolean b(Context context) {
        if (x == null) {
            x = Boolean.valueOf(!context.getPackageName().startsWith("net.dinglisch.android.tasker"));
        }
        return x.booleanValue();
    }

    private boolean c(to toVar) {
        boolean z;
        PackageManager packageManager = getPackageManager();
        int i2 = 0;
        while (true) {
            if (i2 >= u.length) {
                z = true;
                break;
            }
            if (toVar.q3(t[i2])) {
                boolean J = th.J(packageManager, u[i2]);
                r7.f("Kid", "checkApp: code: " + t[i2] + " pkg: " + u[i2] + " have: " + J);
                if (!J) {
                    m(vh.g(this, v[i2], new Object[0]), w[i2]);
                    z = false;
                    break;
                }
            }
            i2++;
        }
        if (z && ((toVar.b3() || toVar.U2(3071)) && !th.J(packageManager, "net.dinglisch.android.zoom"))) {
            m(vh.g(this, 2131887013, new Object[0]), th.D(packageManager) ? "market://details?id=net.dinglisch.android.zoom" : "http://zoom.dinglisch.net/Zoom.apk");
            z = false;
        }
        if (z) {
            int i3 = 0;
            while (true) {
                if (i3 < r.length) {
                    if (toVar.U2(q[i3]) && !th.J(packageManager, r[i3])) {
                        m(vh.g(this, s[i3], new Object[0]), null);
                        z = false;
                        break;
                    }
                    i3++;
                } else {
                    break;
                }
            }
        }
        if (toVar.U2(425) && !th.H(packageManager, g6.b.a)) {
            m(vh.g(this, 2131887611, new Object[0]), null);
            z = false;
        }
        if (!toVar.U2(424) || th.H(packageManager, g6.b.a)) {
            return z;
        }
        m(vh.g(this, 2131887656, new Object[0]), null);
        return false;
    }

    private boolean d(HashMap<String, String> hashMap, String str) {
        PackageManager packageManager = getPackageManager();
        for (Map.Entry<String, String> entry : hashMap.entrySet()) {
            String key = entry.getKey();
            if (!th.J(packageManager, key)) {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                boolean D = th.D(packageManager);
                builder.setMessage(vh.k(this, D ? 2131887237 : 2131887236, str, entry.getValue()));
                builder.setNegativeButton(2131886889, (DialogInterface.OnClickListener) null).setPositiveButton(2131886891, new d(D, key));
                AlertDialog create = builder.create();
                l(create);
                create.show();
                return false;
            }
        }
        return true;
    }

    private boolean e(to toVar, v6 v6Var) {
        HashMap<String, String> y2 = toVar.y2(getPackageManager(), false);
        HashMap<String, String> hashMap = new HashMap<>();
        for (Map.Entry<String, String> entry : y2.entrySet()) {
            if (!v6Var.E(entry.getKey())) {
                hashMap.put(entry.getKey(), entry.getValue());
            }
        }
        return d(hashMap, vh.g(this, 2131887001, new Object[0]).toLowerCase());
    }

    private boolean f(to toVar) {
        return d(i(toVar), vh.g(this, 2131890983, new Object[0]).toLowerCase());
    }

    public static String g(String str) {
        return dq.H3(str.replace(File.separatorChar, '.'));
    }

    public static String h(String str) {
        return dq.H3(str.replace(File.separatorChar, '.'));
    }

    private HashMap<String, String> i(to toVar) {
        HashMap<String, String> hashMap = new HashMap<>();
        if (toVar.q3(559) || toVar.q3(699)) {
            Iterator<tn> it = toVar.P2(0).iterator();
            while (it.hasNext()) {
                for (net.dinglisch.android.taskerm.c cVar : it.next().D0()) {
                    int j = cVar.j();
                    if (j == 559 || j == 699) {
                        String w2 = cVar.N(1).w();
                        int indexOf = w2.indexOf(58);
                        if (indexOf != -1) {
                            w2 = w2.substring(0, indexOf);
                        }
                        if (!w2.equals("default") && !kq.K(w2)) {
                            hashMap.put(w2, w2);
                        }
                    }
                }
            }
        }
        return hashMap;
    }

    public static void j(Context context) {
        boolean R3;
        if (i) {
            return;
        }
        if (b(context)) {
            SharedPreferences S0 = dq.S0(context);
            boolean contains = S0.contains("dscl");
            if (!contains) {
                SharedPreferences.Editor edit = S0.edit();
                edit.putLong(g6.n.a, System.currentTimeMillis());
                edit.putLong(g6.n.b, System.currentTimeMillis());
                edit.putBoolean("dscl", true);
                edit.commit();
            }
            SharedPreferences R0 = dq.R0(context);
            SharedPreferences.Editor edit2 = R0.edit();
            if (contains) {
                R3 = Settings.R3(context, R0);
            } else {
                edit2.putBoolean("mFn", false);
                R3 = false;
            }
            if (Settings.T3(R0) != R3) {
                edit2.putBoolean("mSi", R3);
            }
            to u1 = to.u1(context);
            if (u1 != null) {
                boolean W = u1.w(0).m().W();
                if (W != R0.getBoolean("lEnable", !W)) {
                    edit2.putBoolean("leEnle", W);
                    edit2.putBoolean("dsd", W);
                    edit2.putBoolean("lEnable", W);
                    edit2.putBoolean("tEnable", W);
                    edit2.putBoolean("lpa", W);
                }
                edit2.commit();
            }
            n(context);
        }
        i = true;
    }

    private void k() {
        boolean c2 = MonitorService.c2(this);
        boolean L2 = dq.L2(this, MonitorService.class.getName());
        r7.f("Kid", "enabled: " + c2 + " running: " + L2);
        if (!c2 || L2) {
            return;
        }
        Intent intent = new Intent(this, (Class<?>) MonitorService.class);
        intent.putExtra("eventType", 9995);
        MonitorService.J6(this, intent);
    }

    private void l(Dialog dialog) {
        dialog.setOnDismissListener(new a());
        dialog.setOnCancelListener(new b());
    }

    private void m(String str, String str2) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        boolean z = str2 != null;
        builder.setMessage(z ? vh.k(this, 2131887237, vh.g(this, 2131891127, new Object[0]).toLowerCase(), str) : vh.k(this, 2131887236, vh.g(this, 2131891127, new Object[0]).toLowerCase(), str));
        if (z) {
            builder.setNegativeButton(2131886889, (DialogInterface.OnClickListener) null);
        }
        builder.setPositiveButton(2131886891, z ? new c(str2) : null);
        AlertDialog create = builder.create();
        l(create);
        create.show();
    }

    public static boolean n(Context context) {
        File c1 = dq.c1();
        if (c1 == null) {
            r7.f("Kid", "not unpacking scripts, no external storage");
            return false;
        }
        AssetManager assets = context.getAssets();
        if (assets == null) {
            r7.f("Kid", "init: no assets");
            return false;
        }
        try {
            String[] list = assets.list("kid/sl4a");
            if (dq.r(list)) {
                return false;
            }
            File file = new File(c1, "sl4a/scripts");
            if (!dq.o2(file)) {
                return false;
            }
            boolean z = true;
            for (String str : list) {
                String str2 = "kid/sl4a" + File.separator + str;
                File file2 = new File(file, str.substring(0, str.length() - 4));
                long length = file2.exists() ? file2.length() : -66L;
                r7.f("Kid", str2 + " -> " + file2);
                AssetFileDescriptor openFd = assets.openFd(str2);
                long length2 = openFd.getLength();
                openFd.close();
                if (length != length2) {
                    try {
                        if (dq.H(assets.open(str2), new FileOutputStream(file2))) {
                            z = false;
                        }
                    } catch (FileNotFoundException e) {
                        r7.G("Kid", "unpackScripts: " + e.getMessage());
                    }
                }
            }
            return z;
        } catch (IOException e2) {
            r7.H("Kid", "unpackScripts: ", e2);
            return false;
        }
    }

    public static boolean o(Context context) {
        return tp.f() && tp.g(th.u(context));
    }

    @Override
    public void onCreate(Bundle bundle) {
        Bundle bundle2;
        super.onCreate(bundle);
        s5.v(this, "Kid.onCreate");
        bi.b(this, "Kid");
        to u1 = to.u1(this);
        if (u1 == null) {
            finish();
            return;
        }
        u1.p4();
        v6 m = u1.w(0).m();
        if (e(u1, m) && c(u1) && f(u1)) {
            MonitorService.H8(this, true);
            dq.R(this, true);
            k();
            int i2 = m.i();
            if (u1.T(i2)) {
                tn R = u1.R(i2);
                Intent intent = getIntent();
                if (intent != null) {
                    Bundle bundle3 = new Bundle();
                    Uri data = intent.getData();
                    if (data != null) {
                        bundle3.putString("%launch_data", data.toString());
                    }
                    bundle2 = bundle3;
                } else {
                    bundle2 = null;
                }
                ExecuteService.d6(this, R, 1, -1, -1, -1, null, null, "launch", bundle2);
            } else {
                r7.k("Kid", "unknown launch task ID " + i2);
            }
            finish();
        }
    }
}