导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - mainEntry.java 源代码

正在查看: Minits v4.9.3.32 应用的 mainEntry.java JAVA 源代码文件

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


package com.xone.android.framework;

import C9.h;
import N0.B0;
import a8.C0394a;
import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.BaseInputConnection;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import bb.AbstractC0515a;
import com.xone.android.framework.activities.LoadAppActivity;
import com.xone.android.framework.activities.MainCalendarViewActivity;
import com.xone.android.framework.activities.MainListCollectionActivity;
import com.xone.android.framework.activities.ReplicaConsoleActivity;
import com.xone.android.framework.activities.XoneBaseActivity;
import com.xone.android.framework.services.AppForegroundService;
import com.xone.android.framework.services.WatchDogService;
import com.xone.android.utils.Utils;
import com.xone.interfaces.IXoneApp;
import com.xone.interfaces.IXoneCollection;
import com.xone.interfaces.IXoneObject;
import eb.AbstractC0665a;
import f8.C0670e;
import f8.C0672g;
import fb.AbstractC0692e;
import fb.AbstractC0698k;
import fb.C0694g;
import g8.DialogC0706f;
import gb.AbstractC0734d;
import i8.C0767c;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.Future;
import k8.HandlerC0809j;
import o8.C0874b;
import org.mozilla.javascript.JavaScriptException;
import p8.AbstractC0943g;
import ta.FutureC0996a;
import ua.InterfaceC1032j0;
import ua.InterfaceC1034k0;
import ua.InterfaceC1046q0;
import ua.InterfaceC1049s0;
import ua.K0;
import ua.L0;
import w8.C1073c;

public final class mainEntry extends g.c implements ua.O {
    public boolean A;
    public Intent B;
    public Configuration C;
    public String m;
    public boolean n;
    public int o;
    public ProgressDialog p;
    public AlertDialog q;
    public AlertDialog r;
    public AlertDialog s;
    public AlertDialog t;
    public AlertDialog u;
    public AlertDialog v;
    public DialogC0706f w;
    public boolean x;
    public HandlerC0809j l = new HandlerC0809j(this);
    public final List y = new ArrayList();
    public final List z = new ArrayList();

    public static class a implements Runnable {
        public final WeakReference l;
        public final Throwable m;
        public final DialogInterface.OnClickListener n;

        public a(ua.O o, Throwable th, DialogInterface.OnClickListener onClickListener) {
            this.l = new WeakReference(o);
            this.m = th;
            this.n = onClickListener;
        }

