Loading core/java/android/view/SurfaceControl.java +0 −4 Original line number Diff line number Diff line Loading @@ -451,10 +451,6 @@ public class SurfaceControl { return nativeGetHandle(mNativeObject); } public boolean getTransformToDisplayInverse() { return nativeGetTransformToDisplayInverse(mNativeObject); } /** flag the transaction as an animation */ public static void setAnimationTransaction() { nativeSetAnimationTransaction(); Loading core/jni/android_view_SurfaceControl.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -735,16 +735,6 @@ static jobject nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) { return javaObjectForIBinder(env, ctrl->getHandle()); } static jboolean nativeGetTransformToDisplayInverse(JNIEnv* env, jclass clazz, jlong nativeObject) { bool out = false; auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t status = ctrl->getTransformToDisplayInverse(&out); if (status != NO_ERROR) { return false; } return out; } static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) { sp<IBinder> token(ibinderForJavaObject(env, tokenObject)); if (token == NULL) return NULL; Loading Loading @@ -854,8 +844,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetOverrideScalingMode }, {"nativeGetHandle", "(J)Landroid/os/IBinder;", (void*)nativeGetHandle }, {"nativeGetTransformToDisplayInverse", "(J)Z", (void*)nativeGetTransformToDisplayInverse }, {"nativeScreenshotToBuffer", "(Landroid/os/IBinder;Landroid/graphics/Rect;IIIIZZI)Landroid/graphics/GraphicBuffer;", (void*)nativeScreenshotToBuffer }, Loading services/core/java/com/android/server/wm/DisplayContent.java +3 −23 Original line number Diff line number Diff line Loading @@ -894,9 +894,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int lastOrientation = mLastOrientation; final boolean oldAltOrientation = mAltOrientation; int rotation = mService.mPolicy.rotationForOrientationLw(lastOrientation, oldRotation); final boolean rotateSeamlessly; final boolean rotateSeamlessly = mService.mPolicy.shouldRotateSeamlessly(oldRotation, rotation); if (mService.mPolicy.shouldRotateSeamlessly(oldRotation, rotation)) { if (rotateSeamlessly) { final WindowState seamlessRotated = getWindow((w) -> w.mSeamlesslyRotated); if (seamlessRotated != null) { // We can't rotate (seamlessly or not) while waiting for the last seamless rotation Loading @@ -905,27 +906,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // window-removal. return false; } final WindowState cantSeamlesslyRotate = getWindow((w) -> w.isChildWindow() && w.isVisibleNow() && !w.mWinAnimator.mSurfaceController.getTransformToDisplayInverse()); if (cantSeamlesslyRotate != null) { // In what can only be called an unfortunate workaround we require seamlessly // rotated child windows to have the TRANSFORM_TO_DISPLAY_INVERSE flag. Due to // limitations in the client API, there is no way for the client to set this flag in // a race free fashion. If we seamlessly rotate a window which does not have this // flag, but then gains it, we will get an incorrect visual result // (rotated viewfinder). This means if we want to support seamlessly rotating // windows which could gain this flag, we can't rotate windows without it. This // limits seamless rotation in N to camera framework users, windows without // children, and native code. This is unfortunate but having the camera work is our // primary goal. rotateSeamlessly = false; } else { rotateSeamlessly = true; } } else { rotateSeamlessly = false; } // TODO: Implement forced rotation changes. Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +20 −51 Original line number Diff line number Diff line Loading @@ -1935,42 +1935,12 @@ class WindowStateAnimator { DisplayContent.createRotationMatrix(deltaRotation, x, y, displayWidth, displayHeight, transform); // We have two cases: // 1. Windows with NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY: // These windows never change buffer size when rotating. Rather the window manager // just updates the scaling factors to fit in the new coordinate system, // and SurfaceFlinger takes care of updating the buffer contents. So in this case // we just need we just need to update the scaling factors and things are seamless // already. // 2. Other windows: // In this case, we need to apply a rotation matrix to the window. For example // We just need to apply a rotation matrix to the window. For example // if we have a portrait window and rotate to landscape, the window is still portrait // and now extends off the bottom of the screen (and only halfway across). Essentially we // apply a transform to display the current buffer at it's old position // (in the new coordinate space). We then freeze layer updates until the resize // occurs, at which point we undo, them. if (w.isChildWindow() && mSurfaceController.getTransformToDisplayInverse()) { frameRect.set(x, y, x + width, y + height); transform.mapRect(frameRect); final Rect parentWindowFrame = w.getParentWindow().mFrame; w.mAttrs.x = (int) frameRect.left - parentWindowFrame.left; w.mAttrs.y = (int) frameRect.top - parentWindowFrame.top; w.mAttrs.width = (int) Math.ceil(frameRect.width()); w.mAttrs.height = (int) Math.ceil(frameRect.height()); w.setWindowScale(w.mRequestedWidth, w.mRequestedHeight); w.applyGravityAndUpdateFrame(w.mContainingFrame, w.mDisplayFrame); computeShownFrameLocked(); setSurfaceBoundariesLocked(false); // The stack bounds will not yet be rotated at this point so setSurfaceBoundaries locked // will crop us incorrectly. Overwrite the crop, exposing the full surface. By the next // transaction this will be corrected. cropRect.set(0, 0, w.mRequestedWidth, w.mRequestedWidth + w.mRequestedHeight); mSurfaceController.setCropInTransaction(cropRect, false); } else { mService.markForSeamlessRotation(w, true); transform.getValues(mService.mTmpFloats); Loading @@ -1986,7 +1956,6 @@ class WindowStateAnimator { DtDy * w.mHScale, DsDy * w.mVScale, false); } } void enableSurfaceTrace(FileDescriptor fd) { if (mSurfaceController != null) { Loading services/core/java/com/android/server/wm/WindowSurfaceController.java +0 −4 Original line number Diff line number Diff line Loading @@ -515,10 +515,6 @@ class WindowSurfaceController { return mSurfaceControl.getHandle(); } boolean getTransformToDisplayInverse() { return mSurfaceControl.getTransformToDisplayInverse(); } void getSurface(Surface outSurface) { outSurface.copyFrom(mSurfaceControl); } Loading Loading
core/java/android/view/SurfaceControl.java +0 −4 Original line number Diff line number Diff line Loading @@ -451,10 +451,6 @@ public class SurfaceControl { return nativeGetHandle(mNativeObject); } public boolean getTransformToDisplayInverse() { return nativeGetTransformToDisplayInverse(mNativeObject); } /** flag the transaction as an animation */ public static void setAnimationTransaction() { nativeSetAnimationTransaction(); Loading
core/jni/android_view_SurfaceControl.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -735,16 +735,6 @@ static jobject nativeGetHandle(JNIEnv* env, jclass clazz, jlong nativeObject) { return javaObjectForIBinder(env, ctrl->getHandle()); } static jboolean nativeGetTransformToDisplayInverse(JNIEnv* env, jclass clazz, jlong nativeObject) { bool out = false; auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); status_t status = ctrl->getTransformToDisplayInverse(&out); if (status != NO_ERROR) { return false; } return out; } static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) { sp<IBinder> token(ibinderForJavaObject(env, tokenObject)); if (token == NULL) return NULL; Loading Loading @@ -854,8 +844,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetOverrideScalingMode }, {"nativeGetHandle", "(J)Landroid/os/IBinder;", (void*)nativeGetHandle }, {"nativeGetTransformToDisplayInverse", "(J)Z", (void*)nativeGetTransformToDisplayInverse }, {"nativeScreenshotToBuffer", "(Landroid/os/IBinder;Landroid/graphics/Rect;IIIIZZI)Landroid/graphics/GraphicBuffer;", (void*)nativeScreenshotToBuffer }, Loading
services/core/java/com/android/server/wm/DisplayContent.java +3 −23 Original line number Diff line number Diff line Loading @@ -894,9 +894,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo final int lastOrientation = mLastOrientation; final boolean oldAltOrientation = mAltOrientation; int rotation = mService.mPolicy.rotationForOrientationLw(lastOrientation, oldRotation); final boolean rotateSeamlessly; final boolean rotateSeamlessly = mService.mPolicy.shouldRotateSeamlessly(oldRotation, rotation); if (mService.mPolicy.shouldRotateSeamlessly(oldRotation, rotation)) { if (rotateSeamlessly) { final WindowState seamlessRotated = getWindow((w) -> w.mSeamlesslyRotated); if (seamlessRotated != null) { // We can't rotate (seamlessly or not) while waiting for the last seamless rotation Loading @@ -905,27 +906,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // window-removal. return false; } final WindowState cantSeamlesslyRotate = getWindow((w) -> w.isChildWindow() && w.isVisibleNow() && !w.mWinAnimator.mSurfaceController.getTransformToDisplayInverse()); if (cantSeamlesslyRotate != null) { // In what can only be called an unfortunate workaround we require seamlessly // rotated child windows to have the TRANSFORM_TO_DISPLAY_INVERSE flag. Due to // limitations in the client API, there is no way for the client to set this flag in // a race free fashion. If we seamlessly rotate a window which does not have this // flag, but then gains it, we will get an incorrect visual result // (rotated viewfinder). This means if we want to support seamlessly rotating // windows which could gain this flag, we can't rotate windows without it. This // limits seamless rotation in N to camera framework users, windows without // children, and native code. This is unfortunate but having the camera work is our // primary goal. rotateSeamlessly = false; } else { rotateSeamlessly = true; } } else { rotateSeamlessly = false; } // TODO: Implement forced rotation changes. Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +20 −51 Original line number Diff line number Diff line Loading @@ -1935,42 +1935,12 @@ class WindowStateAnimator { DisplayContent.createRotationMatrix(deltaRotation, x, y, displayWidth, displayHeight, transform); // We have two cases: // 1. Windows with NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY: // These windows never change buffer size when rotating. Rather the window manager // just updates the scaling factors to fit in the new coordinate system, // and SurfaceFlinger takes care of updating the buffer contents. So in this case // we just need we just need to update the scaling factors and things are seamless // already. // 2. Other windows: // In this case, we need to apply a rotation matrix to the window. For example // We just need to apply a rotation matrix to the window. For example // if we have a portrait window and rotate to landscape, the window is still portrait // and now extends off the bottom of the screen (and only halfway across). Essentially we // apply a transform to display the current buffer at it's old position // (in the new coordinate space). We then freeze layer updates until the resize // occurs, at which point we undo, them. if (w.isChildWindow() && mSurfaceController.getTransformToDisplayInverse()) { frameRect.set(x, y, x + width, y + height); transform.mapRect(frameRect); final Rect parentWindowFrame = w.getParentWindow().mFrame; w.mAttrs.x = (int) frameRect.left - parentWindowFrame.left; w.mAttrs.y = (int) frameRect.top - parentWindowFrame.top; w.mAttrs.width = (int) Math.ceil(frameRect.width()); w.mAttrs.height = (int) Math.ceil(frameRect.height()); w.setWindowScale(w.mRequestedWidth, w.mRequestedHeight); w.applyGravityAndUpdateFrame(w.mContainingFrame, w.mDisplayFrame); computeShownFrameLocked(); setSurfaceBoundariesLocked(false); // The stack bounds will not yet be rotated at this point so setSurfaceBoundaries locked // will crop us incorrectly. Overwrite the crop, exposing the full surface. By the next // transaction this will be corrected. cropRect.set(0, 0, w.mRequestedWidth, w.mRequestedWidth + w.mRequestedHeight); mSurfaceController.setCropInTransaction(cropRect, false); } else { mService.markForSeamlessRotation(w, true); transform.getValues(mService.mTmpFloats); Loading @@ -1986,7 +1956,6 @@ class WindowStateAnimator { DtDy * w.mHScale, DsDy * w.mVScale, false); } } void enableSurfaceTrace(FileDescriptor fd) { if (mSurfaceController != null) { Loading
services/core/java/com/android/server/wm/WindowSurfaceController.java +0 −4 Original line number Diff line number Diff line Loading @@ -515,10 +515,6 @@ class WindowSurfaceController { return mSurfaceControl.getHandle(); } boolean getTransformToDisplayInverse() { return mSurfaceControl.getTransformToDisplayInverse(); } void getSurface(Surface outSurface) { outSurface.copyFrom(mSurfaceControl); } Loading