Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba55296d authored by Tom Giordano's avatar Tom Giordano Committed by Steve Kondik
Browse files

framework: fix screenshot and rotation aimation for devices with abnormal hw rotation

Change-Id: I42694931cb1a754aa6c7652c0a96304ef1f88492
parent 1f7ebf20
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -348,7 +348,10 @@ class GlobalScreenshot {
        // only in the natural orientation of the device :!)
        mDisplay.getRealMetrics(mDisplayMetrics);
        float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
        float degrees = getDegreesForRotation(mDisplay.getRotation());
        int rot = mDisplay.getRotation();
        // Allow for abnormal hardware orientation
        rot = (rot + (android.os.SystemProperties.getInt("ro.sf.hwrotation",0) / 90 )) % 4;
        float degrees = getDegreesForRotation(rot);
        boolean requiresRotation = (degrees > 0);
        if (requiresRotation) {
            // Get the dimensions of the device in its native orientation
+18 −7
Original line number Diff line number Diff line
@@ -65,7 +65,9 @@ class ScreenRotationAnimation {
        mContext = context;

        // Screenshot does NOT include rotation!
        mSnapshotRotation = 0;
        // Allow for abnormal hardware orientation
        mSnapshotRotation = (4 - android.os.SystemProperties.getInt("ro.sf.hwrotation",0) / 90) % 4;
        if (mSnapshotRotation == Surface.ROTATION_0 || mSnapshotRotation == Surface.ROTATION_180) {
            if (originalRotation == Surface.ROTATION_90
                || originalRotation == Surface.ROTATION_270) {
                mWidth = originalHeight;
@@ -74,7 +76,16 @@ class ScreenRotationAnimation {
                mWidth = originalWidth;
                mHeight = originalHeight;
            }

        } else {
            if (originalRotation == Surface.ROTATION_90
                || originalRotation == Surface.ROTATION_270) {
                mWidth = originalWidth;
                mHeight = originalHeight;
            } else {
                mWidth = originalHeight;
                mHeight = originalWidth;
            }
        }
        mOriginalRotation = originalRotation;
        mOriginalWidth = originalWidth;
        mOriginalHeight = originalHeight;
+3 −0
Original line number Diff line number Diff line
@@ -5133,6 +5133,9 @@ public class WindowManagerService extends IWindowManager.Stub

            // The screenshot API does not apply the current screen rotation.
            rot = mDisplay.getRotation();
            // Allow for abnormal hardware orientation
            rot = (rot + (android.os.SystemProperties.getInt("ro.sf.hwrotation",0) / 90 )) % 4;

            int fw = frame.width();
            int fh = frame.height();

+1 −2
Original line number Diff line number Diff line
@@ -14,8 +14,7 @@ LOCAL_SRC_FILES:= \
    MessageQueue.cpp 						\
    SurfaceFlinger.cpp 						\
    SurfaceTextureLayer.cpp 				\
    Transform.cpp 							\
    
    Transform.cpp

LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES