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

Commit bb8c4834 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Add new wallpaper features for insets and offsets." into lmp-dev

parents 84e4e62d 067e5f68
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27267,6 +27267,7 @@ package android.service.wallpaper {
    method public android.view.SurfaceHolder getSurfaceHolder();
    method public boolean isPreview();
    method public boolean isVisible();
    method public void onApplyWindowInsets(android.view.WindowInsets);
    method public android.os.Bundle onCommand(java.lang.String, int, int, int, android.os.Bundle, boolean);
    method public void onCreate(android.view.SurfaceHolder);
    method public void onDesiredSizeChanged(int, int);
@@ -34975,12 +34976,18 @@ package android.view {
  public final class WindowInsets {
    ctor public WindowInsets(android.view.WindowInsets);
    method public android.view.WindowInsets consumeStableInsets();
    method public android.view.WindowInsets consumeSystemWindowInsets();
    method public int getStableInsetBottom();
    method public int getStableInsetLeft();
    method public int getStableInsetRight();
    method public int getStableInsetTop();
    method public int getSystemWindowInsetBottom();
    method public int getSystemWindowInsetLeft();
    method public int getSystemWindowInsetRight();
    method public int getSystemWindowInsetTop();
    method public boolean hasInsets();
    method public boolean hasStableInsets();
    method public boolean hasSystemWindowInsets();
    method public boolean isConsumed();
    method public boolean isRound();
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.graphics.Rect;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.app.IWallpaperManagerCallback;
@@ -72,6 +73,11 @@ interface IWallpaperManager {
     */
    int getHeightHint();

    /**
     * Sets extra padding that we would like the wallpaper to have outside of the display.
     */
    void setDisplayPadding(in Rect padding);

    /**
     * Returns the name of the wallpaper. Private API.
     */
+43 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -950,6 +951,48 @@ public class WallpaperManager {
        }
    }

    /**
     * Specify extra padding that the wallpaper should have outside of the display.
     * That is, the given padding supplies additional pixels the wallpaper should extend
     * outside of the display itself.
     * @param padding The number of pixels the wallpaper should extend beyond the display,
     * on its left, top, right, and bottom sides.
     * @hide
     */
    @SystemApi
    public void setDisplayPadding(Rect padding) {
        try {
            if (sGlobals.mService == null) {
                Log.w(TAG, "WallpaperService not running");
            } else {
                sGlobals.mService.setDisplayPadding(padding);
            }
        } catch (RemoteException e) {
            // Ignore
        }
    }

    /**
     * Apply a raw offset to the wallpaper window.  Should only be used in
     * combination with {@link #setDisplayPadding(android.graphics.Rect)} when you
     * have ensured that the wallpaper will extend outside of the display area so that
     * it can be moved without leaving part of the display uncovered.
     * @param x The offset, in pixels, to apply to the left edge.
     * @param y The offset, in pixels, to apply to the top edge.
     * @hide
     */
    @SystemApi
    public void setDisplayOffset(IBinder windowToken, int x, int y) {
        try {
            //Log.v(TAG, "Sending new wallpaper display offsets from app...");
            WindowManagerGlobal.getWindowSession().setWallpaperDisplayOffset(
                    windowToken, x, y);
            //Log.v(TAG, "...app returning after sending display offset!");
        } catch (RemoteException e) {
            // Ignore.
        }
    }

    /**
     * Set the position of the current wallpaper within any larger space, when
     * that wallpaper is visible behind the given window.  The X and Y offsets
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.service.wallpaper;

import android.graphics.Rect;
import android.view.MotionEvent;
import android.os.Bundle;

@@ -24,6 +25,7 @@ import android.os.Bundle;
 */
oneway interface IWallpaperEngine {
    void setDesiredSize(int width, int height);
    void setDisplayPadding(in Rect padding);
    void setVisibility(boolean visible);
    void dispatchPointer(in MotionEvent event);
    void dispatchWallpaperCommand(String action, int x, int y,
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.service.wallpaper;

import android.graphics.Rect;
import android.service.wallpaper.IWallpaperConnection;

/**
@@ -24,5 +25,5 @@ import android.service.wallpaper.IWallpaperConnection;
oneway interface IWallpaperService {
    void attach(IWallpaperConnection connection,
    		IBinder windowToken, int windowType, boolean isPreview,
    		int reqWidth, int reqHeight);
    		int reqWidth, int reqHeight, in Rect padding);
}
Loading