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

Commit c9c15817 authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Reorder operations in ContextHubEndpointBroker#onHalRestart.

Since it's possible for a client to attempt re-opening a session on session closure, update the interface prior to sending the close event.

Bug: 443346395
Flag: EXEMPT bug fix
Test: Presubmits
Change-Id: I43caa9342568f7fc5b1c3ed0156c6d4114a5e78f
parent 78b656af
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -648,12 +648,6 @@ public class ContextHubEndpointBroker extends IContextHubEndpoint.Stub
     * @param hubInterface The new interface to the Context Hub HAL.
     * @param hubInterface The new interface to the Context Hub HAL.
     */
     */
    /* package */ void onHalRestart(@NonNull IEndpointCommunication hubInterface) {
    /* package */ void onHalRestart(@NonNull IEndpointCommunication hubInterface) {
        synchronized (mOpenSessionLock) {
            for (int i = mSessionMap.size() - 1; i >= 0; i--) {
                int id = mSessionMap.keyAt(i);
                onCloseEndpointSession(id, Reason.HUB_RESET);
            }
        }
        synchronized (mRegistrationLock) {
        synchronized (mRegistrationLock) {
            if (mIsRegistered) {
            if (mIsRegistered) {
                mIsRegistered = false;
                mIsRegistered = false;
@@ -665,6 +659,12 @@ public class ContextHubEndpointBroker extends IContextHubEndpoint.Stub
                }
                }
            }
            }
        }
        }
        synchronized (mOpenSessionLock) {
            for (int i = mSessionMap.size() - 1; i >= 0; i--) {
                int id = mSessionMap.keyAt(i);
                onCloseEndpointSession(id, Reason.HUB_RESET);
            }
        }
    }
    }


    /* package */ Optional<Byte> onEndpointSessionOpenRequest(
    /* package */ Optional<Byte> onEndpointSessionOpenRequest(