Loading core/java/android/app/ActivityThread.java +3 −0 Original line number Diff line number Diff line Loading @@ -5652,6 +5652,7 @@ public final class ActivityThread extends ClientTransactionHandler { // Allow application-generated systrace messages if we're debuggable. boolean isAppDebuggable = (data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; Trace.setAppTracingAllowed(isAppDebuggable); ThreadedRenderer.setDebuggingEnabled(isAppDebuggable || Build.IS_DEBUGGABLE); if (isAppDebuggable && data.enableBinderTracking) { Binder.enableTracing(); } Loading Loading @@ -5710,6 +5711,8 @@ public final class ActivityThread extends ClientTransactionHandler { } finally { StrictMode.setThreadPolicyMask(oldMask); } } else { ThreadedRenderer.setIsolatedProcess(true); } // If we use profiles, setup the dex reporter to notify package manager Loading core/java/android/view/ThreadedRenderer.java +15 −6 Original line number Diff line number Diff line Loading @@ -20,13 +20,11 @@ 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; Loading Loading @@ -936,6 +934,20 @@ public final class ThreadedRenderer { nSetHighContrastText(highContrastText); } /** * If set RenderThread will avoid doing any IPC using instead a fake vsync & DisplayInfo source */ public static void setIsolatedProcess(boolean isIsolated) { nSetIsolatedProcess(isIsolated); } /** * If set extra graphics debugging abilities will be enabled such as dumping skp */ public static void setDebuggingEnabled(boolean enable) { nSetDebuggingEnabled(enable); } @Override protected void finalize() throws Throwable { try { Loading Loading @@ -1071,10 +1083,6 @@ public final class ThreadedRenderer { initSched(renderProxy); if (mAppContext != null) { final boolean appDebuggable = (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; nSetDebuggingEnabled(appDebuggable || Build.IS_DEBUGGABLE); initGraphicsStats(); } } Loading Loading @@ -1204,4 +1212,5 @@ public final class ThreadedRenderer { // For temporary experimentation b/66945974 private static native void nHackySetRTAnimationsEnabled(boolean enabled); private static native void nSetDebuggingEnabled(boolean enabled); private static native void nSetIsolatedProcess(boolean enabled); } core/jni/android_view_ThreadedRenderer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -988,6 +988,11 @@ static void android_view_ThreadedRenderer_setDebuggingEnabled(JNIEnv*, jclass, j Properties::debuggingEnabled = enable; } static void android_view_ThreadedRenderer_setIsolatedProcess(JNIEnv*, jclass, jboolean isolated) { Properties::isolatedProcess = isolated; } // ---------------------------------------------------------------------------- // FrameMetricsObserver // ---------------------------------------------------------------------------- Loading Loading @@ -1097,6 +1102,7 @@ static const JNINativeMethod gMethods[] = { { "nHackySetRTAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, { "nSetDebuggingEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setDebuggingEnabled }, { "nSetIsolatedProcess", "(Z)V", (void*)android_view_ThreadedRenderer_setIsolatedProcess }, }; static JavaVM* mJvm = nullptr; Loading libs/hwui/DeviceInfo.cpp +25 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include <DeviceInfo.h> #include "Properties.h" #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> Loading @@ -29,6 +31,19 @@ namespace android { namespace uirenderer { static constexpr android::DisplayInfo sDummyDisplay { 1080, // w 1920, // h 320.0, // xdpi 320.0, // ydpi 60.0, // fps 2.0, // density 0, // orientation false, // secure? 0, // appVsyncOffset 0, // presentationDeadline }; static DeviceInfo* sDeviceInfo = nullptr; static std::once_flag sInitializedFlag; Loading @@ -47,20 +62,26 @@ void DeviceInfo::initialize() { void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo->loadDisplayInfo(); sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; }); } void DeviceInfo::load() { loadDisplayInfo(); mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } void DeviceInfo::loadDisplayInfo() { DisplayInfo DeviceInfo::queryDisplayInfo() { if (Properties::isolatedProcess) { return sDummyDisplay; } DisplayInfo displayInfo; sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &mDisplayInfo); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &displayInfo); LOG_ALWAYS_FATAL_IF(status, "Failed to get display info, error %d", status); return displayInfo; } } /* namespace uirenderer */ Loading libs/hwui/DeviceInfo.h +2 −1 Original line number Diff line number Diff line Loading @@ -47,12 +47,13 @@ public: return di.w * di.h * in; } static DisplayInfo queryDisplayInfo(); private: DeviceInfo() {} ~DeviceInfo() {} void load(); void loadDisplayInfo(); int mMaxTextureSize; DisplayInfo mDisplayInfo; Loading Loading
core/java/android/app/ActivityThread.java +3 −0 Original line number Diff line number Diff line Loading @@ -5652,6 +5652,7 @@ public final class ActivityThread extends ClientTransactionHandler { // Allow application-generated systrace messages if we're debuggable. boolean isAppDebuggable = (data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; Trace.setAppTracingAllowed(isAppDebuggable); ThreadedRenderer.setDebuggingEnabled(isAppDebuggable || Build.IS_DEBUGGABLE); if (isAppDebuggable && data.enableBinderTracking) { Binder.enableTracing(); } Loading Loading @@ -5710,6 +5711,8 @@ public final class ActivityThread extends ClientTransactionHandler { } finally { StrictMode.setThreadPolicyMask(oldMask); } } else { ThreadedRenderer.setIsolatedProcess(true); } // If we use profiles, setup the dex reporter to notify package manager Loading
core/java/android/view/ThreadedRenderer.java +15 −6 Original line number Diff line number Diff line Loading @@ -20,13 +20,11 @@ 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; Loading Loading @@ -936,6 +934,20 @@ public final class ThreadedRenderer { nSetHighContrastText(highContrastText); } /** * If set RenderThread will avoid doing any IPC using instead a fake vsync & DisplayInfo source */ public static void setIsolatedProcess(boolean isIsolated) { nSetIsolatedProcess(isIsolated); } /** * If set extra graphics debugging abilities will be enabled such as dumping skp */ public static void setDebuggingEnabled(boolean enable) { nSetDebuggingEnabled(enable); } @Override protected void finalize() throws Throwable { try { Loading Loading @@ -1071,10 +1083,6 @@ public final class ThreadedRenderer { initSched(renderProxy); if (mAppContext != null) { final boolean appDebuggable = (mAppContext.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; nSetDebuggingEnabled(appDebuggable || Build.IS_DEBUGGABLE); initGraphicsStats(); } } Loading Loading @@ -1204,4 +1212,5 @@ public final class ThreadedRenderer { // For temporary experimentation b/66945974 private static native void nHackySetRTAnimationsEnabled(boolean enabled); private static native void nSetDebuggingEnabled(boolean enabled); private static native void nSetIsolatedProcess(boolean enabled); }
core/jni/android_view_ThreadedRenderer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -988,6 +988,11 @@ static void android_view_ThreadedRenderer_setDebuggingEnabled(JNIEnv*, jclass, j Properties::debuggingEnabled = enable; } static void android_view_ThreadedRenderer_setIsolatedProcess(JNIEnv*, jclass, jboolean isolated) { Properties::isolatedProcess = isolated; } // ---------------------------------------------------------------------------- // FrameMetricsObserver // ---------------------------------------------------------------------------- Loading Loading @@ -1097,6 +1102,7 @@ static const JNINativeMethod gMethods[] = { { "nHackySetRTAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, { "nSetDebuggingEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_setDebuggingEnabled }, { "nSetIsolatedProcess", "(Z)V", (void*)android_view_ThreadedRenderer_setIsolatedProcess }, }; static JavaVM* mJvm = nullptr; Loading
libs/hwui/DeviceInfo.cpp +25 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #include <DeviceInfo.h> #include "Properties.h" #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> Loading @@ -29,6 +31,19 @@ namespace android { namespace uirenderer { static constexpr android::DisplayInfo sDummyDisplay { 1080, // w 1920, // h 320.0, // xdpi 320.0, // ydpi 60.0, // fps 2.0, // density 0, // orientation false, // secure? 0, // appVsyncOffset 0, // presentationDeadline }; static DeviceInfo* sDeviceInfo = nullptr; static std::once_flag sInitializedFlag; Loading @@ -47,20 +62,26 @@ void DeviceInfo::initialize() { void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); sDeviceInfo->loadDisplayInfo(); sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; }); } void DeviceInfo::load() { loadDisplayInfo(); mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } void DeviceInfo::loadDisplayInfo() { DisplayInfo DeviceInfo::queryDisplayInfo() { if (Properties::isolatedProcess) { return sDummyDisplay; } DisplayInfo displayInfo; sp<IBinder> dtoken(SurfaceComposerClient::getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &mDisplayInfo); status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &displayInfo); LOG_ALWAYS_FATAL_IF(status, "Failed to get display info, error %d", status); return displayInfo; } } /* namespace uirenderer */ Loading
libs/hwui/DeviceInfo.h +2 −1 Original line number Diff line number Diff line Loading @@ -47,12 +47,13 @@ public: return di.w * di.h * in; } static DisplayInfo queryDisplayInfo(); private: DeviceInfo() {} ~DeviceInfo() {} void load(); void loadDisplayInfo(); int mMaxTextureSize; DisplayInfo mDisplayInfo; Loading