Loading Android.mk +19 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,7 @@ LOCAL_SRC_FILES += \ core/java/android/view/IAppTransitionAnimationSpecsFuture.aidl \ core/java/android/view/IDockedStackListener.aidl \ core/java/android/view/IGraphicsStats.aidl \ core/java/android/view/IGraphicsStatsCallback.aidl \ core/java/android/view/IInputFilter.aidl \ core/java/android/view/IInputFilterHost.aidl \ core/java/android/view/IOnKeyguardExitResult.aidl \ Loading Loading @@ -1423,6 +1424,24 @@ endif include $(BUILD_JAVA_LIBRARY) # ==== c++ proto device library ============================== include $(CLEAR_VARS) LOCAL_MODULE := libplatformprotos # b/34740546, work around clang-tidy segmentation fault. LOCAL_TIDY_CHECKS := -modernize* LOCAL_PROTOC_OPTIMIZE_TYPE := lite LOCAL_PROTOC_FLAGS := \ --include_source_info \ -Iexternal/protobuf/src LOCAL_SRC_FILES := \ $(call all-proto-files-under, core/proto) \ $(call all-proto-files-under, libs/incident/proto) LOCAL_C_INCLUDES := \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libplatformprotos,)/proto LOCAL_EXPORT_C_INCLUDES := \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libplatformprotos,)/proto include $(BUILD_STATIC_LIBRARY) # ==== c++ proto host library ============================== include $(CLEAR_VARS) LOCAL_MODULE := libplatformprotos Loading core/java/android/view/IGraphicsStats.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ package android.view; import android.os.ParcelFileDescriptor; import android.view.IGraphicsStatsCallback; /** * @hide */ interface IGraphicsStats { ParcelFileDescriptor requestBufferForProcess(String packageName, IBinder token); ParcelFileDescriptor requestBufferForProcess(String packageName, IGraphicsStatsCallback callback); } core/java/android/view/IGraphicsStatsCallback.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2017, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; /** * @hide */ oneway interface IGraphicsStatsCallback { void onRotateGraphicsStatsBuffer(); } core/java/android/view/ThreadedRenderer.java +38 −30 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.AnimatedVectorDrawable; import android.os.Binder; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.util.Log; Loading Loading @@ -260,10 +260,10 @@ public final class ThreadedRenderer { * * @return A threaded renderer backed by OpenGL. */ public static ThreadedRenderer create(Context context, boolean translucent) { public static ThreadedRenderer create(Context context, boolean translucent, String name) { ThreadedRenderer renderer = null; if (isAvailable()) { renderer = new ThreadedRenderer(context, translucent); renderer = new ThreadedRenderer(context, translucent, name); } return renderer; } Loading @@ -287,10 +287,6 @@ public final class ThreadedRenderer { nOverrideProperty(name, value); } public static void dumpProfileData(byte[] data, FileDescriptor fd) { nDumpProfileData(data, fd); } // Keep in sync with DrawFrameTask.h SYNC_* flags // Nothing interesting to report private static final int SYNC_OK = 0; Loading Loading @@ -346,7 +342,7 @@ public final class ThreadedRenderer { private boolean mEnabled; private boolean mRequested = true; ThreadedRenderer(Context context, boolean translucent) { ThreadedRenderer(Context context, boolean translucent, String name) { final TypedArray a = context.obtainStyledAttributes(null, R.styleable.Lighting, 0, 0); mLightY = a.getDimension(R.styleable.Lighting_lightY, 0); mLightZ = a.getDimension(R.styleable.Lighting_lightZ, 0); Loading @@ -360,6 +356,7 @@ public final class ThreadedRenderer { mRootNode = RenderNode.adopt(rootNodePtr); mRootNode.setClipToBounds(false); mNativeProxy = nCreateProxy(translucent, rootNodePtr); nSetName(mNativeProxy, name); ProcessInitializer.sInstance.init(context, mNativeProxy); Loading Loading @@ -826,15 +823,6 @@ public final class ThreadedRenderer { nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater()); } /** * Optional, sets the name of the renderer. Useful for debugging purposes. * * @param name The name of this renderer, can be null */ void setName(String name) { nSetName(mNativeProxy, name); } /** * Blocks until all previously queued work has completed. */ Loading Loading @@ -896,20 +884,29 @@ public final class ThreadedRenderer { private static class ProcessInitializer { static ProcessInitializer sInstance = new ProcessInitializer(); private static IBinder sProcToken; private boolean mInitialized = false; private Context mAppContext; private IGraphicsStats mGraphicsStatsService; private IGraphicsStatsCallback mGraphicsStatsCallback = new IGraphicsStatsCallback.Stub() { @Override public void onRotateGraphicsStatsBuffer() throws RemoteException { rotateBuffer(); } }; private ProcessInitializer() {} synchronized void init(Context context, long renderProxy) { if (mInitialized) return; mInitialized = true; mAppContext = context.getApplicationContext(); initSched(context, renderProxy); initGraphicsStats(context, renderProxy); initGraphicsStats(); } private static void initSched(Context context, long renderProxy) { private void initSched(Context context, long renderProxy) { try { int tid = nGetRenderThreadTid(renderProxy); ActivityManager.getService().setRenderThread(tid); Loading @@ -918,17 +915,28 @@ public final class ThreadedRenderer { } } private static void initGraphicsStats(Context context, long renderProxy) { private void initGraphicsStats() { try { IBinder binder = ServiceManager.getService("graphicsstats"); if (binder == null) return; IGraphicsStats graphicsStatsService = IGraphicsStats.Stub .asInterface(binder); sProcToken = new Binder(); final String pkg = context.getApplicationInfo().packageName; ParcelFileDescriptor pfd = graphicsStatsService. requestBufferForProcess(pkg, sProcToken); nSetProcessStatsBuffer(renderProxy, pfd.getFd()); mGraphicsStatsService = IGraphicsStats.Stub.asInterface(binder); requestBuffer(); } catch (Throwable t) { Log.w(LOG_TAG, "Could not acquire gfx stats buffer", t); } } private void rotateBuffer() { nRotateProcessStatsBuffer(); requestBuffer(); } private void requestBuffer() { try { final String pkg = mAppContext.getApplicationInfo().packageName; ParcelFileDescriptor pfd = mGraphicsStatsService .requestBufferForProcess(pkg, mGraphicsStatsCallback); nSetProcessStatsBuffer(pfd.getFd()); pfd.close(); } catch (Throwable t) { Log.w(LOG_TAG, "Could not acquire gfx stats buffer", t); Loading @@ -948,7 +956,8 @@ public final class ThreadedRenderer { static native void setupShadersDiskCache(String cacheFile); private static native void nSetProcessStatsBuffer(long nativeProxy, int fd); private static native void nRotateProcessStatsBuffer(); private static native void nSetProcessStatsBuffer(int fd); private static native int nGetRenderThreadTid(long nativeProxy); private static native long nCreateRootRenderNode(); Loading Loading @@ -993,7 +1002,6 @@ public final class ThreadedRenderer { private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd, @DumpFlags int dumpFlags); private static native void nDumpProfileData(byte[] data, FileDescriptor fd); private static native void nAddRenderNode(long nativeProxy, long rootRenderNode, boolean placeFront); Loading core/java/android/view/ViewRootImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -887,9 +887,9 @@ public final class ViewRootImpl implements ViewParent, final boolean hasSurfaceInsets = insets.left != 0 || insets.right != 0 || insets.top != 0 || insets.bottom != 0; final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets; mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent); mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent, attrs.getTitle().toString()); if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.setName(attrs.getTitle().toString()); mAttachInfo.mHardwareAccelerated = mAttachInfo.mHardwareAccelerationRequested = true; } Loading Loading
Android.mk +19 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,7 @@ LOCAL_SRC_FILES += \ core/java/android/view/IAppTransitionAnimationSpecsFuture.aidl \ core/java/android/view/IDockedStackListener.aidl \ core/java/android/view/IGraphicsStats.aidl \ core/java/android/view/IGraphicsStatsCallback.aidl \ core/java/android/view/IInputFilter.aidl \ core/java/android/view/IInputFilterHost.aidl \ core/java/android/view/IOnKeyguardExitResult.aidl \ Loading Loading @@ -1423,6 +1424,24 @@ endif include $(BUILD_JAVA_LIBRARY) # ==== c++ proto device library ============================== include $(CLEAR_VARS) LOCAL_MODULE := libplatformprotos # b/34740546, work around clang-tidy segmentation fault. LOCAL_TIDY_CHECKS := -modernize* LOCAL_PROTOC_OPTIMIZE_TYPE := lite LOCAL_PROTOC_FLAGS := \ --include_source_info \ -Iexternal/protobuf/src LOCAL_SRC_FILES := \ $(call all-proto-files-under, core/proto) \ $(call all-proto-files-under, libs/incident/proto) LOCAL_C_INCLUDES := \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libplatformprotos,)/proto LOCAL_EXPORT_C_INCLUDES := \ $(call generated-sources-dir-for,STATIC_LIBRARIES,libplatformprotos,)/proto include $(BUILD_STATIC_LIBRARY) # ==== c++ proto host library ============================== include $(CLEAR_VARS) LOCAL_MODULE := libplatformprotos Loading
core/java/android/view/IGraphicsStats.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ package android.view; import android.os.ParcelFileDescriptor; import android.view.IGraphicsStatsCallback; /** * @hide */ interface IGraphicsStats { ParcelFileDescriptor requestBufferForProcess(String packageName, IBinder token); ParcelFileDescriptor requestBufferForProcess(String packageName, IGraphicsStatsCallback callback); }
core/java/android/view/IGraphicsStatsCallback.aidl 0 → 100644 +24 −0 Original line number Diff line number Diff line /** * Copyright (c) 2017, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; /** * @hide */ oneway interface IGraphicsStatsCallback { void onRotateGraphicsStatsBuffer(); }
core/java/android/view/ThreadedRenderer.java +38 −30 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ import android.graphics.Bitmap; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.AnimatedVectorDrawable; import android.os.Binder; import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.Trace; import android.util.Log; Loading Loading @@ -260,10 +260,10 @@ public final class ThreadedRenderer { * * @return A threaded renderer backed by OpenGL. */ public static ThreadedRenderer create(Context context, boolean translucent) { public static ThreadedRenderer create(Context context, boolean translucent, String name) { ThreadedRenderer renderer = null; if (isAvailable()) { renderer = new ThreadedRenderer(context, translucent); renderer = new ThreadedRenderer(context, translucent, name); } return renderer; } Loading @@ -287,10 +287,6 @@ public final class ThreadedRenderer { nOverrideProperty(name, value); } public static void dumpProfileData(byte[] data, FileDescriptor fd) { nDumpProfileData(data, fd); } // Keep in sync with DrawFrameTask.h SYNC_* flags // Nothing interesting to report private static final int SYNC_OK = 0; Loading Loading @@ -346,7 +342,7 @@ public final class ThreadedRenderer { private boolean mEnabled; private boolean mRequested = true; ThreadedRenderer(Context context, boolean translucent) { ThreadedRenderer(Context context, boolean translucent, String name) { final TypedArray a = context.obtainStyledAttributes(null, R.styleable.Lighting, 0, 0); mLightY = a.getDimension(R.styleable.Lighting_lightY, 0); mLightZ = a.getDimension(R.styleable.Lighting_lightZ, 0); Loading @@ -360,6 +356,7 @@ public final class ThreadedRenderer { mRootNode = RenderNode.adopt(rootNodePtr); mRootNode.setClipToBounds(false); mNativeProxy = nCreateProxy(translucent, rootNodePtr); nSetName(mNativeProxy, name); ProcessInitializer.sInstance.init(context, mNativeProxy); Loading Loading @@ -826,15 +823,6 @@ public final class ThreadedRenderer { nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater()); } /** * Optional, sets the name of the renderer. Useful for debugging purposes. * * @param name The name of this renderer, can be null */ void setName(String name) { nSetName(mNativeProxy, name); } /** * Blocks until all previously queued work has completed. */ Loading Loading @@ -896,20 +884,29 @@ public final class ThreadedRenderer { private static class ProcessInitializer { static ProcessInitializer sInstance = new ProcessInitializer(); private static IBinder sProcToken; private boolean mInitialized = false; private Context mAppContext; private IGraphicsStats mGraphicsStatsService; private IGraphicsStatsCallback mGraphicsStatsCallback = new IGraphicsStatsCallback.Stub() { @Override public void onRotateGraphicsStatsBuffer() throws RemoteException { rotateBuffer(); } }; private ProcessInitializer() {} synchronized void init(Context context, long renderProxy) { if (mInitialized) return; mInitialized = true; mAppContext = context.getApplicationContext(); initSched(context, renderProxy); initGraphicsStats(context, renderProxy); initGraphicsStats(); } private static void initSched(Context context, long renderProxy) { private void initSched(Context context, long renderProxy) { try { int tid = nGetRenderThreadTid(renderProxy); ActivityManager.getService().setRenderThread(tid); Loading @@ -918,17 +915,28 @@ public final class ThreadedRenderer { } } private static void initGraphicsStats(Context context, long renderProxy) { private void initGraphicsStats() { try { IBinder binder = ServiceManager.getService("graphicsstats"); if (binder == null) return; IGraphicsStats graphicsStatsService = IGraphicsStats.Stub .asInterface(binder); sProcToken = new Binder(); final String pkg = context.getApplicationInfo().packageName; ParcelFileDescriptor pfd = graphicsStatsService. requestBufferForProcess(pkg, sProcToken); nSetProcessStatsBuffer(renderProxy, pfd.getFd()); mGraphicsStatsService = IGraphicsStats.Stub.asInterface(binder); requestBuffer(); } catch (Throwable t) { Log.w(LOG_TAG, "Could not acquire gfx stats buffer", t); } } private void rotateBuffer() { nRotateProcessStatsBuffer(); requestBuffer(); } private void requestBuffer() { try { final String pkg = mAppContext.getApplicationInfo().packageName; ParcelFileDescriptor pfd = mGraphicsStatsService .requestBufferForProcess(pkg, mGraphicsStatsCallback); nSetProcessStatsBuffer(pfd.getFd()); pfd.close(); } catch (Throwable t) { Log.w(LOG_TAG, "Could not acquire gfx stats buffer", t); Loading @@ -948,7 +956,8 @@ public final class ThreadedRenderer { static native void setupShadersDiskCache(String cacheFile); private static native void nSetProcessStatsBuffer(long nativeProxy, int fd); private static native void nRotateProcessStatsBuffer(); private static native void nSetProcessStatsBuffer(int fd); private static native int nGetRenderThreadTid(long nativeProxy); private static native long nCreateRootRenderNode(); Loading Loading @@ -993,7 +1002,6 @@ public final class ThreadedRenderer { private static native void nDumpProfileInfo(long nativeProxy, FileDescriptor fd, @DumpFlags int dumpFlags); private static native void nDumpProfileData(byte[] data, FileDescriptor fd); private static native void nAddRenderNode(long nativeProxy, long rootRenderNode, boolean placeFront); Loading
core/java/android/view/ViewRootImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -887,9 +887,9 @@ public final class ViewRootImpl implements ViewParent, final boolean hasSurfaceInsets = insets.left != 0 || insets.right != 0 || insets.top != 0 || insets.bottom != 0; final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets; mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent); mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent, attrs.getTitle().toString()); if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.setName(attrs.getTitle().toString()); mAttachInfo.mHardwareAccelerated = mAttachInfo.mHardwareAccelerationRequested = true; } Loading