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

Commit 9cbaa81f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Skip error logs when HAL doesn't support new message API" into main

parents e9f9bbf3 a967b764
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -192,9 +192,10 @@ import java.util.function.Consumer;
     * This is separate from the constructor so that this may be passed into the callback registered
     * This is separate from the constructor so that this may be passed into the callback registered
     * with the HAL.
     * with the HAL.
     *
     *
     * @throws InstantiationException on any failure
     * @throws InstantiationException on unexpected failure
     * @throws UnsupportedOperationException if not supported by the HAL
     */
     */
    /* package */ void init() throws InstantiationException {
    /* package */ void init() throws InstantiationException, UnsupportedOperationException {
        if (mSessionIdsValid) {
        if (mSessionIdsValid) {
            throw new IllegalStateException("Already initialized");
            throw new IllegalStateException("Already initialized");
        }
        }
@@ -214,12 +215,11 @@ import java.util.function.Consumer;
            if (mHubInterface == null) {
            if (mHubInterface == null) {
                throw new IllegalStateException("Received null IEndpointCommunication");
                throw new IllegalStateException("Received null IEndpointCommunication");
            }
            }
        } catch (RemoteException | IllegalStateException | ServiceSpecificException
        } catch (RemoteException | IllegalStateException | ServiceSpecificException e) {
                 | UnsupportedOperationException e) {
            String error = "Failed to register ContextHubService as message hub";
            String error = "Failed to register ContextHubService as message hub";
            Log.e(TAG, error, e);
            Log.e(TAG, error, e);
            throw new InstantiationException(error);
            throw new InstantiationException(error);
        }
        }  // Forward UnsupportedOperationException to caller


        int[] range = null;
        int[] range = null;
        try {
        try {
+6 −4
Original line number Original line Diff line number Diff line
@@ -342,17 +342,19 @@ public class ContextHubService extends IContextHubService.Stub {
                        new ContextHubEndpointManager(
                        new ContextHubEndpointManager(
                                mContext, mContextHubWrapper, registry, mTransactionManager);
                                mContext, mContextHubWrapper, registry, mTransactionManager);
                mEndpointManager.init();
                mEndpointManager.init();
                Log.i(TAG, "Enabling generic offload API");
                Log.d(TAG, "Enabling generic offload API");
            } catch (InstantiationException e) {
            } catch (InstantiationException | UnsupportedOperationException e) {
                mEndpointManager = null;
                mEndpointManager = null;
                registry = null;
                registry = null;
                Log.w(TAG, "Generic offload API not supported, disabling");
                if (e instanceof UnsupportedOperationException) {
                    Log.d(TAG, "Generic offload API not supported by HAL");
                }
            }
            }
            mHubInfoRegistry = registry;
            mHubInfoRegistry = registry;
        } else {
        } else {
            mHubInfoRegistry = null;
            mHubInfoRegistry = null;
            mEndpointManager = null;
            mEndpointManager = null;
            Log.i(TAG, "Disabling generic offload API");
            Log.d(TAG, "Disabling generic offload API due to flag config");
        }
        }


        initDefaultClientMap();
        initDefaultClientMap();