导航菜单

页面标题

页面副标题

迅 唔 v1.3.9 - MainActivity.java 源代码

正在查看: 迅 唔 v1.3.9 应用的 MainActivity.java JAVA 源代码文件

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


package com.iszzlzbet.xghj;

import android.content.ClipboardManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowMetrics;
import com.iszzlzbet.xghj.InputService;
import com.iszzlzbet.xghj.MainActivity;
import com.iszzlzbet.xghj.MainService;
import d7.m;
import ffi.FFI;
import j6.n;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import k6.b0;
import k6.i;
import l5.f;
import org.json.JSONArray;
import org.json.JSONObject;
import x4.s0;
import x6.g;
import x6.l;
import z4.h;
import z5.j;
import z5.k;

public final class MainActivity extends f {

    public static final a f1664s = new a(null);

    public static k f1665t;

    public static RdClipboardManager f1666u;

    public MainService f1669o;

    public boolean f1670p;

    public final String f1667m = "mChannel";

    public final String f1668n = "mMainActivity";

    public final q1.d f1671q = new q1.d(this, b.f1673i, new c());

    public final e f1672r = new e();

    public static final class a {
        public a() {
        }

        public a(g gVar) {
            this();
        }

        public final k a() {
            return MainActivity.f1665t;
        }

        public final RdClipboardManager b() {
            return MainActivity.f1666u;
        }
    }

    public static final class b extends l implements w6.a<Boolean> {

        public static final b f1673i = new b();

        public b() {
            super(0);
        }

        @Override
        public final Boolean d() {
            return Boolean.FALSE;
        }
    }

    public static final class c extends l implements w6.a<Boolean> {
        public c() {
            super(0);
        }

        @Override
        public final Boolean d() {
            return Boolean.valueOf(MainActivity.this.f1670p);
        }
    }

    public static final class d extends l implements w6.a<n> {
        public d() {
            super(0);
        }

        public final void a() {
            MainActivity.this.l0();
        }

        @Override
        public n d() {
            a();
            return n.f5113a;
        }
    }

    public static final class e implements ServiceConnection {
        public e() {
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            Log.d(MainActivity.this.f1668n, "onServiceConnected");
            x6.k.c(iBinder, "null cannot be cast to non-null type com.iszzlzbet.xghj.MainService.LocalBinder");
            MainActivity.this.f1669o = ((MainService.b) iBinder).a();
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            Log.d(MainActivity.this.f1668n, "onServiceDisconnected");
            MainActivity.this.f1669o = null;
        }
    }

