导航菜单

页面标题

页面副标题

Tasker v6.6.3 - Licence.java 源代码

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

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


package net.dinglisch.android.taskerm;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableRow;
import android.widget.TextView;
import com.joaomgcd.taskerm.licensing.LicenseStatus;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerm.util.TaskerApp;
import net.dinglisch.android.taskerm.d6;

public class Licence extends MyActivity implements View.OnClickListener, l1 {
    private static long F;
    private static ProgressDialog G;
    private Button A;
    private TableRow B;
    private TableRow C;
    private SharedPreferences D;
    private boolean E = false;
    private TextView v;
    private TextView w;
    private EditText x;
    private TextView y;
    private Button z;

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            Licence.this.r0(false);
        }
    }

    public void A0(Throwable th2) throws Exception {
        pp.b0(this, th2.getMessage(), new Object[0]);
    }

    public static void B0(LicenseStatus licenseStatus, Context context, com.joaomgcd.taskerm.util.we weVar, String str) {
        if (licenseStatus == LicenseStatus.Licensed) {
            pp.j0(context, 2131888411, new Object[0]);
            return;
        }
        com.joaomgcd.taskerm.util.j3 j3Var = (com.joaomgcd.taskerm.util.j3) weVar.c();
        if (j3Var != null) {
            gi.j((Activity) context, 2131887415, j3Var.getErrorMessage() + " (this device's id: " + str + ")");
            return;
        }
        gi.j((Activity) context, 2131887415, context.getString(2131887402) + " (this device's id: " + str + ")");
    }

    public static void C0(Context context, int i, com.joaomgcd.taskerm.util.pe peVar) {
        pp.h0(context, i, peVar.a());
    }

    public static void D0(final Context context, int i, l1 l1Var, com.joaomgcd.taskerm.dialog.b bVar) {
        final com.joaomgcd.taskerm.util.we<LicenseStatus, com.joaomgcd.taskerm.util.j3> f;
        gg.w G2 = ((TaskerApp) context.getApplicationContext()).G();
        if (i == 0) {
            if (com.joaomgcd.taskerm.util.ac.V0(context).h0()) {
                final String f2 = ExtensionsContextKt.D0(context).f();
                if (v0(f2)) {
                    f = new com.joaomgcd.taskerm.util.we<>(false, LicenseStatus.Unlicensed, new com.joaomgcd.taskerm.util.j3("Invalid Android Device ID: " + f2));
                } else {
                    f = G2.z(false, true, false).f();
                }
                final LicenseStatus d = f.d();
                xg.e2.b1(new Runnable() {
                    @Override
                    public final void run() {
                        Licence.B0(LicenseStatus.this, context, f, f2);
                    }
                });
                if (l1Var != null) {
                    l1Var.f(i, d == LicenseStatus.Licensed ? 299 : 499, 0);
                }
            } else {
                pp.a0(context, 2131888389, new Object[0]);
            }
        } else if (i == 2) {
            final com.joaomgcd.taskerm.util.pe f3 = G2.P().f();
            final int i2 = f3.b() ? 2131888402 : 2131888401;
            xg.e2.b1(new Runnable() {
                @Override
                public final void run() {
                    Licence.C0(context, i2, f3);
                }
            });
            if (l1Var != null) {
                l1Var.f(i, f3.b() ? 499 : 299, 0);
            }
        }
        if (bVar != null) {
            bVar.f();
        }
    }

    private void E0() {
        setContentView(2131493554);
        Button button = (Button) findViewById(2131296492);
        this.A = button;
        button.setOnClickListener(this);
        Button button2 = (Button) findViewById(2131296580);
        this.z = button2;
        button2.setOnClickListener(new a());
        this.z.setText(oh.g(this, 2131886908, new Object[0]));
        this.v = (TextView) findViewById(2131297615);
        this.w = (TextView) findViewById(2131297614);
        this.x = (EditText) findViewById(2131297608);
        this.y = (TextView) findViewById(2131297609);
        gi.o(this.x, 3);
        this.B = (TableRow) findViewById(2131297558);
        this.C = (TableRow) findViewById(2131297557);
        pp.M2(this, 2131297050, 2131888405);
        pp.M2(this, 2131297051, 2131888410);
        pp.M2(this, 2131297049, 2131888398);
        pp.M2(this, 2131297001, 2131887245);
    }

    private static void F0(SharedPreferences sharedPreferences, String str) {
        String trim = str.trim();
        if (sharedPreferences.getString("lcl", "").equals(trim)) {
            return;
        }
        sharedPreferences.edit().putString("lcl", trim).commit();
    }

    private void G0(int i) {
        setResult(i);
        finish();
    }

    public void H0() {
        int i;
        int i2;
        int i3;
        SharedPreferences sharedPreferences = this.D;
        if (sharedPreferences == null) {
            return;
        }
        String string = sharedPreferences.getString("lcl", null);
        String str = TextUtils.isEmpty(string) ? null : string;
        boolean contains = sharedPreferences.contains(d6.n.a);
        boolean booleanExtra = getIntent().getBooleanExtra("net.dinglisch.android.taskerm.EXTRA_AUTO_VALIDATE", false);
        boolean z = true;
        if (str != null) {
            this.x.setText(str);
            this.y.setText(str);
            if (booleanExtra) {
                r0(true);
            }
        } else {
            sharedPreferences.edit().remove(d6.n.a).commit();
            this.x.setText("");
            this.y.setText("");
            contains = false;
        }
        setResult(-1);
        long currentTimeMillis = (System.currentTimeMillis() - sharedPreferences.getLong(d6.n.b, -1L)) / 86400000;
        if (currentTimeMillis < 0) {
            o7.G("Licence", "days passed since install is negative");
            currentTimeMillis = 8;
        }
        this.y.setTextIsSelectable(true);
        if (contains) {
            pp.n3(this, true);
            MonitorService.K8(this, true);
            this.x.setVisibility(8);
            this.y.setVisibility(0);
            this.v.setTextColor(fp.C(this, 2130968874, "Licence/setup"));
            this.B.setVisibility(8);
            z = TextUtils.isEmpty(sharedPreferences.getString("lcl", ""));
            this.A.setText(2131886894);
            i = 2131888409;
            i2 = 2131886901;
            i3 = 8;
        } else {
            this.x.setVisibility(0);
            this.y.setVisibility(8);
            this.B.setVisibility(0);
            this.v.setTextColor(fp.C(this, 2130968883, "Licence/setup2"));
            long j = 7;
            long j2 = j - currentTimeMillis;
            if (j2 <= 3) {
                this.w.setTextColor(fp.C(this, 2130968883, "Licence/setup3"));
            }
            if (currentTimeMillis >= j) {
                this.B.setVisibility(8);
                this.A.setText(oh.g(this, 2131886880, new Object[0]));
                setResult(2);
                i = 2131888404;
            } else {
                this.w.setText(String.valueOf(j2) + " " + oh.g(this, 2131891170, new Object[0]));
                this.A.setText(oh.g(this, 2131886885, new Object[0]));
                i = 2131888407;
            }
            i2 = 2131886869;
            i3 = 0;
        }
        this.z.setVisibility(i3);
        this.z.setText(oh.g(this, i2, new Object[0]));
        this.v.setText(oh.g(this, i, new Object[0]));
        pp.X2(this.x, z);
        setTitle(oh.g(this, 2131888914, new Object[0]));
        this.C.setVisibility(8);
    }

    private static void I0(final Context context, final l1 l1Var, boolean z, final int i) {
        if (i == 1) {
            return;
        }
        long currentTimeMillis = (System.currentTimeMillis() - F) / 1000;
        if (z && currentTimeMillis < 60) {
            pp.n0(context, 2131888397, Long.valueOf(60 - currentTimeMillis));
            return;
        }
        if (!z) {
            F = System.currentTimeMillis();
        }
        final com.joaomgcd.taskerm.dialog.b k = z ? com.joaomgcd.taskerm.dialog.b.k(new df.o(context, 2131887474, 2131887305)) : null;
        xg.e2.U0(new Runnable() {
            @Override
            public final void run() {
                Licence.D0(context, i, l1Var, k);
            }
        });
    }

    private boolean p0(String str) {
        if (x0(str)) {
            return true;
        }
        pp.a0(this, 2131886749, new Object[0]);
        return false;
    }

    public static void q0(Context context) {
        I0(context, null, false, 0);
    }

    public void r0(boolean z) {
        this.E = z;
        String m1 = pp.m1(this.x);
        F0(this.D, m1);
        CharSequence text = this.z.getText();
        if (text.equals(oh.g(this, 2131886869, new Object[0]))) {
            gi.h(this, 2131886869, 2131887149);
            return;
        }
        if (text.equals(oh.g(this, 2131886901, new Object[0]))) {
            I0(this, this, true, 2);
            return;
        }
        if (TextUtils.isEmpty(m1)) {
            pp.h0(this, 2131889122, new Object[0]);
            return;
        }
        String replace = m1.toUpperCase().replace(" ", "");
        if (p0(replace)) {
            F0(this.D, replace);
            I0(this, this, true, 0);
        }
    }

    @SuppressLint({"MissingPermission"})
    @TargetApi(26)
    public static ti.r<String> s0(Context context) {
        return t0(context, ti.r.w("0000000"));
    }

    @SuppressLint({"MissingPermission"})
    @TargetApi(26)
    public static ti.r<String> t0(final Context context, final ti.r<String> rVar) {
        return !com.joaomgcd.taskerm.util.ac.V0(context).h0() ? ti.r.r(new RuntimeException("Needs Phone State permissions")) : xg.e2.y1(new ik.a() {
            @Override
            public final Object e() {
                String y0;
                y0 = Licence.y0(context, rVar);
                return y0;
            }
        });
    }

    public static boolean u0(SharedPreferences sharedPreferences) {
        return sharedPreferences.getString("lcl", "").length() > 0;
    }

    public static boolean v0(String str) {
        return !w0(str);
    }

    public static boolean w0(String str) {
        return (str == null || TextUtils.isEmpty(str) || str.matches("^0+$")) ? false : true;
    }

    private static boolean x0(String str) {
        return str != null && str.length() == 32;
    }

    public static String y0(Context context, ti.r rVar) {
        TelephonyManager telephonyManager = (TelephonyManager) gi.d(context, "phone", "Licence", "gdi");
        String str = null;
        if (telephonyManager == null) {
            o7.G("Licence", "getDeviceID: no telephony manager");
        } else {
            try {
                if (com.joaomgcd.taskerm.util.r.s()) {
                    try {
                        str = telephonyManager.getMeid();
                    } catch (Throwable unused) {
                    }
                    if (v0(str)) {
                        try {
                            str = telephonyManager.getImei();
                        } catch (Throwable unused2) {
                        }
                    }
                    if (v0(str)) {
                        str = telephonyManager.getDeviceId();
                    }
                } else {
                    str = telephonyManager.getDeviceId();
                }
            } catch (Throwable unused3) {
            }
        }
        if (v0(str)) {
            str = zg.g2.o(context, new zg.v(zg.f1.w, "android_id", false)).f();
        }
        return v0(str) ? (String) rVar.f() : str;
    }

    public void z0(com.joaomgcd.taskerm.util.pe peVar) throws Exception {
        if (peVar.b()) {
            return;
        }
        pp.b0(this, "Need Phone State permission to get device ID and validate license", new Object[0]);
        G0(2);
    }

    @Override
    public void f(int i, int i2, int i3) {
        if (i2 == 299 && this.E) {
            MonitorService.K8(this, true);
            pp.n3(this, true);
            finish();
        } else if (i != 1) {
            if (i2 == 299 || i2 == 499) {
                xg.e2.b1(new Runnable() {
                    @Override
                    public final void run() {
                        Licence.this.H0();
                    }
                });
            }
        }
    }

    @Override
    public void onClick(View view) {
        if (!this.A.equals(view)) {
            if (this.z.equals(view)) {
                String m1 = pp.m1(this.x);
                if (TextUtils.isEmpty(m1)) {
                    pp.h0(this, 2131889122, new Object[0]);
                    return;
                } else {
                    F0(this.D, m1);
                    I0(this, this, true, 0);
                    return;
                }
            }
            return;
        }
        String charSequence = this.A.getText().toString();
        if (charSequence.equals(oh.g(this, 2131886885, new Object[0])) || charSequence.equals(oh.g(this, 2131886894, new Object[0]))) {
            G0(-1);
        } else if (charSequence.equals(oh.g(this, 2131886869, new Object[0]))) {
            pp.l3(this, TaskerIntent.d(true));
        } else {
            G0(2);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.D = pp.S0(this);
        E0();
        net.dinglisch.android.taskerm.a.T(this, true);
        H0();
        com.joaomgcd.taskerm.util.ac.V0(this).f1().B(xg.e2.c).I(new yi.d() {
            @Override
            public final void accept(Object obj) {
                Licence.this.z0((com.joaomgcd.taskerm.util.pe) obj);
            }
        }, new yi.d() {
            @Override
            public final void accept(Object obj) {
                Licence.this.A0((Throwable) obj);
            }
        });
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.v = null;
        this.w = null;
        this.x = null;
        this.z = null;
        this.A = null;
        this.B = null;
        this.C = null;
        this.D = null;
        G = null;
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4) {
            String trim = pp.m1(this.x).trim();
            if (TextUtils.isEmpty(trim)) {
                F0(this.D, trim);
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return true;
        }
        finish();
        return true;
    }

    @Override
    protected void onPause() {
        super.onPause();
        String m1 = pp.m1(this.x);
        if (TextUtils.isEmpty(m1)) {
            return;
        }
        F0(this.D, m1);
    }
}