导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - AndroidIntent.java 源代码

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

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


package com.xone.android.script.runtimeobjects;

import Q8.k;
import Q8.m;
import T9.f;
import Wa.d;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.Keep;
import androidx.fragment.app.j;
import com.xone.android.javascript.ScriptBundleWrapper;
import com.xone.android.javascript.XOneJavascript;
import com.xone.android.utils.Utils;
import com.xone.annotations.ScriptAllowed;
import com.xone.interfaces.IRuntimeObject;
import com.xone.interfaces.IXoneObject;
import fb.AbstractC0698k;
import fb.q;
import fb.t;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Map;
import m5.x0;
import org.mozilla.javascript.BaseFunction;
import org.mozilla.javascript.C0893d0;
import org.mozilla.javascript.C0932x0;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.Q0;
import org.mozilla.javascript.Scriptable;
import qa.EnumC0975b;
import ua.InterfaceC1016b0;
import ua.InterfaceC1018c0;
import ua.InterfaceC1038m0;
import ua.InterfaceC1045q;
import ua.O;
import ua.O0;
import ua.V;
import ua.W;
import ua.X;

@ScriptAllowed
@Keep
public final class AndroidIntent extends BaseFunction implements IRuntimeObject, InterfaceC1045q {
    private final Context context;
    private final X scriptRuntime;
    private Intent targetIntent;
    private static final Map<String, W> mapTypeInfo = createTypeInfoData();
    private static final Map<String, String> mapCachedActions = new HashMap();
    private static final Map<String, String> mapCachedCategories = new HashMap();
    private static final Map<String, Integer> mapCachedFlags = new HashMap();
    private static final Map<String, f> mapRegisteredReceivers = new HashMap();

    public static class a implements InterfaceC1018c0 {
        public final InterfaceC1038m0 l;
        public final IXoneObject m;
        public final String n;

        public a(InterfaceC1038m0 interfaceC1038m0, IXoneObject iXoneObject, String str) {
            this.l = interfaceC1038m0;
            this.m = iXoneObject;
            this.n = str;
        }

        @Override
        public int getRequestCode() {
            return 4000;
        }

        @Override
        public void onActivityResult(int i, Intent intent) {
            Bundle extras;
            if (intent != null) {
                try {
                    extras = intent.getExtras();
                } catch (Exception e) {
                    Utils.g4((Context) this.l, Utils.M2(e));
                    return;
                }
            } else {
                extras = null;
            }
            this.m.ExecuteNode(this.n, extras != null ? new Object[]{Integer.valueOf(i), new ScriptBundleWrapper(extras)} : new Object[]{Integer.valueOf(i)});
        }
    }

    public AndroidIntent(Context context, X x) {
        this.context = context.getApplicationContext();
        this.scriptRuntime = x;
        this.targetIntent = new Intent();
        XOneJavascript.addFunctions(this);
    }

