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

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

Make multiple ContextHubTransaction.setResponse calls non-fatal

It is not necessary to fatally error when this error case happens, so make it a LOGE and early return instead.

Bug: 433459445
Flag: EXEMPT bug fix
Test: CHQTS pass
Change-Id: I6a0a5fb00b94e2000af851c05e0d21320b3c6eef
parent b9484606
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.SystemApi;
import android.chre.flags.Flags;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.util.Log;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -360,7 +361,6 @@ public class ContextHubTransaction<T> {
     * invoked more than once.
     *
     * @param response the response to set
     * @throws IllegalStateException if this method is invoked multiple times
     * @throws NullPointerException if the response is null
     * @hide
     */
@@ -368,8 +368,8 @@ public class ContextHubTransaction<T> {
        synchronized (this) {
            Objects.requireNonNull(response, "Response cannot be null");
            if (mIsResponseSet) {
                throw new IllegalStateException(
                        "Cannot set response of ContextHubTransaction multiple times");
              Log.e(TAG, "Cannot set response of ContextHubTransaction multiple times");
              return;
            }

            mResponse = response;