Loading core/java/android/view/ViewRootImpl.java +17 −12 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public final class ViewRootImpl implements ViewParent, private boolean mForceNextConfigUpdate; private boolean mUseBLASTAdapter; private boolean mForceDisableBLAST; private boolean mEnableTripleBuffering; /** * Signals that compatibility booleans have been initialized according to Loading Loading @@ -784,7 +786,6 @@ public final class ViewRootImpl implements ViewParent, loadSystemProperties(); mImeFocusController = new ImeFocusController(this); mUseBLASTAdapter = WindowManagerGlobal.useBLAST(); } public static void addFirstDrawHandler(Runnable callback) { Loading Loading @@ -925,10 +926,9 @@ public final class ViewRootImpl implements ViewParent, if (mWindowAttributes.packageName == null) { mWindowAttributes.packageName = mBasePackageName; } if (mUseBLASTAdapter) { mWindowAttributes.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_USE_BLAST; } attrs = mWindowAttributes; setTag(); Loading Loading @@ -1102,6 +1102,13 @@ public final class ViewRootImpl implements ViewParent, "Unable to add window -- unknown error code " + res); } if ((res & WindowManagerGlobal.ADD_FLAG_USE_BLAST) != 0) { mUseBLASTAdapter = true; } if ((res & WindowManagerGlobal.ADD_FLAG_USE_TRIPLE_BUFFERING) != 0) { mEnableTripleBuffering = true; } if (view instanceof RootViewSurfaceTaker) { mInputQueueCallback = ((RootViewSurfaceTaker)view).willYouTakeTheInputQueue(); Loading Loading @@ -1414,10 +1421,8 @@ public final class ViewRootImpl implements ViewParent, } mWindowAttributes.privateFlags |= compatibleWindowFlag; if (mUseBLASTAdapter) { mWindowAttributes.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_USE_BLAST; } if (mWindowAttributes.preservePreviousSurfaceInsets) { // Restore old surface insets. Loading Loading @@ -1784,7 +1789,7 @@ public final class ViewRootImpl implements ViewParent, Surface ret = null; if (mBlastBufferQueue == null) { mBlastBufferQueue = new BLASTBufferQueue( mBlastSurfaceControl, width, height); mBlastSurfaceControl, width, height, mEnableTripleBuffering); // We only return the Surface the first time, as otherwise // it hasn't changed and there is no need to update. ret = mBlastBufferQueue.getSurface(); Loading Loading @@ -7393,7 +7398,7 @@ public final class ViewRootImpl implements ViewParent, mPendingDisplayCutout, mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mTempControls, mSurfaceSize, mBlastSurfaceControl); if (mSurfaceControl.isValid()) { if (!mUseBLASTAdapter) { if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); } else { final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, Loading Loading @@ -9760,7 +9765,7 @@ public final class ViewRootImpl implements ViewParent, * @hide */ public SurfaceControl getRenderSurfaceControl() { if (mUseBLASTAdapter) { if (useBLAST()) { return mBlastSurfaceControl; } else { return mSurfaceControl; Loading @@ -9777,11 +9782,11 @@ public final class ViewRootImpl implements ViewParent, * flag. Needs to be called before addView. */ void forceDisableBLAST() { mUseBLASTAdapter = false; mForceDisableBLAST = true; } boolean useBLAST() { return mUseBLASTAdapter; return mUseBLASTAdapter && !mForceDisableBLAST; } /** Loading core/java/android/view/WindowManagerGlobal.java +3 −1 Original line number Diff line number Diff line Loading @@ -124,8 +124,10 @@ public final class WindowManagerGlobal { */ public static final int RELAYOUT_DEFER_SURFACE_DESTROY = 0x2; public static final int ADD_FLAG_IN_TOUCH_MODE = 0x1; public static final int ADD_FLAG_APP_VISIBLE = 0x2; public static final int ADD_FLAG_IN_TOUCH_MODE = RELAYOUT_RES_IN_TOUCH_MODE; public static final int ADD_FLAG_USE_TRIPLE_BUFFERING = 0x4; public static final int ADD_FLAG_USE_BLAST = 0x8; /** * Like {@link #RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS}, but as a "hint" when adding the Loading core/jni/android_graphics_BLASTBufferQueue.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,10 @@ namespace android { static jlong nativeCreate(JNIEnv* env, jclass clazz, jlong surfaceControl, jlong width, jlong height) { static jlong nativeCreate(JNIEnv* env, jclass clazz, jlong surfaceControl, jlong width, jlong height, jboolean enableTripleBuffering) { sp<BLASTBufferQueue> queue = new BLASTBufferQueue( reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, enableTripleBuffering); queue->incStrong((void*)nativeCreate); return reinterpret_cast<jlong>(queue.get()); } Loading Loading @@ -59,7 +60,7 @@ static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceContr static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ { "nativeCreate", "(JJJ)J", { "nativeCreate", "(JJJZ)J", (void*)nativeCreate }, { "nativeGetSurface", "(J)Landroid/view/Surface;", (void*)nativeGetSurface }, Loading graphics/java/android/graphics/BLASTBufferQueue.java +5 −4 Original line number Diff line number Diff line Loading @@ -26,15 +26,17 @@ public final class BLASTBufferQueue { // Note: This field is accessed by native code. private long mNativeObject; // BLASTBufferQueue* private static native long nativeCreate(long surfaceControl, long width, long height); private static native long nativeCreate(long surfaceControl, long width, long height, boolean tripleBufferingEnabled); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr); private static native void nativeSetNextTransaction(long ptr, long transactionPtr); private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height); /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(SurfaceControl sc, int width, int height) { mNativeObject = nativeCreate(sc.mNativeObject, width, height); public BLASTBufferQueue(SurfaceControl sc, int width, int height, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(sc.mNativeObject, width, height, tripleBufferingEnabled); } public void destroy() { Loading Loading @@ -64,4 +66,3 @@ public final class BLASTBufferQueue { } } } services/core/java/com/android/server/wm/WindowManagerService.java +14 −0 Original line number Diff line number Diff line Loading @@ -399,12 +399,18 @@ public class WindowManagerService extends IWindowManager.Stub private static final String HIERARCHICAL_ANIMATIONS_PROPERTY = "persist.wm.hierarchical_animations"; private static final String DISABLE_TRIPLE_BUFFERING_PROPERTY = "ro.sf.disable_triple_buffer"; /** * @see #HIERARCHICAL_ANIMATIONS_PROPERTY */ static boolean sHierarchicalAnimations = SystemProperties.getBoolean(HIERARCHICAL_ANIMATIONS_PROPERTY, true); static boolean sEnableTripleBuffering = !SystemProperties.getBoolean( DISABLE_TRIPLE_BUFFERING_PROPERTY, false); // Enums for animation scale update types. @Retention(RetentionPolicy.SOURCE) @IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE}) Loading Loading @@ -1604,6 +1610,14 @@ public class WindowManagerService extends IWindowManager.Stub // From now on, no exceptions or errors allowed! res = WindowManagerGlobal.ADD_OKAY; if (mUseBLAST) { res |= WindowManagerGlobal.ADD_FLAG_USE_BLAST; } if (sEnableTripleBuffering) { res |= WindowManagerGlobal.ADD_FLAG_USE_TRIPLE_BUFFERING; } if (displayContent.mCurrentFocus == null) { displayContent.mWinAddedSinceNullFocus.add(win); } Loading Loading
core/java/android/view/ViewRootImpl.java +17 −12 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public final class ViewRootImpl implements ViewParent, private boolean mForceNextConfigUpdate; private boolean mUseBLASTAdapter; private boolean mForceDisableBLAST; private boolean mEnableTripleBuffering; /** * Signals that compatibility booleans have been initialized according to Loading Loading @@ -784,7 +786,6 @@ public final class ViewRootImpl implements ViewParent, loadSystemProperties(); mImeFocusController = new ImeFocusController(this); mUseBLASTAdapter = WindowManagerGlobal.useBLAST(); } public static void addFirstDrawHandler(Runnable callback) { Loading Loading @@ -925,10 +926,9 @@ public final class ViewRootImpl implements ViewParent, if (mWindowAttributes.packageName == null) { mWindowAttributes.packageName = mBasePackageName; } if (mUseBLASTAdapter) { mWindowAttributes.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_USE_BLAST; } attrs = mWindowAttributes; setTag(); Loading Loading @@ -1102,6 +1102,13 @@ public final class ViewRootImpl implements ViewParent, "Unable to add window -- unknown error code " + res); } if ((res & WindowManagerGlobal.ADD_FLAG_USE_BLAST) != 0) { mUseBLASTAdapter = true; } if ((res & WindowManagerGlobal.ADD_FLAG_USE_TRIPLE_BUFFERING) != 0) { mEnableTripleBuffering = true; } if (view instanceof RootViewSurfaceTaker) { mInputQueueCallback = ((RootViewSurfaceTaker)view).willYouTakeTheInputQueue(); Loading Loading @@ -1414,10 +1421,8 @@ public final class ViewRootImpl implements ViewParent, } mWindowAttributes.privateFlags |= compatibleWindowFlag; if (mUseBLASTAdapter) { mWindowAttributes.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_USE_BLAST; } if (mWindowAttributes.preservePreviousSurfaceInsets) { // Restore old surface insets. Loading Loading @@ -1784,7 +1789,7 @@ public final class ViewRootImpl implements ViewParent, Surface ret = null; if (mBlastBufferQueue == null) { mBlastBufferQueue = new BLASTBufferQueue( mBlastSurfaceControl, width, height); mBlastSurfaceControl, width, height, mEnableTripleBuffering); // We only return the Surface the first time, as otherwise // it hasn't changed and there is no need to update. ret = mBlastBufferQueue.getSurface(); Loading Loading @@ -7393,7 +7398,7 @@ public final class ViewRootImpl implements ViewParent, mPendingDisplayCutout, mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mTempControls, mSurfaceSize, mBlastSurfaceControl); if (mSurfaceControl.isValid()) { if (!mUseBLASTAdapter) { if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); } else { final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, Loading Loading @@ -9760,7 +9765,7 @@ public final class ViewRootImpl implements ViewParent, * @hide */ public SurfaceControl getRenderSurfaceControl() { if (mUseBLASTAdapter) { if (useBLAST()) { return mBlastSurfaceControl; } else { return mSurfaceControl; Loading @@ -9777,11 +9782,11 @@ public final class ViewRootImpl implements ViewParent, * flag. Needs to be called before addView. */ void forceDisableBLAST() { mUseBLASTAdapter = false; mForceDisableBLAST = true; } boolean useBLAST() { return mUseBLASTAdapter; return mUseBLASTAdapter && !mForceDisableBLAST; } /** Loading
core/java/android/view/WindowManagerGlobal.java +3 −1 Original line number Diff line number Diff line Loading @@ -124,8 +124,10 @@ public final class WindowManagerGlobal { */ public static final int RELAYOUT_DEFER_SURFACE_DESTROY = 0x2; public static final int ADD_FLAG_IN_TOUCH_MODE = 0x1; public static final int ADD_FLAG_APP_VISIBLE = 0x2; public static final int ADD_FLAG_IN_TOUCH_MODE = RELAYOUT_RES_IN_TOUCH_MODE; public static final int ADD_FLAG_USE_TRIPLE_BUFFERING = 0x4; public static final int ADD_FLAG_USE_BLAST = 0x8; /** * Like {@link #RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS}, but as a "hint" when adding the Loading
core/jni/android_graphics_BLASTBufferQueue.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -29,9 +29,10 @@ namespace android { static jlong nativeCreate(JNIEnv* env, jclass clazz, jlong surfaceControl, jlong width, jlong height) { static jlong nativeCreate(JNIEnv* env, jclass clazz, jlong surfaceControl, jlong width, jlong height, jboolean enableTripleBuffering) { sp<BLASTBufferQueue> queue = new BLASTBufferQueue( reinterpret_cast<SurfaceControl*>(surfaceControl), width, height); reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, enableTripleBuffering); queue->incStrong((void*)nativeCreate); return reinterpret_cast<jlong>(queue.get()); } Loading Loading @@ -59,7 +60,7 @@ static void nativeUpdate(JNIEnv*env, jclass clazz, jlong ptr, jlong surfaceContr static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ { "nativeCreate", "(JJJ)J", { "nativeCreate", "(JJJZ)J", (void*)nativeCreate }, { "nativeGetSurface", "(J)Landroid/view/Surface;", (void*)nativeGetSurface }, Loading
graphics/java/android/graphics/BLASTBufferQueue.java +5 −4 Original line number Diff line number Diff line Loading @@ -26,15 +26,17 @@ public final class BLASTBufferQueue { // Note: This field is accessed by native code. private long mNativeObject; // BLASTBufferQueue* private static native long nativeCreate(long surfaceControl, long width, long height); private static native long nativeCreate(long surfaceControl, long width, long height, boolean tripleBufferingEnabled); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr); private static native void nativeSetNextTransaction(long ptr, long transactionPtr); private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height); /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(SurfaceControl sc, int width, int height) { mNativeObject = nativeCreate(sc.mNativeObject, width, height); public BLASTBufferQueue(SurfaceControl sc, int width, int height, boolean tripleBufferingEnabled) { mNativeObject = nativeCreate(sc.mNativeObject, width, height, tripleBufferingEnabled); } public void destroy() { Loading Loading @@ -64,4 +66,3 @@ public final class BLASTBufferQueue { } } }
services/core/java/com/android/server/wm/WindowManagerService.java +14 −0 Original line number Diff line number Diff line Loading @@ -399,12 +399,18 @@ public class WindowManagerService extends IWindowManager.Stub private static final String HIERARCHICAL_ANIMATIONS_PROPERTY = "persist.wm.hierarchical_animations"; private static final String DISABLE_TRIPLE_BUFFERING_PROPERTY = "ro.sf.disable_triple_buffer"; /** * @see #HIERARCHICAL_ANIMATIONS_PROPERTY */ static boolean sHierarchicalAnimations = SystemProperties.getBoolean(HIERARCHICAL_ANIMATIONS_PROPERTY, true); static boolean sEnableTripleBuffering = !SystemProperties.getBoolean( DISABLE_TRIPLE_BUFFERING_PROPERTY, false); // Enums for animation scale update types. @Retention(RetentionPolicy.SOURCE) @IntDef({WINDOW_ANIMATION_SCALE, TRANSITION_ANIMATION_SCALE, ANIMATION_DURATION_SCALE}) Loading Loading @@ -1604,6 +1610,14 @@ public class WindowManagerService extends IWindowManager.Stub // From now on, no exceptions or errors allowed! res = WindowManagerGlobal.ADD_OKAY; if (mUseBLAST) { res |= WindowManagerGlobal.ADD_FLAG_USE_BLAST; } if (sEnableTripleBuffering) { res |= WindowManagerGlobal.ADD_FLAG_USE_TRIPLE_BUFFERING; } if (displayContent.mCurrentFocus == null) { displayContent.mWinAddedSinceNullFocus.add(win); } Loading