    private static Map<String, W> createTypeInfoData() {
        Hashtable hashtable = new Hashtable();
        d dVar = new d("SetAction", O0.a);
        dVar.c("action", 1, false);
        dVar.c("field", 1, true);
        String name = dVar.getName();
        Locale locale = Locale.US;
        hashtable.put(name.toLowerCase(locale), dVar);
        d dVar2 = new d("SetData", O0.a);
        dVar2.c("uri", 1, false);
        hashtable.put(dVar2.getName().toLowerCase(locale), dVar2);
        d dVar3 = new d("SetType", O0.a);
        dVar3.c("type", 1, false);
        hashtable.put(dVar3.getName().toLowerCase(locale), dVar3);
        d dVar4 = new d("SetDataAndType", O0.a);
        dVar4.c("uri", 1, false);
        dVar4.c("type", 1, false);
        hashtable.put(dVar4.getName().toLowerCase(locale), dVar4);
        d dVar5 = new d("SetPackage", O0.a);
        dVar5.c("packagename", 1, false);
        hashtable.put(dVar5.getName().toLowerCase(), dVar5);
        d dVar6 = new d("SetClassName", O0.a);
        dVar6.c("packagename", 1, false);
        dVar6.c("classname", 1, false);
        hashtable.put(dVar6.getName().toLowerCase(locale), dVar6);
        d dVar7 = new d("AddCategory", O0.a);
        dVar7.c("category", 1, false);
        hashtable.put(dVar7.getName().toLowerCase(locale), dVar7);
        d dVar8 = new d("AddFlag", O0.a);
        dVar8.c("flags", 1, false);
        hashtable.put(dVar8.getName().toLowerCase(locale), dVar8);
        d dVar9 = new d("PutStringExtra", O0.a);
        dVar9.c("name", 1, false);
        dVar9.c("value", 1, false);
        hashtable.put(dVar9.getName().toLowerCase(locale), dVar9);
        d dVar10 = new d("PutStringArrayExtra", O0.a);
        dVar10.c("name", 1, false);
        dVar10.c("value", 1, false);
        hashtable.put(dVar10.getName().toLowerCase(locale), dVar10);
        d dVar11 = new d("PutIntegerExtra", O0.a);
        dVar11.c("name", 1, false);
        dVar11.c("value", 2, false);
        hashtable.put(dVar11.getName().toLowerCase(locale), dVar11);
        d dVar12 = new d("PutIntegerArrayExtra", O0.a);
        dVar12.c("name", 1, false);
        dVar12.c("value", 2, false);
        hashtable.put(dVar12.getName().toLowerCase(locale), dVar12);
        d dVar13 = new d("PutFloatExtra", O0.a);
        dVar13.c("name", 1, false);
        dVar13.c("value", 5, false);
        hashtable.put(dVar13.getName().toLowerCase(locale), dVar13);
        d dVar14 = new d("PutFloatArrayExtra", O0.a);
        dVar14.c("name", 1, false);
        dVar14.c("value", 5, false);
        hashtable.put(dVar14.getName().toLowerCase(locale), dVar14);
        d dVar15 = new d("PutDoubleExtra", O0.a);
        dVar15.c("name", 1, false);
        dVar15.c("value", 5, false);
        hashtable.put(dVar15.getName().toLowerCase(locale), dVar15);
        d dVar16 = new d("PutDoubleArrayExtra", O0.a);
        dVar16.c("name", 1, false);
        dVar16.c("value", 5, false);
        hashtable.put(dVar16.getName().toLowerCase(locale), dVar16);
        d dVar17 = new d("PutBooleanExtra", O0.a);
        dVar17.c("name", 1, false);
        dVar17.c("value", 6, false);
        hashtable.put(dVar17.getName().toLowerCase(), dVar17);
        d dVar18 = new d("PutBooleanArrayExtra", O0.a);
        dVar18.c("name", 1, false);
        dVar18.c("value", 6, false);
        hashtable.put(dVar18.getName().toLowerCase(), dVar18);
        d dVar19 = new d("PutBundleExtra", O0.a);
        dVar19.c("name", 1, false);
        dVar19.c("value", 8, false);
        hashtable.put(dVar19.getName().toLowerCase(), dVar19);
        d dVar20 = new d("PutFileExtra", O0.a);
        dVar20.c("name", 1, false);
        dVar20.c("filePath", 1, false);
        hashtable.put(dVar20.getName().toLowerCase(), dVar20);
        d dVar21 = new d("GetLaunchIntentForPackage", O0.a);
        dVar21.c("packagename", 1, false);
        hashtable.put(dVar21.getName().toLowerCase(), dVar21);
        d dVar22 = new d("GetMyPackageName", O0.a);
        hashtable.put(dVar22.getName().toLowerCase(), dVar22);
        d dVar23 = new d("StartActivity", O0.a);
        hashtable.put(dVar23.getName().toLowerCase(), dVar23);
        d dVar24 = new d("StartActivityForResult", O0.a);
        dVar24.c("callbackObjItem", 8, false);
        dVar24.c("callbackNodeName", 1, false);
        dVar24.c("bundleExtras", 8, true);
        hashtable.put(dVar24.getName().toLowerCase(), dVar24);
        d dVar25 = new d("StartService", O0.a);
        hashtable.put(dVar25.getName().toLowerCase(), dVar25);
        d dVar26 = new d("StopService", O0.a);
        hashtable.put(dVar26.getName().toLowerCase(), dVar26);
        d dVar27 = new d("SendBroadcast", O0.a);
        dVar27.c("receiverpermission", 1, true);
        hashtable.put(dVar27.getName().toLowerCase(), dVar27);
        d dVar28 = new d("SendOrderedBroadcast", O0.a);
        dVar28.c("receiverpermission", 1, false);
        hashtable.put(dVar28.getName().toLowerCase(), dVar28);
        d dVar29 = new d("RegisterBroadcastReceiver", O0.a);
        dVar29.c("params", 8, false);
        hashtable.put(dVar29.getName().toLowerCase(), dVar29);
        d dVar30 = new d("UnregisterBroadcastReceiver", O0.a);
        dVar30.c("action", 1, false);
        hashtable.put(dVar30.getName().toLowerCase(), dVar30);
        d dVar31 = new d("IsReceiverRegistered", O0.a);
        dVar31.c("action", 1, false);
        hashtable.put(dVar31.getName().toLowerCase(), dVar31);
        return hashtable;
    }

