导航菜单

页面标题

页面副标题

Tasker v6.5.11 - Licence.java 源代码

正在查看: Tasker v6.5.11 应用的 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.g6;

public class Licence extends MyActivity implements View.OnClickListener, m1 {
    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 {
        dq.b0(this, th2.getMessage(), new Object[0]);
    }

    public static void B0(LicenseStatus licenseStatus, Context context, com.joaomgcd.taskerm.util.x6 x6Var, String str) {
        if (licenseStatus == LicenseStatus.Licensed) {
            dq.j0(context, 2131888400, new Object[0]);
            return;
        }
        com.joaomgcd.taskerm.util.r1 r1Var = (com.joaomgcd.taskerm.util.r1) x6Var.c();
        if (r1Var != null) {
            oi.j((Activity) context, 2131887408, r1Var.getErrorMessage() + " (this device's id: " + str + ")");
            return;
        }
        oi.j((Activity) context, 2131887408, context.getString(2131887395) + " (this device's id: " + str + ")");
    }

    public static void C0(Context context, int i, com.joaomgcd.taskerm.util.s6 s6Var) {
        dq.h0(context, i, s6Var.a());
    }

    public static void D0(final Context context, int i, m1 m1Var, com.joaomgcd.taskerm.dialog.l lVar) {
        final com.joaomgcd.taskerm.util.x6<LicenseStatus, com.joaomgcd.taskerm.util.r1> f;
        yf.i j = ((TaskerApp) context.getApplicationContext()).j();
        if (i == 0) {
            if (com.joaomgcd.taskerm.util.e5.o0(context).A()) {
                final String f2 = ExtensionsContextKt.N(context).f();
                if (v0(f2)) {
                    f = new com.joaomgcd.taskerm.util.x6<>(false, LicenseStatus.Unlicensed, new com.joaomgcd.taskerm.util.r1("Invalid Android Device ID: " + f2));
                } else {
                    f = j.z(false, true, false).f();
                }
                final LicenseStatus d = f.d();
                pg.w0.p0(new Runnable() {
                    @Override
                    public final void run() {
                        Licence.B0(LicenseStatus.this, context, f, f2);
                    }
                });
                if (m1Var != null) {
                    m1Var.f(i, d == LicenseStatus.Licensed ? 299 : 499, 0);
                }
            } else {
                dq.a0(context, 2131888378, new Object[0]);
            }
        } else if (i == 2) {
            final com.joaomgcd.taskerm.util.s6 f3 = j.G().f();
            final int i2 = f3.b() ? 2131888391 : 2131888390;
            pg.w0.p0(new Runnable() {
                @Override
                public final void run() {
                    Licence.C0(context, i2, f3);
                }
            });
            if (m1Var != null) {
                m1Var.f(i, f3.b() ? 499 : 299, 0);
            }
        }
        if (lVar != null) {
            lVar.c();
        }
    }

