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

Commit a967b764 authored by Brian Duddie's avatar Brian Duddie
Browse files

Skip error logs when HAL doesn't support new message API

Fixes: 405104799
Flag: EXEMPT bugfix
Test: presubmit
Change-Id: Icf17df1a031ecf8ea06b03cc3e386b289b72cefd
parent ea21800b
Loading
Loading
Loading
Loading
+5 −5
Original line number 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
     * 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) {
            throw new IllegalStateException("Already initialized");
        }
@@ -214,12 +215,11 @@ import java.util.function.Consumer;
            if (mHubInterface == null) {
                throw new IllegalStateException("Received null IEndpointCommunication");
            }
        } catch (RemoteException | IllegalStateException | ServiceSpecificException
                 | UnsupportedOperationException e) {
        } catch (RemoteException | IllegalStateException | ServiceSpecificException e) {
            String error = "Failed to register ContextHubService as message hub";
            Log.e(TAG, error, e);
            throw new InstantiationException(error);
        }
        }  // Forward UnsupportedOperationException to caller

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

        initDefaultClientMap();