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

Commit 921c120e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "SnapdragonGallery: Fix anr in PotoPage" into android_ui.lnx.2.1-dev

parents 7d14564f 0351ddfd
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ public abstract class PhotoPage extends ActivityState implements
    private static final int MSG_HIDE_BARS = 1;
    private static final int MSG_ON_FULL_SCREEN_CHANGED = 4;
    private static final int MSG_UPDATE_ACTION_BAR = 5;
    private static final int MSG_UNFREEZE_GLROOT = 6;
    private static final int MSG_WANT_BARS = 7;
    private static final int MSG_REFRESH_BOTTOM_CONTROLS = 8;
    private static final int MSG_ON_CAMERA_CENTER = 9;
@@ -101,7 +100,6 @@ public abstract class PhotoPage extends ActivityState implements
    private static final int MSG_UPDATE_PANORAMA_UI = 16;

    private static final int HIDE_BARS_TIMEOUT = 3500;
    private static final int UNFREEZE_GLROOT_TIMEOUT = 250;

    private static final int REQUEST_SLIDESHOW = 1;
    private static final int REQUEST_CROP = 2;
@@ -321,10 +319,6 @@ public abstract class PhotoPage extends ActivityState implements
                        wantBars();
                        break;
                    }
                    case MSG_UNFREEZE_GLROOT: {
                        mActivity.getGLRoot().unfreeze();
                        break;
                    }
                    case MSG_UPDATE_DEFERRED: {
                        long nextUpdate = mDeferUpdateUntil - SystemClock.uptimeMillis();
                        if (nextUpdate <= 0) {
@@ -1483,8 +1477,6 @@ public abstract class PhotoPage extends ActivityState implements
            toolbar.setLayoutParams(layoutParams);
            toolbar.setPadding(0, originalPadding, 0, 0);
        }
        mActivity.getGLRoot().unfreeze();
        mHandler.removeMessages(MSG_UNFREEZE_GLROOT);
        showFullScreen(false);

        DetailsHelper.pause();
@@ -1519,10 +1511,6 @@ public abstract class PhotoPage extends ActivityState implements
        win.setAttributes(winParams);
    }

    @Override
    public void onCurrentImageUpdated() {
        mActivity.getGLRoot().unfreeze();
    }

    @Override
    public void onFilmModeChanged(boolean enabled) {
@@ -1609,7 +1597,6 @@ public abstract class PhotoPage extends ActivityState implements

        transitionFromAlbumPageIfNeeded();

        mActivity.getGLRoot().freeze();
        Toolbar toolbar = mActivity.getToolbar();
        //set the new height and padding to toolbar
        if (toolbar != null) {
@@ -1652,7 +1639,6 @@ public abstract class PhotoPage extends ActivityState implements
        }

        mRecenterCameraOnResume = true;
        mHandler.sendEmptyMessageDelayed(MSG_UNFREEZE_GLROOT, UNFREEZE_GLROOT_TIMEOUT);
        if (mModel == null) {
            onBackPressed();
            return;
+0 −2
Original line number Diff line number Diff line
@@ -45,8 +45,6 @@ public interface GLRoot {
    public int getDisplayRotation();
    public int getCompensation();
    public Matrix getCompensationMatrix();
    public void freeze();
    public void unfreeze();
    public void setLightsOutMode(boolean enabled);

    public Context getContext();
+0 −58
Original line number Diff line number Diff line
@@ -105,9 +105,6 @@ public class GLRootView extends GLSurfaceView
    private final IdleRunner mIdleRunner = new IdleRunner();

    private final ReentrantLock mRenderLock = new ReentrantLock();
    private final Condition mFreezeCondition =
            mRenderLock.newCondition();
    private boolean mFreeze;

    private long mLastDrawFinishTime;
    private boolean mInDownState = false;
@@ -352,10 +349,6 @@ public class GLRootView extends GLSurfaceView
        }
        mRenderLock.lock();

        while (mFreeze) {
            mFreezeCondition.awaitUninterruptibly();
        }

        try {
            onDrawFrameLocked(gl);
        } finally {
@@ -542,7 +535,6 @@ public class GLRootView extends GLSurfaceView

    @Override
    public void onPause() {
        unfreeze();
        super.onPause();
        if (DEBUG_PROFILE) {
            Log.d(TAG, "Stop profiling");
@@ -572,20 +564,6 @@ public class GLRootView extends GLSurfaceView
        return mCompensationMatrix;
    }

    @Override
    public void freeze() {
        mRenderLock.lock();
        mFreeze = true;
        mRenderLock.unlock();
    }

    @Override
    public void unfreeze() {
        mRenderLock.lock();
        mFreeze = false;
        mFreezeCondition.signalAll();
        mRenderLock.unlock();
    }

    @Override
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@@ -602,40 +580,4 @@ public class GLRootView extends GLSurfaceView
        setSystemUiVisibility(flags);
    }

    // We need to unfreeze in the following methods and in onPause().
    // These methods will wait on GLThread. If we have freezed the GLRootView,
    // the GLThread will wait on main thread to call unfreeze and cause dead
    // lock.
    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
        unfreeze();
        super.surfaceChanged(holder, format, w, h);
    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        unfreeze();
        super.surfaceCreated(holder);
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
        unfreeze();
        super.surfaceDestroyed(holder);
    }

    @Override
    protected void onDetachedFromWindow() {
        unfreeze();
        super.onDetachedFromWindow();
    }

    @Override
    protected void finalize() throws Throwable {
        try {
            unfreeze();
        } finally {
            super.finalize();
        }
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -128,7 +128,6 @@ public class PhotoView extends GLView {
        public void onFullScreenChanged(boolean full);
        public void onActionBarAllowed(boolean allowed);
        public void onActionBarWanted();
        public void onCurrentImageUpdated();
        public void onDeleteImage(Path path, int offset);
        public void onUndoDeleteImage();
        public void onCommitDeleteImage();
@@ -469,9 +468,6 @@ public class PhotoView extends GLView {
    }

    public void notifyImageChange(int index) {
        if (index == 0) {
            mListener.onCurrentImageUpdated();
        }
        mPictures.get(index).reload();
        setPictureSize(index);
        invalidate();