    private void E0() {
        setContentView(2131493554);
        Button button = (Button) findViewById(2131296492);
        this.A = button;
        button.setOnClickListener(this);
        Button button2 = (Button) findViewById(2131296579);
        this.z = button2;
        button2.setOnClickListener(new a());
        this.z.setText(vh.g(this, 2131886905, new Object[0]));
        this.v = (TextView) findViewById(2131297613);
        this.w = (TextView) findViewById(2131297612);
        this.x = (EditText) findViewById(2131297606);
        this.y = (TextView) findViewById(2131297607);
        oi.o(this.x, 3);
        this.B = (TableRow) findViewById(2131297556);
        this.C = (TableRow) findViewById(2131297555);
        dq.M2(this, 2131297049, 2131888394);
        dq.M2(this, 2131297050, 2131888399);
        dq.M2(this, 2131297048, 2131888387);
        dq.M2(this, 2131297000, 2131887239);
    }

    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(g6.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(g6.n.a).commit();
            this.x.setText("");
            this.y.setText("");
            contains = false;
        }
        setResult(-1);
        long currentTimeMillis = (System.currentTimeMillis() - sharedPreferences.getLong(g6.n.b, -1L)) / 86400000;
        if (currentTimeMillis < 0) {
            r7.G("Licence", "days passed since install is negative");
            currentTimeMillis = 8;
        }
        this.y.setTextIsSelectable(true);
        if (contains) {
            dq.n3(this, true);
            MonitorService.H8(this, true);
            this.x.setVisibility(8);
            this.y.setVisibility(0);
            this.v.setTextColor(tp.C(this, 2130968874, "Licence/setup"));
            this.B.setVisibility(8);
            z = TextUtils.isEmpty(sharedPreferences.getString("lcl", ""));
            this.A.setText(2131886891);
            i = 2131888398;
            i2 = 2131886898;
            i3 = 8;
        } else {
            this.x.setVisibility(0);
            this.y.setVisibility(8);
            this.B.setVisibility(0);
            this.v.setTextColor(tp.C(this, 2130968883, "Licence/setup2"));
            long j = 7;
            long j2 = j - currentTimeMillis;
            if (j2 <= 3) {
                this.w.setTextColor(tp.C(this, 2130968883, "Licence/setup3"));
            }
            if (currentTimeMillis >= j) {
                this.B.setVisibility(8);
                this.A.setText(vh.g(this, 2131886877, new Object[0]));
                setResult(2);
                i = 2131888393;
            } else {
                this.w.setText(String.valueOf(j2) + " " + vh.g(this, 2131891148, new Object[0]));
                this.A.setText(vh.g(this, 2131886882, new Object[0]));
                i = 2131888396;
            }
            i2 = 2131886866;
            i3 = 0;
        }
        this.z.setVisibility(i3);
        this.z.setText(vh.g(this, i2, new Object[0]));
        this.v.setText(vh.g(this, i, new Object[0]));
        dq.X2(this.x, z);
        setTitle(vh.g(this, 2131888902, new Object[0]));
        this.C.setVisibility(8);
    }

    private static void I0(final Context context, final m1 m1Var, boolean z, final int i) {
        if (i == 1) {
            return;
        }
        long currentTimeMillis = (System.currentTimeMillis() - F) / 1000;
        if (z && currentTimeMillis < 60) {
            dq.n0(context, 2131888386, Long.valueOf(60 - currentTimeMillis));
            return;
        }
        if (!z) {
            F = System.currentTimeMillis();
        }
        final com.joaomgcd.taskerm.dialog.l j = z ? com.joaomgcd.taskerm.dialog.l.j(new we.i(context, 2131887467, 2131887299)) : null;
        pg.w0.l0(new Runnable() {
            @Override
            public final void run() {
                Licence.D0(context, i, m1Var, j);
            }
        });
    }

    private boolean p0(String str) {
        if (x0(str)) {
            return true;
        }
        dq.a0(this, 2131886746, 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 = dq.m1(this.x);
        F0(this.D, m1);
        CharSequence text = this.z.getText();
        if (text.equals(vh.g(this, 2131886866, new Object[0]))) {
            oi.h(this, 2131886866, 2131887143);
            return;
        }
        if (text.equals(vh.g(this, 2131886898, new Object[0]))) {
            I0(this, this, true, 2);
            return;
        }
        if (TextUtils.isEmpty(m1)) {
            dq.h0(this, 2131889110, 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 ji.r<String> s0(Context context) {
        return t0(context, ji.r.w("0000000"));
    }

    @SuppressLint({"MissingPermission"})
    @TargetApi(26)
    public static ji.r<String> t0(final Context context, final ji.r<String> rVar) {
        return !com.joaomgcd.taskerm.util.e5.o0(context).A() ? ji.r.r(new RuntimeException("Needs Phone State permissions")) : pg.w0.K0(new xj.a() {
            @Override
            public final Object invoke() {
                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, ji.r rVar) {
        TelephonyManager telephonyManager = (TelephonyManager) oi.d(context, "phone", "Licence", "gdi");
        String str = null;
        if (telephonyManager == null) {
            r7.G("Licence", "getDeviceID: no telephony manager");
        } else {
            try {
                if (com.joaomgcd.taskerm.util.k.r()) {
                    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 = rg.j0.f(context, new rg.h(rg.u.w, "android_id", false)).f();
        }
        return v0(str) ? (String) rVar.f() : str;
    }

    public void z0(com.joaomgcd.taskerm.util.s6 s6Var) throws Exception {
        if (s6Var.b()) {
            return;
        }
        dq.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.H8(this, true);
            dq.n3(this, true);
            finish();
        } else if (i != 1) {
            if (i2 == 299 || i2 == 499) {
                pg.w0.p0(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 = dq.m1(this.x);
                if (TextUtils.isEmpty(m1)) {
                    dq.h0(this, 2131889110, 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(vh.g(this, 2131886882, new Object[0])) || charSequence.equals(vh.g(this, 2131886891, new Object[0]))) {
            G0(-1);
        } else if (charSequence.equals(vh.g(this, 2131886866, new Object[0]))) {
            dq.l3(this, TaskerIntent.d(true));
        } else {
            G0(2);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.D = dq.S0(this);
        E0();
        net.dinglisch.android.taskerm.a.T(this, true);
        H0();
        com.joaomgcd.taskerm.util.e5.o0(this).w0().B(pg.w0.c).I(new oi.d() {
            @Override
            public final void accept(Object obj) {
                Licence.this.z0((com.joaomgcd.taskerm.util.s6) obj);
            }
        }, new oi.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 = dq.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 = dq.m1(this.x);
        if (TextUtils.isEmpty(m1)) {
            return;
        }
        F0(this.D, m1);
    }
}