Loading android/app/src/com/android/bluetooth/gatt/ContextMap.java +47 −34 Original line number Diff line number Diff line Loading @@ -172,10 +172,10 @@ import java.util.UUID; private List<App> mApps = new ArrayList<App>(); /** Internal map to keep track of logging information by app name */ HashMap<Integer, AppScanStats> mAppScanStats = new HashMap<Integer, AppScanStats>(); private HashMap<Integer, AppScanStats> mAppScanStats = new HashMap<Integer, AppScanStats>(); /** Internal list of connected devices **/ Set<Connection> mConnections = new HashSet<Connection>(); private Set<Connection> mConnections = new HashSet<Connection>(); /** * Add an entry to the application context list. Loading Loading @@ -281,6 +281,7 @@ import java.util.UUID; * Remove all connections for a given application ID. */ void removeConnectionsByAppId(int appId) { synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -289,6 +290,7 @@ import java.util.UUID; } } } } /** * Get an application context by ID. Loading Loading @@ -381,11 +383,13 @@ import java.util.UUID; */ Set<String> getConnectedDevices() { Set<String> addresses = new HashSet<String>(); synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); addresses.add(connection.address); } } return addresses; } Loading @@ -393,6 +397,7 @@ import java.util.UUID; * Get an application context by a connection ID. */ App getByConnId(int connId) { synchronized (mConnections) { Iterator<Connection> ii = mConnections.iterator(); while (ii.hasNext()) { Connection connection = ii.next(); Loading @@ -400,6 +405,7 @@ import java.util.UUID; return getById(connection.appId); } } } return null; } Loading @@ -411,7 +417,7 @@ import java.util.UUID; if (entry == null) { return null; } synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -419,6 +425,7 @@ import java.util.UUID; return connection.connId; } } } return null; } Loading @@ -426,6 +433,7 @@ import java.util.UUID; * Returns the device address for a given connection ID. */ String addressByConnId(int connId) { synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -433,11 +441,13 @@ import java.util.UUID; return connection.address; } } } return null; } List<Connection> getConnectionByApp(int appId) { List<Connection> currentConnections = new ArrayList<Connection>(); synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -445,6 +455,7 @@ import java.util.UUID; currentConnections.add(connection); } } } return currentConnections; } Loading Loading @@ -472,9 +483,11 @@ import java.util.UUID; */ Map<Integer, String> getConnectedMap() { Map<Integer, String> connectedmap = new HashMap<Integer, String>(); synchronized (mConnections) { for (Connection conn : mConnections) { connectedmap.put(conn.appId, conn.address); } } return connectedmap; } Loading Loading
android/app/src/com/android/bluetooth/gatt/ContextMap.java +47 −34 Original line number Diff line number Diff line Loading @@ -172,10 +172,10 @@ import java.util.UUID; private List<App> mApps = new ArrayList<App>(); /** Internal map to keep track of logging information by app name */ HashMap<Integer, AppScanStats> mAppScanStats = new HashMap<Integer, AppScanStats>(); private HashMap<Integer, AppScanStats> mAppScanStats = new HashMap<Integer, AppScanStats>(); /** Internal list of connected devices **/ Set<Connection> mConnections = new HashSet<Connection>(); private Set<Connection> mConnections = new HashSet<Connection>(); /** * Add an entry to the application context list. Loading Loading @@ -281,6 +281,7 @@ import java.util.UUID; * Remove all connections for a given application ID. */ void removeConnectionsByAppId(int appId) { synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -289,6 +290,7 @@ import java.util.UUID; } } } } /** * Get an application context by ID. Loading Loading @@ -381,11 +383,13 @@ import java.util.UUID; */ Set<String> getConnectedDevices() { Set<String> addresses = new HashSet<String>(); synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); addresses.add(connection.address); } } return addresses; } Loading @@ -393,6 +397,7 @@ import java.util.UUID; * Get an application context by a connection ID. */ App getByConnId(int connId) { synchronized (mConnections) { Iterator<Connection> ii = mConnections.iterator(); while (ii.hasNext()) { Connection connection = ii.next(); Loading @@ -400,6 +405,7 @@ import java.util.UUID; return getById(connection.appId); } } } return null; } Loading @@ -411,7 +417,7 @@ import java.util.UUID; if (entry == null) { return null; } synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -419,6 +425,7 @@ import java.util.UUID; return connection.connId; } } } return null; } Loading @@ -426,6 +433,7 @@ import java.util.UUID; * Returns the device address for a given connection ID. */ String addressByConnId(int connId) { synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -433,11 +441,13 @@ import java.util.UUID; return connection.address; } } } return null; } List<Connection> getConnectionByApp(int appId) { List<Connection> currentConnections = new ArrayList<Connection>(); synchronized (mConnections) { Iterator<Connection> i = mConnections.iterator(); while (i.hasNext()) { Connection connection = i.next(); Loading @@ -445,6 +455,7 @@ import java.util.UUID; currentConnections.add(connection); } } } return currentConnections; } Loading Loading @@ -472,9 +483,11 @@ import java.util.UUID; */ Map<Integer, String> getConnectedMap() { Map<Integer, String> connectedmap = new HashMap<Integer, String>(); synchronized (mConnections) { for (Connection conn : mConnections) { connectedmap.put(conn.appId, conn.address); } } return connectedmap; } Loading