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

Commit db70d6ac authored by kaiyiz's avatar kaiyiz
Browse files

Magnification: Fix screen freeze after activity resumes from rotation

mMagnifedViewport.onRotationChangedLocked() will call setShown(),
and then cancel a anime. As the anime should be only canceled in
a looper, if it is executed in the onRotationChangedLocked() of
DisplayMagnifier, a crash will be caused. Therefore when the
magnification is enabled, the activity will crash after rotation.

Move mMagnifedViewport.onRotationChangedLocked() from main thread
into the handler. When MESSAGE_NOTIFY_ROTATION_CHANGED is received,
execute it. As handler is created with a looper, the crash will be
fixed.

CRs-Fixed: 541799

Change-Id: I2a78f24f73d5a9b8693e557d18e2fb01fcaec8fa
parent 2f0cab58
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ final class DisplayMagnifier {
            Slog.i(LOG_TAG, "Rotaton: " + Surface.rotationToString(rotation)
                    + " displayId: " + displayContent.getDisplayId());
        }
        mMagnifedViewport.onRotationChangedLocked();
        mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_ROTATION_CHANGED);
    }

@@ -736,6 +735,8 @@ final class DisplayMagnifier {
                } break;
                case MESSAGE_NOTIFY_ROTATION_CHANGED: {
                    final int rotation = message.arg1;

                    mMagnifedViewport.onRotationChangedLocked();
                    try {
                        mCallbacks.onRotationChanged(rotation);
                    } catch (RemoteException re) {