导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - ScreenCaptureService.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 ScreenCaptureService.java JAVA 源代码文件

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


package com.psk.sharescreen.util;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import androidx.activity.ComponentActivity;
import com.like.common.util.NotificationKt;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u0000 \n2\u00020\u0001:\u0001\nB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016J\b\u0010\u0005\u001a\u00020\u0004H\u0016J\u0012\u0010\u0006\u001a\u00020\u00042\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0014J\b\u0010\t\u001a\u00020\u0004H\u0002¨\u0006\u000b"}, d2 = {"Lcom/psk/sharescreen/util/ScreenCaptureService;", "Landroid/app/IntentService;", "()V", "onCreate", "", "onDestroy", "onHandleIntent", "intent", "Landroid/content/Intent;", "setForeground", "Companion", "sharescreen_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class ScreenCaptureService extends IntentService {
    private static final String KEY_ENCODE_HEIGHT = "encodeHeight";
    private static final String KEY_ENCODE_WIDTH = "encodeWidth";
    private static final String KEY_RESULT_DATA = "resultData";
    private static Function1<? super byte[], Unit> sCallback;
    private static int sEncodeHeight;
    private static int sEncodeWidth;
    private static ScreenEncoder screenEncoder;

    public static final Companion INSTANCE = new Companion(null);
    private static int sSmallIcon = -1;
    private static int sLargeIcon = -1;

    public ScreenCaptureService() {
        super("ScreenCapture");
    }

    @Override
    public void onCreate() {
        super.onCreate();
        setForeground();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        stopForeground(1);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        ScreenEncoder screenEncoder2;
        Intent intent2 = intent != null ? (Intent) intent.getParcelableExtra(KEY_RESULT_DATA) : null;
        if (intent2 == null) {
            return;
        }
        int intExtra = intent.getIntExtra(KEY_ENCODE_WIDTH, 0);
        int intExtra2 = intent.getIntExtra(KEY_ENCODE_HEIGHT, 0);
        ScreenEncoder screenEncoder3 = screenEncoder;
        if (screenEncoder3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("screenEncoder");
            screenEncoder2 = null;
        } else {
            screenEncoder2 = screenEncoder3;
        }
        screenEncoder2.start(this, intExtra, intExtra2, intent2, new Function1<byte[], Unit>() {
            @Override
            public Unit invoke(byte[] bArr) {
                invoke2(bArr);
                return Unit.INSTANCE;
            }

            public final void invoke2(byte[] it) {
                Function1 function1;
                Intrinsics.checkNotNullParameter(it, "it");
                function1 = ScreenCaptureService.sCallback;
                if (function1 != null) {
                    function1.invoke(it);
                }
            }
        });
    }

    private final void setForeground() {
        startForeground(1, NotificationKt.createNotification$default(this, "录屏服务", "录屏服务正在运行", sSmallIcon, sLargeIcon, (String) null, (String) null, 48, (Object) null));
    }

    @Metadata(d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002JM\u0010\u0012\u001a\u00020\n2\u0006\u0010\u0013\u001a\u00020\f2\u0006\u0010\u0014\u001a\u00020\f2\u0006\u0010\u0015\u001a\u00020\u00162\u0012\u0010\u0017\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\n0\b2\u0006\u0010\u0018\u001a\u00020\f2\u0006\u0010\u0019\u001a\u00020\fH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010\u001aJ\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\t0\u001cJQ\u0010\u001d\u001a\u00020\n2\u0006\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0013\u001a\u00020\f2\u0006\u0010\u0014\u001a\u00020\f2\b\b\u0001\u0010\u0019\u001a\u00020\f2\b\b\u0001\u0010\u0018\u001a\u00020\f2\u0012\u0010\u0017\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\n0\bH\u0086@ø\u0001\u0000¢\u0006\u0002\u0010\u001eJ\u000e\u0010\u001f\u001a\u00020\n2\u0006\u0010 \u001a\u00020!R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u001c\u0010\u0007\u001a\u0010\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\n\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082.¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\""}, d2 = {"Lcom/psk/sharescreen/util/ScreenCaptureService$Companion;", "", "()V", "KEY_ENCODE_HEIGHT", "", "KEY_ENCODE_WIDTH", "KEY_RESULT_DATA", "sCallback", "Lkotlin/Function1;", "", "", "sEncodeHeight", "", "sEncodeWidth", "sLargeIcon", "sSmallIcon", "screenEncoder", "Lcom/psk/sharescreen/util/ScreenEncoder;", "doStart", ScreenCaptureService.KEY_ENCODE_WIDTH, ScreenCaptureService.KEY_ENCODE_HEIGHT, "activity", "Landroidx/activity/ComponentActivity;", "callback", "largeIcon", "smallIcon", "(IILandroidx/activity/ComponentActivity;Lkotlin/jvm/functions/Function1;IILkotlin/coroutines/Continuation;)Ljava/lang/Object;", "getLastSerialDataBuf", "", "start", "(Landroidx/activity/ComponentActivity;IIIILkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "stop", "context", "Landroid/content/Context;", "sharescreen_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final Object start(ComponentActivity componentActivity, int i, int i2, int i3, int i4, Function1<? super byte[], Unit> function1, Continuation<? super Unit> continuation) {
            System.out.println((Object) ("start encodeWidth:" + i + ", encodeHeight:" + i2 + ", sEncodeWidth:" + ScreenCaptureService.sEncodeWidth + ", sEncodeHeight:" + ScreenCaptureService.sEncodeHeight));
            if (i > 0 && i2 > 0) {
                if (ScreenCaptureService.sEncodeWidth != 0) {
                    int min = Math.min(ScreenCaptureService.sEncodeWidth, i);
                    int min2 = Math.min(ScreenCaptureService.sEncodeHeight, i2);
                    if (min < ScreenCaptureService.sEncodeWidth || min2 < ScreenCaptureService.sEncodeHeight) {
                        stop((Context) componentActivity);
                        Object doStart = doStart(min, min2, componentActivity, function1, i4, i3, continuation);
                        return doStart == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? doStart : Unit.INSTANCE;
                    }
                    return Unit.INSTANCE;
                }
                Object doStart2 = doStart(i, i2, componentActivity, function1, i4, i3, continuation);
                return doStart2 == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? doStart2 : Unit.INSTANCE;
            }
            return Unit.INSTANCE;
        }

        public final List<byte[]> getLastSerialDataBuf() {
            ArrayList arrayList = new ArrayList();
            ScreenEncoder screenEncoder = ScreenCaptureService.screenEncoder;
            if (screenEncoder == null) {
                Intrinsics.throwUninitializedPropertyAccessException("screenEncoder");
                screenEncoder = null;
            }
            Iterator<byte[]> it = screenEncoder.getLastSerialDataBuf().iterator();
            while (it.hasNext()) {
                byte[] data = it.next();
                Intrinsics.checkNotNullExpressionValue(data, "data");
                arrayList.add(data);
            }
            return arrayList;
        }

        public final java.lang.Object doStart(int r5, int r6, androidx.activity.ComponentActivity r7, kotlin.jvm.functions.Function1<? super byte[], kotlin.Unit> r8, int r9, int r10, kotlin.coroutines.Continuation<? super kotlin.Unit> r11) {
            throw new UnsupportedOperationException("Method not decompiled: com.psk.sharescreen.util.ScreenCaptureService.Companion.doStart(int, int, androidx.activity.ComponentActivity, kotlin.jvm.functions.Function1, int, int, kotlin.coroutines.Continuation):java.lang.Object");
        }

        public final void stop(Context context) {
            Intrinsics.checkNotNullParameter(context, "context");
            ScreenEncoder screenEncoder = null;
            ScreenCaptureService.sCallback = null;
            ScreenCaptureService.sLargeIcon = -1;
            ScreenCaptureService.sSmallIcon = -1;
            ScreenCaptureService.sEncodeWidth = 0;
            ScreenCaptureService.sEncodeHeight = 0;
            context.stopService(new Intent(context, (Class<?>) ScreenCaptureService.class));
            ScreenEncoder screenEncoder2 = ScreenCaptureService.screenEncoder;
            if (screenEncoder2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("screenEncoder");
            } else {
                screenEncoder = screenEncoder2;
            }
            screenEncoder.release();
        }
    }
}