导航菜单

页面标题

页面副标题

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

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

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


package com.uixxpi.ercpqxo;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.content.res.Configuration;
import android.hardware.display.VirtualDisplay;
import android.media.Image;
import android.media.ImageReader;
import android.media.MediaCodec;
import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Parcelable;
import android.os.PowerManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Surface;
import android.view.WindowManager;
import android.view.WindowMetrics;
import com.uixxpi.ercpqxo.MainService;
import ffi.FFI;
import j6.n;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import k6.b0;
import org.json.JSONException;
import org.json.JSONObject;
import v.p;
import x6.k;
import x6.l;

public final class MainService extends Service {
    public static final a C = new a(null);
    public static boolean D;
    public static boolean E;
    public static boolean F;
    public static MainService G;
    public Boolean A;
    public final MediaCodec.Callback B;

    public Looper f1748h;

    public Handler f1749i;

    public final boolean f1753m;

    public boolean f1755o;

    public MediaProjection f1756p;

    public Surface f1757q;

    public final ExecutorService f1758r;

    public MediaCodec f1759s;

    public ImageReader f1760t;

    public VirtualDisplay f1761u;

    public final q1.d f1762v;

    public NotificationManager f1763w;

    public String f1764x;

    public p.c f1765y;

    public ByteBuffer f1766z;

    public final j6.d f1750j = j6.e.a(new f());

    public final j6.d f1751k = j6.e.a(new g());

    public final String f1752l = "LOG_SERVICE";

    public final b f1754n = new b();

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

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

        public final MainService a() {
            return MainService.G;
        }

        public final boolean b() {
            return MainService.F;
        }

        public final boolean c() {
            return MainService.D;
        }

