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

Commit 26b733d9 authored by Sashidhar Ganiga's avatar Sashidhar Ganiga Committed by Steve Kondik
Browse files

frameworks/base: synchronize surface control object access.

Protect surface control object access with lock to avoid
synchronization issues.

CRs-Fixed: 854205
Change-Id: I497d4533a88e5665159aa5d728ed392d2d5c5e32
parent 48eda689
Loading
Loading
Loading
Loading
+30 −26
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class ScreenRotationAnimation {
    final Context mContext;
    final DisplayContent mDisplayContent;
    SurfaceControl mSurfaceControl;
    final Object mLock = new Object();
    BlackFrame mCustomBlackFrame;
    BlackFrame mExitingBlackFrame;
    BlackFrame mEnteringBlackFrame;
@@ -323,6 +324,7 @@ class ScreenRotationAnimation {
    }

    private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) {
        synchronized(mLock) {
            if (mSurfaceControl != null) {
                matrix.getValues(mTmpFloats);
                float x = mTmpFloats[Matrix.MTRANS_X];
@@ -348,6 +350,7 @@ class ScreenRotationAnimation {
                }
            }
        }
    }

    public static void createRotationMatrix(int rotation, int width, int height,
            Matrix outMatrix) {
@@ -1048,15 +1051,16 @@ class ScreenRotationAnimation {
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case SCREENSHOT_FREEZE_TIMEOUT: {
                     synchronized(mLock) {
                         if ((mSurfaceControl != null) && (isAnimating())) {
                             Slog.e(TAG, "Exceeded Freeze timeout. Destroy layers");
                             kill();
                         } else if (mSurfaceControl != null){
                        Slog.e(TAG,
                          "No animation, exceeded freeze timeout. Destroy Screenshot layer");
                             Slog.e(TAG,"No animation, exceeded freeze timeout. Destroy Screenshot layer");
                             mSurfaceControl.destroy();
                             mSurfaceControl = null;
                         }
                     }
                     break;
                }
                default: