Add system feature for Companion Device Manager
Bug: 30932767
Test: Add just the feature gating first, ensure Context#getSystemSetrvice now
returns null.
Add feature in the configuration files, ensure companion device feature works again.
Change-Id: I4ad2d52f7877eae0e951f43ddbb23881d5de8d8b
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1a0aff7..8b5e24f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1376,9 +1376,11 @@
traceEnd();
}
- traceBeginAndSlog("StartCompanionDeviceManager");
- mSystemServiceManager.startService(COMPANION_DEVICE_MANAGER_SERVICE_CLASS);
- traceEnd();
+ if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_COMPANION_DEVICE_SETUP)) {
+ traceBeginAndSlog("StartCompanionDeviceManager");
+ mSystemServiceManager.startService(COMPANION_DEVICE_MANAGER_SERVICE_CLASS);
+ traceEnd();
+ }
traceBeginAndSlog("StartRestrictionManager");
mSystemServiceManager.startService(RestrictionsManagerService.class);