    private static int findStaticIntegerValue(String str, String str2, String str3) {
        try {
            return Class.forName(str2).getDeclaredField(str3).getInt(null);
        } catch (ClassNotFoundException unused) {
            throw new IllegalArgumentException(str + "(): Error, class " + str2 + " not found.");
        } catch (NoSuchFieldException unused2) {
            throw new IllegalArgumentException(str + "(): Error, field " + str3 + " not found.");
        }
    }

    private static String findStaticStringValue(String str, String str2, String str3) {
        try {
            return (String) Class.forName(str2).getDeclaredField(str3).get(null);
        } catch (ClassNotFoundException unused) {
            throw new IllegalArgumentException(str + "(): Error, class " + str2 + " not found.");
        } catch (NoSuchFieldException unused2) {
            throw new IllegalArgumentException(str + "(): Error, field " + str3 + " not found.");
        }
    }

    private <T extends Activity> T getActivity() {
        InterfaceC1038m0 app = getApp();
        j g = app.g();
        if (g != null) {
            return g;
        }
        O S = app.S();
        if (S != null) {
            return (T) S;
        }
        return null;
    }

    private InterfaceC1038m0 getApp() {
        return (InterfaceC1038m0) this.context.getApplicationContext();
    }

    private Context getContext() {
        return this.context.getApplicationContext();
    }

    private IXoneObject getSelfObject() {
        Q0 m = XOneJavascript.m();
        if (m == null) {
            return null;
        }
        Object obj = m.get("self");
        if (obj instanceof IXoneObject) {
            return (IXoneObject) obj;
        }
        return null;
    }

    @Override
    public Object GetPropertyManager(String str, Object[] objArr) {
        return null;
    }

    @Override
    public W GetTypeInfo(String str) {
        String lowerCase = str.toLowerCase(Locale.US);
        Map<String, W> map = mapTypeInfo;
        if (map.containsKey(lowerCase)) {
            return map.get(lowerCase);
        }
        return null;
    }