        public final boolean d() {
            return MainService.E;
        }
    }

    public final class b extends Binder {
        public b() {
        }

        public final MainService a() {
            return MainService.this;
        }
    }

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

        public static final c f1768i = new c();

        public c() {
            super(0);
        }

        @Override
        public final Boolean d() {
            return Boolean.valueOf(MainService.C.d());
        }
    }

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

        public static final d f1769i = new d();

        public d() {
            super(0);
        }

        @Override
        public final Boolean d() {
            return Boolean.valueOf(MainService.C.b());
        }
    }

    public static final class e extends MediaCodec.Callback {
        public e() {
        }

        public static final void b(ByteBuffer byteBuffer, MediaCodec mediaCodec, int i8) {
            k.e(byteBuffer, "$buf");
            k.e(mediaCodec, "$codec");
            byteBuffer.get(new byte[byteBuffer.limit()]);
            mediaCodec.releaseOutputBuffer(i8, false);
        }

        @Override
        public void onError(MediaCodec mediaCodec, MediaCodec.CodecException codecException) {
            k.e(mediaCodec, "codec");
            k.e(codecException, c4.e.f1363d);
        }

        @Override
        public void onInputBufferAvailable(MediaCodec mediaCodec, int i8) {
            k.e(mediaCodec, "codec");
        }

        @Override
        public void onOutputBufferAvailable(final MediaCodec mediaCodec, final int i8, MediaCodec.BufferInfo bufferInfo) {
            k.e(mediaCodec, "codec");
            k.e(bufferInfo, "info");
            final ByteBuffer outputBuffer = mediaCodec.getOutputBuffer(i8);
            if (outputBuffer != null) {
                MainService.this.f1758r.execute(new Runnable() {
                    @Override
                    public final void run() {
                        MainService.e.b(outputBuffer, mediaCodec, i8);
                    }
                });
            }
        }

        @Override
        public void onOutputFormatChanged(MediaCodec mediaCodec, MediaFormat mediaFormat) {
            k.e(mediaCodec, "codec");
            k.e(mediaFormat, "format");
        }
    }

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

        @Override
        public final PowerManager d() {
            Object systemService = MainService.this.getApplicationContext().getSystemService("power");
            k.c(systemService, "null cannot be cast to non-null type android.os.PowerManager");
            return (PowerManager) systemService;
        }
    }

    public static final class g extends l implements w6.a<PowerManager.WakeLock> {
        public g() {
            super(0);
        }

        @Override
        public final PowerManager.WakeLock d() {
            return MainService.this.w().newWakeLock(268435466, "rustdesk:wakelock");
        }
    }

    public MainService() {
        this.f1755o = Build.VERSION.SDK_INT > 33;
        this.f1758r = Executors.newSingleThreadExecutor();
        this.f1762v = new q1.d(this, c.f1768i, d.f1769i);
        this.B = new e();
    }

    public static final void l() {
        z5.k a8 = MainActivity.f1735s.a();
        if (a8 != null) {
            a8.c("on_state_changed", b0.e(j6.k.a("name", "input"), j6.k.a("value", String.valueOf(InputService.E.b()))));
        }
    }

    public static final void m() {
        z5.k a8 = MainActivity.f1735s.a();
        if (a8 != null) {
            a8.c("on_state_changed", b0.e(j6.k.a("name", "media"), j6.k.a("value", String.valueOf(C.c()))));
        }
    }

    public static final void r(ImageReader imageReader) {
        k.e(imageReader, "imageReader");
        try {
            Image acquireLatestImage = imageReader.acquireLatestImage();
            if (acquireLatestImage != null) {
                try {
                    if (C.d()) {
                        ByteBuffer buffer = acquireLatestImage.getPlanes()[0].getBuffer();
                        buffer.rewind();
                        if (!com.uixxpi.ercpqxo.a.h()) {
                            FFI ffi2 = FFI.f2946a;
                            k.b(buffer);
                            ffi2.onVideoFrameUpdate(buffer);
                        }
                        n nVar = n.f5113a;
                        u6.a.a(acquireLatestImage, null);
                        return;
                    }
                } finally {
                }
            }
            u6.a.a(acquireLatestImage, null);
        } catch (Exception unused) {
        }
    }

    public final boolean A() {
        return this.f1762v.j(this.f1756p);
    }

    public final void B() {
        Intent intent = new Intent(this, (Class<?>) PermissionRequestTransparentActivity.class);
        intent.setAction("REQUEST_MEDIA_PROJECTION");
        intent.setFlags(268435456);
        startActivity(intent);
    }

    public final boolean C() {
        if (C.d()) {
            return true;
        }
        if (this.f1756p == null) {
            return false;
        }
        G(getResources().getConfiguration().orientation);
        this.f1757q = q();
        if (this.f1753m) {
            MediaProjection mediaProjection = this.f1756p;
            k.b(mediaProjection);
            E(mediaProjection);
        } else {
            MediaProjection mediaProjection2 = this.f1756p;
            k.b(mediaProjection2);
            D(mediaProjection2);
        }
        if (Build.VERSION.SDK_INT >= 30 && this.f1762v.h(false, this.f1756p)) {
            this.f1762v.k();
        }
        k();
        E = true;
        FFI.f2946a.setFrameRawEnable("video", true);
        RdClipboardManager b8 = MainActivity.f1735s.b();
        if (b8 != null) {
            b8.e(E);
        }
        return true;
    }

    public final void D(MediaProjection mediaProjection) {
        Surface surface = this.f1757q;
        if (surface == null) {
            return;
        }
        k.b(surface);
        p(mediaProjection, surface);
    }

    public final void E(MediaProjection mediaProjection) {
        o();
        MediaCodec mediaCodec = this.f1759s;
        if (mediaCodec != null) {
            Surface createInputSurface = mediaCodec.createInputSurface();
            this.f1757q = createInputSurface;
            if (Build.VERSION.SDK_INT >= 30) {
                k.b(createInputSurface);
                createInputSurface.setFrameRate(1.0f, 0);
            }
            mediaCodec.setCallback(this.B);
            mediaCodec.start();
            Surface surface = this.f1757q;
            k.b(surface);
            p(mediaProjection, surface);
        }
    }

    public final synchronized void F() {
        FFI.f2946a.setFrameRawEnable("video", false);
        E = false;
        RdClipboardManager b8 = MainActivity.f1735s.b();
        if (b8 != null) {
            b8.e(E);
        }
        if (this.f1755o) {
            VirtualDisplay virtualDisplay = this.f1761u;
            if (virtualDisplay != null) {
                virtualDisplay.setSurface(null);
            }
        } else {
            VirtualDisplay virtualDisplay2 = this.f1761u;
            if (virtualDisplay2 != null) {
                virtualDisplay2.release();
            }
        }
        ImageReader imageReader = this.f1760t;
        if (imageReader != null) {
            imageReader.close();
        }
        this.f1760t = null;
        MediaCodec mediaCodec = this.f1759s;
        if (mediaCodec != null) {
            mediaCodec.signalEndOfInputStream();
            mediaCodec.stop();
            mediaCodec.release();
        }
        if (!this.f1755o) {
            this.f1761u = null;
        }
        this.f1759s = null;
        Surface surface = this.f1757q;
        if (surface != null) {
            surface.release();
        }
        F = false;
        this.f1762v.n();
    }

    public final void G(int i8) {
        int i9;
        int i10;
        int i11;
        WindowMetrics maximumWindowMetrics;
        Object systemService = getSystemService("window");
        k.c(systemService, "null cannot be cast to non-null type android.view.WindowManager");
        WindowManager windowManager = (WindowManager) systemService;
        if (Build.VERSION.SDK_INT >= 30) {
            maximumWindowMetrics = windowManager.getMaximumWindowMetrics();
            k.d(maximumWindowMetrics, "getMaximumWindowMetrics(...)");
            i9 = maximumWindowMetrics.getBounds().width();
            i10 = maximumWindowMetrics.getBounds().height();
            i11 = getResources().getConfiguration().densityDpi;
        } else {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
            int i12 = displayMetrics.widthPixels;
            int i13 = displayMetrics.heightPixels;
            int i14 = displayMetrics.densityDpi;
            i9 = i12;
            i10 = i13;
            i11 = i14;
        }
        int max = Math.max(i9, i10);
        int min = Math.min(i9, i10);
        int i15 = 2;
        if (i8 != 2) {
            max = min;
            min = max;
        }
        if (max == 0 || min == 0) {
            return;
        }
        if (!k.a(this.A, Boolean.TRUE) || (max <= 1200 && min <= 1200)) {
            i15 = 1;
        } else {
            max /= 2;
            min /= 2;
            i11 /= 2;
        }
        if (com.uixxpi.ercpqxo.a.g().d() != max) {
            com.uixxpi.ercpqxo.a.g().h(max);
            com.uixxpi.ercpqxo.a.g().f(min);
            com.uixxpi.ercpqxo.a.g().g(i15);
            com.uixxpi.ercpqxo.a.g().e(i11);
            t(max, min);
            if (!C.d()) {
                FFI.f2946a.refreshScreen();
                return;
            }
            F();
            FFI.f2946a.refreshScreen();
            C();
        }
    }

    public final void H(int i8, String str, String str2, String str3) {
        p.c cVar = this.f1765y;
        NotificationManager notificationManager = null;
        if (cVar == null) {
            k.n("notificationBuilder");
            cVar = null;
        }
        Notification a8 = cVar.k(false).m(2).h(com.uixxpi.ercpqxo.a.t("Do you accept?")).g(str + ':' + str2 + '-' + str3).a();
        k.d(a8, "build(...)");
        NotificationManager notificationManager2 = this.f1763w;
        if (notificationManager2 == null) {
            k.n("notificationManager");
        } else {
            notificationManager = notificationManager2;
        }
        notificationManager.notify(v(i8), a8);
    }

    public final void j(int i8) {
        NotificationManager notificationManager = this.f1763w;
        if (notificationManager == null) {
            k.n("notificationManager");
            notificationManager = null;
        }
        notificationManager.cancel(v(i8));
    }

    public final boolean k() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                MainService.m();
            }
        });
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public final void run() {
                MainService.l();
            }
        });
        return C.c();
    }

    public final void n() {
        Intent intent = new Intent(this, (Class<?>) MainActivity.class);
        intent.setFlags(270532608);
        intent.setAction("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.LAUNCHER");
        intent.putExtra("type", intent.getType());
        PendingIntent activity = PendingIntent.getActivity(this, 0, intent, Build.VERSION.SDK_INT >= 23 ? 201326592 : 134217728);
        p.c cVar = this.f1765y;
        if (cVar == null) {
            k.n("notificationBuilder");
            cVar = null;
        }
        Notification a8 = cVar.k(true).n(2131492867).i(-1).d(true).m(0).h("迅唔").g(com.uixxpi.ercpqxo.a.t("Service is running")).l(true).f(activity).e(w.a.b(this, 2131034185)).o(System.currentTimeMillis()).a();
        k.d(a8, "build(...)");
        startForeground(1, a8);
    }

    public final void o() {
        this.f1759s = MediaCodec.createEncoderByType("video/x-vnd.on2.vp9");
        MediaFormat createVideoFormat = MediaFormat.createVideoFormat("video/x-vnd.on2.vp9", com.uixxpi.ercpqxo.a.g().d(), com.uixxpi.ercpqxo.a.g().b());
        k.d(createVideoFormat, "createVideoFormat(...)");
        createVideoFormat.setInteger("bitrate", 1024000);
        createVideoFormat.setInteger("frame-rate", 30);
        createVideoFormat.setInteger("color-format", 2135033992);
        createVideoFormat.setInteger("i-frame-interval", 5);
        try {
            MediaCodec mediaCodec = this.f1759s;
            k.b(mediaCodec);
            mediaCodec.configure(createVideoFormat, (Surface) null, (MediaCrypto) null, 1);
        } catch (Exception unused) {
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        k.e(intent, "intent");
        return this.f1754n;
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        k.e(configuration, "newConfig");
        super.onConfigurationChanged(configuration);
        G(configuration.orientation);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        FFI ffi2 = FFI.f2946a;
        ffi2.init(this);
        G = this;
        HandlerThread handlerThread = new HandlerThread("Service", 10);
        handlerThread.start();
        this.f1748h = handlerThread.getLooper();
        this.f1749i = new Handler(handlerThread.getLooper());
        G(getResources().getConfiguration().orientation);
        y();
        String string = getApplicationContext().getSharedPreferences("KEY_SHARED_PREFERENCES", 0).getString("KEY_APP_DIR_CONFIG_PATH", "");
        if (string == null) {
            string = "";
        }
        ffi2.startServer(string, "");
        n();
    }

    @Override
    public void onDestroy() {
        k();
        stopService(new Intent(this, (Class<?>) FloatingWindowService.class));
        G = null;
        super.onDestroy();
    }

    @Override
    public int onStartCommand(Intent intent, int i8, int i9) {
        super.onStartCommand(intent, i8, i9);
        n nVar = null;
        if (!k.a(intent != null ? intent.getAction() : null, "INIT_MEDIA_PROJECTION_AND_SERVICE")) {
            return 2;
        }
        n();
        if (intent.getBooleanExtra("EXT_INIT_FROM_BOOT", false)) {
            FFI.f2946a.startService();
        }
        Object systemService = getSystemService("media_projection");
        k.c(systemService, "null cannot be cast to non-null type android.media.projection.MediaProjectionManager");
        MediaProjectionManager mediaProjectionManager = (MediaProjectionManager) systemService;
        Intent intent2 = (Intent) intent.getParcelableExtra("MEDIA_PROJECTION_RES_INTENT");
        if (intent2 != null) {
            this.f1756p = mediaProjectionManager.getMediaProjection(-1, intent2);
            k();
            D = true;
            nVar = n.f5113a;
        }
        if (nVar != null) {
            return 2;
        }
        B();
        return 2;
    }

    public final void p(MediaProjection mediaProjection, Surface surface) {
        n nVar;
        try {
            VirtualDisplay virtualDisplay = this.f1761u;
            if (virtualDisplay != null) {
                virtualDisplay.resize(com.uixxpi.ercpqxo.a.g().d(), com.uixxpi.ercpqxo.a.g().b(), com.uixxpi.ercpqxo.a.g().a());
                virtualDisplay.setSurface(surface);
                nVar = n.f5113a;
            } else {
                nVar = null;
            }
            if (nVar == null) {
                this.f1761u = mediaProjection.createVirtualDisplay("RustDeskVD", com.uixxpi.ercpqxo.a.g().d(), com.uixxpi.ercpqxo.a.g().b(), com.uixxpi.ercpqxo.a.g().a(), 16, surface, null, null);
            }
        } catch (SecurityException unused) {
            B();
        }
    }

    public final Surface q() {
        if (this.f1753m) {
            return null;
        }
        ImageReader newInstance = ImageReader.newInstance(com.uixxpi.ercpqxo.a.g().d(), com.uixxpi.ercpqxo.a.g().b(), 1, 4);
        newInstance.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
            @Override
            public final void onImageAvailable(ImageReader imageReader) {
                MainService.r(imageReader);
            }
        }, this.f1749i);
        this.f1760t = newInstance;
        return newInstance.getSurface();
    }

    public final String rustGetByName(String str) {
        boolean c8;
        k.e(str, "name");
        int hashCode = str.hashCode();
        if (hashCode == -1179770810) {
            if (str.equals("is_end")) {
                c8 = com.uixxpi.ercpqxo.a.c();
                return String.valueOf(c8);
            }
            return "";
        }
        if (hashCode != -43107340) {
            if (hashCode == 124726541 && str.equals("is_start")) {
                c8 = C.d();
                return String.valueOf(c8);
            }
        } else if (str.equals("screen_size")) {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("width", com.uixxpi.ercpqxo.a.g().d());
            jSONObject.put("height", com.uixxpi.ercpqxo.a.g().b());
            jSONObject.put("scale", com.uixxpi.ercpqxo.a.g().c());
            String jSONObject2 = jSONObject.toString();
            k.b(jSONObject2);
            return jSONObject2;
        }
        return "";
    }

    public final void rustKeyEventInput(byte[] bArr) {
        k.e(bArr, "input");
        InputService a8 = InputService.E.a();
        if (a8 != null) {
            a8.B(bArr);
        }
    }

    public final void rustPointerInput(int i8, int i9, int i10, int i11, String str) {
        InputService a8;
        k.e(str, "url");
        if (!w().isInteractive() && (i8 == 0 || i9 == 9)) {
            if (x().isHeld()) {
                x().release();
            }
            Log.d(this.f1752l, "Turn on Screen");
            x().acquire(5000L);
            return;
        }
        if (i8 != 0) {
            if (i8 == 1 && (a8 = InputService.E.a()) != null) {
                a8.D(i9, i10, i11, str);
                return;
            }
            return;
        }
        InputService a9 = InputService.E.a();
        if (a9 != null) {
            a9.E(i9, i10, i11);
        }
    }

    public final void rustSetByName(String str, String str2, String str3) {
        z5.k a8;
        Map e8;
        InputService a9;
        InputService a10;
        k.e(str, "name");
        k.e(str2, "arg1");
        k.e(str3, "arg2");
        try {
            switch (str.hashCode()) {
                case -1373783725:
                    if (str.equals("update_voice_call_state")) {
                        JSONObject jSONObject = new JSONObject(str2);
                        Object obj = jSONObject.get("id");
                        k.c(obj, "null cannot be cast to non-null type kotlin.Int");
                        int intValue = ((Integer) obj).intValue();
                        Object obj2 = jSONObject.get("name");
                        k.c(obj2, "null cannot be cast to non-null type kotlin.String");
                        String str4 = (String) obj2;
                        Object obj3 = jSONObject.get("peer_id");
                        k.c(obj3, "null cannot be cast to non-null type kotlin.String");
                        String str5 = (String) obj3;
                        Object obj4 = jSONObject.get("in_voice_call");
                        k.c(obj4, "null cannot be cast to non-null type kotlin.Boolean");
                        boolean booleanValue = ((Boolean) obj4).booleanValue();
                        Object obj5 = jSONObject.get("incoming_voice_call");
                        k.c(obj5, "null cannot be cast to non-null type kotlin.Boolean");
                        boolean booleanValue2 = ((Boolean) obj5).booleanValue();
                        if (booleanValue) {
                            if (!this.f1762v.m(this.f1756p) && (a8 = MainActivity.f1735s.a()) != null) {
                                e8 = b0.e(j6.k.a("type", "custom-nook-nocancel-hasclose-error"), j6.k.a("title", "Voice call"), j6.k.a("text", "Failed to switch to voice call."));
                            }
                        } else if (booleanValue2) {
                            H(intValue, "Voice Call Request", str4, str5);
                            break;
                        } else if (!this.f1762v.l(this.f1756p) && (a8 = MainActivity.f1735s.a()) != null) {
                            e8 = b0.e(j6.k.a("type", "custom-nook-nocancel-hasclose-error"), j6.k.a("title", "Voice call"), j6.k.a("text", "Failed to switch out voice call."));
                        }
                        a8.c("msgbox", e8);
                        break;
                    }
                    break;
                case -1321684887:
                    if (str.equals("start_capture") && (a9 = InputService.E.a()) != null) {
                        a9.F(str2, str3);
                        break;
                    }
                    break;
                case -734044868:
                    if (str.equals("add_connection")) {
                        JSONObject jSONObject2 = new JSONObject(str2);
                        Object obj6 = jSONObject2.get("id");
                        k.c(obj6, "null cannot be cast to non-null type kotlin.Int");
                        ((Integer) obj6).intValue();
                        Object obj7 = jSONObject2.get("name");
                        k.c(obj7, "null cannot be cast to non-null type kotlin.String");
                        Object obj8 = jSONObject2.get("peer_id");
                        k.c(obj8, "null cannot be cast to non-null type kotlin.String");
                        Object obj9 = jSONObject2.get("authorized");
                        k.c(obj9, "null cannot be cast to non-null type kotlin.Boolean");
                        boolean booleanValue3 = ((Boolean) obj9).booleanValue();
                        Object obj10 = jSONObject2.get("is_file_transfer");
                        k.c(obj10, "null cannot be cast to non-null type kotlin.Boolean");
                        boolean booleanValue4 = ((Boolean) obj10).booleanValue();
                        com.uixxpi.ercpqxo.a.t(booleanValue4 ? "File Connection" : "Screen Connection");
                        if (booleanValue3 && !booleanValue4 && !C.d()) {
                            C();
                            break;
                        }
                    }
                    break;
                case -81921474:
                    if (str.equals("half_scale")) {
                        boolean parseBoolean = Boolean.parseBoolean(str2);
                        if (!k.a(this.A, Boolean.valueOf(parseBoolean))) {
                            this.A = Boolean.valueOf(parseBoolean);
                            G(getResources().getConfiguration().orientation);
                            break;
                        }
                    }
                    break;
                case 1329409395:
                    if (str.equals("start_overlay") && (a10 = InputService.E.a()) != null) {
                        a10.G(str2, str3);
                        break;
                    }
                    break;
                case 1672893449:
                    if (str.equals("stop_capture")) {
                        F();
                        break;
                    }
                    break;
            }
        } catch (JSONException e9) {
            e9.printStackTrace();
        }
    }

    public final void s() {
        ByteBuffer c8 = com.uixxpi.ercpqxo.b.f1788a.c();
        if (c8 != null) {
            FFI ffi2 = FFI.f2946a;
            ByteBuffer byteBuffer = this.f1766z;
            if (byteBuffer == null) {
                k.n("ErrorExceptions");
                byteBuffer = null;
            }
            ffi2.e4807c73c6efa1e2(c8, byteBuffer);
        }
    }

    public final void t(int i8, int i9) {
        this.f1766z = FFI.f2946a.dd50d328f48c6896(i8, i9);
    }

    public final void u() {
        D = false;
        F = false;
        F();
        if (this.f1755o) {
            VirtualDisplay virtualDisplay = this.f1761u;
            if (virtualDisplay != null) {
                virtualDisplay.release();
            }
            this.f1761u = null;
        }
        this.f1756p = null;
        k();
        stopForeground(true);
        stopService(new Intent(this, (Class<?>) FloatingWindowService.class));
        stopSelf();
    }

    public final int v(int i8) {
        return i8 + 100;
    }

    public final PowerManager w() {
        return (PowerManager) this.f1750j.getValue();
    }

    public final PowerManager.WakeLock x() {
        Object value = this.f1751k.getValue();
        k.d(value, "getValue(...)");
        return (PowerManager.WakeLock) value;
    }

    public final void y() {
        final String str;
        Object systemService = getSystemService("notification");
        k.c(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        this.f1763w = (NotificationManager) systemService;
        if (Build.VERSION.SDK_INT >= 26) {
            str = "RustDesk";
            final int i8 = 4;
            final String str2 = "RustDesk Service";
            ?? r12 = new Parcelable(str, str2, i8) {
                static {
                    throw new NoClassDefFoundError();
                }

                public native void setDescription(String str3);

                public native void setLightColor(int i9);

                public native void setLockscreenVisibility(int i9);
            };
            r12.setDescription("RustDesk Service Channel");
            r12.setLightColor(-16776961);
            r12.setLockscreenVisibility(0);
            NotificationManager notificationManager = this.f1763w;
            if (notificationManager == null) {
                k.n("notificationManager");
                notificationManager = null;
            }
            notificationManager.createNotificationChannel(r12);
        } else {
            str = "";
        }
        this.f1764x = str;
        this.f1765y = new p.c(this, str);
    }

    public final boolean z() {
        return this.f1762v.i(this.f1756p);
    }
}