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

Commit 628c969e authored by Andrii Kulian's avatar Andrii Kulian Committed by Automerger Merge Worker
Browse files

Merge "Report bounds instead of size in WindowMetrics" into rvc-dev am:...

Merge "Report bounds instead of size in WindowMetrics" into rvc-dev am: 363edf44 am: f8bb4fef am: 8c58f80e

Change-Id: I6e2bf186abc5df21f002178911f722bd57591636
parents c55323a1 8c58f80e
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -55766,8 +55766,8 @@ package android.view {
  }
  }
  public final class WindowMetrics {
  public final class WindowMetrics {
    ctor public WindowMetrics(@NonNull android.util.Size, @NonNull android.view.WindowInsets);
    ctor public WindowMetrics(@NonNull android.graphics.Rect, @NonNull android.view.WindowInsets);
    method @NonNull public android.util.Size getSize();
    method @NonNull public android.graphics.Rect getBounds();
    method @NonNull public android.view.WindowInsets getWindowInsets();
    method @NonNull public android.view.WindowInsets getWindowInsets();
  }
  }
+2 −3
Original line number Original line Diff line number Diff line
@@ -60,7 +60,6 @@ import android.text.method.MovementMethod;
import android.util.Log;
import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.util.Printer;
import android.util.Size;
import android.view.Gravity;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyEvent;
@@ -1480,8 +1479,8 @@ public class InputMethodService extends AbstractInputMethodService {
     */
     */
    public int getMaxWidth() {
    public int getMaxWidth() {
        final WindowManager windowManager = getSystemService(WindowManager.class);
        final WindowManager windowManager = getSystemService(WindowManager.class);
        final Size windowSize = windowManager.getCurrentWindowMetrics().getSize();
        final Rect windowBounds = windowManager.getCurrentWindowMetrics().getBounds();
        return windowSize.getWidth();
        return windowBounds.width();
    }
    }
    
    
    /**
    /**
+7 −7
Original line number Original line Diff line number Diff line
@@ -57,8 +57,8 @@ import java.util.List;
 * <li>The application display area specifies the part of the display that may contain
 * <li>The application display area specifies the part of the display that may contain
 * an application window, excluding the system decorations.  The application display area may
 * an application window, excluding the system decorations.  The application display area may
 * be smaller than the real display area because the system subtracts the space needed
 * be smaller than the real display area because the system subtracts the space needed
 * for decor elements such as the status bar.  Use {@link WindowMetrics#getSize()} to query the
 * for decor elements such as the status bar.  Use {@link WindowMetrics#getBounds()} to query the
 * application window size.</li>
 * application window bounds.</li>
 * <li>The real display area specifies the part of the display that contains content
 * <li>The real display area specifies the part of the display that contains content
 * including the system decorations.  Even so, the real display area may be smaller than the
 * including the system decorations.  Even so, the real display area may be smaller than the
 * physical size of the display if the window manager is emulating a smaller display
 * physical size of the display if the window manager is emulating a smaller display
@@ -673,7 +673,7 @@ public final class Display {
     *
     *
     * @param outSize A {@link Point} object to receive the size information.
     * @param outSize A {@link Point} object to receive the size information.
     * @deprecated Use {@link WindowManager#getCurrentWindowMetrics()} to obtain an instance of
     * @deprecated Use {@link WindowManager#getCurrentWindowMetrics()} to obtain an instance of
     * {@link WindowMetrics} and use {@link WindowMetrics#getSize()} instead.
     * {@link WindowMetrics} and use {@link WindowMetrics#getBounds()} instead.
     */
     */
    @Deprecated
    @Deprecated
    public void getSize(Point outSize) {
    public void getSize(Point outSize) {
@@ -689,7 +689,7 @@ public final class Display {
     * Gets the size of the display as a rectangle, in pixels.
     * Gets the size of the display as a rectangle, in pixels.
     *
     *
     * @param outSize A {@link Rect} object to receive the size information.
     * @param outSize A {@link Rect} object to receive the size information.
     * @deprecated Use {@link WindowMetrics#getSize()} to get the dimensions of the application
     * @deprecated Use {@link WindowMetrics#getBounds()} to get the dimensions of the application
     * window area.
     * window area.
     */
     */
    @Deprecated
    @Deprecated
@@ -755,7 +755,7 @@ public final class Display {
    }
    }


    /**
    /**
     * @deprecated Use {@link WindowMetrics#getSize()} instead.
     * @deprecated Use {@link WindowMetrics#getBounds#width()} instead.
     */
     */
    @Deprecated
    @Deprecated
    public int getWidth() {
    public int getWidth() {
@@ -766,7 +766,7 @@ public final class Display {
    }
    }


    /**
    /**
     * @deprecated Use {@link WindowMetrics#getSize()} instead.
     * @deprecated Use {@link WindowMetrics#getBounds()#height()} instead.
     */
     */
    @Deprecated
    @Deprecated
    public int getHeight() {
    public int getHeight() {
@@ -1105,7 +1105,7 @@ public final class Display {
     * </p>
     * </p>
     *
     *
     * @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
     * @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
     * @deprecated Use {@link WindowMetrics#getSize()} to get the dimensions of the application
     * @deprecated Use {@link WindowMetrics#getBounds()} to get the dimensions of the application
     * window area, and {@link Configuration#densityDpi} to get the current density.
     * window area, and {@link Configuration#densityDpi} to get the current density.
     */
     */
    @Deprecated
    @Deprecated
+3 −3
Original line number Original line Diff line number Diff line
@@ -23,11 +23,11 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Build;
import android.os.Build;
import android.os.RemoteException;
import android.os.RemoteException;
import android.provider.Settings;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
import android.util.Size;
import android.util.SparseArray;
import android.util.SparseArray;
import android.util.TypedValue;
import android.util.TypedValue;


@@ -410,8 +410,8 @@ public class ViewConfiguration {


        // Size of the screen in bytes, in ARGB_8888 format
        // Size of the screen in bytes, in ARGB_8888 format
        final WindowManager windowManager = context.getSystemService(WindowManager.class);
        final WindowManager windowManager = context.getSystemService(WindowManager.class);
        final Size maxWindowSize = windowManager.getMaximumWindowMetrics().getSize();
        final Rect maxWindowBounds = windowManager.getMaximumWindowMetrics().getBounds();
        mMaximumDrawingCacheSize = 4 * maxWindowSize.getWidth() * maxWindowSize.getHeight();
        mMaximumDrawingCacheSize = 4 * maxWindowBounds.width() * maxWindowBounds.height();


        mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
        mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
        mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
        mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
+2 −7
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ import android.graphics.Region;
import android.os.Bundle;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.Size;


import com.android.internal.os.IResultReceiver;
import com.android.internal.os.IResultReceiver;


@@ -220,7 +219,7 @@ public final class WindowManagerImpl implements WindowManager {
        final Context context = mParentWindow != null ? mParentWindow.getContext() : mContext;
        final Context context = mParentWindow != null ? mParentWindow.getContext() : mContext;
        final Rect bounds = getCurrentBounds(context);
        final Rect bounds = getCurrentBounds(context);


        return new WindowMetrics(toSize(bounds), computeWindowInsets(bounds));
        return new WindowMetrics(bounds, computeWindowInsets(bounds));
    }
    }


    private static Rect getCurrentBounds(Context context) {
    private static Rect getCurrentBounds(Context context) {
@@ -232,11 +231,7 @@ public final class WindowManagerImpl implements WindowManager {
    @Override
    @Override
    public WindowMetrics getMaximumWindowMetrics() {
    public WindowMetrics getMaximumWindowMetrics() {
        final Rect maxBounds = getMaximumBounds();
        final Rect maxBounds = getMaximumBounds();
        return new WindowMetrics(toSize(maxBounds), computeWindowInsets(maxBounds));
        return new WindowMetrics(maxBounds, computeWindowInsets(maxBounds));
    }

    private Size toSize(Rect frame) {
        return new Size(frame.width(), frame.height());
    }
    }


    private Rect getMaximumBounds() {
    private Rect getMaximumBounds() {
Loading