[AAPM] Return null service for unsupported form factors.
The initial launch is targeted towards general purpose devices.
Other form factors may be added later.
Bug: 352420507
Bug: 375055360
Change-Id: I65e81008c4ed35f63d681a4e72f943b229cd06bf
Flag: android.security.aapm_api
Test: Presubmits
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index bd26db5..c6b8f3b 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -1750,10 +1750,13 @@
@Override
public AdvancedProtectionManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
- IBinder iBinder = ServiceManager.getServiceOrThrow(
+ IBinder iBinder = ServiceManager.getService(
Context.ADVANCED_PROTECTION_SERVICE);
IAdvancedProtectionService service =
IAdvancedProtectionService.Stub.asInterface(iBinder);
+ if (service == null) {
+ return null;
+ }
return new AdvancedProtectionManager(service);
}
});