1/**
2 * Copyright (c) 2008, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.graphics.Rect;
20import android.os.Bundle;
21import android.os.ParcelFileDescriptor;
22import android.app.IWallpaperManagerCallback;
23import android.app.WallpaperInfo;
24import android.content.ComponentName;
25
26/** @hide */
27interface IWallpaperManager {
28
29    /**
30     * Set the wallpaper for the current user.
31     *
32     * If 'extras' is non-null, on successful return it will contain:
33     *   EXTRA_SET_WALLPAPER_ID : integer ID that the new wallpaper will have
34     *
35     * 'which' is some combination of:
36     *   FLAG_SET_SYSTEM
37     *   FLAG_SET_LOCK
38     *
39     * A 'null' cropHint rectangle is explicitly permitted as a sentinel for "whatever
40     * the source image's bounding rect is."
41     *
42     * The completion callback's "onWallpaperChanged()" method is invoked when the
43     * new wallpaper content is ready to display.
44     */
45    ParcelFileDescriptor setWallpaper(String name, in String callingPackage,
46            in Rect cropHint, boolean allowBackup, out Bundle extras, int which,
47            IWallpaperManagerCallback completion, int userId);
48
49    /**
50     * Set the live wallpaper. This only affects the system wallpaper.
51     */
52    void setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId);
53
54    /**
55     * Set the live wallpaper. This only affects the system wallpaper.
56     */
57    void setWallpaperComponent(in ComponentName name);
58
59    /**
60     * Get the wallpaper for a given user.
61     */
62    ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, int which,
63            out Bundle outParams, int userId);
64
65    /**
66     * Retrieve the given user's current wallpaper ID of the given kind.
67     */
68    int getWallpaperIdForUser(int which, int userId);
69
70    /**
71     * If the current system wallpaper is a live wallpaper component, return the
72     * information about that wallpaper.  Otherwise, if it is a static image,
73     * simply return null.
74     */
75    WallpaperInfo getWallpaperInfo(int userId);
76
77    /**
78     * Clear the system wallpaper.
79     */
80    void clearWallpaper(in String callingPackage, int which, int userId);
81
82    /**
83     * Return whether the current system wallpaper has the given name.
84     */
85    boolean hasNamedWallpaper(String name);
86
87    /**
88     * Sets the dimension hint for the wallpaper. These hints indicate the desired
89     * minimum width and height for the wallpaper.
90     */
91    void setDimensionHints(in int width, in int height, in String callingPackage);
92
93    /**
94     * Returns the desired minimum width for the wallpaper.
95     */
96    int getWidthHint();
97
98    /**
99     * Returns the desired minimum height for the wallpaper.
100     */
101    int getHeightHint();
102
103    /**
104     * Sets extra padding that we would like the wallpaper to have outside of the display.
105     */
106    void setDisplayPadding(in Rect padding, in String callingPackage);
107
108    /**
109     * Returns the name of the wallpaper. Private API.
110     */
111    String getName();
112
113    /**
114     * Informs the service that wallpaper settings have been restored. Private API.
115     */
116    void settingsRestored();
117
118    /**
119     * Check whether wallpapers are supported for the calling user.
120     */
121    boolean isWallpaperSupported(in String callingPackage);
122
123    /**
124     * Check whether setting of wallpapers are allowed for the calling user.
125     */
126    boolean isSetWallpaperAllowed(in String callingPackage);
127
128    /*
129     * Backup: is the current system wallpaper image eligible for off-device backup?
130     */
131    boolean isWallpaperBackupEligible(int which, int userId);
132
133    /*
134     * Keyguard: register a callback for being notified that lock-state relevant
135     * wallpaper content has changed.
136     */
137    boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);
138}
139