Loading core/java/android/app/ContextImpl.java +8 −1 Original line number Diff line number Diff line Loading @@ -3062,7 +3062,14 @@ class ContextImpl extends Context { @Override public boolean isDeviceContext() { return mIsExplicitDeviceId || isAssociatedWithDisplay(); if (mIsExplicitDeviceId) { if (mDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT) { return true; } VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); return vdm.isValidVirtualDeviceId(mDeviceId); } return isAssociatedWithDisplay(); } @Override Loading core/java/android/content/Context.java +4 −2 Original line number Diff line number Diff line Loading @@ -7378,10 +7378,12 @@ public abstract class Context { /** * Indicates whether the value of {@link Context#getDeviceId()} can be relied upon for * this instance. It will return {@code true} for Contexts created by * {@link Context#createDeviceContext(int)}, as well as for UI and Display Contexts. * {@link Context#createDeviceContext(int)} which reference a valid device ID, as well as for * UI and Display Contexts. * <p> * Contexts created with {@link Context#createDeviceContext(int)} will have an explicit * device association, which will never change. UI Contexts and Display Contexts are * device association, which will never change, even if the underlying device is closed or is * removed. UI Contexts and Display Contexts are * already associated with a display, so if the device association is not explicitly * given, {@link Context#getDeviceId()} will return the ID of the device associated with * the associated display. The system can assign an arbitrary device id value for Contexts not Loading Loading
core/java/android/app/ContextImpl.java +8 −1 Original line number Diff line number Diff line Loading @@ -3062,7 +3062,14 @@ class ContextImpl extends Context { @Override public boolean isDeviceContext() { return mIsExplicitDeviceId || isAssociatedWithDisplay(); if (mIsExplicitDeviceId) { if (mDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT) { return true; } VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class); return vdm.isValidVirtualDeviceId(mDeviceId); } return isAssociatedWithDisplay(); } @Override Loading
core/java/android/content/Context.java +4 −2 Original line number Diff line number Diff line Loading @@ -7378,10 +7378,12 @@ public abstract class Context { /** * Indicates whether the value of {@link Context#getDeviceId()} can be relied upon for * this instance. It will return {@code true} for Contexts created by * {@link Context#createDeviceContext(int)}, as well as for UI and Display Contexts. * {@link Context#createDeviceContext(int)} which reference a valid device ID, as well as for * UI and Display Contexts. * <p> * Contexts created with {@link Context#createDeviceContext(int)} will have an explicit * device association, which will never change. UI Contexts and Display Contexts are * device association, which will never change, even if the underlying device is closed or is * removed. UI Contexts and Display Contexts are * already associated with a display, so if the device association is not explicitly * given, {@link Context#getDeviceId()} will return the ID of the device associated with * the associated display. The system can assign an arbitrary device id value for Contexts not Loading