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

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

Merge "Update AidlContextHubWrapper methods"

parents 8b84813b 23d05c31
Loading
Loading
Loading
Loading
+37 −14
Original line number Diff line number Diff line
@@ -453,8 +453,13 @@ public abstract class IContextHubWrapper {
        public int sendMessageToContextHub(
                short hostEndpointId, int contextHubId, NanoAppMessage message)
                throws RemoteException {
            return toTransactionResult(mHub.sendMessageToHub(contextHubId,
                    ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message)));
            try {
                mHub.sendMessageToHub(contextHubId,
                        ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message));
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        @ContextHubTransaction.Result
@@ -462,31 +467,55 @@ public abstract class IContextHubWrapper {
                int transactionId) throws RemoteException {
            android.hardware.contexthub.NanoappBinary aidlNanoAppBinary =
                    ContextHubServiceUtil.createAidlNanoAppBinary(binary);
            return toTransactionResult(
                    mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId));
            try {
                mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId);
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        @ContextHubTransaction.Result
        public int unloadNanoapp(int contextHubId, long nanoappId, int transactionId)
                throws RemoteException {
            return toTransactionResult(mHub.unloadNanoapp(contextHubId, nanoappId, transactionId));
            try {
                mHub.unloadNanoapp(contextHubId, nanoappId, transactionId);
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        @ContextHubTransaction.Result
        public int enableNanoapp(int contextHubId, long nanoappId, int transactionId)
                throws RemoteException {
            return toTransactionResult(mHub.enableNanoapp(contextHubId, nanoappId, transactionId));
            try {
                mHub.enableNanoapp(contextHubId, nanoappId, transactionId);
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        @ContextHubTransaction.Result
        public int disableNanoapp(int contextHubId, long nanoappId, int transactionId)
                throws RemoteException {
            return toTransactionResult(mHub.disableNanoapp(contextHubId, nanoappId, transactionId));
            try {
                mHub.disableNanoapp(contextHubId, nanoappId, transactionId);
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        @ContextHubTransaction.Result
        public int queryNanoapps(int contextHubId) throws RemoteException {
            return toTransactionResult(mHub.queryNanoapps(contextHubId));
            try {
                mHub.queryNanoapps(contextHubId);
                return ContextHubTransaction.RESULT_SUCCESS;
            } catch (RemoteException e) {
                return ContextHubTransaction.RESULT_FAILED_UNKNOWN;
            }
        }

        public void registerCallback(int contextHubId, ICallback callback) throws RemoteException {
@@ -494,12 +523,6 @@ public abstract class IContextHubWrapper {
            mHub.registerCallback(contextHubId, mAidlCallbackMap.get(contextHubId));
        }

        @ContextHubTransaction.Result
        private int toTransactionResult(boolean success) {
            return success ? ContextHubTransaction.RESULT_SUCCESS
                    : ContextHubTransaction.RESULT_FAILED_UNKNOWN;
        }

        private void onSettingChanged(byte setting, boolean enabled) {
            try {
                mHub.onSettingChanged(setting, enabled);