Loading core/java/android/hardware/location/ContextHubManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -697,6 +697,7 @@ public final class ContextHubManager { * * @param endpointId Statically generated ID for an endpoint. * @return A list of {@link HubDiscoveryInfo} objects that represents the result of discovery. * @throws UnsupportedOperationException If the operation is not supported. */ @FlaggedApi(Flags.FLAG_OFFLOAD_API) @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) Loading Loading @@ -733,6 +734,7 @@ public final class ContextHubManager { * cannot be null or empty. * @return A list of {@link HubDiscoveryInfo} objects that represents the result of discovery. * @throws IllegalArgumentException if the serviceDescriptor is empty/null. * @throws UnsupportedOperationException If the operation is not supported. */ @FlaggedApi(Flags.FLAG_OFFLOAD_API) @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) Loading services/core/java/com/android/server/location/contexthub/ContextHubService.java +10 −9 Original line number Diff line number Diff line Loading @@ -756,9 +756,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubInfo> getHubs() throws RemoteException { super.getHubs_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkHubDiscoveryPreconditions(); return mHubInfoRegistry.getHubs(); } Loading @@ -766,9 +764,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubEndpointInfo> findEndpoints(long endpointId) { super.findEndpoints_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkEndpointDiscoveryPreconditions(); return mHubInfoRegistry.findEndpoints(endpointId); } Loading @@ -776,9 +772,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubEndpointInfo> findEndpointsWithService(String serviceDescriptor) { super.findEndpointsWithService_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkEndpointDiscoveryPreconditions(); return mHubInfoRegistry.findEndpointsWithService(serviceDescriptor); } Loading Loading @@ -834,6 +828,13 @@ public class ContextHubService extends IContextHubService.Stub { } } private void checkHubDiscoveryPreconditions() { if (mHubInfoRegistry == null) { Log.e(TAG, "Hub registry failed to initialize"); throw new UnsupportedOperationException("Hub discovery is not supported"); } } /** * Creates an internal load transaction callback to be used for old API clients * Loading Loading
core/java/android/hardware/location/ContextHubManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -697,6 +697,7 @@ public final class ContextHubManager { * * @param endpointId Statically generated ID for an endpoint. * @return A list of {@link HubDiscoveryInfo} objects that represents the result of discovery. * @throws UnsupportedOperationException If the operation is not supported. */ @FlaggedApi(Flags.FLAG_OFFLOAD_API) @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) Loading Loading @@ -733,6 +734,7 @@ public final class ContextHubManager { * cannot be null or empty. * @return A list of {@link HubDiscoveryInfo} objects that represents the result of discovery. * @throws IllegalArgumentException if the serviceDescriptor is empty/null. * @throws UnsupportedOperationException If the operation is not supported. */ @FlaggedApi(Flags.FLAG_OFFLOAD_API) @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) Loading
services/core/java/com/android/server/location/contexthub/ContextHubService.java +10 −9 Original line number Diff line number Diff line Loading @@ -756,9 +756,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubInfo> getHubs() throws RemoteException { super.getHubs_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkHubDiscoveryPreconditions(); return mHubInfoRegistry.getHubs(); } Loading @@ -766,9 +764,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubEndpointInfo> findEndpoints(long endpointId) { super.findEndpoints_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkEndpointDiscoveryPreconditions(); return mHubInfoRegistry.findEndpoints(endpointId); } Loading @@ -776,9 +772,7 @@ public class ContextHubService extends IContextHubService.Stub { @Override public List<HubEndpointInfo> findEndpointsWithService(String serviceDescriptor) { super.findEndpointsWithService_enforcePermission(); if (mHubInfoRegistry == null) { return Collections.emptyList(); } checkEndpointDiscoveryPreconditions(); return mHubInfoRegistry.findEndpointsWithService(serviceDescriptor); } Loading Loading @@ -834,6 +828,13 @@ public class ContextHubService extends IContextHubService.Stub { } } private void checkHubDiscoveryPreconditions() { if (mHubInfoRegistry == null) { Log.e(TAG, "Hub registry failed to initialize"); throw new UnsupportedOperationException("Hub discovery is not supported"); } } /** * Creates an internal load transaction callback to be used for old API clients * Loading