Loading core/java/android/hardware/contexthub/HubEndpoint.java +14 −30 Original line number Diff line number Diff line Loading @@ -122,16 +122,11 @@ public class HubEndpoint { HubEndpointInfo initiator, @Nullable String serviceDescriptor) throws RemoteException { boolean sessionExists; synchronized (mLock) { sessionExists = mActiveSessions.contains(sessionId); // TODO(b/378974199): Consider refactor these assertions boolean sessionExists = getActiveSession(sessionId) != null; if (sessionExists) { Log.w( TAG, "onSessionOpenComplete: session already exists, id=" + sessionId); } "onSessionOpenComplete: session already exists, id=" + sessionId); } if (!sessionExists && mLifecycleCallback != null) { Loading @@ -150,13 +145,7 @@ public class HubEndpoint { @Override public void onSessionOpenComplete(int sessionId) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } // TODO(b/378974199): Consider refactor these assertions final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w( TAG, Loading @@ -179,13 +168,7 @@ public class HubEndpoint { @Override public void onSessionClosed(int sessionId, int reason) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } // TODO(b/378974199): Consider refactor these assertions final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w(TAG, "onSessionClosed: session not active, id=" + sessionId); } Loading @@ -211,12 +194,7 @@ public class HubEndpoint { @Override public void onMessageReceived(int sessionId, HubMessage message) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w(TAG, "onMessageReceived: session not active, id=" + sessionId); } Loading @@ -233,6 +211,12 @@ public class HubEndpoint { } } private HubEndpointSession getActiveSession(int sessionId) { synchronized (mLock) { return mActiveSessions.get(sessionId); } } private void sendMessageDeliveryStatus( int sessionId, HubMessage message, byte errorCode) { if (message.isResponseRequired()) { Loading Loading
core/java/android/hardware/contexthub/HubEndpoint.java +14 −30 Original line number Diff line number Diff line Loading @@ -122,16 +122,11 @@ public class HubEndpoint { HubEndpointInfo initiator, @Nullable String serviceDescriptor) throws RemoteException { boolean sessionExists; synchronized (mLock) { sessionExists = mActiveSessions.contains(sessionId); // TODO(b/378974199): Consider refactor these assertions boolean sessionExists = getActiveSession(sessionId) != null; if (sessionExists) { Log.w( TAG, "onSessionOpenComplete: session already exists, id=" + sessionId); } "onSessionOpenComplete: session already exists, id=" + sessionId); } if (!sessionExists && mLifecycleCallback != null) { Loading @@ -150,13 +145,7 @@ public class HubEndpoint { @Override public void onSessionOpenComplete(int sessionId) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } // TODO(b/378974199): Consider refactor these assertions final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w( TAG, Loading @@ -179,13 +168,7 @@ public class HubEndpoint { @Override public void onSessionClosed(int sessionId, int reason) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } // TODO(b/378974199): Consider refactor these assertions final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w(TAG, "onSessionClosed: session not active, id=" + sessionId); } Loading @@ -211,12 +194,7 @@ public class HubEndpoint { @Override public void onMessageReceived(int sessionId, HubMessage message) throws RemoteException { final HubEndpointSession activeSession; // Retrieve the active session synchronized (mLock) { activeSession = mActiveSessions.get(sessionId); } final HubEndpointSession activeSession = getActiveSession(sessionId); if (activeSession == null) { Log.w(TAG, "onMessageReceived: session not active, id=" + sessionId); } Loading @@ -233,6 +211,12 @@ public class HubEndpoint { } } private HubEndpointSession getActiveSession(int sessionId) { synchronized (mLock) { return mActiveSessions.get(sessionId); } } private void sendMessageDeliveryStatus( int sessionId, HubMessage message, byte errorCode) { if (message.isResponseRequired()) { Loading