Loading core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -9338,6 +9338,8 @@ package android.companion.virtual { public final class VirtualDeviceManager { method @NonNull public java.util.List<android.companion.virtual.VirtualDevice> getVirtualDevices(); field public static final int DEVICE_ID_DEFAULT = 0; // 0x0 field public static final int DEVICE_ID_INVALID = -1; // 0xffffffff } } Loading Loading @@ -10104,8 +10106,6 @@ package android.content { field public static final int CONTEXT_RESTRICTED = 4; // 0x4 field public static final String CREDENTIAL_SERVICE = "credential"; field public static final String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps"; field public static final int DEVICE_ID_DEFAULT = 0; // 0x0 field public static final int DEVICE_ID_INVALID = -1; // 0xffffffff field public static final String DEVICE_LOCK_SERVICE = "device_lock"; field public static final String DEVICE_POLICY_SERVICE = "device_policy"; field public static final String DISPLAY_HASH_SERVICE = "display_hash"; core/java/android/app/ActivityThread.java +2 −2 Original line number Diff line number Diff line Loading @@ -4575,7 +4575,7 @@ public final class ActivityThread extends ClientTransactionHandler ActivityManager.getService()); if (!service.isUiContext()) { // WindowProviderService is a UI Context. VirtualDeviceManager vdm = context.getSystemService(VirtualDeviceManager.class); if (mLastReportedDeviceId == Context.DEVICE_ID_DEFAULT if (mLastReportedDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT || vdm.isValidVirtualDeviceId(mLastReportedDeviceId)) { service.updateDeviceId(mLastReportedDeviceId); } Loading Loading @@ -6103,7 +6103,7 @@ public final class ActivityThread extends ClientTransactionHandler private void updateDeviceIdForNonUIContexts(int deviceId) { // Invalid device id is treated as a no-op. if (deviceId == Context.DEVICE_ID_INVALID) { if (deviceId == VirtualDeviceManager.DEVICE_ID_INVALID) { return; } if (deviceId == mLastReportedDeviceId) { Loading core/java/android/app/ContextImpl.java +3 −3 Original line number Diff line number Diff line Loading @@ -244,7 +244,7 @@ class ContextImpl extends Context { @UnsupportedAppUsage private @NonNull Resources mResources; private @Nullable Display mDisplay; // may be null if invalid display or not initialized yet. private int mDeviceId = Context.DEVICE_ID_DEFAULT; private int mDeviceId = VirtualDeviceManager.DEVICE_ID_DEFAULT; /** * If set to {@code true} the resources for this context will be configured for mDisplay which Loading Loading @@ -2756,7 +2756,7 @@ class ContextImpl extends Context { @Override public @NonNull Context createDeviceContext(int deviceId) { if (deviceId != Context.DEVICE_ID_DEFAULT) { if (deviceId != VirtualDeviceManager.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(deviceId)) { throw new IllegalArgumentException( Loading Loading @@ -3036,7 +3036,7 @@ class ContextImpl extends Context { @Override public void updateDeviceId(int updatedDeviceId) { if (updatedDeviceId != Context.DEVICE_ID_DEFAULT) { if (updatedDeviceId != VirtualDeviceManager.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(updatedDeviceId)) { throw new IllegalArgumentException( Loading core/java/android/companion/virtual/VirtualDevice.java +2 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.companion.virtual; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; Loading @@ -39,9 +38,9 @@ public final class VirtualDevice implements Parcelable { * @hide */ public VirtualDevice(int id, @Nullable String name) { if (id <= Context.DEVICE_ID_DEFAULT) { if (id <= VirtualDeviceManager.DEVICE_ID_DEFAULT) { throw new IllegalArgumentException("VirtualDevice ID mist be greater than " + Context.DEVICE_ID_DEFAULT); + VirtualDeviceManager.DEVICE_ID_DEFAULT); } mId = id; mName = name; Loading core/java/android/companion/virtual/VirtualDeviceManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -97,6 +97,16 @@ public final class VirtualDeviceManager { | DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH | DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_FOCUS; /** * The default device ID, which is the ID of the primary (non-virtual) device. */ public static final int DEVICE_ID_DEFAULT = 0; /** * Invalid device ID. */ public static final int DEVICE_ID_INVALID = -1; /** * Broadcast Action: A Virtual Device was removed. * Loading Loading @@ -240,7 +250,7 @@ public final class VirtualDeviceManager { public int getDeviceIdForDisplayId(int displayId) { if (mService == null) { Log.w(TAG, "Failed to retrieve virtual devices; no virtual device manager service."); return Context.DEVICE_ID_DEFAULT; return DEVICE_ID_DEFAULT; } try { return mService.getDeviceIdForDisplayId(displayId); Loading @@ -251,7 +261,7 @@ public final class VirtualDeviceManager { /** * Checks whether the passed {@code deviceId} is a valid virtual device ID or not. * {@link Context#DEVICE_ID_DEFAULT} is not valid as it is the ID of the default * {@link VirtualDeviceManager#DEVICE_ID_DEFAULT} is not valid as it is the ID of the default * device which is not a virtual device. {@code deviceId} must correspond to a virtual device * created by {@link VirtualDeviceManager#createVirtualDevice(int, VirtualDeviceParams)}. * Loading Loading
core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -9338,6 +9338,8 @@ package android.companion.virtual { public final class VirtualDeviceManager { method @NonNull public java.util.List<android.companion.virtual.VirtualDevice> getVirtualDevices(); field public static final int DEVICE_ID_DEFAULT = 0; // 0x0 field public static final int DEVICE_ID_INVALID = -1; // 0xffffffff } } Loading Loading @@ -10104,8 +10106,6 @@ package android.content { field public static final int CONTEXT_RESTRICTED = 4; // 0x4 field public static final String CREDENTIAL_SERVICE = "credential"; field public static final String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps"; field public static final int DEVICE_ID_DEFAULT = 0; // 0x0 field public static final int DEVICE_ID_INVALID = -1; // 0xffffffff field public static final String DEVICE_LOCK_SERVICE = "device_lock"; field public static final String DEVICE_POLICY_SERVICE = "device_policy"; field public static final String DISPLAY_HASH_SERVICE = "display_hash";
core/java/android/app/ActivityThread.java +2 −2 Original line number Diff line number Diff line Loading @@ -4575,7 +4575,7 @@ public final class ActivityThread extends ClientTransactionHandler ActivityManager.getService()); if (!service.isUiContext()) { // WindowProviderService is a UI Context. VirtualDeviceManager vdm = context.getSystemService(VirtualDeviceManager.class); if (mLastReportedDeviceId == Context.DEVICE_ID_DEFAULT if (mLastReportedDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT || vdm.isValidVirtualDeviceId(mLastReportedDeviceId)) { service.updateDeviceId(mLastReportedDeviceId); } Loading Loading @@ -6103,7 +6103,7 @@ public final class ActivityThread extends ClientTransactionHandler private void updateDeviceIdForNonUIContexts(int deviceId) { // Invalid device id is treated as a no-op. if (deviceId == Context.DEVICE_ID_INVALID) { if (deviceId == VirtualDeviceManager.DEVICE_ID_INVALID) { return; } if (deviceId == mLastReportedDeviceId) { Loading
core/java/android/app/ContextImpl.java +3 −3 Original line number Diff line number Diff line Loading @@ -244,7 +244,7 @@ class ContextImpl extends Context { @UnsupportedAppUsage private @NonNull Resources mResources; private @Nullable Display mDisplay; // may be null if invalid display or not initialized yet. private int mDeviceId = Context.DEVICE_ID_DEFAULT; private int mDeviceId = VirtualDeviceManager.DEVICE_ID_DEFAULT; /** * If set to {@code true} the resources for this context will be configured for mDisplay which Loading Loading @@ -2756,7 +2756,7 @@ class ContextImpl extends Context { @Override public @NonNull Context createDeviceContext(int deviceId) { if (deviceId != Context.DEVICE_ID_DEFAULT) { if (deviceId != VirtualDeviceManager.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(deviceId)) { throw new IllegalArgumentException( Loading Loading @@ -3036,7 +3036,7 @@ class ContextImpl extends Context { @Override public void updateDeviceId(int updatedDeviceId) { if (updatedDeviceId != Context.DEVICE_ID_DEFAULT) { if (updatedDeviceId != VirtualDeviceManager.DEVICE_ID_DEFAULT) { VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); if (!vdm.isValidVirtualDeviceId(updatedDeviceId)) { throw new IllegalArgumentException( Loading
core/java/android/companion/virtual/VirtualDevice.java +2 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ package android.companion.virtual; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; Loading @@ -39,9 +38,9 @@ public final class VirtualDevice implements Parcelable { * @hide */ public VirtualDevice(int id, @Nullable String name) { if (id <= Context.DEVICE_ID_DEFAULT) { if (id <= VirtualDeviceManager.DEVICE_ID_DEFAULT) { throw new IllegalArgumentException("VirtualDevice ID mist be greater than " + Context.DEVICE_ID_DEFAULT); + VirtualDeviceManager.DEVICE_ID_DEFAULT); } mId = id; mName = name; Loading
core/java/android/companion/virtual/VirtualDeviceManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -97,6 +97,16 @@ public final class VirtualDeviceManager { | DisplayManager.VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH | DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_FOCUS; /** * The default device ID, which is the ID of the primary (non-virtual) device. */ public static final int DEVICE_ID_DEFAULT = 0; /** * Invalid device ID. */ public static final int DEVICE_ID_INVALID = -1; /** * Broadcast Action: A Virtual Device was removed. * Loading Loading @@ -240,7 +250,7 @@ public final class VirtualDeviceManager { public int getDeviceIdForDisplayId(int displayId) { if (mService == null) { Log.w(TAG, "Failed to retrieve virtual devices; no virtual device manager service."); return Context.DEVICE_ID_DEFAULT; return DEVICE_ID_DEFAULT; } try { return mService.getDeviceIdForDisplayId(displayId); Loading @@ -251,7 +261,7 @@ public final class VirtualDeviceManager { /** * Checks whether the passed {@code deviceId} is a valid virtual device ID or not. * {@link Context#DEVICE_ID_DEFAULT} is not valid as it is the ID of the default * {@link VirtualDeviceManager#DEVICE_ID_DEFAULT} is not valid as it is the ID of the default * device which is not a virtual device. {@code deviceId} must correspond to a virtual device * created by {@link VirtualDeviceManager#createVirtualDevice(int, VirtualDeviceParams)}. * Loading