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

Commit a5505432 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent deadlock in RollbackManager#getAvailabeRollbacks" into qt-dev

parents 085528db cf968e9d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -239,9 +239,20 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub {
        }, filter, null, getHandler());
    }

    /**
     * This method posts a blocking call to the handler thread, so it should not be called from
     * that same thread.
     * @throws {@link IllegalStateException} if called from {@link #mHandlerThread}
     */
    @Override
    public ParceledListSlice getAvailableRollbacks() {
        enforceManageRollbacks("getAvailableRollbacks");
        if (Thread.currentThread().equals(mHandlerThread)) {
            Log.wtf(TAG, "Calling getAvailableRollbacks from mHandlerThread "
                    + "causes a deadlock");
            throw new IllegalStateException("Cannot call RollbackManager#getAvailableRollbacks "
                    + "from the handler thread!");
        }

        // Wait for the handler thread to get the list of available rollbacks
        // to get the most up-to-date results. This is intended to reduce test