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 
17 package android.app;
18 
19 import android.graphics.Rect;
20 import android.os.Bundle;
21 import android.os.ParcelFileDescriptor;
22 import android.app.IWallpaperManagerCallback;
23 import android.app.WallpaperInfo;
24 import android.content.ComponentName;
25 import android.app.WallpaperColors;
26 
27 /** @hide */
28 interface IWallpaperManager {
29 
30     /**
31      * Set the wallpaper for the current user.
32      *
33      * If 'extras' is non-null, on successful return it will contain:
34      *   EXTRA_SET_WALLPAPER_ID : integer ID that the new wallpaper will have
35      *
36      * 'which' is some combination of:
37      *   FLAG_SET_SYSTEM
38      *   FLAG_SET_LOCK
39      *
40      * A 'null' cropHint rectangle is explicitly permitted as a sentinel for "whatever
41      * the source image's bounding rect is."
42      *
43      * The completion callback's "onWallpaperChanged()" method is invoked when the
44      * new wallpaper content is ready to display.
45      */
setWallpaper(String name, in String callingPackage, in Rect cropHint, boolean allowBackup, out Bundle extras, int which, IWallpaperManagerCallback completion, int userId)46     ParcelFileDescriptor setWallpaper(String name, in String callingPackage,
47             in Rect cropHint, boolean allowBackup, out Bundle extras, int which,
48             IWallpaperManagerCallback completion, int userId);
49 
50     /**
51      * Set the live wallpaper. This only affects the system wallpaper.
52      */
setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId)53     void setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId);
54 
55     /**
56      * Set the live wallpaper. This only affects the system wallpaper.
57      */
58     @UnsupportedAppUsage
setWallpaperComponent(in ComponentName name)59     void setWallpaperComponent(in ComponentName name);
60 
61 
62     /**
63      * @deprecated Use {@link #getWallpaperWithFeature(String, IWallpaperManagerCallback, int,
64      * Bundle, int)}
65      */
66     @UnsupportedAppUsage
getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId)67     ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which,
68             out Bundle outParams, int userId);
69 
70     /**
71      * Get the wallpaper for a given user.
72      */
getWallpaperWithFeature(String callingPkg, String callingFeatureId, IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId)73     ParcelFileDescriptor getWallpaperWithFeature(String callingPkg, String callingFeatureId,
74             IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId);
75 
76     /**
77      * Retrieve the given user's current wallpaper ID of the given kind.
78      */
getWallpaperIdForUser(int which, int userId)79     int getWallpaperIdForUser(int which, int userId);
80 
81     /**
82      * If the current system wallpaper is a live wallpaper component, return the
83      * information about that wallpaper.  Otherwise, if it is a static image,
84      * simply return null.
85      */
86     @UnsupportedAppUsage
getWallpaperInfo(int userId)87     WallpaperInfo getWallpaperInfo(int userId);
88 
89     /**
90      * Clear the system wallpaper.
91      */
clearWallpaper(in String callingPackage, int which, int userId)92     void clearWallpaper(in String callingPackage, int which, int userId);
93 
94     /**
95      * Return whether the current system wallpaper has the given name.
96      */
97     @UnsupportedAppUsage
hasNamedWallpaper(String name)98     boolean hasNamedWallpaper(String name);
99 
100     /**
101      * Sets the dimension hint for the wallpaper. These hints indicate the desired
102      * minimum width and height for the wallpaper in a particular display.
103      */
setDimensionHints(in int width, in int height, in String callingPackage, int displayId)104     void setDimensionHints(in int width, in int height, in String callingPackage, int displayId);
105 
106     /**
107      * Returns the desired minimum width for the wallpaper in a particular display.
108      */
109     @UnsupportedAppUsage
getWidthHint(int displayId)110     int getWidthHint(int displayId);
111 
112     /**
113      * Returns the desired minimum height for the wallpaper in a particular display.
114      */
115     @UnsupportedAppUsage
getHeightHint(int displayId)116     int getHeightHint(int displayId);
117 
118     /**
119      * Sets extra padding that we would like the wallpaper to have outside of the display.
120      */
setDisplayPadding(in Rect padding, in String callingPackage, int displayId)121     void setDisplayPadding(in Rect padding, in String callingPackage, int displayId);
122 
123     /**
124      * Returns the name of the wallpaper. Private API.
125      */
getName()126     String getName();
127 
128     /**
129      * Informs the service that wallpaper settings have been restored. Private API.
130      */
settingsRestored()131     void settingsRestored();
132 
133     /**
134      * Check whether wallpapers are supported for the calling user.
135      */
isWallpaperSupported(in String callingPackage)136     boolean isWallpaperSupported(in String callingPackage);
137 
138     /**
139      * Check whether setting of wallpapers are allowed for the calling user.
140      */
isSetWallpaperAllowed(in String callingPackage)141     boolean isSetWallpaperAllowed(in String callingPackage);
142 
143     /*
144      * Backup: is the current system wallpaper image eligible for off-device backup?
145      */
isWallpaperBackupEligible(int which, int userId)146     boolean isWallpaperBackupEligible(int which, int userId);
147 
148     /*
149      * Keyguard: register a callback for being notified that lock-state relevant
150      * wallpaper content has changed.
151      */
setLockWallpaperCallback(IWallpaperManagerCallback cb)152     boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);
153 
154     /**
155      * Returns the colors used by the lock screen or system wallpaper.
156      *
157      * @param which either {@link WallpaperManager#FLAG_LOCK}
158      * or {@link WallpaperManager#FLAG_SYSTEM}
159      * @param displayId Which display is interested
160      * @return colors of chosen wallpaper
161      */
getWallpaperColors(int which, int userId, int displayId)162     WallpaperColors getWallpaperColors(int which, int userId, int displayId);
163 
164     /**
165      * Register a callback to receive color updates from a display
166      */
registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)167     void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
168 
169     /**
170      * Unregister a callback that was receiving color updates from a display
171      */
unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)172     void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
173 
174     /**
175      * Called from SystemUI when it shows the AoD UI.
176      */
setInAmbientMode(boolean inAmbientMode, long animationDuration)177     oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration);
178 }
179