Loading core/java/android/app/ContextImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -2814,7 +2814,7 @@ class ContextImpl extends Context { public @NonNull Context createDeviceContext(int deviceId) { if (deviceId != Context.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(deviceId)) { if (vdm == null || !vdm.isValidVirtualDeviceId(deviceId)) { throw new IllegalArgumentException( "Not a valid ID of the default device or any virtual device: " + deviceId); } Loading core/java/android/app/SystemServiceRegistry.java +5 −0 Original line number Diff line number Diff line Loading @@ -877,6 +877,10 @@ public final class SystemServiceRegistry { @Override public VirtualDeviceManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!ctx.getPackageManager().hasSystemFeature( PackageManager.FEATURE_COMPANION_DEVICE_SETUP)) { return null; } IVirtualDeviceManager service = IVirtualDeviceManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.VIRTUAL_DEVICE_SERVICE)); return new VirtualDeviceManager(service, ctx.getOuterContext()); Loading Loading @@ -1648,6 +1652,7 @@ public final class SystemServiceRegistry { case Context.ETHERNET_SERVICE: case Context.CONTEXTHUB_SERVICE: case Context.VIRTUALIZATION_SERVICE: case Context.VIRTUAL_DEVICE_SERVICE: return null; } Slog.wtf(TAG, "Manager wrapper not available: " + name); Loading core/java/android/content/Context.java +3 −0 Original line number Diff line number Diff line Loading @@ -5703,6 +5703,9 @@ public abstract class Context { * Use with {@link #getSystemService(String)} to retrieve a * {@link android.companion.virtual.VirtualDeviceManager} for managing virtual devices. * * On devices without {@link PackageManager#FEATURE_COMPANION_DEVICE_SETUP} * system feature the {@link #getSystemService(String)} will return {@code null}. * * @see #getSystemService(String) * @see android.companion.virtual.VirtualDeviceManager */ Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; import static android.content.pm.ConfigurationInfo.GL_ES_VERSION_UNDEFINED; import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS; import static android.content.pm.PackageManager.FEATURE_CANT_SAVE_STATE; import static android.content.pm.PackageManager.FEATURE_COMPANION_DEVICE_SETUP; import static android.content.pm.PackageManager.FEATURE_EXPANDED_PICTURE_IN_PICTURE; import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT; import static android.content.pm.PackageManager.FEATURE_LEANBACK; Loading Loading @@ -401,6 +402,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { volatile WindowProcessController mHeavyWeightProcess; boolean mHasHeavyWeightFeature; boolean mHasLeanbackFeature; boolean mHasCompanionDeviceSetupFeature; /** The process of the top most activity. */ volatile WindowProcessController mTopApp; /** Loading Loading @@ -859,6 +861,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final PackageManager pm = mContext.getPackageManager(); mHasHeavyWeightFeature = pm.hasSystemFeature(FEATURE_CANT_SAVE_STATE); mHasLeanbackFeature = pm.hasSystemFeature(FEATURE_LEANBACK); mHasCompanionDeviceSetupFeature = pm.hasSystemFeature(FEATURE_COMPANION_DEVICE_SETUP); mVrController.onSystemReady(); mRecentTasks.onSystemReadyLocked(); mTaskSupervisor.onSystemReady(); Loading services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +7 −2 Original line number Diff line number Diff line Loading @@ -1239,9 +1239,14 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { return Context.DEVICE_ID_DEFAULT; } if (mVirtualDeviceManager == null) { if (mService.mHasCompanionDeviceSetupFeature) { mVirtualDeviceManager = mService.mContext.getSystemService(VirtualDeviceManager.class); } if (mVirtualDeviceManager == null) { return Context.DEVICE_ID_DEFAULT; } } return mVirtualDeviceManager.getDeviceIdForDisplayId(displayId); } Loading Loading
core/java/android/app/ContextImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -2814,7 +2814,7 @@ class ContextImpl extends Context { public @NonNull Context createDeviceContext(int deviceId) { if (deviceId != Context.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(deviceId)) { if (vdm == null || !vdm.isValidVirtualDeviceId(deviceId)) { throw new IllegalArgumentException( "Not a valid ID of the default device or any virtual device: " + deviceId); } Loading
core/java/android/app/SystemServiceRegistry.java +5 −0 Original line number Diff line number Diff line Loading @@ -877,6 +877,10 @@ public final class SystemServiceRegistry { @Override public VirtualDeviceManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!ctx.getPackageManager().hasSystemFeature( PackageManager.FEATURE_COMPANION_DEVICE_SETUP)) { return null; } IVirtualDeviceManager service = IVirtualDeviceManager.Stub.asInterface( ServiceManager.getServiceOrThrow(Context.VIRTUAL_DEVICE_SERVICE)); return new VirtualDeviceManager(service, ctx.getOuterContext()); Loading Loading @@ -1648,6 +1652,7 @@ public final class SystemServiceRegistry { case Context.ETHERNET_SERVICE: case Context.CONTEXTHUB_SERVICE: case Context.VIRTUALIZATION_SERVICE: case Context.VIRTUAL_DEVICE_SERVICE: return null; } Slog.wtf(TAG, "Manager wrapper not available: " + name); Loading
core/java/android/content/Context.java +3 −0 Original line number Diff line number Diff line Loading @@ -5703,6 +5703,9 @@ public abstract class Context { * Use with {@link #getSystemService(String)} to retrieve a * {@link android.companion.virtual.VirtualDeviceManager} for managing virtual devices. * * On devices without {@link PackageManager#FEATURE_COMPANION_DEVICE_SETUP} * system feature the {@link #getSystemService(String)} will return {@code null}. * * @see #getSystemService(String) * @see android.companion.virtual.VirtualDeviceManager */ Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; import static android.content.pm.ConfigurationInfo.GL_ES_VERSION_UNDEFINED; import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS; import static android.content.pm.PackageManager.FEATURE_CANT_SAVE_STATE; import static android.content.pm.PackageManager.FEATURE_COMPANION_DEVICE_SETUP; import static android.content.pm.PackageManager.FEATURE_EXPANDED_PICTURE_IN_PICTURE; import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT; import static android.content.pm.PackageManager.FEATURE_LEANBACK; Loading Loading @@ -401,6 +402,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { volatile WindowProcessController mHeavyWeightProcess; boolean mHasHeavyWeightFeature; boolean mHasLeanbackFeature; boolean mHasCompanionDeviceSetupFeature; /** The process of the top most activity. */ volatile WindowProcessController mTopApp; /** Loading Loading @@ -859,6 +861,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final PackageManager pm = mContext.getPackageManager(); mHasHeavyWeightFeature = pm.hasSystemFeature(FEATURE_CANT_SAVE_STATE); mHasLeanbackFeature = pm.hasSystemFeature(FEATURE_LEANBACK); mHasCompanionDeviceSetupFeature = pm.hasSystemFeature(FEATURE_COMPANION_DEVICE_SETUP); mVrController.onSystemReady(); mRecentTasks.onSystemReadyLocked(); mTaskSupervisor.onSystemReady(); Loading
services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +7 −2 Original line number Diff line number Diff line Loading @@ -1239,9 +1239,14 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { return Context.DEVICE_ID_DEFAULT; } if (mVirtualDeviceManager == null) { if (mService.mHasCompanionDeviceSetupFeature) { mVirtualDeviceManager = mService.mContext.getSystemService(VirtualDeviceManager.class); } if (mVirtualDeviceManager == null) { return Context.DEVICE_ID_DEFAULT; } } return mVirtualDeviceManager.getDeviceIdForDisplayId(displayId); } Loading