    public static final void g0(MainActivity mainActivity, j jVar, k.d dVar) {
        String str;
        SharedPreferences.Editor edit;
        boolean z7;
        n nVar;
        n nVar2;
        InputService a8;
        n nVar3;
        Boolean bool;
        x6.k.e(mainActivity, "this$0");
        x6.k.e(jVar, "call");
        x6.k.e(dVar, "result");
        String str2 = jVar.f12456a;
        if (str2 != null) {
            switch (str2.hashCode()) {
                case -2144523317:
                    if (str2.equals("sync_app_dir")) {
                        if (jVar.f12457b instanceof String) {
                            edit = mainActivity.getSharedPreferences("KEY_SHARED_PREFERENCES", 0).edit();
                            Object obj = jVar.f12457b;
                            x6.k.c(obj, "null cannot be cast to non-null type kotlin.String");
                            edit.putString("KEY_APP_DIR_CONFIG_PATH", (String) obj);
                            edit.apply();
                            bool = Boolean.TRUE;
                            dVar.a(bool);
                            break;
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                    }
                    break;
                case -2045328762:
                    if (str2.equals("init_service")) {
                        mainActivity.bindService(new Intent(mainActivity.e(), (Class<?>) MainService.class), mainActivity.f1672r, 1);
                        if (!MainService.C.c()) {
                            mainActivity.k0();
                            bool = Boolean.TRUE;
                            dVar.a(bool);
                            break;
                        } else {
                            dVar.a(Boolean.FALSE);
                            break;
                        }
                    }
                    break;
                case -1897543042:
                    if (str2.equals("check_service")) {
                        k kVar = f1665t;
                        if (kVar != null) {
                            kVar.c("on_state_changed", b0.e(j6.k.a("name", "input"), j6.k.a("value", String.valueOf(InputService.E.b()))));
                        }
                        k kVar2 = f1665t;
                        if (kVar2 != null) {
                            kVar2.c("on_state_changed", b0.e(j6.k.a("name", "media"), j6.k.a("value", String.valueOf(MainService.C.c()))));
                        }
                        bool = Boolean.TRUE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -1653420736:
                    if (str2.equals("get_start_on_boot_opt")) {
                        z7 = mainActivity.getSharedPreferences("KEY_SHARED_PREFERENCES", 0).getBoolean("KEY_START_ON_BOOT_OPT", false);
                        bool = Boolean.valueOf(z7);
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -1321684887:
                    if (str2.equals("start_capture")) {
                        MainService mainService = mainActivity.f1669o;
                        if (mainService != null) {
                            dVar.a(Boolean.valueOf(mainService.C()));
                            nVar = n.f5113a;
                        } else {
                            nVar = null;
                        }
                        if (nVar != null) {
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -1190505608:
                    if (str2.equals("stop_service")) {
                        Log.d(mainActivity.f1668n, "Stop service");
                        MainService mainService2 = mainActivity.f1669o;
                        if (mainService2 != null) {
                            mainService2.u();
                            dVar.a(Boolean.TRUE);
                            nVar2 = n.f5113a;
                        } else {
                            nVar2 = null;
                        }
                        if (nVar2 != null) {
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -1172668288:
                    if (str2.equals("on_voice_call_closed")) {
                        mainActivity.i0();
                        break;
                    }
                    break;
                case -1015793331:
                    if (str2.equals("stop_input")) {
                        if (Build.VERSION.SDK_INT >= 24 && (a8 = InputService.E.a()) != null) {
                            a8.disableSelf();
                        }
                        InputService.a aVar = InputService.E;
                        aVar.c(null);
                        k kVar3 = f1665t;
                        if (kVar3 != null) {
                            kVar3.c("on_state_changed", b0.e(j6.k.a("name", "input"), j6.k.a("value", String.valueOf(aVar.b()))));
                        }
                        bool = Boolean.TRUE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -936039830:
                    if (str2.equals("check_video_permission")) {
                        MainService mainService3 = mainActivity.f1669o;
                        if (mainService3 != null) {
                            dVar.a(Boolean.valueOf(mainService3.k()));
                            nVar3 = n.f5113a;
                        } else {
                            nVar3 = null;
                        }
                        if (nVar3 != null) {
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case -561690241:
                    if (str2.equals("request_permission")) {
                        if (jVar.f12457b instanceof String) {
                            Context a9 = mainActivity.a();
                            x6.k.d(a9, "getContext(...)");
                            Object obj2 = jVar.f12457b;
                            x6.k.c(obj2, "null cannot be cast to non-null type kotlin.String");
                            com.iszzlzbet.xghj.a.k(a9, (String) obj2);
                            bool = Boolean.TRUE;
                            dVar.a(bool);
                            break;
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                    }
                    break;
                case -513579853:
                    if (str2.equals("start_action")) {
                        if (jVar.f12457b instanceof String) {
                            Context a10 = mainActivity.a();
                            x6.k.d(a10, "getContext(...)");
                            Object obj3 = jVar.f12457b;
                            x6.k.c(obj3, "null cannot be cast to non-null type kotlin.String");
                            com.iszzlzbet.xghj.a.s(a10, (String) obj3);
                            bool = Boolean.TRUE;
                            dVar.a(bool);
                            break;
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                    }
                    break;
                case -461732883:
                    if (str2.equals("on_voice_call_started")) {
                        mainActivity.j0();
                        break;
                    }
                    break;
                case 796546720:
                    if (str2.equals("enable_soft_keyboard")) {
                        Object obj4 = jVar.f12457b;
                        x6.k.c(obj4, "null cannot be cast to non-null type kotlin.Boolean");
                        boolean booleanValue = ((Boolean) obj4).booleanValue();
                        Window window = mainActivity.getWindow();
                        if (booleanValue) {
                            window.clearFlags(131072);
                        } else {
                            window.addFlags(131072);
                        }
                        bool = Boolean.TRUE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case 882790220:
                    if (str2.equals("set_start_on_boot_opt")) {
                        if (jVar.f12457b instanceof Boolean) {
                            edit = mainActivity.getSharedPreferences("KEY_SHARED_PREFERENCES", 0).edit();
                            Object obj5 = jVar.f12457b;
                            x6.k.c(obj5, "null cannot be cast to non-null type kotlin.Boolean");
                            edit.putBoolean("KEY_START_ON_BOOT_OPT", ((Boolean) obj5).booleanValue());
                            edit.apply();
                            bool = Boolean.TRUE;
                            dVar.a(bool);
                            break;
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                    }
                    break;
                case 1148922696:
                    if (str2.equals("get_value")) {
                        Object obj6 = jVar.f12457b;
                        if (!(obj6 instanceof String)) {
                            dVar.a(null);
                            break;
                        } else if (!x6.k.a(obj6, "KEY_IS_SUPPORT_VOICE_CALL")) {
                            str = "No such key";
                            dVar.b("-1", str, null);
                            break;
                        } else {
                            z7 = com.iszzlzbet.xghj.a.j();
                            bool = Boolean.valueOf(z7);
                            dVar.a(bool);
                            break;
                        }
                    }
                    break;
                case 1271700112:
                    if (str2.equals("cancel_notification")) {
                        Object obj7 = jVar.f12457b;
                        if (obj7 instanceof Integer) {
                            x6.k.c(obj7, "null cannot be cast to non-null type kotlin.Int");
                            int intValue = ((Integer) obj7).intValue();
                            MainService mainService4 = mainActivity.f1669o;
                            if (mainService4 != null) {
                                mainService4.j(intValue);
                                break;
                            }
                        }
                        bool = Boolean.TRUE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case 1364216822:
                    if (str2.equals("try_sync_clipboard")) {
                        RdClipboardManager b8 = f1664s.b();
                        if (b8 != null) {
                            b8.f(true);
                        }
                        bool = Boolean.TRUE;
                        dVar.a(bool);
                        break;
                    }
                    break;
                case 1862025574:
                    if (str2.equals("check_permission")) {
                        if (jVar.f12457b instanceof String) {
                            Context a11 = mainActivity.a();
                            Object obj8 = jVar.f12457b;
                            x6.k.c(obj8, "null cannot be cast to non-null type kotlin.String");
                            z7 = s0.d(a11, obj8);
                            bool = Boolean.valueOf(z7);
                            dVar.a(bool);
                            break;
                        }
                        bool = Boolean.FALSE;
                        dVar.a(bool);
                    }
                    break;
            }
        }
        str = "No such method";
        dVar.b("-1", str, null);
    }

    public static final void h0(boolean z7) {
        k kVar = f1665t;
        if (kVar != null) {
            kVar.c("on_state_changed", b0.e(j6.k.a("name", "input"), j6.k.a("value", String.valueOf(z7))));
        }
    }

    @Override
    public void F(io.flutter.embedding.engine.a aVar) {
        x6.k.e(aVar, "flutterEngine");
        super.F(aVar);
        if (MainService.C.c()) {
            bindService(new Intent(e(), (Class<?>) MainService.class), this.f1672r, 1);
        }
        k kVar = new k(aVar.k().k(), this.f1667m);
        f1665t = kVar;
        x6.k.b(kVar);
        f0(kVar);
        l6.a.a((r12 & 1) != 0, (r12 & 2) != 0 ? false : false, (r12 & 4) != 0 ? null : null, (r12 & 8) != 0 ? null : null, (r12 & 16) != 0 ? -1 : 0, new d());
    }

    public final void f0(k kVar) {
        kVar.e(new k.c() {
            @Override
            public final void f(z5.j jVar, k.d dVar) {
                MainActivity.g0(MainActivity.this, jVar, dVar);
            }
        });
    }

    public final void i0() {
        n nVar;
        boolean z7;
        MainService mainService = this.f1669o;
        if (mainService != null) {
            z7 = mainService.z();
            nVar = n.f5113a;
        } else {
            nVar = null;
            z7 = false;
        }
        if (nVar == null) {
            this.f1670p = false;
            z7 = this.f1671q.i(null);
        }
        if (z7) {
            Log.d(this.f1668n, "onVoiceCallClosed success");
            return;
        }
        Log.e(this.f1668n, "onVoiceCallClosed fail");
        k kVar = f1665t;
        if (kVar != null) {
            kVar.c("msgbox", b0.e(j6.k.a("type", "custom-nook-nocancel-hasclose-error"), j6.k.a("title", "Voice call"), j6.k.a("text", "Failed to stop voice call.")));
        }
    }

    public final void j0() {
        n nVar;
        boolean z7;
        MainService mainService = this.f1669o;
        if (mainService != null) {
            z7 = mainService.A();
            nVar = n.f5113a;
        } else {
            nVar = null;
            z7 = false;
        }
        if (nVar == null) {
            this.f1670p = true;
            z7 = this.f1671q.j(null);
        }
        if (z7) {
            Log.d(this.f1668n, "onVoiceCallStarted success");
            return;
        }
        Log.e(this.f1668n, "onVoiceCallStarted fail");
        k kVar = f1665t;
        if (kVar != null) {
            kVar.c("msgbox", b0.e(j6.k.a("type", "custom-nook-nocancel-hasclose-error"), j6.k.a("title", "Voice call"), j6.k.a("text", "Failed to start voice call.")));
        }
    }

    public final void k0() {
        Intent intent = new Intent(this, (Class<?>) PermissionRequestTransparentActivity.class);
        intent.setAction("REQUEST_MEDIA_PROJECTION");
        startActivityForResult(intent, 101);
    }

    public final void l0() {
        int i8;
        boolean z7;
        boolean isHardwareAccelerated;
        WindowMetrics maximumWindowMetrics;
        if (Build.VERSION.SDK_INT >= 30) {
            maximumWindowMetrics = getWindowManager().getMaximumWindowMetrics();
            x6.k.d(maximumWindowMetrics, "getMaximumWindowMetrics(...)");
            com.iszzlzbet.xghj.a.q(maximumWindowMetrics.getBounds().width());
            i8 = maximumWindowMetrics.getBounds().height();
        } else {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
            com.iszzlzbet.xghj.a.q(displayMetrics.widthPixels);
            i8 = displayMetrics.heightPixels;
        }
        com.iszzlzbet.xghj.a.p(i8);
        boolean z8 = false;
        MediaCodecInfo[] codecInfos = new MediaCodecList(0).getCodecInfos();
        JSONArray jSONArray = new JSONArray();
        Object systemService = getSystemService("window");
        x6.k.c(systemService, "null cannot be cast to non-null type android.view.WindowManager");
        j6.g<Integer, Integer> i9 = com.iszzlzbet.xghj.a.i((WindowManager) systemService);
        boolean z9 = true;
        int intValue = (((i9.c().intValue() + 64) - 1) / 64) * 64;
        int intValue2 = (((i9.d().intValue() + 64) - 1) / 64) * 64;
        x6.k.b(codecInfos);
        int length = codecInfos.length;
        int i10 = 0;
        while (i10 < length) {
            MediaCodecInfo mediaCodecInfo = codecInfos[i10];
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("name", mediaCodecInfo.getName());
            jSONObject.put("is_encoder", mediaCodecInfo.isEncoder());
            Boolean bool = null;
            if (Build.VERSION.SDK_INT >= 29) {
                isHardwareAccelerated = mediaCodecInfo.isHardwareAccelerated();
                bool = Boolean.valueOf(isHardwareAccelerated);
            } else {
                List g8 = k6.l.g("OMX.google.", "OMX.SEC.", "c2.android");
                if (!(g8 instanceof Collection) || !g8.isEmpty()) {
                    Iterator it = g8.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            z8 = false;
                            break;
                        }
                        String str = (String) it.next();
                        String name = mediaCodecInfo.getName();
                        x6.k.d(name, "getName(...)");
                        if (m.l(name, str, z9)) {
                            z8 = true;
                            break;
                        }
                    }
                }
                if (z8) {
                    bool = Boolean.FALSE;
                } else {
                    List<String> g9 = k6.l.g("c2.qti", "OMX.qcom.video", "OMX.Exynos", "OMX.hisi", "OMX.MTK", "OMX.Intel", "OMX.Nvidia");
                    if (!(g9 instanceof Collection) || !g9.isEmpty()) {
                        for (String str2 : g9) {
                            String name2 = mediaCodecInfo.getName();
                            x6.k.d(name2, "getName(...)");
                            if (m.l(name2, str2, z9)) {
                                z7 = true;
                                break;
                            }
                        }
                    }
                    z7 = false;
                    if (z7) {
                        bool = Boolean.TRUE;
                    }
                }
            }
            if (x6.k.a(bool, Boolean.TRUE)) {
                jSONObject.put("hw", bool.booleanValue());
                String[] supportedTypes = mediaCodecInfo.getSupportedTypes();
                x6.k.d(supportedTypes, "getSupportedTypes(...)");
                String str3 = "";
                for (String str4 : supportedTypes) {
                    if (k6.l.g("video/avc", "video/hevc").contains(str4)) {
                        x6.k.b(str4);
                        str3 = str4;
                    }
                }
                if (str3.length() > 0) {
                    jSONObject.put("mime_type", str3);
                    MediaCodecInfo.CodecCapabilities capabilitiesForType = mediaCodecInfo.getCapabilitiesForType(str3);
                    if (!mediaCodecInfo.isEncoder() || capabilitiesForType.getVideoCapabilities().isSizeSupported(intValue, intValue2) || capabilitiesForType.getVideoCapabilities().isSizeSupported(intValue2, intValue)) {
                        Integer lower = capabilitiesForType.getVideoCapabilities().getSupportedWidths().getLower();
                        x6.k.d(lower, "getLower(...)");
                        jSONObject.put("min_width", lower.intValue());
                        Integer upper = capabilitiesForType.getVideoCapabilities().getSupportedWidths().getUpper();
                        x6.k.d(upper, "getUpper(...)");
                        jSONObject.put("max_width", upper.intValue());
                        Integer lower2 = capabilitiesForType.getVideoCapabilities().getSupportedHeights().getLower();
                        x6.k.d(lower2, "getLower(...)");
                        jSONObject.put("min_height", lower2.intValue());
                        Integer upper2 = capabilitiesForType.getVideoCapabilities().getSupportedHeights().getUpper();
                        x6.k.d(upper2, "getUpper(...)");
                        jSONObject.put("max_height", upper2.intValue());
                        int[] iArr = capabilitiesForType.colorFormats;
                        x6.k.d(iArr, "colorFormats");
                        boolean f8 = i.f(iArr, 2130708361);
                        jSONObject.put("surface", f8);
                        int[] iArr2 = capabilitiesForType.colorFormats;
                        x6.k.d(iArr2, "colorFormats");
                        boolean f9 = i.f(iArr2, 21);
                        jSONObject.put("nv12", f9);
                        if (f9 || f8) {
                            jSONObject.put("min_bitrate", capabilitiesForType.getVideoCapabilities().getBitrateRange().getLower().intValue() / 1000);
                            jSONObject.put("max_bitrate", capabilitiesForType.getVideoCapabilities().getBitrateRange().getUpper().intValue() / 1000);
                            if (!mediaCodecInfo.isEncoder() && Build.VERSION.SDK_INT >= 30) {
                                jSONObject.put("low_latency", capabilitiesForType.isFeatureSupported("low-latency"));
                            }
                            if (mediaCodecInfo.isEncoder()) {
                                jSONArray.put(jSONObject);
                            }
                            i10++;
                            z8 = false;
                            z9 = true;
                        }
                    }
                }
            }
            i10++;
            z8 = false;
            z9 = true;
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("version", Build.VERSION.SDK_INT);
        jSONObject2.put("w", intValue);
        jSONObject2.put(h.f12385n, intValue2);
        jSONObject2.put("codecs", jSONArray);
        FFI ffi2 = FFI.f2946a;
        String jSONObject3 = jSONObject2.toString();
        x6.k.d(jSONObject3, "toString(...)");
        ffi2.setCodecInfo(jSONObject3);
    }

    @Override
    public void onActivityResult(int i8, int i9, Intent intent) {
        k kVar;
        super.onActivityResult(i8, i9, intent);
        if (i8 == 101 && i9 == -100 && (kVar = f1665t) != null) {
            kVar.c("on_media_projection_canceled", null);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        int i8;
        WindowMetrics maximumWindowMetrics;
        getWindow().setFlags(256, 256);
        if (Build.VERSION.SDK_INT >= 30) {
            maximumWindowMetrics = getWindowManager().getMaximumWindowMetrics();
            x6.k.d(maximumWindowMetrics, "getMaximumWindowMetrics(...)");
            com.iszzlzbet.xghj.a.q(maximumWindowMetrics.getBounds().width());
            i8 = maximumWindowMetrics.getBounds().height();
        } else {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
            com.iszzlzbet.xghj.a.q(displayMetrics.widthPixels);
            i8 = displayMetrics.heightPixels;
        }
        com.iszzlzbet.xghj.a.p(i8);
        super.onCreate(bundle);
        if (f1666u == null) {
            Object systemService = getSystemService("clipboard");
            x6.k.c(systemService, "null cannot be cast to non-null type android.content.ClipboardManager");
            f1666u = new RdClipboardManager((ClipboardManager) systemService);
            FFI ffi2 = FFI.f2946a;
            RdClipboardManager rdClipboardManager = f1666u;
            x6.k.b(rdClipboardManager);
            ffi2.setClipboardManager(rdClipboardManager);
        }
    }

    @Override
    public void onDestroy() {
        Log.e(this.f1668n, "onDestroy");
        if (this.f1669o != null) {
            unbindService(this.f1672r);
        }
        super.onDestroy();
    }

    @Override
    public void onResume() {
        super.onResume();
        final boolean b8 = InputService.E.b();
        e().runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                MainActivity.h0(b8);
            }
        });
    }

    @Override
    public void onStart() {
        super.onStart();
        stopService(new Intent(this, (Class<?>) FloatingWindowService.class));
    }

    @Override
    public void onStop() {
        super.onStop();
        if (x6.k.a(FFI.f2946a.getLocalOption("disable-floating-window"), "Y") || !MainService.C.c()) {
            return;
        }
        startService(new Intent(this, (Class<?>) FloatingWindowService.class));
    }
}