Merge "Pass the context hub ID to getPreloadedNanoappIds in the Context Hub service" into udc-dev am: 479af59315
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21793409 Change-Id: Ic7d959e92dff355b43ad8bc24be8025b07f9a554 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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];
|
||||
}
|
||||
@@ -1261,13 +1261,19 @@ public class ContextHubService extends IContextHubService.Stub {
|
||||
return;
|
||||
}
|
||||
|
||||
long[] preloadedNanoappIds = mContextHubWrapper.getPreloadedNanoappIds();
|
||||
if (preloadedNanoappIds == null) {
|
||||
return;
|
||||
}
|
||||
for (long preloadedNanoappId : preloadedNanoappIds) {
|
||||
pw.print("ID: 0x");
|
||||
pw.println(Long.toHexString(preloadedNanoappId));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
@@ -924,7 +926,7 @@ public abstract class IContextHubWrapper {
|
||||
mHub.queryApps(contextHubId));
|
||||
}
|
||||
|
||||
public long[] getPreloadedNanoappIds() {
|
||||
public long[] getPreloadedNanoappIds(int contextHubId) {
|
||||
return new long[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user