Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2745f0c4 authored by Marco Loaiza's avatar Marco Loaiza Committed by Android (Google) Code Review
Browse files

Merge "Remove isDeviceContext method"

parents 3105b3b8 462bde7d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -10243,7 +10243,6 @@ package android.content {
    method @Deprecated public abstract int getWallpaperDesiredMinimumHeight();
    method @Deprecated public abstract int getWallpaperDesiredMinimumWidth();
    method public abstract void grantUriPermission(String, android.net.Uri, int);
    method public boolean isDeviceContext();
    method public abstract boolean isDeviceProtectedStorage();
    method public boolean isRestricted();
    method public boolean isUiContext();
+0 −12
Original line number Diff line number Diff line
@@ -3067,18 +3067,6 @@ class ContextImpl extends Context {
        return mDeviceId;
    }

    @Override
    public boolean isDeviceContext() {
        if (mIsExplicitDeviceId) {
            if (mDeviceId == VirtualDeviceManager.DEVICE_ID_DEFAULT) {
                return true;
            }
            VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class);
            return vdm.isValidVirtualDeviceId(mDeviceId);
        }
        return isAssociatedWithDisplay();
    }

    @Override
    public void registerDeviceIdChangeListener(@NonNull @CallbackExecutor Executor executor,
            @NonNull IntConsumer listener) {
+5 −28
Original line number Diff line number Diff line
@@ -7384,7 +7384,6 @@ public abstract class Context {
     * @throws IllegalArgumentException if the given device ID is not a valid ID of the default
     *         device or a virtual device.
     *
     * @see #isDeviceContext()
     * @see #createDeviceContext(int)
     * @hide
     */
@@ -7408,26 +7407,8 @@ public abstract class Context {
     * </p>
     *
     * <p>
     * This method will only return a reliable value for this instance if
     * {@link Context#isDeviceContext()} is {@code true}. The system can assign an arbitrary device
     * id value for Contexts not logically associated with a device.
     * </p>
     *
     * @return the ID of the device this context is associated with.
     * @see #isDeviceContext()
     * @see #createDeviceContext(int)
     * @see #registerDeviceIdChangeListener(Executor, IntConsumer)
     */
    public int getDeviceId() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * 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)} which reference a valid device ID, as well as for
     * UI and Display Contexts.
     * <p>
     * This method will only return a reliable value for this instance if it was created with
     * {@link Context#createDeviceContext(int)}, or if this instance is a UI or Display Context.
     * Contexts created with {@link Context#createDeviceContext(int)} will have an explicit
     * device association, which will never change, even if the underlying device is closed or is
     * removed. UI Contexts and Display Contexts are
@@ -7437,15 +7418,12 @@ public abstract class Context {
     * logically associated with a device.
     * </p>
     *
     * @return {@code true} if {@link Context#getDeviceId()} is reliable, {@code false} otherwise.
     *
     * @return the ID of the device this context is associated with.
     * @see #createDeviceContext(int)
     * @see #getDeviceId()}
     * @see #createDisplayContext(Display)
     * @see #registerDeviceIdChangeListener(Executor, IntConsumer)
     * @see #isUiContext()
     */

    public boolean isDeviceContext() {
    public int getDeviceId() {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

@@ -7464,7 +7442,6 @@ public abstract class Context {
     * @param listener The listener {@code IntConsumer} to call which will receive the updated
     *                 device ID.
     *
     * @see Context#isDeviceContext()
     * @see Context#getDeviceId()
     * @see Context#createDeviceContext(int)
     */
+0 −5
Original line number Diff line number Diff line
@@ -1200,11 +1200,6 @@ public class ContextWrapper extends Context {
        return mBase.getDeviceId();
    }

    @Override
    public boolean isDeviceContext() {
        return mBase.isDeviceContext();
    }

    @Override
    public void registerDeviceIdChangeListener(@NonNull @CallbackExecutor Executor executor,
            @NonNull IntConsumer listener) {
+0 −9
Original line number Diff line number Diff line
@@ -138,15 +138,6 @@ public class DecorContext extends ContextThemeWrapper {
        return false;
    }

    @Override
    public boolean isDeviceContext() {
        Context context = mContext.get();
        if (context != null) {
            return context.isDeviceContext();
        }
        return false;
    }

    @Override
    public boolean isConfigurationContext() {
        Context context = mContext.get();