    @Override
    public Object Invoke(String str, EnumC0975b enumC0975b, Object[] objArr) {
        String lowerCase = str.toLowerCase(Locale.US);
        lowerCase.getClass();
        switch (lowerCase) {
            case "sendorderedbroadcast":
                return Integer.valueOf(sendOrderedBroadcast(objArr));
            case "setdatafromfile":
                return setDataFromFile(objArr);
            case "startactivity":
                return Integer.valueOf(startActivity());
            case "putdoublearrayextra":
                return putDoubleArrayExtra(objArr);
            case "putfloatarrayextra":
                return putFloatArrayExtra(objArr);
            case "addflag":
                return addFlag(objArr);
            case "putstringarrayextra":
                return putStringArrayExtra(objArr);
            case "unregisterbroadcastreceiver":
                return Integer.valueOf(unregisterBroadcastReceiver(objArr));
            case "addcategory":
                return addCategory(objArr);
            case "stopservice":
                return Integer.valueOf(stopService());
            case "registerbroadcastreceiver":
                return Integer.valueOf(registerBroadcastReceiver(objArr));
            case "putfileextra":
                return putFileExtra(objArr);
            case "getlaunchintentforpackage":
                return getLaunchIntentForPackage(objArr);
            case "setclassname":
                return setClassName(objArr);
            case "isreceiverregistered":
                return Boolean.valueOf(isReceiverRegistered(objArr));
            case "putdoubleextra":
                return putDoubleExtra(objArr);
            case "getmypackagename":
                return getMyPackageName();
            case "putstringextra":
                return putStringExtra(objArr);
            case "startservice":
                return Integer.valueOf(startService());
            case "putbooleanarrayextra":
                return putBooleanArrayExtra(objArr);
            case "putfloatextra":
                return putFloatExtra(objArr);
            case "setpackage":
                return setPackage(objArr);
            case "setdataandtype":
                return setDataAndType(objArr);
            case "startactivityforresult":
                return Integer.valueOf(startActivityForResult(objArr));
            case "sendbroadcast":
                return Integer.valueOf(sendBroadcast(objArr));
            case "setaction":
                return setAction(objArr);
            case "putbundleextra":
                return putBundleExtra(objArr);
            case "putintegerarrayextra":
                return putIntegerArrayExtra(objArr);
            case "putbooleanextra":
                return putBooleanExtra(objArr);
            case "putintegerextra":
                return putIntegerExtra(objArr);
            case "setdata":
                return setData(objArr);
            case "settype":
                return setType(objArr);
            default:
                throw new IllegalArgumentException(getName() + ": Function/method/property " + str + " not implemented.");
        }
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent addCategory(Object... objArr) {
        Utils.j("AddCategory", objArr);
        if (objArr.length != 1 && objArr.length != 2) {
            Utils.g("AddCategory", objArr, 1);
        }
        if (objArr.length == 1) {
            String y = t.y(objArr[0]);
            if (!TextUtils.isEmpty(y)) {
                this.targetIntent.addCategory(y);
                return this;
            }
            throw new IllegalArgumentException("AddCategory(): Error, empty category parameter");
        }
        if (objArr.length != 2) {
            return this;
        }
        String y2 = t.y(objArr[0]);
        String y3 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y2)) {
            throw new IllegalArgumentException("AddCategory(): Error, empty class parameter");
        }
        if (TextUtils.isEmpty(y3)) {
            throw new IllegalArgumentException("AddCategory(): Error, empty field parameter");
        }
        String str = y2 + "." + y3;
        Map<String, String> map = mapCachedCategories;
        String str2 = map.get(str);
        if (TextUtils.isEmpty(str2)) {
            str2 = findStaticStringValue("AddCategory", y2, y3);
            map.put(str, str2);
        }
        this.targetIntent.addCategory(str2);
        return this;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent addFlag(Object... objArr) {
        Utils.j("AddFlag", objArr);
        if (objArr.length != 1 && objArr.length != 2) {
            Utils.g("AddFlag", objArr, 1);
        }
        if (objArr.length == 1) {
            int p = q.p(objArr[0], -1);
            if (p != -1) {
                this.targetIntent.addFlags(p);
                return this;
            }
            throw new IllegalArgumentException("AddFlag(): Error, empty flag parameter");
        }
        if (objArr.length != 2) {
            return this;
        }
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("AddFlag(): Error, empty class parameter");
        }
        if (TextUtils.isEmpty(y2)) {
            throw new IllegalArgumentException("AddFlag(): Error, empty field parameter");
        }
        String str = y + "." + y2;
        Map<String, Integer> map = mapCachedFlags;
        Integer num = map.get(str);
        if (num == null) {
            num = Integer.valueOf(findStaticIntegerValue("AddFlag", y, y2));
            map.put(str, num);
        }
        this.targetIntent.addFlags(num.intValue());
        return this;
    }

    @Override
    public Object call(org.mozilla.javascript.Context context, Scriptable scriptable, Scriptable scriptable2, Object[] objArr) {
        return new AndroidIntent(this.context, this.scriptRuntime);
    }

    @Override
    public String getDefaultMethod() {
        return "";
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent getLaunchIntentForPackage(Object... objArr) {
        Utils.j("GetLaunchIntentForPackage", objArr);
        Utils.g("GetLaunchIntentForPackage", objArr, 1);
        String y = t.y(objArr[0]);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("GetLaunchIntentForPackage(): Error, empty package name parameter");
        }
        Intent launchIntentForPackage = this.context.getPackageManager().getLaunchIntentForPackage(y);
        this.targetIntent = launchIntentForPackage;
        if (launchIntentForPackage != null) {
            return this;
        }
        throw new IllegalArgumentException("GetLaunchIntentForPackage(): Error, package name " + y + " not found");
    }

    @ScriptAllowed
    @Keep
    public String getMyPackageName() {
        return this.context.getPackageName();
    }

    @Override
    public String getName() {
        return "AndroidIntent";
    }

    @Override
    public V getScope() {
        return this.scriptRuntime.c();
    }

    @Override
    public Intent getTargetIntent() {
        return this.targetIntent;
    }

    @ScriptAllowed
    @Keep
    public boolean isReceiverRegistered(Object... objArr) {
        Utils.j("IsReceiverRegistered", objArr);
        Utils.g("IsReceiverRegistered", objArr, 1);
        String z = t.z(objArr[0], null);
        if (!TextUtils.isEmpty(z)) {
            return mapRegisteredReceivers.containsKey(z);
        }
        throw new IllegalArgumentException("IsReceiverRegistered(): Empty action parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putBooleanArrayExtra(Object... objArr) {
        Utils.j("PutBooleanArrayExtra", objArr);
        Utils.g("PutBooleanArrayExtra", objArr, 2);
        String y = t.y(objArr[0]);
        boolean[] l = m.l((C0893d0) objArr[1]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, l);
            return this;
        }
        throw new IllegalArgumentException("PutBooleanArrayExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putBooleanExtra(Object... objArr) {
        Utils.j("PutBooleanExtra", objArr);
        Utils.g("PutBooleanExtra", objArr, 2);
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutBooleanExtra(): Error, empty name parameter");
        }
        if (!TextUtils.isEmpty(y2)) {
            this.targetIntent.putExtra(y, q.e(y2));
            return this;
        }
        throw new IllegalArgumentException("PutBooleanExtra(): Error, empty value parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putBundleExtra(Object... objArr) {
        Utils.j("PutBundleExtra", objArr);
        Utils.g("PutBundleExtra", objArr, 2);
        String y = t.y(objArr[0]);
        ScriptBundleWrapper scriptBundleWrapper = (ScriptBundleWrapper) objArr[1];
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutBundleExtra(): Error, empty name parameter");
        }
        if (scriptBundleWrapper != null) {
            this.targetIntent.putExtra(y, scriptBundleWrapper.X());
            return this;
        }
        throw new IllegalArgumentException("PutBundleExtra(): Error, empty value parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putCharSequenceArrayListExtra(Object... objArr) {
        Utils.j("PutCharSequenceArrayListExtra", objArr);
        Utils.g("PutCharSequenceArrayListExtra", objArr, 2);
        String y = t.y(objArr[0]);
        ArrayList<CharSequence> j = m.j((C0893d0) objArr[1], CharSequence.class);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putCharSequenceArrayListExtra(y, j);
            return this;
        }
        throw new IllegalArgumentException("PutCharSequenceArrayListExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putDoubleArrayExtra(Object... objArr) {
        Utils.j("PutDoubleArrayExtra", objArr);
        Utils.g("PutDoubleArrayExtra", objArr, 2);
        String y = t.y(objArr[0]);
        double[] o = m.o((C0893d0) objArr[1]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, o);
            return this;
        }
        throw new IllegalArgumentException("PutDoubleArrayExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putDoubleExtra(Object... objArr) {
        Utils.j("PutDoubleExtra", objArr);
        Utils.g("PutDoubleExtra", objArr, 2);
        String y = t.y(objArr[0]);
        double i = q.i(objArr[1], -1.0d);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutDoubleExtra(): Error, empty name parameter");
        }
        if (i != -1.0d) {
            this.targetIntent.putExtra(y, i);
            return this;
        }
        throw new IllegalArgumentException("PutDoubleExtra(): Error, empty value parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putExtra(Object... objArr) {
        Utils.j("PutExtra", objArr);
        Utils.g("PutExtra", objArr, 2);
        String y = t.y(objArr[0]);
        Object obj = objArr[1];
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutExtra(): Error, empty name parameter");
        }
        if (obj == null) {
            throw new IllegalArgumentException("PutExtra(): Error, empty value parameter");
        }
        if (obj instanceof String) {
            this.targetIntent.putExtra(y, (String) obj);
            return this;
        }
        if (obj instanceof CharSequence) {
            this.targetIntent.putExtra(y, (CharSequence) obj);
            return this;
        }
        if (obj instanceof Integer) {
            this.targetIntent.putExtra(y, ((Integer) obj).intValue());
            return this;
        }
        if (obj instanceof Short) {
            this.targetIntent.putExtra(y, ((Short) obj).shortValue());
            return this;
        }
        if (obj instanceof Float) {
            this.targetIntent.putExtra(y, ((Float) obj).floatValue());
            return this;
        }
        if (obj instanceof Double) {
            this.targetIntent.putExtra(y, ((Double) obj).doubleValue());
            return this;
        }
        if (obj instanceof Boolean) {
            this.targetIntent.putExtra(y, ((Boolean) obj).booleanValue());
            return this;
        }
        if (obj instanceof Parcelable) {
            this.targetIntent.putExtra(y, (Parcelable) obj);
            return this;
        }
        if (obj instanceof Serializable) {
            this.targetIntent.putExtra(y, (Serializable) obj);
        }
        return this;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putFileExtra(Object... objArr) {
        Utils.j("PutFileExtra", objArr);
        Utils.g("PutFileExtra", objArr, 2);
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y2)) {
            throw new IllegalArgumentException("PutFileExtra(): Error, empty value parameter");
        }
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutFileExtra(): Error, empty name parameter");
        }
        InterfaceC1038m0 app = getApp();
        File w1 = Utils.w1(app.Y(), app.T(), y2);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutFileExtra(): Error, empty name parameter");
        }
        if (!w1.exists()) {
            throw new FileNotFoundException("PutFileExtra(): File " + w1.getAbsolutePath() + " does not exist");
        }
        if (w1.isFile()) {
            this.targetIntent.putExtra(y, Utils.B1(this.context, w1));
            return this;
        }
        throw new FileNotFoundException("PutFileExtra(): Path " + w1.getAbsolutePath() + " is not a file");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putFloatArrayExtra(Object... objArr) {
        Utils.j("PutFloatArrayExtra", objArr);
        Utils.g("PutFloatArrayExtra", objArr, 2);
        String y = t.y(objArr[0]);
        float[] p = m.p((C0893d0) objArr[1]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, p);
            return this;
        }
        throw new IllegalArgumentException("PutFloatArrayExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putFloatExtra(Object... objArr) {
        Utils.j("PutFloatExtra", objArr);
        Utils.g("PutFloatExtra", objArr, 2);
        String y = t.y(objArr[0]);
        float m = q.m(objArr[1], -1.0f);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutFloatExtra(): Error, empty name parameter");
        }
        if (m != -1.0f) {
            this.targetIntent.putExtra(y, m);
            return this;
        }
        throw new IllegalArgumentException("PutFloatExtra(): Error, empty value parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putIntegerArrayExtra(Object... objArr) {
        Utils.j("PutIntegerArrayExtra", objArr);
        Utils.g("PutIntegerArrayExtra", objArr, 2);
        String y = t.y(objArr[0]);
        int[] q = m.q((C0893d0) objArr[1]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, q);
            return this;
        }
        throw new IllegalArgumentException("PutIntegerArrayExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putIntegerArrayListExtra(Object... objArr) {
        Utils.j("PutIntegerArrayListExtra", objArr);
        Utils.g("PutIntegerArrayListExtra", objArr, 2);
        String y = t.y(objArr[0]);
        ArrayList<Integer> k = m.k((C0893d0) objArr[1], Integer.class, true);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putIntegerArrayListExtra(y, k);
            return this;
        }
        throw new IllegalArgumentException("PutIntegerArrayListExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putIntegerExtra(Object... objArr) {
        Utils.j("PutIntegerExtra", objArr);
        Utils.g("PutIntegerExtra", objArr, 2);
        String y = t.y(objArr[0]);
        int p = q.p(objArr[1], -1);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("PutIntegerExtra(): Error, empty name parameter");
        }
        if (p != -1) {
            this.targetIntent.putExtra(y, p);
            return this;
        }
        throw new IllegalArgumentException("PutIntegerExtra(): Error, empty value parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putParcelableArrayListExtra(Object... objArr) {
        Utils.j("PutParcelableArrayListExtra", objArr);
        Utils.g("PutParcelableArrayListExtra", objArr, 2);
        String y = t.y(objArr[0]);
        ArrayList<? extends Parcelable> j = m.j((C0893d0) objArr[1], Parcelable.class);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putParcelableArrayListExtra(y, j);
            return this;
        }
        throw new IllegalArgumentException("PutParcelableArrayListExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putStringArrayExtra(Object... objArr) {
        Utils.j("PutStringArrayExtra", objArr);
        Utils.g("PutStringArrayExtra", objArr, 2);
        String y = t.y(objArr[0]);
        String[] strArr = (String[]) m.h((C0893d0) objArr[1], String[].class);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, strArr);
            return this;
        }
        throw new IllegalArgumentException("PutStringArrayExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putStringArrayListExtra(Object... objArr) {
        Utils.j("PutStringArrayListExtra", objArr);
        Utils.g("PutStringArrayListExtra", objArr, 2);
        String y = t.y(objArr[0]);
        ArrayList<String> j = m.j((C0893d0) objArr[1], String.class);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putStringArrayListExtra(y, j);
            return this;
        }
        throw new IllegalArgumentException("PutStringArrayListExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent putStringExtra(Object... objArr) {
        Utils.j("PutStringExtra", objArr);
        Utils.g("PutStringExtra", objArr, 2);
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.putExtra(y, y2);
            return this;
        }
        throw new IllegalArgumentException("PutStringExtra(): Error, empty name parameter");
    }

    @ScriptAllowed
    @Keep
    public int registerBroadcastReceiver(Object... objArr) {
        Utils.j("RegisterBroadcastReceiver", objArr);
        Utils.g("RegisterBroadcastReceiver", objArr, 1);
        Object obj = objArr[0];
        if (!(obj instanceof C0932x0)) {
            throw new IllegalArgumentException("RegisterBroadcastReceiver(): Invalid parameter type");
        }
        C0932x0 c0932x0 = (C0932x0) obj;
        String E = k.E(c0932x0, "action", null);
        String E2 = k.E(c0932x0, "permission", null);
        boolean a2 = k.a(c0932x0, "exported", true);
        Object y = k.y(c0932x0, "onReceive");
        if (TextUtils.isEmpty(E)) {
            throw new IllegalArgumentException("RegisterBroadcastReceiver(): Empty action parameter");
        }
        if (y == null) {
            throw new IllegalArgumentException("RegisterBroadcastReceiver(): Empty onReceive parameter");
        }
        Map<String, f> map = mapRegisteredReceivers;
        if (map.containsKey(E)) {
            throw new IllegalStateException("RegisterBroadcastReceiver(): Receiver for action " + E + " already registered");
        }
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(E);
        f fVar = new f(y, false);
        if (TextUtils.isEmpty(E2)) {
            if (Build.VERSION.SDK_INT >= 33) {
                x0.a(this.context, fVar, intentFilter, a2 ? 2 : 4);
            } else {
                this.context.registerReceiver(fVar, intentFilter);
            }
        } else if (Build.VERSION.SDK_INT >= 33) {
            this.context.registerReceiver(fVar, intentFilter, E2, null, a2 ? 2 : 4);
        } else {
            this.context.registerReceiver(fVar, intentFilter, E2, null);
        }
        map.put(E, fVar);
        return 0;
    }

    @ScriptAllowed
    @Keep
    public int sendBroadcast(Object... objArr) {
        Utils.h("SendBroadcast", objArr, 0, 1);
        String z = t.z(Utils.w(objArr, 0, null), null);
        if (TextUtils.isEmpty(z)) {
            this.context.sendBroadcast(this.targetIntent);
        } else {
            this.context.sendBroadcast(this.targetIntent, z);
        }
        return 0;
    }

    @ScriptAllowed
    @Keep
    public int sendOrderedBroadcast(Object... objArr) {
        Utils.h("SendOrderedBroadcast", objArr, 0, 1);
        String z = t.z(Utils.w(objArr, 0, null), null);
        if (TextUtils.isEmpty(z)) {
            this.context.sendOrderedBroadcast(this.targetIntent, null);
        } else {
            this.context.sendOrderedBroadcast(this.targetIntent, z);
        }
        return 0;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setAction(Object... objArr) {
        Utils.j("SetAction", objArr);
        if (objArr.length != 1 && objArr.length != 2) {
            Utils.g("SetAction", objArr, 1);
        }
        if (objArr.length == 1) {
            this.targetIntent.setAction(t.y(objArr[0]));
            return this;
        }
        if (objArr.length != 2) {
            return this;
        }
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("SetAction(): Error, empty class parameter");
        }
        if (TextUtils.isEmpty(y2)) {
            throw new IllegalArgumentException("SetAction(): Error, empty field parameter");
        }
        String str = y + "." + y2;
        Map<String, String> map = mapCachedActions;
        String str2 = map.get(str);
        if (TextUtils.isEmpty(str2)) {
            str2 = findStaticStringValue("SetAction", y, y2);
            map.put(str, str2);
        }
        this.targetIntent.setAction(str2);
        return this;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setClassName(Object... objArr) {
        Utils.j("SetClassName", objArr);
        Utils.g("SetClassName", objArr, 2);
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        if (TextUtils.isEmpty(y)) {
            throw new IllegalArgumentException("SetClassName(): Error, empty package name parameter");
        }
        if (!TextUtils.isEmpty(y2)) {
            this.targetIntent.setClassName(y, y2);
            return this;
        }
        throw new IllegalArgumentException("SetClassName(): Error, empty class name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setData(Object... objArr) {
        Utils.j("SetData", objArr);
        Utils.g("SetData", objArr, 1);
        this.targetIntent.setData(Uri.parse(t.y(objArr[0])));
        return this;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setDataAndType(Object... objArr) {
        Utils.j("SetDataAndType", objArr);
        Utils.g("SetDataAndType", objArr, 2);
        String y = t.y(objArr[0]);
        String y2 = t.y(objArr[1]);
        File file = new File(y);
        this.targetIntent.setDataAndType(file.exists() ? Utils.B1(getContext(), file) : Uri.parse(y), y2);
        return this;
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setDataFromFile(Object... objArr) {
        Utils.j("SetDataFromFile", objArr);
        Utils.g("SetDataFromFile", objArr, 1);
        String y = t.y(objArr[0]);
        InterfaceC1038m0 app = getApp();
        File w1 = Utils.w1(app.Y(), app.T(), y);
        if (!w1.exists()) {
            throw new FileNotFoundException("SetDataFromFile(): File " + w1.getAbsolutePath() + " does not exist");
        }
        if (w1.isFile()) {
            this.targetIntent.setData(Utils.B1(this.context, w1));
            return this;
        }
        throw new FileNotFoundException("SetDataFromFile(): Path " + w1.getAbsolutePath() + " is not a file");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setPackage(Object... objArr) {
        Utils.j("SetPackage", objArr);
        Utils.g("SetPackage", objArr, 1);
        String y = t.y(objArr[0]);
        if (!TextUtils.isEmpty(y)) {
            this.targetIntent.setPackage(y);
            return this;
        }
        throw new IllegalArgumentException("SetPackage(): Error, empty package name parameter");
    }

    @ScriptAllowed
    @Keep
    public AndroidIntent setType(Object... objArr) {
        Utils.j("SetType", objArr);
        Utils.g("SetType", objArr, 1);
        this.targetIntent.setType(t.y(objArr[0]));
        return this;
    }

    @ScriptAllowed
    public int startActivity() {
        Activity activity = getActivity();
        if (activity != null) {
            activity.startActivity(this.targetIntent);
            return 0;
        }
        throw new NullPointerException("StartActivity(): No activity present to launch intent");
    }

    @ScriptAllowed
    @Keep
    public int startActivityForResult(Object... objArr) {
        InterfaceC1018c0 aVar;
        Utils.j("StartActivityForResult", objArr);
        Utils.h("StartActivityForResult", objArr, 1, 3);
        Object obj = objArr[0];
        if (obj == null) {
            throw new IllegalArgumentException("StartActivityForResult(): Empty first argument");
        }
        Bundle bundle = null;
        if (obj instanceof Function) {
            aVar = new K9.k(getApp(), getSelfObject(), (Function) obj);
            if (objArr.length != 1) {
                bundle = ((ScriptBundleWrapper) objArr[1]).X();
            }
        } else {
            if (!(obj instanceof IXoneObject)) {
                throw new IllegalArgumentException("StartActivityForResult(): Unknown argument of type " + obj.getClass().getSimpleName());
            }
            aVar = new a(getApp(), (IXoneObject) obj, t.y(objArr[1]));
            if (objArr.length != 2) {
                bundle = ((ScriptBundleWrapper) objArr[2]).X();
            }
        }
        InterfaceC1016b0 interfaceC1016b0 = (InterfaceC1016b0) getActivity();
        if (interfaceC1016b0 == null) {
            throw new NullPointerException("No activity present to launch intent");
        }
        interfaceC1016b0.q(aVar);
        if (bundle == null) {
            interfaceC1016b0.startActivityForResult(this.targetIntent, 4000);
            return 0;
        }
        interfaceC1016b0.startActivityForResult(this.targetIntent, 4000, bundle);
        return 0;
    }

    @ScriptAllowed
    @Keep
    public int startService() {
        this.context.startService(this.targetIntent);
        return 0;
    }

    @ScriptAllowed
    @Keep
    public int stopService() {
        this.context.stopService(this.targetIntent);
        return 0;
    }

    @ScriptAllowed
    @Keep
    public String toString() {
        Intent intent = this.targetIntent;
        return intent == null ? "Empty intent" : AbstractC0698k.B(intent).toString();
    }

    @ScriptAllowed
    @Keep
    public int unregisterBroadcastReceiver(Object... objArr) {
        Utils.j("UnregisterBroadcastReceiver", objArr);
        Utils.g("UnregisterBroadcastReceiver", objArr, 1);
        String z = t.z(objArr[0], null);
        if (TextUtils.isEmpty(z)) {
            throw new IllegalArgumentException("UnregisterBroadcastReceiver(): Empty action parameter");
        }
        Map<String, f> map = mapRegisteredReceivers;
        if (!map.containsKey(z)) {
            return 0;
        }
        this.context.unregisterReceiver(map.get(z));
        map.remove(z);
        return 0;
    }

    public AndroidIntent(Context context, X x, Intent intent) {
        this.context = context.getApplicationContext();
        this.scriptRuntime = x;
        this.targetIntent = intent;
        XOneJavascript.addFunctions(this);
    }
}