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

Commit 635eeb22 authored by Presubmit Automerger Backend's avatar Presubmit Automerger Backend
Browse files

[automerge] DO NOT MERGE Transform UDFPS touch coordinates to portrait mode 2p: a9e20f2f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16709489

Bug: 215810673
Change-Id: I2a02ae0478cb9e547d82c497fce5fb9480835f9f
parents 0dc942c4 a9e20f2f
Loading
Loading
Loading
Loading
+27 −2
Original line number Diff line number Diff line
@@ -480,8 +480,33 @@ public class UdfpsController implements DozeReceiver {
                        final long sinceLastLog = mSystemClock.elapsedRealtime() - mTouchLogTime;
                        if (!isIlluminationRequested && !mGoodCaptureReceived &&
                                !exceedsVelocityThreshold) {
                            onFingerDown((int) event.getRawX(), (int) event.getRawY(), minor,
                                    major);
                            final int rawX = (int) event.getRawX();
                            final int rawY = (int) event.getRawY();
                            // Default coordinates assume portrait mode.
                            int x = rawX;
                            int y = rawY;

                            // Gets the size based on the current rotation of the display.
                            Point p = new Point();
                            mContext.getDisplay().getRealSize(p);

                            // Transform x, y to portrait mode if the device is in landscape mode.
                            switch (mContext.getDisplay().getRotation()) {
                                case Surface.ROTATION_90:
                                    x = p.y - rawY;
                                    y = rawX;
                                    break;

                                case Surface.ROTATION_270:
                                    x = rawY;
                                    y = p.x - rawX;
                                    break;

                                default:
                                    // Do nothing to stay in portrait mode.
                            }

                            onFingerDown(x, y, minor, major);
                            Log.v(TAG, "onTouch | finger down: " + touchInfo);
                            mTouchLogTime = mSystemClock.elapsedRealtime();
                            mPowerManager.userActivity(mSystemClock.uptimeMillis(),