summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Prem <premedhara@google.com> 2023-08-21 21:09:47 +0000
committer Prem <premedhara@google.com> 2023-08-21 21:40:49 +0000
commit7e54c708e901284b11fd2055d4891321343cb47c (patch)
tree6e71f03d1066be6503e2fe2e95bba286659dfaaa
parent2c00da4e4a83e6a2a9bc6c2096ef329accda3ad9 (diff)
Check VDM flag before accessing
Bug: 287295010 Test: Build Change-Id: I72f28b98102d617655bac029f309d91fc25e1ea7
-rw-r--r--core/java/android/app/SystemServiceRegistry.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index e57849957f13..fbb97ffea035 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -243,6 +243,7 @@ import android.view.translation.ITranslationManager;
import android.view.translation.TranslationManager;
import android.view.translation.UiTranslationManager;
+import com.android.internal.R;
import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IBatteryStats;
import com.android.internal.app.ISoundTriggerService;
@@ -871,6 +872,10 @@ public final class SystemServiceRegistry {
PackageManager.FEATURE_COMPANION_DEVICE_SETUP)) {
return null;
}
+ if (!ctx.getResources().getBoolean(R.bool.config_enableVirtualDeviceManager)) {
+ return null;
+ }
+
IVirtualDeviceManager service = IVirtualDeviceManager.Stub.asInterface(
ServiceManager.getServiceOrThrow(Context.VIRTUAL_DEVICE_SERVICE));
return new VirtualDeviceManager(service, ctx.getOuterContext());