Loading services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +16 −11 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.os.HandlerThread; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.util.Log; import android.util.Log; import android.util.Pair; import android.util.Pair; Loading Loading @@ -435,7 +436,7 @@ public abstract class IContextHubWrapper { public void onHostEndpointConnected(HostEndpointInfo info) { public void onHostEndpointConnected(HostEndpointInfo info) { try { try { mHub.onHostEndpointConnected(info); mHub.onHostEndpointConnected(info); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException in onHostEndpointConnected"); Log.e(TAG, "RemoteException in onHostEndpointConnected"); } } } } Loading @@ -444,7 +445,7 @@ public abstract class IContextHubWrapper { public void onHostEndpointDisconnected(short hostEndpointId) { public void onHostEndpointDisconnected(short hostEndpointId) { try { try { mHub.onHostEndpointDisconnected((char) hostEndpointId); mHub.onHostEndpointDisconnected((char) hostEndpointId); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException in onHostEndpointDisconnected"); Log.e(TAG, "RemoteException in onHostEndpointDisconnected"); } } } } Loading @@ -457,7 +458,7 @@ public abstract class IContextHubWrapper { mHub.sendMessageToHub(contextHubId, mHub.sendMessageToHub(contextHubId, ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message)); ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message)); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -470,7 +471,7 @@ public abstract class IContextHubWrapper { try { try { mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId); mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -481,7 +482,7 @@ public abstract class IContextHubWrapper { try { try { mHub.unloadNanoapp(contextHubId, nanoappId, transactionId); mHub.unloadNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -492,7 +493,7 @@ public abstract class IContextHubWrapper { try { try { mHub.enableNanoapp(contextHubId, nanoappId, transactionId); mHub.enableNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -503,7 +504,7 @@ public abstract class IContextHubWrapper { try { try { mHub.disableNanoapp(contextHubId, nanoappId, transactionId); mHub.disableNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -513,21 +514,25 @@ public abstract class IContextHubWrapper { try { try { mHub.queryNanoapps(contextHubId); mHub.queryNanoapps(contextHubId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } public void registerCallback(int contextHubId, ICallback callback) throws RemoteException { public void registerCallback(int contextHubId, ICallback callback) throws RemoteException { mAidlCallbackMap.put(contextHubId, new ContextHubAidlCallback(contextHubId, callback)); mAidlCallbackMap.put(contextHubId, new ContextHubAidlCallback(contextHubId, callback)); try { mHub.registerCallback(contextHubId, mAidlCallbackMap.get(contextHubId)); mHub.registerCallback(contextHubId, mAidlCallbackMap.get(contextHubId)); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Exception while registering callback: " + e.getMessage()); } } } private void onSettingChanged(byte setting, boolean enabled) { private void onSettingChanged(byte setting, boolean enabled) { try { try { mHub.onSettingChanged(setting, enabled); mHub.onSettingChanged(setting, enabled); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException while sending setting update"); Log.e(TAG, "Exception while sending setting update: " + e.getMessage()); } } } } } } Loading Loading
services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +16 −11 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.os.HandlerThread; import android.os.Process; import android.os.Process; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.util.Log; import android.util.Log; import android.util.Pair; import android.util.Pair; Loading Loading @@ -435,7 +436,7 @@ public abstract class IContextHubWrapper { public void onHostEndpointConnected(HostEndpointInfo info) { public void onHostEndpointConnected(HostEndpointInfo info) { try { try { mHub.onHostEndpointConnected(info); mHub.onHostEndpointConnected(info); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException in onHostEndpointConnected"); Log.e(TAG, "RemoteException in onHostEndpointConnected"); } } } } Loading @@ -444,7 +445,7 @@ public abstract class IContextHubWrapper { public void onHostEndpointDisconnected(short hostEndpointId) { public void onHostEndpointDisconnected(short hostEndpointId) { try { try { mHub.onHostEndpointDisconnected((char) hostEndpointId); mHub.onHostEndpointDisconnected((char) hostEndpointId); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException in onHostEndpointDisconnected"); Log.e(TAG, "RemoteException in onHostEndpointDisconnected"); } } } } Loading @@ -457,7 +458,7 @@ public abstract class IContextHubWrapper { mHub.sendMessageToHub(contextHubId, mHub.sendMessageToHub(contextHubId, ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message)); ContextHubServiceUtil.createAidlContextHubMessage(hostEndpointId, message)); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -470,7 +471,7 @@ public abstract class IContextHubWrapper { try { try { mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId); mHub.loadNanoapp(contextHubId, aidlNanoAppBinary, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -481,7 +482,7 @@ public abstract class IContextHubWrapper { try { try { mHub.unloadNanoapp(contextHubId, nanoappId, transactionId); mHub.unloadNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -492,7 +493,7 @@ public abstract class IContextHubWrapper { try { try { mHub.enableNanoapp(contextHubId, nanoappId, transactionId); mHub.enableNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -503,7 +504,7 @@ public abstract class IContextHubWrapper { try { try { mHub.disableNanoapp(contextHubId, nanoappId, transactionId); mHub.disableNanoapp(contextHubId, nanoappId, transactionId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } Loading @@ -513,21 +514,25 @@ public abstract class IContextHubWrapper { try { try { mHub.queryNanoapps(contextHubId); mHub.queryNanoapps(contextHubId); return ContextHubTransaction.RESULT_SUCCESS; return ContextHubTransaction.RESULT_SUCCESS; } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { return ContextHubTransaction.RESULT_FAILED_UNKNOWN; return ContextHubTransaction.RESULT_FAILED_UNKNOWN; } } } } public void registerCallback(int contextHubId, ICallback callback) throws RemoteException { public void registerCallback(int contextHubId, ICallback callback) throws RemoteException { mAidlCallbackMap.put(contextHubId, new ContextHubAidlCallback(contextHubId, callback)); mAidlCallbackMap.put(contextHubId, new ContextHubAidlCallback(contextHubId, callback)); try { mHub.registerCallback(contextHubId, mAidlCallbackMap.get(contextHubId)); mHub.registerCallback(contextHubId, mAidlCallbackMap.get(contextHubId)); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Exception while registering callback: " + e.getMessage()); } } } private void onSettingChanged(byte setting, boolean enabled) { private void onSettingChanged(byte setting, boolean enabled) { try { try { mHub.onSettingChanged(setting, enabled); mHub.onSettingChanged(setting, enabled); } catch (RemoteException e) { } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "RemoteException while sending setting update"); Log.e(TAG, "Exception while sending setting update: " + e.getMessage()); } } } } } } Loading