Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6afa009c authored by John Reck's avatar John Reck
Browse files

Allow debuggable apps to do skp capture

Change-Id: Ibb56887b28eb8260bf2ca0b38dbe78233e9cfaf4
Fixes: 74086676
Test: verified can still capture an skp
parent b1d5004c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -20,11 +20,13 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.os.Build;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -1066,6 +1068,9 @@ public final class ThreadedRenderer {
            mInitialized = true;
            mAppContext = context.getApplicationContext();

            nSetDebuggingEnabled(
                    (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
                    || Build.IS_DEBUGGABLE);
            initSched(renderProxy);
            initGraphicsStats();
        }
@@ -1194,4 +1199,5 @@ public final class ThreadedRenderer {
    private static native void nSetHighContrastText(boolean enabled);
    // For temporary experimentation b/66945974
    private static native void nHackySetRTAnimationsEnabled(boolean enabled);
    private static native void nSetDebuggingEnabled(boolean enabled);
}
+5 −0
Original line number Diff line number Diff line
@@ -984,6 +984,10 @@ static void android_view_ThreadedRenderer_hackySetRTAnimationsEnabled(JNIEnv*, j
    Properties::enableRTAnimations = enable;
}

static void android_view_ThreadedRenderer_setDebuggingEnabled(JNIEnv*, jclass, jboolean enable) {
    Properties::debuggingEnabled = enable;
}

// ----------------------------------------------------------------------------
// FrameMetricsObserver
// ----------------------------------------------------------------------------
@@ -1092,6 +1096,7 @@ static const JNINativeMethod gMethods[] = {
    { "nSetHighContrastText", "(Z)V", (void*)android_view_ThreadedRenderer_setHighContrastText },
    { "nHackySetRTAnimationsEnabled", "(Z)V",
            (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled },
    { "nSetDebuggingEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setDebuggingEnabled },
};

static JavaVM* mJvm = nullptr;
+2 −2
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ bool Properties::skpCaptureEnabled = false;
bool Properties::enableRTAnimations = true;

bool Properties::runningInEmulator = false;
bool Properties::debuggingEnabled = false;

static int property_get_int(const char* key, int defaultValue) {
    char buf[PROPERTY_VALUE_MAX] = {
@@ -134,8 +135,7 @@ bool Properties::load() {

    filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false);

    skpCaptureEnabled = property_get_bool("ro.debuggable", false) &&
                        property_get_bool(PROPERTY_CAPTURE_SKP_ENABLED, false);
    skpCaptureEnabled = debuggingEnabled && property_get_bool(PROPERTY_CAPTURE_SKP_ENABLED, false);

    runningInEmulator = property_get_bool(PROPERTY_QEMU_KERNEL, false);

+2 −0
Original line number Diff line number Diff line
@@ -268,6 +268,8 @@ public:

    static bool runningInEmulator;

    ANDROID_API static bool debuggingEnabled;

private:
    static ProfileType sProfileType;
    static bool sDisableProfileBars;