导航菜单

页面标题

页面副标题

Tasker v6.5.11 - ProxyTransparent.java 源代码

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

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


package net.dinglisch.android.taskerm;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.net.VpnService;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import net.dinglisch.android.taskerm.ExecuteService;
import net.dinglisch.android.taskerm.yl;
import net.dinglisch.android.taskerm.zg;

public class ProxyTransparent extends Activity {
    private Timer i;
    private int s;
    private Bundle q = null;
    private Bundle r = null;
    private net.dinglisch.android.taskerm.c t = null;
    private boolean u = false;
    private c6 v = null;
    private Object w = new Object();
    private boolean x = false;

    class a implements yl.a {
        a() {
        }

        @Override
        public void a(Bitmap bitmap) {
            ProxyTransparent.this.f(bitmap);
        }

        @Override
        public void b() {
            ProxyTransparent.this.k("screenieError", ExecuteService.v.Error, null);
        }
    }

    class b extends Handler {
        b() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                ProxyTransparent.this.startActivityForResult(h4.w(true), 2);
            } else {
                ProxyTransparent.this.k("docFileRefusal", ExecuteService.v.Error, null);
            }
        }
    }

    class c extends Handler {
        c() {
        }

        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == 1) {
                StringBuilder sb = new StringBuilder();
                sb.append("jsi exit have vars ");
                sb.append(ProxyTransparent.this.v._getLocalVars() != null);
                r7.f("ProxyTransparent", sb.toString());
                ProxyTransparent proxyTransparent = ProxyTransparent.this;
                proxyTransparent.k("jsiExit", ExecuteService.v.None, proxyTransparent.v._getLocalVars());
                return;
            }
            if (i == 2) {
                r7.f("ProxyTransparent", "jsi error");
                c6.flashErrorBundle(ProxyTransparent.this, message.getData());
                ProxyTransparent.this.k("jsiError", ExecuteService.v.Error, null);
            } else if (i == 3) {
                r7.f("ProxyTransparent", "jsi timeout");
                ProxyTransparent.this.k("jsiTimeout", ExecuteService.v.Error, null);
            } else if (i != 4) {
                r7.k("ProxyTransparent", "jsiHandler: unexpected JSI what " + message.what);
                ProxyTransparent proxyTransparent2 = ProxyTransparent.this;
                proxyTransparent2.k("jsiUnknown", ExecuteService.v.Error, proxyTransparent2.v._getLocalVars());
            }
        }
    }

    class d extends TimerTask {
        d() {
        }

        @Override
        public void run() {
            ProxyTransparent.this.m();
            if (ProxyTransparent.this.v == null) {
                ProxyTransparent.this.j("timerExpiry");
                return;
            }
            Handler _getHandler = ProxyTransparent.this.v._getHandler();
            if (_getHandler != null) {
                r7.F("ProxyTransparent", "timeout");
                _getHandler.sendEmptyMessage(3);
            }
        }
    }

    public static class e extends Handler {
        WeakReference<ProxyTransparent> a;

        e(ProxyTransparent proxyTransparent) {
            this.a = new WeakReference<>(proxyTransparent);
        }

        @Override
        public void handleMessage(Message message) {
            this.a.get().k("scanDone", ExecuteService.v.None, null);
        }
    }

    public void f(Bitmap bitmap) {
        String I4 = ExecuteService.I4(this, 0, this.t, this.r);
        if (TextUtils.isEmpty(I4)) {
            k("handleScreenieError", ExecuteService.v.Error, null);
            return;
        }
        String E2 = dq.E2(I4);
        boolean R = this.t.i(1).R();
        File j = dq.j(dq.x2(new File(E2)), ".png");
        r7.f("ProxyTransparent", this.t.getName() + ": got bitmap " + bitmap.getWidth() + "x" + bitmap.getHeight() + ", write to " + j);
        if (!zg.z(bitmap, j, zg.a.PNG, 90)) {
            k("handleScreenieError", ExecuteService.v.Error, null);
            return;
        }
        if (!R) {
            k("handleScreeny", ExecuteService.v.None, null);
            return;
        }
        r7.f("ProxyTransparent", this.t.getName() + ": scan file");
        oh.c(this, j, 5000L, new e(this));
    }

    private void g(int i, Bundle bundle) {
        if (this.t.j() == 176) {
            yl.b(this, 8);
            return;
        }
        if (this.t.j() == 47) {
            try {
                startActivityForResult(sd.d(this), 4);
                return;
            } catch (Exception unused) {
                r7.G("ProxyTransparent", "failed to show overlays permission dialog");
                return;
            }
        }
        if (a1.l1(this.t.j()) && !dq.y1(this, "android.permission.WRITE_SETTINGS") && sd.l() && !sd.m(this)) {
            try {
                startActivityForResult(sd.h(this), 3);
                return;
            } catch (Exception unused2) {
                r7.G("ProxyTransparent", "failed to show write settings permission dialog");
                return;
            }
        }
        if (a1.b1(this.t)) {
            i();
            h4.W(this, new b());
            return;
        }
        int j = this.t.j();
        if (bundle == null) {
            bundle = new Bundle();
        }
        if (j == 129 || j == 131) {
            String scriptFromAction = c6.getScriptFromAction(this, this.t, bundle);
            if (scriptFromAction != null) {
                this.v = c6.runPureScript(this, new Random().nextInt(), null, i, this.t.i(2).R(), scriptFromAction, ExecuteService.J4(this, 1, this.t, bundle, true), bundle, new c());
            }
            if (this.v == null) {
                r7.G("ProxyTransparent", "jsi load failed");
                j("jsiHandler");
                return;
            } else {
                int s = this.t.x(3).s(this, bundle);
                if (s != Integer.MAX_VALUE) {
                    h(s * 1000);
                    return;
                }
                return;
            }
        }
        if (j == 173) {
            Intent prepare = VpnService.prepare(this);
            if (prepare == null) {
                j("vpnAlreadyPrepared");
                return;
            } else {
                startActivityForResult(prepare, 1);
                return;
            }
        }
        if (j != 810) {
            r7.k("ProxyTransparent", "bad action code: " + j);
            j("onCreateAction");
            return;
        }
        Window window = getWindow();
        int s2 = this.t.x(0).s(this, bundle);
        if (s2 < 20 && !this.t.i(1).R()) {
            s2 = 20;
        }
        if (s2 > 255) {
            s2 = 255;
        }
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.screenBrightness = s2 / 255.0f;
        window.setAttributes(attributes);
        h(getSharedPreferences(g6.g, 0).getInt("sDelay", 100));
    }

    private void i() {
        tp.c0(this, tp.X(this));
        getActionBar().hide();
        getWindow().setBackgroundDrawable(new ColorDrawable(0));
    }

    public void j(String str) {
        synchronized (this.w) {
            try {
                if (!this.x) {
                    r7.f("ProxyTransparent", "s&f(1): " + str);
                    m();
                    l();
                    ExecuteService.Q7(this);
                    this.x = true;
                    finish();
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }

    public void k(String str, ExecuteService.v vVar, Bundle bundle) {
        synchronized (this.w) {
            try {
                if (!this.x) {
                    r7.f("ProxyTransparent", "s&f(3): " + str);
                    m();
                    l();
                    ExecuteService.R7(this, vVar, bundle);
                    this.x = true;
                    finish();
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }

    private void l() {
        c6 c6Var = this.v;
        if (c6Var != null) {
            c6Var._stop();
            this.v = null;
        }
    }

    public void m() {
        Timer timer = this.i;
        if (timer != null) {
            synchronized (timer) {
                this.i.cancel();
                this.i = null;
            }
        }
    }

    public void h(long j) {
        Timer timer = new Timer();
        this.i = timer;
        timer.schedule(new d(), j);
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        if (i == 8) {
            Point b1 = dq.b1(this);
            yl.a(this, i2, intent, b1.x, b1.y, new a());
            return;
        }
        if (i == 1) {
            k("vpnExit", i2 == -1 ? ExecuteService.v.NeedRestart : ExecuteService.v.Error, null);
            return;
        }
        if (i == 2) {
            h4.D(this, i2, intent);
            k("docFileExit", i2 == -1 ? ExecuteService.v.NeedRestart : ExecuteService.v.Error, null);
        } else if (i == 3) {
            k("writeSettingsExit", (sd.l() && sd.m(this)) ? ExecuteService.v.NeedRestart : ExecuteService.v.Error, null);
        } else if (i == 4) {
            k("overlaysExit", (sd.i() && sd.j(this)) ? ExecuteService.v.NeedRestart : ExecuteService.v.Error, null);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (bundle == null) {
            Intent intent = getIntent();
            com.joaomgcd.taskerm.util.f1.e(intent);
            bundle = intent.getExtras();
        }
        if (bundle == null) {
            j("onCreate1");
            return;
        }
        if (!bundle.containsKey("aci")) {
            j("onCreate2");
            return;
        }
        this.q = bundle.getBundle("aci");
        this.s = bundle.getInt("pri");
        this.r = bundle.getBundle("lvars");
        this.t = new net.dinglisch.android.taskerm.c(new qi(this.q));
        g(this.s, this.r);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        m();
        this.q = null;
        this.r = null;
        this.t = null;
        l();
    }

    @Override
    public void onPause() {
        super.onPause();
        if (this.v != null || this.t.j() == 173 || this.t.j() == 176 || a1.b1(this.t) || a1.l1(this.t.j()) || this.t.j() == 47) {
            return;
        }
        if (isFinishing() || this.u) {
            j("onPause");
        }
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        Bundle bundle2 = this.q;
        if (bundle2 != null) {
            bundle.putBundle("aci", bundle2);
        }
        Bundle bundle3 = this.r;
        if (bundle3 != null) {
            bundle.putBundle("lvars", bundle3);
        }
        bundle.putInt("pri", this.s);
    }

    @Override
    protected void onUserLeaveHint() {
        super.onUserLeaveHint();
        this.u = true;
    }
}