        @Override
        public void run() {
            try {
                ua.O o = (ua.O) this.l.get();
                if (o != null && !o.c()) {
                    o.J(this.m, this.n);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static class b implements DialogInterface.OnClickListener {
        public final mainEntry l;

        public b(mainEntry mainentry) {
            this.l = mainentry;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            this.l.a1((AlertDialog) dialogInterface);
        }
    }

    public static class c implements DialogInterface.OnClickListener {
        public final mainEntry l;

        public c(mainEntry mainentry) {
            this.l = mainentry;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            this.l.E0(true);
        }
    }

    public static class d implements View.OnKeyListener {
        public final mainEntry l;
        public final AlertDialog m;

        public d(mainEntry mainentry, AlertDialog alertDialog) {
            this.l = mainentry;
            this.m = alertDialog;
        }

        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getAction() != 0 || i != 66) {
                return false;
            }
            this.l.a1(this.m);
            return true;
        }
    }

    public static class e implements DialogInterface.OnClickListener {
        public final mainEntry l;

        public e(mainEntry mainentry) {
            this.l = mainentry;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            try {
                Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
                intent.setData(Uri.fromParts("package", this.l.getPackageName(), null));
                this.l.startActivity(intent);
                this.l.A0("mainEntry.requestNeededPermissions(): Permissions denied permanently");
            } catch (Exception e) {
                this.l.b(e);
            }
        }
    }

    private AlertDialog F1(int i, CharSequence charSequence, CharSequence charSequence2) {
        AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
        if (i == 0) {
            h.setIcon(R.drawable.ic_dialog_info);
        } else {
            h.setIcon(R.drawable.ic_dialog_alert);
        }
        if (!TextUtils.isEmpty(charSequence)) {
            h.setTitle(charSequence);
        }
        if (!TextUtils.isEmpty(charSequence2)) {
            h.setMessage(charSequence2);
        }
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                mainEntry.this.Z1(dialogInterface, i2);
            }
        });
        AlertDialog create = h.create();
        create.setOwnerActivity(this);
        return create;
    }

    private void G2(int i, CharSequence charSequence, CharSequence charSequence2) {
        AlertDialog F1 = F1(i, charSequence, charSequence2);
        F1.show();
        TextView textView = (TextView) F1.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(A1());
        }
    }

    public static B0 J0(View view, B0 b0) {
        C0.b f = b0.f(B0.o.d());
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        marginLayoutParams.topMargin = f.b;
        marginLayoutParams.leftMargin = f.a;
        marginLayoutParams.bottomMargin = f.d;
        marginLayoutParams.rightMargin = f.c;
        view.setLayoutParams(marginLayoutParams);
        return B0.b;
    }

    public static String J1(String str) {
        if (str == null) {
            return null;
        }
        int indexOf = str.indexOf(44);
        return indexOf == -1 ? "" : str.substring(indexOf + 1);
    }

    public static boolean K1(File file) {
        return Y0(file, Arrays.asList("mappings.xml", "mappings.xml.sec", "mappings.xne", "mappings.xne.sec"));
    }

    public static void L0(LoadAppActivity loadAppActivity) {
        if (loadAppActivity.isFinishing()) {
            return;
        }
        loadAppActivity.finish();
    }

    private void M1() {
        InterfaceC1032j0 W0;
        C0670e x1;
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        IXoneObject currentCompany = c1.getCurrentCompany();
        IXoneCollection ownerCollection = currentCompany != null ? currentCompany.getOwnerCollection() : c1.GetCollection("Empresas");
        InterfaceC1032j0 properties = ownerCollection.getProperties();
        if (properties == null || (W0 = properties.W0("maintenance")) == null) {
            return;
        }
        InterfaceC1034k0 childNodes = W0.getChildNodes();
        for (int i = 0; i < childNodes.count(); i++) {
            InterfaceC1032j0 interfaceC1032j0 = childNodes.get(i);
            if (TextUtils.equals("action", interfaceC1032j0.getName()) && !TextUtils.equals("replica", AbstractC0734d.a(interfaceC1032j0, "name")) && (x1 = xoneApp.Z0().x1(interfaceC1032j0, ownerCollection)) != null) {
                this.z.add(x1);
            }
        }
    }

    public static boolean R1(String str) {
        String[] list = xoneApp.getContext().getAssets().list(str);
        if (list != null) {
            CharSequence text = xoneApp.getContext().getText(AbstractC0568j.E);
            for (String str2 : list) {
                if (TextUtils.equals(str2, text)) {
                    return true;
                }
            }
        }
        return false;
    }

    public static boolean Y0(File file, List list) {
        Iterator it = list.iterator();
        while (it.hasNext()) {
            if (new File(file, (String) it.next()).isFile()) {
                return true;
            }
        }
        return false;
    }

    public void Z1(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        if (T1()) {
            A0("MainEntry_GetInfoMessageDialog");
        } else {
            j1();
        }
        B2(false);
    }

    public void d2(C9.h hVar, DialogInterface dialogInterface, int i) {
        try {
            hVar.i(this);
        } catch (Exception e2) {
            b(e2);
        }
    }

    private void m1() {
        if (S1()) {
            F2();
            return;
        }
        Intent intent = getIntent();
        Bundle extras = intent.getExtras();
        ComponentName component = intent.getComponent();
        if (component != null && component.getClassName().compareTo("com.xone.android.framework.MainEntryMessageAlias") == 0) {
            AbstractC0692e.n(extras, "executeOnRecovery", false);
            AbstractC0692e.n(extras, "executeOnMessage", true);
        }
        String i = AbstractC0692e.i(extras, "appname");
        if (TextUtils.isEmpty(i)) {
            i = Utils.P1(getApplicationContext(), "appname", null);
        }
        if (TextUtils.isEmpty(i)) {
            i = D1();
        }
        String str = i;
        if (!TextUtils.isEmpty(str)) {
            String string = getApplicationContext().getSharedPreferences(str, 0).getString("XOneAppLanguage", "");
            if (!TextUtils.isEmpty(string)) {
                Locale locale = new Locale(string);
                Locale.setDefault(locale);
                Configuration configuration = getApplicationContext().getResources().getConfiguration();
                configuration.locale = locale;
                getApplicationContext().getResources().updateConfiguration(configuration, null);
            }
        }
        this.p = null;
        xoneApp.Z0().Q2(this.l);
        xoneApp.Z0().P2(this);
        xoneApp.Z0().W();
        A2();
        B2(false);
        Ja.k.b(xoneApp.getContext()).e();
        if (Build.MANUFACTURER.equals("SNOPOW") && Build.MODEL.equals("M9_LTE")) {
            C1073c.m();
        }
        boolean a2 = AbstractC0692e.a(extras, "executeOnRecovery", false);
        boolean a3 = AbstractC0692e.a(extras, "executeOnMessage", false);
        Intent e2 = AbstractC0692e.e(extras, "shareIntent", null);
        Parcelable g = AbstractC0692e.g(extras, "nfcTag", null);
        Bundle b2 = AbstractC0692e.b(extras, "intentBundle", null);
        if (TextUtils.isEmpty(str) && !Utils.p3()) {
            if (s2()) {
                w2();
                return;
            } else {
                O1();
                return;
            }
        }
        InputStream y1 = y1(str);
        if (y1 == null) {
            if (P1(str)) {
                p2(str, a2, a3, g, b2, e2);
                return;
            } else if (xoneApp.Z0().l3(0)) {
                A0("mainEntry.doOnCreate(): App not fully installed, starting XOneLive");
                return;
            } else {
                p2(str, a2, a3, g, b2, e2);
                return;
            }
        }
        if (Utils.p3()) {
            return;
        }
        try {
            File G1 = G1(str);
            if (Long.parseLong(Utils.K1(y1)) != ((G1 == null || !G1.exists()) ? 0L : Long.parseLong(Utils.r1(G1)))) {
                O1();
            } else {
                p2(str, a2, a3, g, b2, e2);
            }
            Utils.N(y1);
        } catch (Throwable th) {
            Utils.N(y1);
            throw th;
        }
    }

    private static xoneApp u1() {
        return xoneApp.Z0();
    }

    public void u2() {
        try {
            IXoneApp c1 = xoneApp.c1();
            if (c1 == null || c1.getUserInterface() == null) {
                return;
            }
            BaseInputConnection baseInputConnection = new BaseInputConnection(findViewById(AbstractC0564f.U0), true);
            KeyEvent keyEvent = new KeyEvent(0, 82);
            KeyEvent keyEvent2 = new KeyEvent(1, 82);
            baseInputConnection.sendKeyEvent(keyEvent);
            baseInputConnection.sendKeyEvent(keyEvent2);
        } catch (Exception e2) {
            b(e2);
        }
    }

    private void w2() {
        new h.a().d(true).e(7001).f(getString(ha.v.b)).c(new C9.c() {
            @Override
            public final void a(Set set) {
                mainEntry.this.e2(set);
            }
        }).h("android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE").a().i(this);
    }

    private void x2() {
        Iterator it = this.z.iterator();
        while (it.hasNext()) {
            C0874b.u((C0670e) it.next());
        }
    }

    @Override
    public void A0(String str) {
        r2("finish", str);
        finish();
    }

    public Typeface A1() {
        return B0.h.g(getApplicationContext(), ha.u.a);
    }

    public final void A2() {
        String str;
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        Resources resources = getResources();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        int i = Build.VERSION.SDK_INT;
        DisplayMetrics displayMetrics2 = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics2);
        c1.setGlobalMacro("##SCREEN_RESOLUTION_WIDTH##", String.valueOf(displayMetrics2.widthPixels));
        c1.setGlobalMacro("##SCREEN_RESOLUTION_HEIGHT##", String.valueOf(displayMetrics2.heightPixels));
        c1.setGlobalMacro("##CURRENT_LANGUAGE##", fb.n.b(this));
        c1.setGlobalMacro("##CURRENT_COUNTRY_CODE##", Locale.getDefault().getCountry());
        int i2 = displayMetrics.densityDpi;
        if (i2 != 120) {
            str = "mdpi";
            if (i2 != 160) {
                if (i2 == 240) {
                    str = "hdpi";
                } else if (i2 == 320) {
                    str = "xhdpi";
                } else if (i2 == 480) {
                    str = "xxhdpi";
                } else if (i2 == 640) {
                    str = "xxxhdpi";
                }
            }
        } else {
            str = "ldpi";
        }
        c1.setGlobalMacro("##CURRENT_DENSITY##", str);
        c1.setGlobalMacro("##CURRENT_DENSITY_VALUE##", String.valueOf(displayMetrics.density * 160.0f));
        c1.setGlobalMacro("##DEVICE_OS##", "android");
        c1.setGlobalMacro("##DEVICE_OSVERSION##", Build.VERSION.RELEASE);
        c1.setGlobalMacro("##DEVICE_OSSDKCODE##", Integer.toString(i));
        c1.setGlobalMacro("##DEVICE_OSSDK##", Build.VERSION.SDK);
        c1.setGlobalMacro("##DEVICE_MODEL##", Build.MODEL);
        c1.setGlobalMacro("##DEVICE_MANUFACTURER##", Build.MANUFACTURER);
        if (Utils.t3(this)) {
            if (Utils.q3(this)) {
                c1.SetVisualConditions("android:watchround", true);
                c1.setGlobalMacro("##DEVICE_TYPE##", "watchround");
            } else {
                c1.SetVisualConditions("android:watchsquare", true);
                c1.setGlobalMacro("##DEVICE_TYPE##", "watchsquare");
            }
        } else if (Utils.r3(this)) {
            c1.SetVisualConditions("android:tablet", true);
            c1.setGlobalMacro("##DEVICE_TYPE##", "tablet");
        } else if (Utils.o3(this)) {
            c1.SetVisualConditions("android:mini", true);
            c1.setGlobalMacro("##DEVICE_TYPE##", "mini");
        } else if (Utils.i3(this)) {
            c1.SetVisualConditions("android:hiphone", true);
            c1.setGlobalMacro("##DEVICE_TYPE##", "hiphone");
        } else {
            c1.SetVisualConditions("android:phone", true);
            c1.setGlobalMacro("##DEVICE_TYPE##", "phone");
        }
        String str2 = resources.getConfiguration().orientation == 1 ? "vertical" : "horizontal";
        c1.SetVisualConditions(str2, false);
        c1.setGlobalMacro("##CURRENT_ORIENTATION##", str2);
        PackageInfo X0 = X0(getPackageName());
        if (X0 != null) {
            c1.setGlobalMacro("##FRAME_VERSION##", X0.versionName);
            c1.setGlobalMacro("##FRAME_VERSION_CODE##", String.valueOf(X0.versionCode));
        }
        if (!ha.N.i()) {
            X0 = X0("com.xone.live.services");
        }
        if (X0 != null) {
            c1.setGlobalMacro("##LIVEUPDATE_VERSION##", X0.versionName);
            c1.setGlobalMacro("##LIVEUPDATE_VERSION_CODE##", String.valueOf(X0.versionCode));
        }
    }

    public final AlertDialog B1(Activity activity, Throwable th, final String str, DialogInterface.OnClickListener onClickListener) {
        AlertDialog.Builder g = AbstractC0665a.g(activity);
        boolean z = false;
        final String str2 = "";
        if (th instanceof ha.q) {
            str = th.getMessage();
            g.setCancelable(false);
        } else if (th instanceof JavaScriptException) {
            str = th.getMessage();
        } else if (th instanceof InterfaceC1049s0) {
            InterfaceC1049s0 interfaceC1049s0 = (InterfaceC1049s0) th;
            if (interfaceC1049s0.a()) {
                str = Utils.M2(th);
            }
            z = interfaceC1049s0.b();
        } else if (th instanceof C0394a) {
            str = th.getMessage();
        } else {
            z = true;
            if (th != 0) {
                str = Utils.M2(th);
                str2 = Utils.N2(th);
            }
        }
        g.setIcon(R.drawable.ic_dialog_alert);
        g.setTitle(AbstractC0568j.q);
        g.setMessage(str);
        if (onClickListener == null) {
            onClickListener = new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.dismiss();
                }
            };
        }
        g.setPositiveButton(AbstractC0568j.a, onClickListener);
        if (z) {
            final Context applicationContext = activity.getApplicationContext();
            final WeakReference weakReference = new WeakReference(activity.findViewById(R.id.content));
            g.setNeutralButton(w7.h.g, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    w7.s.r(applicationContext, weakReference, str, str2);
                }
            });
        }
        Utils.p(this.t);
        AlertDialog create = g.create();
        this.t = create;
        create.setOwnerActivity(activity);
        return this.t;
    }

    public void B2(boolean z) {
        this.n = z;
    }

    @Override
    public void C0(int i, Intent intent) {
        v2(false, i, intent);
    }

    public AlertDialog C1(Throwable th, DialogInterface.OnClickListener onClickListener) {
        return B1(this, th, null, onClickListener);
    }

    public void C2(AlertDialog alertDialog) {
        this.q = alertDialog;
    }

    public final String D1() {
        File[] listFiles;
        File parentFile = getApplicationContext().getFilesDir().getParentFile();
        if (parentFile == null || !parentFile.exists() || (listFiles = parentFile.listFiles()) == null) {
            return null;
        }
        for (File file : listFiles) {
            if (Q1(file)) {
                return v1(file.getName());
            }
        }
        return null;
    }

    public void D2(Exception exc) {
        exc.printStackTrace();
        String str = "A " + exc.getClass().getSimpleName() + " has ocurred";
        if (!TextUtils.isEmpty(exc.getMessage())) {
            str = str + "\n" + exc.getMessage();
        }
        E2(str);
    }

    @Override
    public void E0(boolean z) {
        v2(z, -1, null);
    }

    public HandlerC0809j E1() {
        return this.l;
    }

    public void E2(String str) {
        AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
        h.setTitle(AbstractC0568j.q);
        h.setMessage(str);
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.f2(dialogInterface, i);
            }
        });
        AlertDialog create = h.create();
        this.r = create;
        create.show();
        TextView textView = (TextView) this.r.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(A1());
        }
    }

    public final void F2() {
        n2();
        AlertDialog.Builder g = AbstractC0665a.g(this);
        g.setIcon(R.drawable.ic_dialog_alert);
        g.setTitle(AbstractC0568j.L);
        g.setMessage(AbstractC0568j.m0);
        g.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.g2(dialogInterface, i);
            }
        });
        Utils.p(this.s);
        AlertDialog create = g.create();
        this.s = create;
        create.setOwnerActivity(this);
        this.s.show();
        TextView textView = (TextView) this.s.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(A1());
        }
    }

    public final File G1(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        File file = new File(fb.n.a(getFilesDir().getParent() + "/app_" + str + "/mappings.xml", true));
        if (!file.exists() || !file.isFile()) {
            file = new File(fb.n.a(getFilesDir().getParent() + "/app_" + str + "/mappings.xml", false));
        }
        if (file.exists() && file.isFile()) {
            return file;
        }
        return null;
    }

    public DialogC0706f H1() {
        Utils.p(this.w);
        DialogC0706f dialogC0706f = new DialogC0706f(this);
        this.w = dialogC0706f;
        return dialogC0706f;
    }

    public void H2() {
        Message obtainMessage = this.l.obtainMessage();
        obtainMessage.what = 2016;
        this.l.sendMessage(obtainMessage);
    }

    public AlertDialog I1() {
        return this.q;
    }

    public void h2(final int i, final String str, final String str2, final B8.g gVar) {
        if (!Utils.s3()) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    mainEntry.this.h2(i, str, str2, gVar);
                }
            });
            return;
        }
        DialogC0706f H1 = H1();
        H1.d(i, gVar, str, str2);
        H1.show();
    }

    @Override
    public void J(Throwable th, DialogInterface.OnClickListener onClickListener) {
        th.printStackTrace();
        if (!Utils.s3()) {
            runOnUiThread(new a(this, th, onClickListener));
            return;
        }
        try {
            AlertDialog C1 = C1(th, onClickListener);
            C1.show();
            TextView textView = (TextView) C1.findViewById(R.id.message);
            if (textView != null) {
                textView.setTypeface(A1());
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void J2() {
        Intent intent = new Intent((Context) this, (Class<?>) ReplicaConsoleActivity.class);
        intent.setAction("android.intent.action.MAIN");
        intent.setFlags(268435456);
        intent.putExtra("appname", this.m);
        startActivity(intent);
    }

    public final void K2() {
        AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
        h.setTitle(AbstractC0568j.u0);
        h.setMessage(AbstractC0568j.t0);
        h.setCancelable(false);
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.l2(dialogInterface, i);
            }
        });
        h.create().show();
    }

    public final boolean L1() {
        Intent intent;
        if (xoneApp.Z0().S() == null || (intent = getIntent()) == null || !AbstractC0698k.C(intent, 4194304)) {
            return false;
        }
        this.A = true;
        Utils.l("XOneAndroidFramework", "Applying shortcut bug workaround to main entry activity");
        A0("mainEntry.hasShortcutBug(): Finishing activity");
        return true;
    }

    public final void L2(CharSequence charSequence) {
        AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
        h.setTitle(AbstractC0568j.u0);
        h.setMessage(charSequence);
        h.setCancelable(false);
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.m2(dialogInterface, i);
            }
        });
        h.create().show();
    }

    public final void M2(Configuration configuration) {
        Configuration configuration2 = this.C;
        if (configuration2 == null) {
            this.C = configuration;
        } else {
            configuration2.updateFrom(configuration);
        }
    }

    public void N1() {
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        String entryPointCollection = c1.getEntryPointCollection(c1.GetCurrentVisualConditions());
        if (TextUtils.isEmpty(entryPointCollection)) {
            return;
        }
        final IXoneCollection GetCollection = c1.GetCollection(entryPointCollection);
        if (!C9.e.r(getApplicationContext())) {
            h1(GetCollection);
            return;
        }
        InterfaceC1032j0 GetNode = GetCollection.GetNode("permissions");
        if (GetNode == null) {
            h1(GetCollection);
            return;
        }
        InterfaceC1034k0<InterfaceC1032j0> childNodes = GetNode.getChildNodes();
        if (childNodes == null || childNodes.count() <= 0) {
            h1(GetCollection);
            return;
        }
        LinkedHashSet linkedHashSet = new LinkedHashSet();
        for (InterfaceC1032j0 interfaceC1032j0 : childNodes) {
            if (interfaceC1032j0 == null) {
                throw new IllegalArgumentException("Null permission node");
            }
            linkedHashSet.addAll(C9.e.u(this, interfaceC1032j0.w0("name")));
        }
        new h.a().d(true).e(7000).f(getString(ha.v.b)).c(new C9.c() {
            @Override
            public final void a(Set set) {
                mainEntry.this.b2(GetCollection, set);
            }
        }).g(linkedHashSet).a().i(this);
    }

    public void O1() {
        new C8.k(this).runSeriallyAsyncTask();
    }

    public boolean P1(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        File file = new File(getApplicationContext().getApplicationInfo().dataDir, "app_" + str);
        if (file.exists() && K1(file)) {
            return new File(file, "license.ini").exists() && new File(file, "bd/gestion.db").exists();
        }
        return false;
    }

    public final boolean Q1(File file) {
        if (!file.isDirectory()) {
            return false;
        }
        File file2 = new File(file, getString(AbstractC0568j.E));
        if (file2.exists()) {
            return file2.isFile();
        }
        return false;
    }

    public final boolean S1() {
        return getApplicationContext().getSharedPreferences("com.xone.live.SET_FRAMEWORK_LOCKED_BY_SECURE_PROVISIONING", 0).getBoolean("locked", false);
    }

    public boolean T1() {
        return !this.n;
    }

    @Override
    public void U() {
        v2(false, -1, null);
    }

    public final void U1(DialogInterface dialogInterface, int i) {
        H2();
    }

    public void V0(int i, String str, String str2) {
        if (!AbstractC0515a.c(i)) {
            G2(i, str, str2);
            return;
        }
        if (i != -666) {
            if (i == -8100 && TextUtils.isEmpty(str2)) {
                return;
            }
            if (fb.t.h(str2)) {
                G2(i, str, "NO DESCRIPTION");
                return;
            }
            if ("##EXIT##".equals(str2)) {
                A0("mainEntry.HandleErrors(): ##EXIT## macro");
            } else if ("##EXITAPP##".equals(str2)) {
                A0("mainEntry.HandleErrors(): ##EXITAPP## macro");
            } else {
                G2(i, str, str2);
            }
        }
    }

    public final void V1(DialogInterface dialogInterface, int i) {
        A0("mainEntry.doLoginProcess() onPermissionsGranted catch handler");
    }

    public InputStream W0(String str) {
        try {
            return getAssets().open(str);
        } catch (IOException unused) {
            return null;
        }
    }

    public final void W1(IXoneCollection iXoneCollection, Set set) {
        try {
            i1(iXoneCollection);
        } catch (Exception e2) {
            J(e2, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    mainEntry.this.V1(dialogInterface, i);
                }
            });
        }
    }

    public PackageInfo X0(String str) {
        try {
            return getPackageManager().getPackageInfo(str, 0);
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    public final void X1(DialogInterface dialogInterface, int i) {
        A0("mainEntry.doLoginProcess() catch handler");
    }

    public final void Y1() {
        if (isFinishing()) {
            return;
        }
        A0("MainEntry.finishApp()");
    }

    public final void Z0(StringBuilder sb2) {
        Context applicationContext = getApplicationContext();
        sb2.append("\n\n");
        sb2.append(getString(AbstractC0568j.n));
        sb2.append(" ");
        sb2.append(Utils.Y0(applicationContext));
    }

    @Override
    public void a(C9.h hVar) {
        if (this.y.contains(hVar)) {
            return;
        }
        this.y.add(hVar);
    }

    public void a1(AlertDialog alertDialog) {
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        try {
            EditText editText = (EditText) alertDialog.findViewById(AbstractC0564f.R1);
            EditText editText2 = (EditText) alertDialog.findViewById(AbstractC0564f.n1);
            String str = null;
            String obj = editText.getText() == null ? null : editText.getText().toString();
            if (editText2.getText() != null) {
                str = editText2.getText().toString();
            }
            if (c1.LogonUser(obj, str, getString(AbstractC0568j.t0)) == null) {
                K2();
                alertDialog.dismiss();
                return;
            }
            Utils.Y3(getApplicationContext(), obj, this.m + "##user");
            xoneApp.Z0().z = true;
            removeDialog(2);
            if (g1()) {
                o1();
            } else {
                n1();
            }
        } catch (Exception e2) {
            e2.printStackTrace();
            String message = e2.getMessage();
            if (TextUtils.isEmpty(message)) {
                message = e2.getClass().getSimpleName();
            }
            L2(message);
        }
    }

    public final void a2(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        A0("MainEntryHandleError_OnClick");
    }

    @Override
    public void b(Throwable th) {
        J(th, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.a2(dialogInterface, i);
            }
        });
    }

    public final void b1(int i) {
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(AbstractC0564f.U0);
        if (relativeLayout.getChildCount() > 0) {
            relativeLayout.removeAllViews();
        }
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        C0672g z1 = xoneApp.Z0().z1(c1.getUser());
        r8.m mVar = new r8.m(this);
        mVar.m(z1, this.o, i, relativeLayout.getMeasuredWidth());
        relativeLayout.addView(mVar, -1, -1);
    }

    public final void b2(IXoneCollection iXoneCollection, Set set) {
        try {
            h1(iXoneCollection);
        } catch (Exception e2) {
            b(e2);
        }
    }

    @Override
    public boolean c() {
        return isDestroyed();
    }

    @Override
    public void c0(String str, boolean z, boolean z2, Parcelable parcelable, Bundle bundle, Intent intent) {
        File file = new File(getApplicationContext().getFilesDir().getParent(), "app_" + str);
        if (!file.exists() || !file.isDirectory()) {
            y0();
            return;
        }
        if (!fb.t.E(str, Utils.P1(getApplicationContext(), "appname", null))) {
            Utils.Y3(getApplicationContext(), str, "appname");
        }
        this.m = str;
        xoneApp Z0 = xoneApp.Z0();
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            throw new NullPointerException("AppData is not loaded yet");
        }
        this.o = w1(this.m);
        c1.setUserInterface(new XoneGlobalUI());
        try {
            Z0.P(str);
            C0694g c0694g = new C0694g(new File(Z0.T(), "app.ini"));
            Z0.o(c0694g.a("UseTranslation", true));
            Z0.O(c0694g.a("EncryptApp", false));
        } catch (Exception e2) {
            D2(e2);
        }
        if ((Z0.s1() != null || Z0.y) && c1.getConfigFile() != null) {
            boolean z3 = Z0.y;
            if (z3 && !Z0.z) {
                if (this.u != null) {
                    try {
                        dismissDialog(2);
                    } catch (Exception e3) {
                        e3.printStackTrace();
                    }
                }
                j1();
            } else if (z3) {
                if (g1()) {
                    o1();
                } else {
                    n1();
                }
            }
        } else if (z || z2 || parcelable != null) {
            Z0.z = false;
            Z0.y = false;
            new C8.C(z, z2, parcelable, bundle, intent).runSeriallyAsyncTask();
        } else {
            Z0.z = false;
            Z0.y = false;
            Context applicationContext = getApplicationContext();
            Intent u = LoadAppActivity.u();
            if (ha.N.d(applicationContext) && Utils.e3(applicationContext)) {
                this.B = u;
            } else {
                startActivityForResult(u, 500);
            }
        }
        Z0.Q2(this.l);
    }

    public final void c1() {
        StringBuilder sb2 = new StringBuilder();
        if (!TextUtils.isEmpty("cache/media")) {
            sb2.append("/");
            sb2.append("cache/media");
        }
        String D0 = Utils.D0(xoneApp.Z0().Y(), xoneApp.Z0().T(), fb.t.G(sb2.toString(), "/"), false);
        if (TextUtils.isEmpty(D0)) {
            return;
        }
        File file = new File(D0);
        if (file.exists()) {
            Utils.n0(file);
        }
    }

    public final void c2() {
        if (c()) {
            Utils.l("XOneAndroidFramework", "MainEntry is already destroyed");
        } else {
            z2(false);
        }
    }

    public boolean d1(String str, int i, int i2) {
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            E0(true);
            return false;
        }
        IXoneCollection GetCollection = c1.GetCollection(str);
        if (GetCollection == null) {
            return false;
        }
        if (i == 0) {
            Intent intent = TextUtils.equals(GetCollection.CollPropertyValue("viewmode"), "calendar") ? new Intent((Context) this, (Class<?>) MainCalendarViewActivity.class) : XoneBaseActivity.z3(GetCollection);
            intent.setAction("android.intent.action.MAIN");
            intent.putExtra("collname", str);
            intent.putExtra("mode", i);
            intent.putExtra("mask", i2);
            startActivityForResult(intent, 510);
        } else {
            Intent y3 = XoneBaseActivity.y3(GetCollection);
            y3.setAction("android.intent.action.MAIN");
            y3.putExtra("collname", str);
            y3.putExtra("newobject", true);
            y3.putExtra("mode", i);
            y3.putExtra("mask", i2);
            startActivityForResult(y3, 503);
        }
        return true;
    }

    public final void e1() {
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            return;
        }
        InterfaceC1032j0 appNode = c1.getAppNode();
        String w0 = appNode.w0("autologon-username");
        String w02 = appNode.w0("autologon-password");
        if (TextUtils.isEmpty(w0)) {
            w0 = "admin";
        }
        if (TextUtils.isEmpty(w02)) {
            w02 = "";
        }
        if (c1.LogonUser(w0, w02, getString(AbstractC0568j.t0)) == null) {
            AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
            h.setTitle(AbstractC0568j.u0);
            h.setMessage(AbstractC0568j.t0);
            h.setCancelable(false);
            h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    mainEntry.this.U1(dialogInterface, i);
                }
            });
            Utils.p(this.v);
            AlertDialog create = h.create();
            this.v = create;
            create.show();
            return;
        }
        Utils.Y3(getApplicationContext(), w0, this.m + "##user");
        xoneApp.Z0().z = true;
        if (g1()) {
            o1();
        } else {
            n1();
        }
    }

    public final void e2(Set set) {
        O1();
    }

    public final void f1(int i, Intent intent) {
        if (i != 10) {
            E0(true);
            return;
        }
        if (intent == null) {
            return;
        }
        Bundle extras = intent.getExtras();
        if (extras == null) {
            Utils.l("XOneAndroidFramework", "doCustomLogin(): Cannot retrieve intent extras from activity result!");
            return;
        }
        String j = AbstractC0692e.j(extras, "##LOGIN_NEWUSER##", null);
        String j2 = AbstractC0692e.j(extras, "##LOGIN_NEWPASS##", null);
        int d2 = AbstractC0692e.d(extras, "##LOGIN_COLL_OBJECT_INDEX##", -1);
        xoneApp.Z0().S0(J1(j), J1(j2), d2);
    }

    public final void f2(DialogInterface dialogInterface, int i) {
        j1();
    }

    public boolean g1() {
        xoneApp Z0 = xoneApp.Z0();
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            throw new NullPointerException("appData is not loaded yet");
        }
        if (c1.getCurrentCompany() != null) {
            Z0.G2(false);
            String y = fb.t.y(c1.getCurrentCompany().getVariables("##INACTIVITY_TIME##"));
            if (!TextUtils.isEmpty(y)) {
                Z0.H2(Integer.parseInt(y));
                Z0.G2(true);
            }
        }
        if (Z0.p1()) {
            Z0.j3();
        }
        return !TextUtils.isEmpty(c1.getEntryPointCollection(c1.GetCurrentVisualConditions()));
    }

    public final void g2(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
        A0("mainEntry.showFrameworkLockedBySecureProvisioning(): Button onClick()");
    }

    public void h1(IXoneCollection iXoneCollection) {
        Intent y3;
        M1();
        x2();
        String l1 = xoneApp.Z0().l1();
        if (TextUtils.isEmpty(l1)) {
            y3 = XoneBaseActivity.y3(iXoneCollection);
        } else if (l1.compareToIgnoreCase("calendar") == 0) {
            y3 = new Intent((Context) this, (Class<?>) MainCalendarViewActivity.class);
        } else if (l1.compareToIgnoreCase("grid") == 0) {
            y3 = new Intent((Context) this, (Class<?>) MainListCollectionActivity.class);
        } else if (l1.compareToIgnoreCase("edit") == 0) {
            y3 = XoneBaseActivity.y3(iXoneCollection);
        } else {
            Utils.l("XOneAndroidFramework", "Loading entry point error, unknown collection mode " + l1);
            y3 = XoneBaseActivity.y3(iXoneCollection);
        }
        y3.putExtra("collname", iXoneCollection.getName());
        y3.putExtra("mask", 0);
        y3.putExtra("newobject", true);
        startActivityForResult(y3, 511);
    }

    public void i1(IXoneCollection iXoneCollection) {
        xoneApp Z0 = xoneApp.Z0();
        IXoneApp c1 = xoneApp.c1();
        iXoneCollection.setVariables("##LOGIN_LASTUSER##", Utils.P1(Z0, this.m + "##user", ""));
        iXoneCollection.setVariables("##LOGIN_LASTPASS##", null);
        iXoneCollection.setVariables("##LOGIN_LASTNOUSERIN##", "0");
        iXoneCollection.setVariables("##LOGIN_ERRORDESCRIPTION##", getString(AbstractC0568j.t0));
        if (C9.e.q(Z0, "android.permission.READ_PHONE_STATE")) {
            String Y0 = Utils.Y0(Z0);
            iXoneCollection.setVariables("DEVICEID", Y0);
            if (c1 != null) {
                c1.setGlobalMacro("##DEVICEID##", Y0);
                c1.setGlobalMacro("##ANDROIDID##", Utils.G0(Z0));
            }
        }
        Intent y3 = XoneBaseActivity.y3(iXoneCollection);
        y3.setAction("android.intent.action.MAIN");
        y3.putExtra("collname", iXoneCollection.getName());
        y3.putExtra("mask", 0);
        y3.putExtra("newobject", true);
        startActivityForResult(y3, 502);
    }

    public final void i2(DialogInterface dialogInterface, int i) {
        A0("mainEntry.showNoAppInstalled(): Button onClick()");
    }

    public void j1() {
        final IXoneCollection iXoneCollection;
        InterfaceC1032j0 interfaceC1032j0;
        try {
            xoneApp Z0 = xoneApp.Z0();
            IXoneApp G0 = Z0.G0();
            if (G0 == null) {
                return;
            }
            if (Z0.O1()) {
                e1();
                return;
            }
            String loginCollectionName = G0.getLoginCollectionName(G0.GetCurrentVisualConditions());
            if (TextUtils.isEmpty(loginCollectionName)) {
                iXoneCollection = null;
                interfaceC1032j0 = null;
            } else {
                iXoneCollection = G0.GetCollection(loginCollectionName);
                interfaceC1032j0 = iXoneCollection.getProperties();
            }
            if (interfaceC1032j0 == null) {
                H2();
                return;
            }
            if (!C9.e.r(getApplicationContext())) {
                i1(iXoneCollection);
                return;
            }
            InterfaceC1032j0 GetNode = iXoneCollection.GetNode("permissions");
            if (GetNode == null) {
                i1(iXoneCollection);
                return;
            }
            InterfaceC1034k0<InterfaceC1032j0> childNodes = GetNode.getChildNodes();
            if (childNodes != null && childNodes.count() > 0) {
                LinkedHashSet linkedHashSet = new LinkedHashSet();
                for (InterfaceC1032j0 interfaceC1032j02 : childNodes) {
                    if (interfaceC1032j02 == null) {
                        throw new IllegalArgumentException("Null permission node");
                    }
                    linkedHashSet.addAll(C9.e.u(this, interfaceC1032j02.w0("name")));
                }
                new h.a().d(true).e(7000).f(getString(ha.v.b)).c(new C9.c() {
                    @Override
                    public final void a(Set set) {
                        mainEntry.this.W1(iXoneCollection, set);
                    }
                }).g(linkedHashSet).a().i(this);
                return;
            }
            i1(iXoneCollection);
        } catch (Exception e2) {
            J(e2, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    mainEntry.this.X1(dialogInterface, i);
                }
            });
        }
    }

    public final void j2(DialogInterface dialogInterface, int i) {
        A0("mainEntry.ShowNoAppInstalledRunnable(): Button onClick()");
    }

    public final boolean k1() {
        InterfaceC1032j0 configFile;
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null || (configFile = c1.getConfigFile()) == null) {
            return false;
        }
        InterfaceC1032j0 b0 = configFile.W0("collprops").b0("coll", "logoff-coll", "true");
        if (b0 == null) {
            return q1();
        }
        String w0 = b0.w0("name");
        IXoneCollection GetCollection = c1.GetCollection(w0);
        if (GetCollection == null) {
            return false;
        }
        Intent y3 = XoneBaseActivity.y3(GetCollection);
        y3.setAction("android.intent.action.MAIN");
        y3.putExtra("collname", w0);
        y3.putExtra("mask", 0);
        y3.putExtra("newobject", true);
        startActivityForResult(y3, 509);
        return true;
    }

    public final void k2(String str, StringBuilder sb2) {
        if (c()) {
            return;
        }
        AlertDialog.Builder h = AbstractC0665a.h(this, str);
        h.setMessage(sb2);
        h.setCancelable(false);
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.j2(dialogInterface, i);
            }
        });
        Utils.p(I1());
        AlertDialog create = h.create();
        C2(create);
        create.show();
        TextView textView = (TextView) create.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(A1());
        }
    }

    public final void l1() {
        IXoneApp c1 = xoneApp.c1();
        try {
            if (c1 == null) {
                t1(-1, null);
                return;
            }
            while (c1.IsScriptExecute()) {
                Thread.sleep(50L);
            }
            c1.getCompany().getOwnerCollection().ExecuteCollAction("onlogoff");
            t1(-1, null);
        } catch (InterruptedException unused) {
        } catch (Exception e2) {
            if (c1 == null) {
                e2.printStackTrace();
                return;
            }
            InterfaceC1046q0 error = c1.getError();
            if (error == null) {
                b(e2);
                return;
            }
            int number = error.getNumber();
            if (number == -8100 && TextUtils.isEmpty(error.getDescription())) {
                return;
            }
            Message obtainMessage = this.l.obtainMessage();
            obtainMessage.what = 701;
            Bundle bundle = new Bundle();
            bundle.putInt("code", number);
            bundle.putString("title", "Logoff error");
            bundle.putString("message", error.getDescription());
            obtainMessage.setData(bundle);
            this.l.sendMessage(obtainMessage);
        }
    }

    public final void l2(DialogInterface dialogInterface, int i) {
        H2();
    }

    public final void m2(DialogInterface dialogInterface, int i) {
        H2();
    }

    public void n1() {
        xoneApp.Z0().K2(null);
        b1(0);
        M1();
        x2();
    }

    public final void n2() {
        Class d2;
        if (ha.N.i() && (d2 = ha.M.d("com.xone.live.services.LiveUpdateService")) != null) {
            Utils.Q3(getApplicationContext(), d2, false, "FrameworkLockedByProvisioning");
        }
    }

    public void o1() {
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null) {
            throw new NullPointerException("appData is not loaded yet");
        }
        if (TextUtils.isEmpty(c1.getEntryPointCollection(c1.GetCurrentVisualConditions()))) {
            return;
        }
        Message obtainMessage = E1().obtainMessage();
        obtainMessage.what = 4;
        E1().sendMessage(obtainMessage);
    }

    public final void o2() {
        Class d2 = ha.M.d("com.xone.android.hotswap.activities.SetupActivity");
        if (d2 == null) {
            return;
        }
        Intent intent = new Intent(getApplicationContext(), (Class<?>) d2);
        intent.addFlags(268435456);
        startActivity(intent);
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.j*/.onActivityResult(i, i2, intent);
        r2("onActivityResult", null);
        if (i == 500 && i2 == -1) {
            getWindow().setFlags(4, 0);
            this.l.post(new Runnable() {
                @Override
                public final void run() {
                    mainEntry.this.j1();
                }
            });
            return;
        }
        if (i == 500) {
            xoneApp Z0 = xoneApp.Z0();
            Future s1 = Z0.s1();
            if (s1 != null && !s1.isDone()) {
                s1.cancel(true);
            }
            Z0.y = false;
            Z0.z = false;
            A0("mainEntry.onActivityResult(): Request code: ACTIVITY_LOADAPP");
            return;
        }
        if (i == 511) {
            if (AbstractC0698k.c(intent, "bExcludeMainEntry", false)) {
                return;
            }
            this.l.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    mainEntry.this.c2();
                }
            }, 500L);
            return;
        }
        if (i == 501) {
            A0("mainEntry.onActivityResult(): Request code: ACTIVITY_UPDATE");
            return;
        }
        if (i == 502) {
            if (i2 == 12) {
                A0("mainEntry.onActivityResult(): Result code: ACTIVITY_RESULT_CODE_ERROR");
                return;
            } else {
                f1(i2, intent);
                return;
            }
        }
        if (i2 == 14) {
            z2(true);
        } else if (i == 503 && i2 == 10) {
            Utils.k4(u1(), "MainEntryActivity", null, null);
        }
    }

    public void onConfigurationChanged(android.content.res.Configuration r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.framework.mainEntry.onConfigurationChanged(android.content.res.Configuration):void");
    }

    public void onCreate(Bundle bundle) {
        r2("onCreate", null);
        this.x = false;
        requestWindowFeature(1);
        setContentView(AbstractC0565g.n);
        super/*androidx.fragment.app.j*/.onCreate(bundle);
        try {
            getOnBackPressedDispatcher().h(new L0(new K0() {
                @Override
                public final void a() {
                    mainEntry.this.u2();
                }
            }));
            g.a supportActionBar = getSupportActionBar();
            if (supportActionBar != null) {
                supportActionBar.k();
            }
            Configuration configuration = new Configuration();
            this.C = configuration;
            configuration.updateFrom(getResources().getConfiguration());
            if (L1()) {
                return;
            }
            if (bundle != null) {
                q2(bundle);
                return;
            }
            if (Build.VERSION.SDK_INT >= 35) {
                N0.Z.F0(findViewById(AbstractC0564f.U0), new N0.I() {
                    public final B0 a(View view, B0 b0) {
                        return mainEntry.J0(view, b0);
                    }
                });
            }
            m1();
        } catch (Exception e2) {
            b(e2);
        }
    }

    public Dialog onCreateDialog(int i) {
        try {
            if (i == 1) {
                return new ProgressDialog(this);
            }
            if (i != 2) {
                if (i != 2024) {
                    return null;
                }
                return t2();
            }
            String P1 = Utils.P1(getApplicationContext(), this.m + "##user", "");
            View inflate = LayoutInflater.from(this).inflate(AbstractC0565g.m, (ViewGroup) null);
            EditText editText = (EditText) inflate.findViewById(AbstractC0564f.R1);
            EditText editText2 = (EditText) inflate.findViewById(AbstractC0564f.n1);
            TextView textView = (TextView) inflate.findViewById(AbstractC0564f.S1);
            AbstractC0665a.b(textView.getContext().getTheme(), textView, (TextView) inflate.findViewById(AbstractC0564f.o1));
            editText.setText(P1);
            AlertDialog.Builder h = AbstractC0665a.h(this, xoneApp.Z0().s0());
            h.setIcon(AbstractC0563e.I);
            h.setTitle(AbstractC0568j.I);
            h.setView(inflate);
            h.setCancelable(false);
            h.setPositiveButton(AbstractC0568j.a, new b(this));
            h.setNegativeButton(AbstractC0568j.f, new c(this));
            AlertDialog create = h.create();
            this.u = create;
            editText2.setOnKeyListener(new d(this, create));
            Window window = this.u.getWindow();
            if (window != null) {
                window.getAttributes().windowAnimations = AbstractC0569k.a;
            }
            return this.u;
        } catch (Exception e2) {
            b(e2);
            return null;
        }
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        super/*android.app.Activity*/.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(AbstractC0566h.b, menu);
        MenuItem findItem = menu.findItem(AbstractC0564f.Q0);
        if (findItem != null) {
            findItem.setIcon(R.drawable.ic_menu_directions);
        }
        MenuItem findItem2 = menu.findItem(AbstractC0564f.T0);
        if (findItem2 != null) {
            findItem2.setIcon(R.drawable.ic_menu_close_clear_cancel);
        }
        MenuItem findItem3 = menu.findItem(AbstractC0564f.R0);
        if (findItem3 != null) {
            findItem3.setIcon(R.drawable.ic_menu_info_details);
        }
        MenuItem findItem4 = menu.findItem(AbstractC0564f.S0);
        if (findItem4 != null) {
            if (this.o == 1) {
                findItem4.setTitle(AbstractC0568j.N);
                findItem4.setIcon(R.drawable.ic_menu_slideshow);
            } else {
                findItem4.setTitle(AbstractC0568j.O);
                findItem4.setIcon(R.drawable.ic_menu_agenda);
            }
        }
        return true;
    }

    public void onDestroy() {
        r2("onDestroy", null);
        super.onDestroy();
        if (this.A) {
            return;
        }
        try {
            try {
                xoneApp Z0 = xoneApp.Z0();
                IXoneApp c1 = xoneApp.c1();
                Z0.J2(false);
                Utils.p(this.q);
                Utils.p(this.r);
                Utils.p(this.s);
                Utils.p(this.t);
                Utils.p(this.v);
                Utils.p(this.w);
                if (s8.h.k()) {
                    s8.h.f().j().clear();
                }
                this.l.removeCallbacksAndMessages(null);
                this.l = null;
                if (Z0.P1()) {
                    c1();
                }
                Z0.y2(null);
                Z0.K2(null);
                Z0.Q2(null);
                Z0.P2(null);
                Z0.A(false);
                if (c1 != null && (c1.getUserInterface() instanceof XoneGlobalUI)) {
                    ((XoneGlobalUI) c1.getUserInterface()).stopPlaySoundAndVibrate();
                }
                if (C0767c.e()) {
                    C0767c d2 = C0767c.d();
                    if (d2.f()) {
                        d2.r();
                    }
                }
                i8.m.e();
                if (Z0.P1()) {
                    c1();
                }
                Z0.p0("mainEntry.onDestroy()", false);
                Future s1 = Z0.s1();
                if (s1 != null && !s1.isDone()) {
                    s1.cancel(true);
                }
                Z0.y = false;
                Z0.z = false;
                Z0.M2(null);
                AppForegroundService.b(Z0);
                if (Build.MANUFACTURER.equals("SNOPOW") && Build.MODEL.equals("M9_LTE")) {
                    C1073c.b();
                }
                this.x = true;
            } catch (Exception e2) {
                e2.printStackTrace();
                this.x = true;
            }
        } catch (Throwable th) {
            this.x = true;
            throw th;
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        r2("onOptionsItemSelected", null);
        try {
            int itemId = menuItem.getItemId();
            if (itemId == AbstractC0564f.R0) {
                J2();
                return true;
            }
            if (itemId == AbstractC0564f.T0) {
                U();
                return true;
            }
            if (itemId == AbstractC0564f.Q0) {
                moveTaskToBack(false);
                return true;
            }
            if (itemId != AbstractC0564f.S0) {
                return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
            }
            int i = this.o == 1 ? 2 : 1;
            this.o = i;
            if (i == 1) {
                menuItem.setTitle(AbstractC0568j.N);
                menuItem.setIcon(R.drawable.ic_menu_slideshow);
                this.o = 1;
            } else {
                menuItem.setTitle(AbstractC0568j.O);
                menuItem.setIcon(R.drawable.ic_menu_agenda);
                this.o = 2;
            }
            y2(this.m, this.o);
            RelativeLayout relativeLayout = (RelativeLayout) findViewById(AbstractC0564f.U0);
            if (relativeLayout.getChildCount() <= 0 || !(relativeLayout.getChildAt(0) instanceof r8.m)) {
                b1(0);
                return true;
            }
            int currentSelect = ((r8.m) relativeLayout.getChildAt(0)).getCurrentSelect();
            b1(currentSelect);
            Message obtainMessage = this.l.obtainMessage();
            obtainMessage.what = 5;
            obtainMessage.arg2 = currentSelect;
            this.l.sendMessage(obtainMessage);
            return true;
        } catch (Exception e2) {
            b(e2);
            return false;
        }
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        r2("onRequestPermissionsResult", null);
        super/*androidx.fragment.app.j*/.onRequestPermissionsResult(i, strArr, iArr);
        C9.e.v(this, strArr);
        final C9.h i2 = C9.e.i(i, this.y);
        if (i2 == null) {
            return;
        }
        HashSet hashSet = new HashSet();
        HashSet hashSet2 = new HashSet();
        if (iArr != null) {
            for (int i3 = 0; i3 < iArr.length; i3++) {
                String str = strArr[i3];
                if (TextUtils.equals("android.permission.ACCESS_BACKGROUND_LOCATION", str) && C9.e.p(this, "android.permission.ACCESS_BACKGROUND_LOCATION")) {
                    iArr[i3] = 0;
                }
                if (iArr[i3] == 0) {
                    hashSet.add(str);
                } else {
                    hashSet2.add(str);
                }
            }
        }
        try {
            if (hashSet2.isEmpty()) {
                if (!i2.f()) {
                    i2.h(hashSet);
                    return;
                }
                i2.j(false);
                i2.a("android.permission.ACCESS_BACKGROUND_LOCATION");
                i2.i(this);
                return;
            }
            if (Build.VERSION.SDK_INT >= 29 && hashSet2.size() == 1 && hashSet2.contains("android.permission.ACCESS_BACKGROUND_LOCATION")) {
                Set d2 = i2.d();
                d2.clear();
                d2.add("android.permission.ACCESS_BACKGROUND_LOCATION");
                i2.i(this);
            } else {
                if (i2.e()) {
                    J(new ha.q(i2.c()), new DialogInterface.OnClickListener() {
                        @Override
                        public final void onClick(DialogInterface dialogInterface, int i4) {
                            mainEntry.this.d2(i2, dialogInterface, i4);
                        }
                    });
                }
                i2.g(hashSet2);
            }
        } catch (Exception e2) {
            b(e2);
        }
    }

    public void onRestoreInstanceState(Bundle bundle) {
        r2("onRestoreInstanceState", null);
        super/*android.app.Activity*/.onRestoreInstanceState(bundle);
    }

    public void onResume() {
        super/*androidx.fragment.app.j*/.onResume();
        xoneApp.Z0().y2(this);
        if (this.B != null) {
            Utils.l("XOneAndroidFramework", "Launching saved LoadAppActivity intent");
            startActivityForResult(this.B, 500);
            this.B = null;
        }
    }

    public void onSaveInstanceState(Bundle bundle) {
        r2("onSaveInstanceState", null);
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        if (TextUtils.isEmpty(this.m)) {
            return;
        }
        bundle.putString("appname", this.m);
    }

    public void onUserInteraction() {
        super/*android.app.Activity*/.onUserInteraction();
        if (xoneApp.Z0().p1()) {
            xoneApp.Z0().L2(Calendar.getInstance());
        }
    }

    @Override
    public void p(C9.h hVar) {
        List<C9.f> j = C9.e.j(this, hVar);
        if (j.isEmpty()) {
            hVar.h(hVar.d());
            return;
        }
        HashSet hashSet = new HashSet();
        for (C9.f fVar : j) {
            String a2 = fVar.a();
            if (TextUtils.isEmpty(a2)) {
                a2 = "";
            }
            Utils.l("XOneAndroidFramework", "Permission denied: " + a2);
            if (fVar.b()) {
                hashSet.add(fVar.a());
            }
        }
        if (hashSet.isEmpty()) {
            a(hVar);
            C9.e.h(this, hVar);
        } else {
            J(new ha.q(hVar.c()), new e(this));
            hVar.g(hashSet);
        }
    }

    public Future p1(IXoneObject iXoneObject) {
        if (iXoneObject == null) {
            return new FutureC0996a();
        }
        IXoneCollection ownerCollection = iXoneObject.getOwnerCollection();
        Intent y3 = XoneBaseActivity.y3(ownerCollection);
        y3.setAction("android.intent.action.MAIN");
        y3.setFlags(268435456);
        y3.putExtra("collname", ownerCollection.getName());
        y3.putExtra("saveandquit", true);
        y3.putExtra("index", Integer.valueOf(ownerCollection.ObjectIndex(iXoneObject)));
        if (ownerCollection.getOwnerObject() != null) {
            y3.putExtra("pushobject", true);
            Integer valueOf = Integer.valueOf(xoneApp.Z0().D1().nextInt());
            y3.putExtra("parentID", valueOf);
            xoneApp.Z0().k2(iXoneObject, valueOf);
        }
        XoneBaseActivity.P1(y3, ownerCollection);
        startActivity(y3);
        return new FutureC0996a(iXoneObject);
    }

    public final void p2(String str, boolean z, boolean z2, Parcelable parcelable, Bundle bundle, Intent intent) {
        Message obtainMessage = this.l.obtainMessage();
        obtainMessage.what = 2025;
        Bundle bundle2 = new Bundle();
        bundle2.putString("appname", str);
        bundle2.putBoolean("executeOnRecovery", z);
        bundle2.putBoolean("executeOnMessage", z2);
        bundle2.putParcelable("nfcTag", parcelable);
        bundle2.putBundle("intentBundle", bundle);
        bundle2.putParcelable("shareIntent", intent);
        obtainMessage.setData(bundle2);
        this.l.sendMessage(obtainMessage);
    }

    public final boolean q1() {
        IXoneObject company;
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null || (company = c1.getCompany()) == null || company.getOwnerCollection().getProperties().W0("onlogoff") == null) {
            return false;
        }
        new Thread(new Runnable() {
            @Override
            public final void run() {
                mainEntry.this.l1();
            }
        }, "LogoffNodeThread").start();
        return true;
    }

    public final void q2(Bundle bundle) {
        String string = bundle.getString("appname");
        File file = new File(getApplicationContext().getFilesDir().getParent() + "/app_" + string + "/");
        if (!file.exists() || !file.isDirectory()) {
            y0();
            return;
        }
        if (!fb.t.E(string, Utils.P1(getApplicationContext(), "appname", null))) {
            Utils.Y3(getApplicationContext(), string, "appname");
        }
        this.m = string;
        this.o = w1(string);
        IXoneApp c1 = xoneApp.c1();
        if (c1 == null || TextUtils.isEmpty(string)) {
            return;
        }
        c1.setUserInterface(new XoneGlobalUI());
        try {
            xoneApp Z0 = xoneApp.Z0();
            Z0.P(string);
            C0694g c0694g = new C0694g(new File(Z0.T(), "app.ini"));
            Z0.o(c0694g.a("UseTranslation", true));
            Z0.O(c0694g.a("EncryptApp", false));
        } catch (Exception e2) {
            D2(e2);
        }
    }

    public final List r1(ViewGroup viewGroup) {
        ArrayList arrayList = new ArrayList();
        if (viewGroup != null) {
            int childCount = viewGroup.getChildCount();
            for (int i = 0; i < childCount; i++) {
                View childAt = viewGroup.getChildAt(i);
                if (childAt instanceof r8.f) {
                    arrayList.add((r8.f) childAt);
                } else if (childAt instanceof ViewGroup) {
                    arrayList.addAll(r1((ViewGroup) childAt));
                }
            }
        }
        return arrayList;
    }

    public final void r2(String str, String str2) {
        if (Utils.d3(u1())) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("mainEntry");
            if (TextUtils.isEmpty(str)) {
                sb2.append(" unknown event fired.");
            } else {
                sb2.append(' ');
                sb2.append(str);
                sb2.append(" event fired.");
            }
            if (TextUtils.isEmpty(str2)) {
                sb2.append(" No reason specified.");
            } else {
                sb2.append(" Reason: ");
                sb2.append(str2);
            }
            Utils.k("XOneAndroidFramework", sb2);
        }
    }

    public final InputStream s1(String str) {
        InputStream W0 = W0(x1(str));
        return W0 != null ? W0 : W0(z1(str));
    }

    public final boolean s2() {
        String[] list;
        String[] list2 = xoneApp.getContext().getAssets().list("");
        if (list2 != null && list2.length != 0) {
            ArrayList arrayList = new ArrayList();
            for (String str : list2) {
                if (R1(str)) {
                    arrayList.add(str);
                }
            }
            if (arrayList.isEmpty()) {
                return false;
            }
            int size = arrayList.size();
            int i = 0;
            while (i < size) {
                Object obj = arrayList.get(i);
                i++;
                String str2 = (String) obj;
                if (str2 != null && (list = xoneApp.getContext().getAssets().list(str2)) != null) {
                    for (String str3 : list) {
                        if (str3.equalsIgnoreCase("files")) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    public void startActivityForResult(Intent intent, int i) {
        intent.putExtra("requestCode", i);
        super/*androidx.activity.ComponentActivity*/.startActivityForResult(intent, i);
    }

    public void t1(int i, Intent intent) {
        Runnable runnable;
        xoneApp Z0 = xoneApp.Z0();
        IXoneApp c1 = xoneApp.c1();
        try {
            try {
                Utils.Y2(this);
                if (c1 != null) {
                    for (int i2 = 0; i2 < 600 && c1.IsScriptExecute(); i2++) {
                        try {
                            Thread.sleep(100L);
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
                fa.j.s();
                xoneApp.P0();
                AppForegroundService.b(Z0);
                WatchDogService.h();
                Future s1 = Z0.s1();
                if (s1 != null) {
                    s1.cancel(true);
                    final LoadAppActivity s = LoadAppActivity.s();
                    if (s != null) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public final void run() {
                                mainEntry.L0(LoadAppActivity.this);
                            }
                        });
                    }
                }
                if (intent != null) {
                    setResult(i, intent);
                }
                runnable = new Runnable() {
                    @Override
                    public final void run() {
                        mainEntry.this.Y1();
                    }
                };
            } catch (Exception e3) {
                e3.printStackTrace();
                if (intent != null) {
                    setResult(i, intent);
                }
                runnable = new Runnable() {
                    @Override
                    public final void run() {
                        mainEntry.this.Y1();
                    }
                };
            }
            runOnUiThread(runnable);
        } catch (Throwable th) {
            if (intent != null) {
                setResult(i, intent);
            }
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    mainEntry.this.Y1();
                }
            });
            throw th;
        }
    }

    public final ProgressDialog t2() {
        ProgressDialog l = AbstractC0665a.l(this);
        this.p = l;
        l.setProgressStyle(1);
        this.p.setCancelable(false);
        this.p.setMax(5);
        this.p.setMessage(getString(AbstractC0568j.D));
        return this.p;
    }

    @Override
    public void u0() {
        r8.m mVar = (r8.m) findViewById(AbstractC0564f.a);
        if (mVar == null) {
            return;
        }
        Iterator it = r1(mVar).iterator();
        while (it.hasNext()) {
            AdapterView.OnItemClickListener onItemClickListener = ((r8.f) it.next()).getOnItemClickListener();
            if (onItemClickListener instanceof AbstractC0943g) {
                ((AbstractC0943g) onItemClickListener).b();
            }
        }
    }

    public final String v1(String str) {
        return str.startsWith("app_") ? str.substring(4) : str;
    }

    public void v2(boolean z, int i, Intent intent) {
        if (!z) {
            try {
                if (k1()) {
                    return;
                }
            } catch (Exception e2) {
                b(e2);
            }
        }
        t1(i, intent);
    }

    public final int w1(String str) {
        if (TextUtils.isEmpty(str)) {
            return 1;
        }
        return getApplicationContext().getSharedPreferences(str, 0).getInt("menu_mode", 1);
    }

    @Override
    public ProgressDialog x0() {
        return this.p;
    }

    public final String x1(String str) {
        return str + "/mappings.xml.sec";
    }

    @Override
    public void y0() {
        if (Utils.p3()) {
            o2();
            A0("mainEntry.showNoAppInstalled(): Developer framework, launching hotswap activity");
            return;
        }
        final StringBuilder sb2 = new StringBuilder();
        Intent intent = getIntent();
        String stringExtra = intent != null ? intent.getStringExtra("appname") : null;
        if (TextUtils.isEmpty(stringExtra)) {
            sb2.append(getString(AbstractC0568j.T));
        } else {
            sb2.append(String.format(getString(AbstractC0568j.U), stringExtra));
        }
        Context applicationContext = getApplicationContext();
        if (!C9.e.r(applicationContext)) {
            Z0(sb2);
        } else if (C9.e.p(applicationContext, "android.permission.READ_PHONE_STATE") || (Build.VERSION.SDK_INT >= 29 && Utils.H2(this) >= 29)) {
            Z0(sb2);
        }
        final String s0 = xoneApp.Z0().s0();
        if (!Utils.s3()) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    mainEntry.this.k2(s0, sb2);
                }
            });
            return;
        }
        AlertDialog.Builder h = AbstractC0665a.h(this, s0);
        h.setMessage(sb2);
        h.setCancelable(false);
        h.setPositiveButton(AbstractC0568j.a, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                mainEntry.this.i2(dialogInterface, i);
            }
        });
        Utils.p(this.q);
        AlertDialog create = h.create();
        this.q = create;
        create.show();
        TextView textView = (TextView) this.q.findViewById(R.id.message);
        if (textView != null) {
            textView.setTypeface(A1());
        }
    }

    public final InputStream y1(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        InputStream s1 = s1(str);
        if (s1 != null) {
            return s1;
        }
        String[] list = getAssets().list("");
        if (list == null) {
            return null;
        }
        for (String str2 : list) {
            if (!TextUtils.isEmpty(str2)) {
                Locale locale = Locale.US;
                if (str2.toLowerCase(locale).endsWith(str.toLowerCase(locale))) {
                    Utils.l("XOneAndroidFramework", "Embedded app name directory differs from the installed app name directory. Always use lowercase paths while embedding an app.");
                    return s1(new File(str2).getName());
                }
            }
        }
        return null;
    }

    public final void y2(String str, int i) {
        SharedPreferences.Editor edit = getApplicationContext().getSharedPreferences(str, 0).edit();
        edit.putInt("menu_mode", i);
        edit.apply();
    }

    public final String z1(String str) {
        return str + "/mappings.xml";
    }

    public void z2(boolean z) {
        Message obtainMessage = this.l.obtainMessage(704);
        obtainMessage.what = 704;
        obtainMessage.arg2 = z ? 1 : 0;
        this.l.sendMessage(obtainMessage);
    }
}