Loading services/core/java/com/android/server/location/contexthub/ContextHubService.java +14 −8 Original line number Diff line number Diff line Loading @@ -1148,7 +1148,7 @@ public class ContextHubService extends IContextHubService.Stub { super.getPreloadedNanoAppIds_enforcePermission(); Objects.requireNonNull(hubInfo, "hubInfo cannot be null"); long[] nanoappIds = mContextHubWrapper.getPreloadedNanoappIds(); long[] nanoappIds = mContextHubWrapper.getPreloadedNanoappIds(hubInfo.getId()); if (nanoappIds == null) { return new long[0]; } Loading Loading @@ -1261,15 +1261,21 @@ public class ContextHubService extends IContextHubService.Stub { return; } long[] preloadedNanoappIds = mContextHubWrapper.getPreloadedNanoappIds(); for (int contextHubId: mContextHubIdToInfoMap.keySet()) { long[] preloadedNanoappIds = mContextHubWrapper.getPreloadedNanoappIds(contextHubId); if (preloadedNanoappIds == null) { return; } pw.print("Context Hub (id="); pw.print(contextHubId); pw.println("):"); for (long preloadedNanoappId : preloadedNanoappIds) { pw.print(" ID: 0x"); pw.println(Long.toHexString(preloadedNanoappId)); } } } private void checkPermissions() { ContextHubServiceUtil.checkPermissions(mContext); Loading services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +7 −5 Original line number Diff line number Diff line Loading @@ -363,9 +363,11 @@ public abstract class IContextHubWrapper { * Provides the list of preloaded nanoapp IDs on the system. The output of this API must * not change. * * @return The list of preloaded nanoapp IDs * @param contextHubId The context Hub ID. * * @return The list of preloaded nanoapp IDs. */ public abstract long[] getPreloadedNanoappIds(); public abstract long[] getPreloadedNanoappIds(int contextHubId); /** * Registers a callback with the Context Hub. Loading Loading @@ -714,14 +716,14 @@ public abstract class IContextHubWrapper { } } public long[] getPreloadedNanoappIds() { public long[] getPreloadedNanoappIds(int contextHubId) { android.hardware.contexthub.IContextHub hub = getHub(); if (hub == null) { return null; } try { return hub.getPreloadedNanoappIds(); return hub.getPreloadedNanoappIds(contextHubId); } catch (RemoteException e) { Log.e(TAG, "Exception while getting preloaded nanoapp IDs: " + e.getMessage()); return null; Loading Loading @@ -924,7 +926,7 @@ public abstract class IContextHubWrapper { mHub.queryApps(contextHubId)); } public long[] getPreloadedNanoappIds() { public long[] getPreloadedNanoappIds(int contextHubId) { return new long[0]; } Loading services/tests/servicestests/src/com/android/server/location/contexthub/ContextHubServiceTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ package com.android.server.location.contexthub; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -75,7 +76,7 @@ public class ContextHubServiceTest { @Test public void testDump_emptyPreloadedNanoappList() { when(mMockContextHubWrapper.getPreloadedNanoappIds()).thenReturn(null); when(mMockContextHubWrapper.getPreloadedNanoappIds(anyInt())).thenReturn(null); StringWriter stringWriter = new StringWriter(); ContextHubService service = new ContextHubService(mContext, mMockContextHubWrapper); Loading Loading
services/core/java/com/android/server/location/contexthub/ContextHubService.java +14 −8 Original line number Diff line number Diff line Loading @@ -1148,7 +1148,7 @@ public class ContextHubService extends IContextHubService.Stub { super.getPreloadedNanoAppIds_enforcePermission(); Objects.requireNonNull(hubInfo, "hubInfo cannot be null"); long[] nanoappIds = mContextHubWrapper.getPreloadedNanoappIds(); long[] nanoappIds = mContextHubWrapper.getPreloadedNanoappIds(hubInfo.getId()); if (nanoappIds == null) { return new long[0]; } Loading Loading @@ -1261,15 +1261,21 @@ public class ContextHubService extends IContextHubService.Stub { return; } long[] preloadedNanoappIds = mContextHubWrapper.getPreloadedNanoappIds(); for (int contextHubId: mContextHubIdToInfoMap.keySet()) { long[] preloadedNanoappIds = mContextHubWrapper.getPreloadedNanoappIds(contextHubId); if (preloadedNanoappIds == null) { return; } pw.print("Context Hub (id="); pw.print(contextHubId); pw.println("):"); for (long preloadedNanoappId : preloadedNanoappIds) { pw.print(" ID: 0x"); pw.println(Long.toHexString(preloadedNanoappId)); } } } private void checkPermissions() { ContextHubServiceUtil.checkPermissions(mContext); Loading
services/core/java/com/android/server/location/contexthub/IContextHubWrapper.java +7 −5 Original line number Diff line number Diff line Loading @@ -363,9 +363,11 @@ public abstract class IContextHubWrapper { * Provides the list of preloaded nanoapp IDs on the system. The output of this API must * not change. * * @return The list of preloaded nanoapp IDs * @param contextHubId The context Hub ID. * * @return The list of preloaded nanoapp IDs. */ public abstract long[] getPreloadedNanoappIds(); public abstract long[] getPreloadedNanoappIds(int contextHubId); /** * Registers a callback with the Context Hub. Loading Loading @@ -714,14 +716,14 @@ public abstract class IContextHubWrapper { } } public long[] getPreloadedNanoappIds() { public long[] getPreloadedNanoappIds(int contextHubId) { android.hardware.contexthub.IContextHub hub = getHub(); if (hub == null) { return null; } try { return hub.getPreloadedNanoappIds(); return hub.getPreloadedNanoappIds(contextHubId); } catch (RemoteException e) { Log.e(TAG, "Exception while getting preloaded nanoapp IDs: " + e.getMessage()); return null; Loading Loading @@ -924,7 +926,7 @@ public abstract class IContextHubWrapper { mHub.queryApps(contextHubId)); } public long[] getPreloadedNanoappIds() { public long[] getPreloadedNanoappIds(int contextHubId) { return new long[0]; } Loading
services/tests/servicestests/src/com/android/server/location/contexthub/ContextHubServiceTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ package com.android.server.location.contexthub; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -75,7 +76,7 @@ public class ContextHubServiceTest { @Test public void testDump_emptyPreloadedNanoappList() { when(mMockContextHubWrapper.getPreloadedNanoappIds()).thenReturn(null); when(mMockContextHubWrapper.getPreloadedNanoappIds(anyInt())).thenReturn(null); StringWriter stringWriter = new StringWriter(); ContextHubService service = new ContextHubService(mContext, mMockContextHubWrapper); Loading