Loading services/core/java/com/android/server/location/ContextHubService.java +7 −7 Original line number Diff line number Diff line Loading @@ -415,10 +415,12 @@ public class ContextHubService extends IContextHubService.Stub { checkPermissions(); ArrayList<Integer> foundInstances = new ArrayList<>(); for (NanoAppInstanceInfo info : mNanoAppStateManager.getNanoAppInstanceInfoCollection()) { if (filter != null) { mNanoAppStateManager.foreachNanoAppInstanceInfo((info) -> { if (filter.testMatch(info)) { foundInstances.add(info.getHandle()); } }); } int[] retArray = new int[foundInstances.size()]; Loading Loading @@ -767,9 +769,7 @@ public class ContextHubService extends IContextHubService.Stub { pw.println(""); pw.println("=================== NANOAPPS ===================="); // Dump nanoAppHash for (NanoAppInstanceInfo info : mNanoAppStateManager.getNanoAppInstanceInfoCollection()) { pw.println(info); } mNanoAppStateManager.foreachNanoAppInstanceInfo((info) -> pw.println(info)); // dump eventLog } Loading services/core/java/com/android/server/location/NanoAppStateManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ import android.hardware.contexthub.V1_0.HubAppInfo; import android.hardware.location.NanoAppInstanceInfo; import android.util.Log; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.function.Consumer; /** * Manages the state of loaded nanoapps at the Context Hubs. Loading Loading @@ -70,11 +70,15 @@ import java.util.List; } /** * @return a collection of NanoAppInstanceInfo objects in the cache * Invokes a Consumer operation for each NanoAppInstanceInfo entry in the cache * * @param consumer the Consumer operation to perform */ /* package */ synchronized Collection<NanoAppInstanceInfo> getNanoAppInstanceInfoCollection() { return mNanoAppHash.values(); synchronized void foreachNanoAppInstanceInfo(Consumer<NanoAppInstanceInfo> consumer) { for (NanoAppInstanceInfo info : mNanoAppHash.values()) { consumer.accept(info); } } /** Loading Loading
services/core/java/com/android/server/location/ContextHubService.java +7 −7 Original line number Diff line number Diff line Loading @@ -415,10 +415,12 @@ public class ContextHubService extends IContextHubService.Stub { checkPermissions(); ArrayList<Integer> foundInstances = new ArrayList<>(); for (NanoAppInstanceInfo info : mNanoAppStateManager.getNanoAppInstanceInfoCollection()) { if (filter != null) { mNanoAppStateManager.foreachNanoAppInstanceInfo((info) -> { if (filter.testMatch(info)) { foundInstances.add(info.getHandle()); } }); } int[] retArray = new int[foundInstances.size()]; Loading Loading @@ -767,9 +769,7 @@ public class ContextHubService extends IContextHubService.Stub { pw.println(""); pw.println("=================== NANOAPPS ===================="); // Dump nanoAppHash for (NanoAppInstanceInfo info : mNanoAppStateManager.getNanoAppInstanceInfoCollection()) { pw.println(info); } mNanoAppStateManager.foreachNanoAppInstanceInfo((info) -> pw.println(info)); // dump eventLog } Loading
services/core/java/com/android/server/location/NanoAppStateManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -21,11 +21,11 @@ import android.hardware.contexthub.V1_0.HubAppInfo; import android.hardware.location.NanoAppInstanceInfo; import android.util.Log; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.function.Consumer; /** * Manages the state of loaded nanoapps at the Context Hubs. Loading Loading @@ -70,11 +70,15 @@ import java.util.List; } /** * @return a collection of NanoAppInstanceInfo objects in the cache * Invokes a Consumer operation for each NanoAppInstanceInfo entry in the cache * * @param consumer the Consumer operation to perform */ /* package */ synchronized Collection<NanoAppInstanceInfo> getNanoAppInstanceInfoCollection() { return mNanoAppHash.values(); synchronized void foreachNanoAppInstanceInfo(Consumer<NanoAppInstanceInfo> consumer) { for (NanoAppInstanceInfo info : mNanoAppHash.values()) { consumer.accept(info); } } /** Loading