Fix wording regarding ThreadedRenderer
ThreadedRenderer is not synonymous with hardware rendering, so remove references to hardware rendering when referring to ThreadedRenderer. Change-Id: Ic66a482ccf05f556ebe6ec194ce4f858f75bbb8b
This commit is contained in:
@@ -25,7 +25,7 @@ import android.graphics.Paint;
|
||||
import android.util.Pools.SynchronizedPool;
|
||||
|
||||
/**
|
||||
* An implementation of a GL canvas that records drawing operations.
|
||||
* A Canvas implementation that records drawing operations for deferred rendering.
|
||||
* This is intended for use with a DisplayList. This class keeps a list of all the Paint and
|
||||
* Bitmap objects that it draws, preventing the backing memory of Bitmaps from being freed while
|
||||
* the DisplayList is still holding a native reference to the memory.
|
||||
|
||||
@@ -51,7 +51,7 @@ import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
*
|
||||
* <h3>Creating a display list</h3>
|
||||
* <pre class="prettyprint">
|
||||
* HardwareRenderer renderer = myView.getHardwareRenderer();
|
||||
* ThreadedRenderer renderer = myView.getThreadedRenderer();
|
||||
* if (renderer != null) {
|
||||
* DisplayList displayList = renderer.createDisplayList();
|
||||
* DisplayListCanvas canvas = displayList.start(width, height);
|
||||
|
||||
@@ -368,11 +368,11 @@ public class TextureView extends View {
|
||||
|
||||
HardwareLayer getHardwareLayer() {
|
||||
if (mLayer == null) {
|
||||
if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
|
||||
if (mAttachInfo == null || mAttachInfo.mThreadedRenderer == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mLayer = mAttachInfo.mHardwareRenderer.createTextureLayer();
|
||||
mLayer = mAttachInfo.mThreadedRenderer.createTextureLayer();
|
||||
if (!mUpdateSurface) {
|
||||
// Create a new SurfaceTexture for the layer.
|
||||
mSurface = new SurfaceTexture(false);
|
||||
|
||||
@@ -25,9 +25,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
@@ -44,10 +42,9 @@ import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Hardware renderer that proxies the rendering to a render thread. Most calls
|
||||
* Threaded renderer that proxies the rendering to a render thread. Most calls
|
||||
* are currently synchronous.
|
||||
*
|
||||
* The UI thread can block on the RenderThread, but RenderThread must never
|
||||
@@ -85,7 +82,7 @@ public final class ThreadedRenderer {
|
||||
static final String RENDER_DIRTY_REGIONS_PROPERTY = "debug.hwui.render_dirty_regions";
|
||||
|
||||
/**
|
||||
* System property used to enable or disable hardware rendering profiling.
|
||||
* System property used to enable or disable threaded rendering profiling.
|
||||
* The default value of this property is assumed to be false.
|
||||
*
|
||||
* When profiling is enabled, the adb shell dumpsys gfxinfo command will
|
||||
@@ -113,7 +110,7 @@ public final class ThreadedRenderer {
|
||||
|
||||
/**
|
||||
* System property used to specify the number of frames to be used
|
||||
* when doing hardware rendering profiling.
|
||||
* when doing threaded rendering profiling.
|
||||
* The default value of this property is #PROFILE_MAX_FRAMES.
|
||||
*
|
||||
* When profiling is enabled, the adb shell dumpsys gfxinfo command will
|
||||
@@ -191,7 +188,7 @@ public final class ThreadedRenderer {
|
||||
"debug.hwui.show_non_rect_clip";
|
||||
|
||||
/**
|
||||
* A process can set this flag to false to prevent the use of hardware
|
||||
* A process can set this flag to false to prevent the use of threaded
|
||||
* rendering.
|
||||
*
|
||||
* @hide
|
||||
@@ -199,14 +196,14 @@ public final class ThreadedRenderer {
|
||||
public static boolean sRendererDisabled = false;
|
||||
|
||||
/**
|
||||
* Further hardware renderer disabling for the system process.
|
||||
* Further threaded renderer disabling for the system process.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static boolean sSystemRendererDisabled = false;
|
||||
|
||||
/**
|
||||
* Invoke this method to disable hardware rendering in the current process.
|
||||
* Invoke this method to disable threaded rendering in the current process.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@@ -220,9 +217,9 @@ public final class ThreadedRenderer {
|
||||
public static boolean sTrimForeground = false;
|
||||
|
||||
/**
|
||||
* Controls whether or not the hardware renderer should aggressively
|
||||
* trim memory. Note that this must not be set for any process that
|
||||
* uses WebView! This should be only used by system_process or similar
|
||||
* Controls whether or not the renderer should aggressively trim
|
||||
* memory. Note that this must not be set for any process that uses
|
||||
* WebView! This should be only used by system_process or similar
|
||||
* that do not go into the background.
|
||||
*/
|
||||
public static void enableForegroundTrimming() {
|
||||
@@ -230,10 +227,10 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether hardware acceleration is available under any form for
|
||||
* Indicates whether threaded rendering is available under any form for
|
||||
* the view hierarchy.
|
||||
*
|
||||
* @return True if the view hierarchy can potentially be hardware accelerated,
|
||||
* @return True if the view hierarchy can potentially be defer rendered,
|
||||
* false otherwise
|
||||
*/
|
||||
public static boolean isAvailable() {
|
||||
@@ -241,7 +238,7 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the directory to use as a persistent storage for hardware rendering
|
||||
* Sets the directory to use as a persistent storage for threaded rendering
|
||||
* resources.
|
||||
*
|
||||
* @param cacheDir A directory the current process can write to
|
||||
@@ -253,11 +250,11 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a hardware renderer using OpenGL.
|
||||
* Creates a threaded renderer using OpenGL.
|
||||
*
|
||||
* @param translucent True if the surface is translucent, false otherwise
|
||||
*
|
||||
* @return A hardware renderer backed by OpenGL.
|
||||
* @return A threaded renderer backed by OpenGL.
|
||||
*/
|
||||
public static ThreadedRenderer create(Context context, boolean translucent) {
|
||||
ThreadedRenderer renderer = null;
|
||||
@@ -366,7 +363,7 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys the hardware rendering context.
|
||||
* Destroys the threaded rendering context.
|
||||
*/
|
||||
void destroy() {
|
||||
mInitialized = false;
|
||||
@@ -375,25 +372,25 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether hardware acceleration is currently enabled.
|
||||
* Indicates whether threaded rendering is currently enabled.
|
||||
*
|
||||
* @return True if hardware acceleration is in use, false otherwise.
|
||||
* @return True if threaded rendering is in use, false otherwise.
|
||||
*/
|
||||
boolean isEnabled() {
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether hardware acceleration is currently enabled.
|
||||
* Indicates whether threaded rendering is currently enabled.
|
||||
*
|
||||
* @param enabled True if the hardware renderer is in use, false otherwise.
|
||||
* @param enabled True if the threaded renderer is in use, false otherwise.
|
||||
*/
|
||||
void setEnabled(boolean enabled) {
|
||||
mEnabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether hardware acceleration is currently request but not
|
||||
* Indicates whether threaded rendering is currently request but not
|
||||
* necessarily enabled yet.
|
||||
*
|
||||
* @return True if requested, false otherwise.
|
||||
@@ -403,10 +400,10 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether hardware acceleration is currently requested but not
|
||||
* Indicates whether threaded rendering is currently requested but not
|
||||
* necessarily enabled yet.
|
||||
*
|
||||
* @return True to request hardware acceleration, false otherwise.
|
||||
* @return True to request threaded rendering, false otherwise.
|
||||
*/
|
||||
void setRequested(boolean requested) {
|
||||
mRequested = requested;
|
||||
@@ -421,9 +418,9 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the hardware renderer for the specified surface.
|
||||
* Initializes the threaded renderer for the specified surface.
|
||||
*
|
||||
* @param surface The surface to hardware accelerate
|
||||
* @param surface The surface to render
|
||||
*
|
||||
* @return True if the initialization was successful, false otherwise.
|
||||
*/
|
||||
@@ -436,16 +433,16 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the hardware renderer for the specified surface and setup the
|
||||
* Initializes the threaded renderer for the specified surface and setup the
|
||||
* renderer for drawing, if needed. This is invoked when the ViewAncestor has
|
||||
* potentially lost the hardware renderer. The hardware renderer should be
|
||||
* potentially lost the threaded renderer. The threaded renderer should be
|
||||
* reinitialized and setup when the render {@link #isRequested()} and
|
||||
* {@link #isEnabled()}.
|
||||
*
|
||||
* @param width The width of the drawing surface.
|
||||
* @param height The height of the drawing surface.
|
||||
* @param attachInfo Information about the window.
|
||||
* @param surface The surface to hardware accelerate
|
||||
* @param surface The surface to render
|
||||
* @param surfaceInsets The drawing surface insets to apply
|
||||
*
|
||||
* @return true if the surface was initialized, false otherwise. Returning
|
||||
@@ -466,9 +463,9 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the hardware renderer for the specified surface.
|
||||
* Updates the threaded renderer for the specified surface.
|
||||
*
|
||||
* @param surface The surface to hardware accelerate
|
||||
* @param surface The surface to render
|
||||
*/
|
||||
void updateSurface(Surface surface) throws OutOfResourcesException {
|
||||
updateEnabledState(surface);
|
||||
@@ -477,7 +474,7 @@ public final class ThreadedRenderer {
|
||||
|
||||
/**
|
||||
* Halts any current rendering into the surface. Use this if it is unclear whether
|
||||
* or not the surface used by the HardwareRenderer will be changing. It
|
||||
* or not the surface used by the ThreadedRenderer will be changing. It
|
||||
* Suspends any rendering into the surface, but will not do any destruction.
|
||||
*
|
||||
* Any subsequent draws will override the pause, resuming normal operation.
|
||||
@@ -519,10 +516,10 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be invoked whenever the current hardware renderer
|
||||
* This method should be invoked whenever the current threaded renderer
|
||||
* context should be reset.
|
||||
*
|
||||
* @param surface The surface to hardware accelerate
|
||||
* @param surface The surface to render
|
||||
*/
|
||||
void invalidate(Surface surface) {
|
||||
updateSurface(surface);
|
||||
@@ -589,7 +586,7 @@ public final class ThreadedRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the HardwareRenderer's opacity
|
||||
* Change the ThreadedRenderer's opacity
|
||||
*/
|
||||
void setOpaque(boolean opaque) {
|
||||
nSetOpaque(mNativeProxy, opaque && !mHasInsets);
|
||||
@@ -658,7 +655,7 @@ public final class ThreadedRenderer {
|
||||
view.mRecreateDisplayList = false;
|
||||
}
|
||||
|
||||
private void updateRootDisplayList(View view, HardwareDrawCallbacks callbacks) {
|
||||
private void updateRootDisplayList(View view, DrawCallbacks callbacks) {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "Record View#draw()");
|
||||
updateViewTreeDisplayList(view);
|
||||
|
||||
@@ -667,13 +664,13 @@ public final class ThreadedRenderer {
|
||||
try {
|
||||
final int saveCount = canvas.save();
|
||||
canvas.translate(mInsetLeft, mInsetTop);
|
||||
callbacks.onHardwarePreDraw(canvas);
|
||||
callbacks.onPreDraw(canvas);
|
||||
|
||||
canvas.insertReorderBarrier();
|
||||
canvas.drawRenderNode(view.updateDisplayListIfDirty());
|
||||
canvas.insertInorderBarrier();
|
||||
|
||||
callbacks.onHardwarePostDraw(canvas);
|
||||
callbacks.onPostDraw(canvas);
|
||||
canvas.restoreToCount(saveCount);
|
||||
mRootNodeNeedsUpdate = false;
|
||||
} finally {
|
||||
@@ -726,29 +723,29 @@ public final class ThreadedRenderer {
|
||||
|
||||
/**
|
||||
* Interface used to receive callbacks whenever a view is drawn by
|
||||
* a hardware renderer instance.
|
||||
* a threaded renderer instance.
|
||||
*/
|
||||
interface HardwareDrawCallbacks {
|
||||
interface DrawCallbacks {
|
||||
/**
|
||||
* Invoked before a view is drawn by a hardware renderer.
|
||||
* Invoked before a view is drawn by a threaded renderer.
|
||||
* This method can be used to apply transformations to the
|
||||
* canvas but no drawing command should be issued.
|
||||
*
|
||||
* @param canvas The Canvas used to render the view.
|
||||
*/
|
||||
void onHardwarePreDraw(DisplayListCanvas canvas);
|
||||
void onPreDraw(DisplayListCanvas canvas);
|
||||
|
||||
/**
|
||||
* Invoked after a view is drawn by a hardware renderer.
|
||||
* Invoked after a view is drawn by a threaded renderer.
|
||||
* It is safe to invoke drawing commands from this method.
|
||||
*
|
||||
* @param canvas The Canvas used to render the view.
|
||||
*/
|
||||
void onHardwarePostDraw(DisplayListCanvas canvas);
|
||||
void onPostDraw(DisplayListCanvas canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the content drawn by HardwareDrawCallbacks needs to
|
||||
* Indicates that the content drawn by DrawCallbacks needs to
|
||||
* be updated, which will be done by the next call to draw()
|
||||
*/
|
||||
void invalidateRoot() {
|
||||
@@ -762,7 +759,7 @@ public final class ThreadedRenderer {
|
||||
* @param attachInfo AttachInfo tied to the specified view.
|
||||
* @param callbacks Callbacks invoked when drawing happens.
|
||||
*/
|
||||
void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks) {
|
||||
void draw(View view, AttachInfo attachInfo, DrawCallbacks callbacks) {
|
||||
attachInfo.mIgnoreDirtyState = true;
|
||||
|
||||
final Choreographer choreographer = attachInfo.mViewRootImpl.mChoreographer;
|
||||
|
||||
@@ -5525,7 +5525,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
Window.OnFrameMetricsAvailableListener listener,
|
||||
Handler handler) {
|
||||
if (mAttachInfo != null) {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
if (mFrameMetricsObservers == null) {
|
||||
mFrameMetricsObservers = new ArrayList<>();
|
||||
}
|
||||
@@ -5533,7 +5533,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
FrameMetricsObserver fmo = new FrameMetricsObserver(window,
|
||||
handler.getLooper(), listener);
|
||||
mFrameMetricsObservers.add(fmo);
|
||||
mAttachInfo.mHardwareRenderer.addFrameMetricsObserver(fmo);
|
||||
mAttachInfo.mThreadedRenderer.addFrameMetricsObserver(fmo);
|
||||
} else {
|
||||
Log.w(VIEW_LOG_TAG, "View not hardware-accelerated. Unable to observe frame stats");
|
||||
}
|
||||
@@ -5555,7 +5555,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
*/
|
||||
public void removeFrameMetricsListener(
|
||||
Window.OnFrameMetricsAvailableListener listener) {
|
||||
ThreadedRenderer renderer = getHardwareRenderer();
|
||||
ThreadedRenderer renderer = getThreadedRenderer();
|
||||
FrameMetricsObserver fmo = findFrameMetricsObserver(listener);
|
||||
if (fmo == null) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -5572,7 +5572,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
|
||||
private void registerPendingFrameMetricsObservers() {
|
||||
if (mFrameMetricsObservers != null) {
|
||||
ThreadedRenderer renderer = getHardwareRenderer();
|
||||
ThreadedRenderer renderer = getThreadedRenderer();
|
||||
if (renderer != null) {
|
||||
for (FrameMetricsObserver fmo : mFrameMetricsObservers) {
|
||||
renderer.addFrameMetricsObserver(fmo);
|
||||
@@ -13826,8 +13826,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public ThreadedRenderer getHardwareRenderer() {
|
||||
return mAttachInfo != null ? mAttachInfo.mHardwareRenderer : null;
|
||||
public ThreadedRenderer getThreadedRenderer() {
|
||||
return mAttachInfo != null ? mAttachInfo.mThreadedRenderer : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -15870,8 +15870,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
switch (mLayerType) {
|
||||
case LAYER_TYPE_HARDWARE:
|
||||
updateDisplayListIfDirty();
|
||||
if (attachInfo.mHardwareRenderer != null && mRenderNode.isValid()) {
|
||||
attachInfo.mHardwareRenderer.buildLayer(mRenderNode);
|
||||
if (attachInfo.mThreadedRenderer != null && mRenderNode.isValid()) {
|
||||
attachInfo.mThreadedRenderer.buildLayer(mRenderNode);
|
||||
}
|
||||
break;
|
||||
case LAYER_TYPE_SOFTWARE:
|
||||
@@ -15989,7 +15989,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
* @hide
|
||||
*/
|
||||
public boolean canHaveDisplayList() {
|
||||
return !(mAttachInfo == null || mAttachInfo.mHardwareRenderer == null);
|
||||
return !(mAttachInfo == null || mAttachInfo.mThreadedRenderer == null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17246,7 +17246,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
|
||||
// Attempt to use a display list if requested.
|
||||
if (canvas.isHardwareAccelerated() && mAttachInfo != null
|
||||
&& mAttachInfo.mHardwareRenderer != null) {
|
||||
&& mAttachInfo.mThreadedRenderer != null) {
|
||||
mBackgroundRenderNode = getDrawableRenderNode(background, mBackgroundRenderNode);
|
||||
|
||||
final RenderNode renderNode = mBackgroundRenderNode;
|
||||
@@ -22681,7 +22681,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
|
||||
boolean mHardwareAccelerated;
|
||||
boolean mHardwareAccelerationRequested;
|
||||
ThreadedRenderer mHardwareRenderer;
|
||||
ThreadedRenderer mThreadedRenderer;
|
||||
List<RenderNode> mPendingAnimatingRenderNodes;
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,7 +112,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
*/
|
||||
@SuppressWarnings({"EmptyCatchBlock", "PointlessBooleanExpression"})
|
||||
public final class ViewRootImpl implements ViewParent,
|
||||
View.AttachInfo.Callbacks, ThreadedRenderer.HardwareDrawCallbacks {
|
||||
View.AttachInfo.Callbacks, ThreadedRenderer.DrawCallbacks {
|
||||
private static final String TAG = "ViewRootImpl";
|
||||
private static final boolean DBG = false;
|
||||
private static final boolean LOCAL_LOGV = false;
|
||||
@@ -390,7 +390,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
/** Set to true once doDie() has been called. */
|
||||
private boolean mRemoved;
|
||||
|
||||
private boolean mNeedsHwRendererSetup;
|
||||
private boolean mNeedsRendererSetup;
|
||||
|
||||
/**
|
||||
* Consistency verifier for debugging purposes.
|
||||
@@ -785,17 +785,17 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
void destroyHardwareResources() {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
|
||||
mAttachInfo.mHardwareRenderer.destroy();
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.destroyHardwareResources(mView);
|
||||
mAttachInfo.mThreadedRenderer.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void detachFunctor(long functor) {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
// Fence so that any pending invokeFunctor() messages will be processed
|
||||
// before we return from detachFunctor.
|
||||
mAttachInfo.mHardwareRenderer.stopDrawing();
|
||||
mAttachInfo.mThreadedRenderer.stopDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,8 +813,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
public void registerAnimatingRenderNode(RenderNode animator) {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.registerAnimatingRenderNode(animator);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.registerAnimatingRenderNode(animator);
|
||||
} else {
|
||||
if (mAttachInfo.mPendingAnimatingRenderNodes == null) {
|
||||
mAttachInfo.mPendingAnimatingRenderNodes = new ArrayList<RenderNode>();
|
||||
@@ -825,8 +825,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
public void registerVectorDrawableAnimator(
|
||||
AnimatedVectorDrawable.VectorDrawableAnimatorRT animator) {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.registerVectorDrawableAnimator(animator);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.registerVectorDrawableAnimator(animator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,17 +867,17 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mAttachInfo.mHardwareAccelerationRequested = true;
|
||||
} else if (!ThreadedRenderer.sRendererDisabled
|
||||
|| (ThreadedRenderer.sSystemRendererDisabled && forceHwAccelerated)) {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.destroy();
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.destroy();
|
||||
}
|
||||
|
||||
final Rect insets = attrs.surfaceInsets;
|
||||
final boolean hasSurfaceInsets = insets.left != 0 || insets.right != 0
|
||||
|| insets.top != 0 || insets.bottom != 0;
|
||||
final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets;
|
||||
mAttachInfo.mHardwareRenderer = ThreadedRenderer.create(mContext, translucent);
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.setName(attrs.getTitle().toString());
|
||||
mAttachInfo.mThreadedRenderer = ThreadedRenderer.create(mContext, translucent);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.setName(attrs.getTitle().toString());
|
||||
mAttachInfo.mHardwareAccelerated =
|
||||
mAttachInfo.mHardwareAccelerationRequested = true;
|
||||
}
|
||||
@@ -944,7 +944,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|| mWindowAttributes.surfaceInsets.top != oldInsetTop
|
||||
|| mWindowAttributes.surfaceInsets.right != oldInsetRight
|
||||
|| mWindowAttributes.surfaceInsets.bottom != oldInsetBottom) {
|
||||
mNeedsHwRendererSetup = true;
|
||||
mNeedsRendererSetup = true;
|
||||
}
|
||||
|
||||
applyKeepScreenOnFlag(mWindowAttributes);
|
||||
@@ -1138,7 +1138,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
void setWindowStopped(boolean stopped) {
|
||||
if (mStopped != stopped) {
|
||||
mStopped = stopped;
|
||||
final ThreadedRenderer renderer = mAttachInfo.mHardwareRenderer;
|
||||
final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer;
|
||||
if (renderer != null) {
|
||||
if (DEBUG_DRAW) Log.d(mTag, "WindowStopped on " + getTitle() + " set to " + mStopped);
|
||||
renderer.setStopped(mStopped);
|
||||
@@ -1214,8 +1214,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
* this knowledge to adjust the scheduling of off-thread animations
|
||||
*/
|
||||
void notifyRendererOfFramePending() {
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.notifyFramePending();
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.notifyFramePending();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1740,11 +1740,11 @@ public final class ViewRootImpl implements ViewParent,
|
||||
host.getMeasuredHeight() + ", params=" + params);
|
||||
}
|
||||
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
// relayoutWindow may decide to destroy mSurface. As that decision
|
||||
// happens in WindowManager service, we need to be defensive here
|
||||
// and stop using the surface in case it gets destroyed.
|
||||
if (mAttachInfo.mHardwareRenderer.pauseSurface(mSurface)) {
|
||||
if (mAttachInfo.mThreadedRenderer.pauseSurface(mSurface)) {
|
||||
// Animations were running so we need to push a frame
|
||||
// to resume them
|
||||
mDirty.set(0, 0, mWidth, mHeight);
|
||||
@@ -1850,9 +1850,9 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// Only initialize up-front if transparent regions are not
|
||||
// requested, otherwise defer to see if the entire window
|
||||
// will be transparent
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
try {
|
||||
hwInitialized = mAttachInfo.mHardwareRenderer.initialize(
|
||||
hwInitialized = mAttachInfo.mThreadedRenderer.initialize(
|
||||
mSurface);
|
||||
if (hwInitialized && (host.mPrivateFlags
|
||||
& View.PFLAG_REQUEST_TRANSPARENT_REGIONS) == 0) {
|
||||
@@ -1880,14 +1880,14 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mScroller.abortAnimation();
|
||||
}
|
||||
// Our surface is gone
|
||||
if (mAttachInfo.mHardwareRenderer != null &&
|
||||
mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||
mAttachInfo.mHardwareRenderer.destroy();
|
||||
if (mAttachInfo.mThreadedRenderer != null &&
|
||||
mAttachInfo.mThreadedRenderer.isEnabled()) {
|
||||
mAttachInfo.mThreadedRenderer.destroy();
|
||||
}
|
||||
} else if ((surfaceGenerationId != mSurface.getGenerationId()
|
||||
|| surfaceSizeChanged)
|
||||
&& mSurfaceHolder == null
|
||||
&& mAttachInfo.mHardwareRenderer != null) {
|
||||
&& mAttachInfo.mThreadedRenderer != null) {
|
||||
mFullRedrawNeeded = true;
|
||||
try {
|
||||
// Need to do updateSurface (which leads to CanvasContext::setSurface and
|
||||
@@ -1898,7 +1898,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// Note that frame size change doesn't always imply surface size change (eg.
|
||||
// drag resizing uses fullscreen surface), need to check surfaceSizeChanged
|
||||
// flag from WindowManager.
|
||||
mAttachInfo.mHardwareRenderer.updateSurface(mSurface);
|
||||
mAttachInfo.mThreadedRenderer.updateSurface(mSurface);
|
||||
} catch (OutOfResourcesException e) {
|
||||
handleOutOfResourcesException(e);
|
||||
return;
|
||||
@@ -2001,15 +2001,15 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
}
|
||||
|
||||
final ThreadedRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
|
||||
if (hardwareRenderer != null && hardwareRenderer.isEnabled()) {
|
||||
final ThreadedRenderer threadedRenderer = mAttachInfo.mThreadedRenderer;
|
||||
if (threadedRenderer != null && threadedRenderer.isEnabled()) {
|
||||
if (hwInitialized
|
||||
|| mWidth != hardwareRenderer.getWidth()
|
||||
|| mHeight != hardwareRenderer.getHeight()
|
||||
|| mNeedsHwRendererSetup) {
|
||||
hardwareRenderer.setup(mWidth, mHeight, mAttachInfo,
|
||||
|| mWidth != threadedRenderer.getWidth()
|
||||
|| mHeight != threadedRenderer.getHeight()
|
||||
|| mNeedsRendererSetup) {
|
||||
threadedRenderer.setup(mWidth, mHeight, mAttachInfo,
|
||||
mWindowAttributes.surfaceInsets);
|
||||
mNeedsHwRendererSetup = false;
|
||||
mNeedsRendererSetup = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2253,8 +2253,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
if (windowMoved || mAttachInfo.mNeedsUpdateLightCenter) {
|
||||
// Update the light position for the new offsets.
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.setLightCenter(mAttachInfo);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.setLightCenter(mAttachInfo);
|
||||
}
|
||||
mAttachInfo.mNeedsUpdateLightCenter = false;
|
||||
}
|
||||
@@ -2520,12 +2520,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
int mHardwareYOffset;
|
||||
|
||||
@Override
|
||||
public void onHardwarePreDraw(DisplayListCanvas canvas) {
|
||||
public void onPreDraw(DisplayListCanvas canvas) {
|
||||
canvas.translate(-mHardwareXOffset, -mHardwareYOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHardwarePostDraw(DisplayListCanvas canvas) {
|
||||
public void onPostDraw(DisplayListCanvas canvas) {
|
||||
drawAccessibilityFocusedDrawableIfNeeded(canvas);
|
||||
for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) {
|
||||
mWindowCallbacks.get(i).onPostDraw(canvas);
|
||||
@@ -2537,8 +2537,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
*/
|
||||
void outputDisplayList(View view) {
|
||||
view.mRenderNode.output();
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
((ThreadedRenderer)mAttachInfo.mHardwareRenderer).serializeDisplayListTree();
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
((ThreadedRenderer)mAttachInfo.mThreadedRenderer).serializeDisplayListTree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2638,9 +2638,9 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mWindowDrawCountDown = null;
|
||||
}
|
||||
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.fence();
|
||||
mAttachInfo.mHardwareRenderer.setStopped(mStopped);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.fence();
|
||||
mAttachInfo.mThreadedRenderer.setStopped(mStopped);
|
||||
}
|
||||
|
||||
if (LOCAL_LOGV) {
|
||||
@@ -2766,7 +2766,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mChoreographer.getFrameTimeNanos() / TimeUtils.NANOS_PER_MS;
|
||||
|
||||
if (!dirty.isEmpty() || mIsAnimating || accessibilityFocusDirty) {
|
||||
if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
|
||||
if (mAttachInfo.mThreadedRenderer != null && mAttachInfo.mThreadedRenderer.isEnabled()) {
|
||||
// If accessibility focus moved, always invalidate the root.
|
||||
boolean invalidateRoot = accessibilityFocusDirty || mInvalidateRootRequested;
|
||||
mInvalidateRootRequested = false;
|
||||
@@ -2781,7 +2781,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
if (invalidateRoot) {
|
||||
mAttachInfo.mHardwareRenderer.invalidateRoot();
|
||||
mAttachInfo.mThreadedRenderer.invalidateRoot();
|
||||
}
|
||||
|
||||
dirty.setEmpty();
|
||||
@@ -2794,14 +2794,14 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// report next draw overrides setStopped()
|
||||
// This value is re-sync'd to the value of mStopped
|
||||
// in the handling of mReportNextDraw post-draw.
|
||||
mAttachInfo.mHardwareRenderer.setStopped(false);
|
||||
mAttachInfo.mThreadedRenderer.setStopped(false);
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
requestDrawWindow();
|
||||
}
|
||||
|
||||
mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
|
||||
mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this);
|
||||
} else {
|
||||
// If we get here with a disabled & requested hardware renderer, something went
|
||||
// wrong (an invalidate posted right before we destroyed the hardware surface
|
||||
@@ -2811,12 +2811,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// Before we request a new frame we must however attempt to reinitiliaze the
|
||||
// hardware renderer if it's in requested state. This would happen after an
|
||||
// eglTerminate() for instance.
|
||||
if (mAttachInfo.mHardwareRenderer != null &&
|
||||
!mAttachInfo.mHardwareRenderer.isEnabled() &&
|
||||
mAttachInfo.mHardwareRenderer.isRequested()) {
|
||||
if (mAttachInfo.mThreadedRenderer != null &&
|
||||
!mAttachInfo.mThreadedRenderer.isEnabled() &&
|
||||
mAttachInfo.mThreadedRenderer.isRequested()) {
|
||||
|
||||
try {
|
||||
mAttachInfo.mHardwareRenderer.initializeIfNeeded(
|
||||
mAttachInfo.mThreadedRenderer.initializeIfNeeded(
|
||||
mWidth, mHeight, mAttachInfo, mSurface, surfaceInsets);
|
||||
} catch (OutOfResourcesException e) {
|
||||
handleOutOfResourcesException(e);
|
||||
@@ -3196,8 +3196,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mAccessibilityFocusedHost = view;
|
||||
mAccessibilityFocusedVirtualView = node;
|
||||
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.invalidateRoot();
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.invalidateRoot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3571,12 +3571,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
boolean inTouchMode = msg.arg2 != 0;
|
||||
ensureTouchModeLocally(inTouchMode);
|
||||
|
||||
if (mAttachInfo.mHardwareRenderer != null && mSurface.isValid()){
|
||||
if (mAttachInfo.mThreadedRenderer != null && mSurface.isValid()){
|
||||
mFullRedrawNeeded = true;
|
||||
try {
|
||||
final WindowManager.LayoutParams lp = mWindowAttributes;
|
||||
final Rect surfaceInsets = lp != null ? lp.surfaceInsets : null;
|
||||
mAttachInfo.mHardwareRenderer.initializeIfNeeded(
|
||||
mAttachInfo.mThreadedRenderer.initializeIfNeeded(
|
||||
mWidth, mHeight, mAttachInfo, mSurface, surfaceInsets);
|
||||
} catch (OutOfResourcesException e) {
|
||||
Log.e(mTag, "OutOfResourcesException locking surface", e);
|
||||
@@ -5931,8 +5931,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
profileRendering(mAttachInfo.mHasWindowFocus);
|
||||
|
||||
// Hardware rendering
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
if (mAttachInfo.mHardwareRenderer.loadSystemProperties()) {
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
if (mAttachInfo.mThreadedRenderer.loadSystemProperties()) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
@@ -5950,7 +5950,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
private void destroyHardwareRenderer() {
|
||||
ThreadedRenderer hardwareRenderer = mAttachInfo.mHardwareRenderer;
|
||||
ThreadedRenderer hardwareRenderer = mAttachInfo.mThreadedRenderer;
|
||||
|
||||
if (hardwareRenderer != null) {
|
||||
if (mView != null) {
|
||||
@@ -5959,7 +5959,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
hardwareRenderer.destroy();
|
||||
hardwareRenderer.setRequested(false);
|
||||
|
||||
mAttachInfo.mHardwareRenderer = null;
|
||||
mAttachInfo.mThreadedRenderer = null;
|
||||
mAttachInfo.mHardwareAccelerated = false;
|
||||
}
|
||||
}
|
||||
@@ -6946,8 +6946,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
void changeCanvasOpacity(boolean opaque) {
|
||||
Log.d(mTag, "changeCanvasOpacity: opaque=" + opaque);
|
||||
if (mAttachInfo.mHardwareRenderer != null) {
|
||||
mAttachInfo.mHardwareRenderer.setOpaque(opaque);
|
||||
if (mAttachInfo.mThreadedRenderer != null) {
|
||||
mAttachInfo.mThreadedRenderer.setOpaque(opaque);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ public final class WindowManagerGlobal {
|
||||
for (int i = mRoots.size() - 1; i >= 0; --i) {
|
||||
final ViewRootImpl root = mRoots.get(i);
|
||||
if (root.mView != null && root.getHostVisibility() == View.VISIBLE
|
||||
&& root.mAttachInfo.mHardwareRenderer != null) {
|
||||
&& root.mAttachInfo.mThreadedRenderer != null) {
|
||||
hasVisibleWindows = true;
|
||||
} else {
|
||||
root.destroyHardwareResources();
|
||||
@@ -551,7 +551,7 @@ public final class WindowManagerGlobal {
|
||||
pw.printf("\n\t%s (visibility=%d)", name, root.getHostVisibility());
|
||||
|
||||
ThreadedRenderer renderer =
|
||||
root.getView().mAttachInfo.mHardwareRenderer;
|
||||
root.getView().mAttachInfo.mThreadedRenderer;
|
||||
if (renderer != null) {
|
||||
renderer.dumpGfxInfo(pw, fd, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user