Adds a test API to get the list of preloaded nanoapp

Required to run validation tests to check device capability
needed to run the preloaded nanoapps.

Bug: 258074235
Test: make update-api
Change-Id: Id39d9f0ee3e73bbd00e31fa03a4d626938d49f5a
This commit is contained in:
Arthur Ishiguro
2022-11-08 01:45:57 +00:00
committed by Matthew Sedam
parent c92cb1ebb4
commit afcd38fe12
2 changed files with 37 additions and 0 deletions

View File

@@ -1312,6 +1312,14 @@ package android.hardware.lights {
}
package android.hardware.location {
public final class ContextHubManager {
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) public long[] getPreloadedNanoAppIds(@NonNull android.hardware.location.ContextHubInfo);
}
}
package android.hardware.soundtrigger {
public class KeyphraseEnrollmentInfo {

View File

@@ -24,6 +24,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.app.PendingIntent;
import android.content.Context;
@@ -965,6 +966,34 @@ public final class ContextHubManager {
return createClient(null /* context */, hubInfo, pendingIntent, nanoAppId);
}
/**
* Queries for the list of preloaded nanoapp IDs on the system.
*
* @param hubInfo The Context Hub to query a list of nanoapp IDs from.
*
* @return The list of 64-bit IDs of the preloaded nanoapps.
*
* @throws NullPointerException if hubInfo is null
* @hide
*/
@TestApi
@RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB)
@NonNull public long[] getPreloadedNanoAppIds(@NonNull ContextHubInfo hubInfo) {
Objects.requireNonNull(hubInfo, "hubInfo cannot be null");
long[] nanoappIds = null;
try {
nanoappIds = mService.getPreloadedNanoAppIds(hubInfo);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
if (nanoappIds == null) {
nanoappIds = new long[0];
}
return nanoappIds;
}
/**
* Unregister a callback for receive messages from the context hub.
*