Loading core/java/android/view/SurfaceView.java +22 −17 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class SurfaceView extends View { final Rect mStableInsets = new Rect(); final Rect mOutsets = new Rect(); final Rect mBackdropFrame = new Rect(); final Rect mTmpRect = new Rect(); final Configuration mConfiguration = new Configuration(); static final int KEEP_SCREEN_ON_MSG = 1; Loading Loading @@ -661,21 +662,21 @@ public class SurfaceView extends View { transformFromViewToWindowSpace(mLocation); mWinFrame.set(mWindowSpaceLeft, mWindowSpaceTop, mTmpRect.set(mWindowSpaceLeft, mWindowSpaceTop, mLocation[0], mLocation[1]); if (mTranslator != null) { mTranslator.translateRectInAppWindowToScreen(mWinFrame); mTranslator.translateRectInAppWindowToScreen(mTmpRect); } if (!isHardwareAccelerated() || !mRtHandlingPositionUpdates) { try { if (DEBUG) Log.d(TAG, String.format("%d updateWindowPosition UI, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom)); mSession.repositionChild(mWindow, mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom, -1, mWinFrame); mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom)); mSession.repositionChild(mWindow, mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom, -1, mTmpRect); } catch (RemoteException ex) { Log.e(TAG, "Exception from relayout", ex); } Loading @@ -687,10 +688,10 @@ public class SurfaceView extends View { private Rect mRTLastReportedPosition = new Rect(); /** * Called by native on RenderThread to update the window position * Called by native by a Rendering Worker thread to update the window position * @hide */ public final void updateWindowPositionRT(long frameNumber, public final void updateWindowPosition_renderWorker(long frameNumber, int left, int top, int right, int bottom) { IWindowSession session = mSession; MyWindow window = mWindow; Loading @@ -715,7 +716,7 @@ public class SurfaceView extends View { } try { if (DEBUG) { Log.d(TAG, String.format("%d updateWindowPosition RT, frameNr = %d, " + Log.d(TAG, String.format("%d updateWindowPosition RenderWorker, frameNr = %d, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), frameNumber, left, top, right, bottom)); } Loading @@ -732,12 +733,12 @@ public class SurfaceView extends View { /** * Called by native on RenderThread to notify that the window is no longer in the * draw tree * draw tree. UI thread is blocked at this point. * @hide */ public final void windowPositionLostRT(long frameNumber) { public final void windowPositionLost_uiRtSync(long frameNumber) { if (DEBUG) { Log.d(TAG, String.format("%d windowPositionLostRT RT, frameNr = %d", Log.d(TAG, String.format("%d windowPositionLost, frameNr = %d", System.identityHashCode(this), frameNumber)); } IWindowSession session = mSession; Loading @@ -752,14 +753,18 @@ public class SurfaceView extends View { // safely access other member variables at this time. // So do what the UI thread would have done if RT wasn't handling position // updates. if (!mWinFrame.isEmpty() && !mWinFrame.equals(mRTLastReportedPosition)) { mTmpRect.set(mLayout.x, mLayout.y, mLayout.x + mLayout.width, mLayout.y + mLayout.height); if (!mTmpRect.isEmpty() && !mTmpRect.equals(mRTLastReportedPosition)) { try { if (DEBUG) Log.d(TAG, String.format("%d updateWindowPosition, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom)); session.repositionChild(window, mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom, frameNumber, mWinFrame); mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom)); session.repositionChild(window, mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom, frameNumber, mWinFrame); } catch (RemoteException ex) { Log.e(TAG, "Exception from relayout", ex); } Loading core/jni/android_view_RenderNode.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -721,9 +721,9 @@ static const JNINativeMethod gMethods[] = { int register_android_view_RenderNode(JNIEnv* env) { jclass clazz = FindClassOrDie(env, "android/view/SurfaceView"); gSurfaceViewPositionUpdateMethod = GetMethodIDOrDie(env, clazz, "updateWindowPositionRT", "(JIIII)V"); "updateWindowPosition_renderWorker", "(JIIII)V"); gSurfaceViewPositionLostMethod = GetMethodIDOrDie(env, clazz, "windowPositionLostRT", "(J)V"); "windowPositionLost_uiRtSync", "(J)V"); clazz = FindClassOrDie(env, "android/view/RenderNode"); gOnRenderNodeDetached = GetMethodIDOrDie(env, clazz, "onRenderNodeDetached", "()V"); Loading Loading
core/java/android/view/SurfaceView.java +22 −17 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class SurfaceView extends View { final Rect mStableInsets = new Rect(); final Rect mOutsets = new Rect(); final Rect mBackdropFrame = new Rect(); final Rect mTmpRect = new Rect(); final Configuration mConfiguration = new Configuration(); static final int KEEP_SCREEN_ON_MSG = 1; Loading Loading @@ -661,21 +662,21 @@ public class SurfaceView extends View { transformFromViewToWindowSpace(mLocation); mWinFrame.set(mWindowSpaceLeft, mWindowSpaceTop, mTmpRect.set(mWindowSpaceLeft, mWindowSpaceTop, mLocation[0], mLocation[1]); if (mTranslator != null) { mTranslator.translateRectInAppWindowToScreen(mWinFrame); mTranslator.translateRectInAppWindowToScreen(mTmpRect); } if (!isHardwareAccelerated() || !mRtHandlingPositionUpdates) { try { if (DEBUG) Log.d(TAG, String.format("%d updateWindowPosition UI, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom)); mSession.repositionChild(mWindow, mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom, -1, mWinFrame); mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom)); mSession.repositionChild(mWindow, mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom, -1, mTmpRect); } catch (RemoteException ex) { Log.e(TAG, "Exception from relayout", ex); } Loading @@ -687,10 +688,10 @@ public class SurfaceView extends View { private Rect mRTLastReportedPosition = new Rect(); /** * Called by native on RenderThread to update the window position * Called by native by a Rendering Worker thread to update the window position * @hide */ public final void updateWindowPositionRT(long frameNumber, public final void updateWindowPosition_renderWorker(long frameNumber, int left, int top, int right, int bottom) { IWindowSession session = mSession; MyWindow window = mWindow; Loading @@ -715,7 +716,7 @@ public class SurfaceView extends View { } try { if (DEBUG) { Log.d(TAG, String.format("%d updateWindowPosition RT, frameNr = %d, " + Log.d(TAG, String.format("%d updateWindowPosition RenderWorker, frameNr = %d, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), frameNumber, left, top, right, bottom)); } Loading @@ -732,12 +733,12 @@ public class SurfaceView extends View { /** * Called by native on RenderThread to notify that the window is no longer in the * draw tree * draw tree. UI thread is blocked at this point. * @hide */ public final void windowPositionLostRT(long frameNumber) { public final void windowPositionLost_uiRtSync(long frameNumber) { if (DEBUG) { Log.d(TAG, String.format("%d windowPositionLostRT RT, frameNr = %d", Log.d(TAG, String.format("%d windowPositionLost, frameNr = %d", System.identityHashCode(this), frameNumber)); } IWindowSession session = mSession; Loading @@ -752,14 +753,18 @@ public class SurfaceView extends View { // safely access other member variables at this time. // So do what the UI thread would have done if RT wasn't handling position // updates. if (!mWinFrame.isEmpty() && !mWinFrame.equals(mRTLastReportedPosition)) { mTmpRect.set(mLayout.x, mLayout.y, mLayout.x + mLayout.width, mLayout.y + mLayout.height); if (!mTmpRect.isEmpty() && !mTmpRect.equals(mRTLastReportedPosition)) { try { if (DEBUG) Log.d(TAG, String.format("%d updateWindowPosition, " + "postion = [%d, %d, %d, %d]", System.identityHashCode(this), mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom)); session.repositionChild(window, mWinFrame.left, mWinFrame.top, mWinFrame.right, mWinFrame.bottom, frameNumber, mWinFrame); mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom)); session.repositionChild(window, mTmpRect.left, mTmpRect.top, mTmpRect.right, mTmpRect.bottom, frameNumber, mWinFrame); } catch (RemoteException ex) { Log.e(TAG, "Exception from relayout", ex); } Loading
core/jni/android_view_RenderNode.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -721,9 +721,9 @@ static const JNINativeMethod gMethods[] = { int register_android_view_RenderNode(JNIEnv* env) { jclass clazz = FindClassOrDie(env, "android/view/SurfaceView"); gSurfaceViewPositionUpdateMethod = GetMethodIDOrDie(env, clazz, "updateWindowPositionRT", "(JIIII)V"); "updateWindowPosition_renderWorker", "(JIIII)V"); gSurfaceViewPositionLostMethod = GetMethodIDOrDie(env, clazz, "windowPositionLostRT", "(J)V"); "windowPositionLost_uiRtSync", "(J)V"); clazz = FindClassOrDie(env, "android/view/RenderNode"); gOnRenderNodeDetached = GetMethodIDOrDie(env, clazz, "onRenderNodeDetached", "()V"); Loading