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      * Get the wallpaper for a given user.
63      */
64     @UnsupportedAppUsage
getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId)65     ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which,
66             out Bundle outParams, int userId);
67 
68     /**
69      * Retrieve the given user's current wallpaper ID of the given kind.
70      */
getWallpaperIdForUser(int which, int userId)71     int getWallpaperIdForUser(int which, int userId);
72 
73     /**
74      * If the current system wallpaper is a live wallpaper component, return the
75      * information about that wallpaper.  Otherwise, if it is a static image,
76      * simply return null.
77      */
78     @UnsupportedAppUsage
getWallpaperInfo(int userId)79     WallpaperInfo getWallpaperInfo(int userId);
80 
81     /**
82      * Clear the system wallpaper.
83      */
clearWallpaper(in String callingPackage, int which, int userId)84     void clearWallpaper(in String callingPackage, int which, int userId);
85 
86     /**
87      * Return whether the current system wallpaper has the given name.
88      */
89     @UnsupportedAppUsage
hasNamedWallpaper(String name)90     boolean hasNamedWallpaper(String name);
91 
92     /**
93      * Sets the dimension hint for the wallpaper. These hints indicate the desired
94      * minimum width and height for the wallpaper in a particular display.
95      */
setDimensionHints(in int width, in int height, in String callingPackage, int displayId)96     void setDimensionHints(in int width, in int height, in String callingPackage, int displayId);
97 
98     /**
99      * Returns the desired minimum width for the wallpaper in a particular display.
100      */
101     @UnsupportedAppUsage
getWidthHint(int displayId)102     int getWidthHint(int displayId);
103 
104     /**
105      * Returns the desired minimum height for the wallpaper in a particular display.
106      */
107     @UnsupportedAppUsage
getHeightHint(int displayId)108     int getHeightHint(int displayId);
109 
110     /**
111      * Sets extra padding that we would like the wallpaper to have outside of the display.
112      */
setDisplayPadding(in Rect padding, in String callingPackage, int displayId)113     void setDisplayPadding(in Rect padding, in String callingPackage, int displayId);
114 
115     /**
116      * Returns the name of the wallpaper. Private API.
117      */
getName()118     String getName();
119 
120     /**
121      * Informs the service that wallpaper settings have been restored. Private API.
122      */
settingsRestored()123     void settingsRestored();
124 
125     /**
126      * Check whether wallpapers are supported for the calling user.
127      */
isWallpaperSupported(in String callingPackage)128     boolean isWallpaperSupported(in String callingPackage);
129 
130     /**
131      * Check whether setting of wallpapers are allowed for the calling user.
132      */
isSetWallpaperAllowed(in String callingPackage)133     boolean isSetWallpaperAllowed(in String callingPackage);
134 
135     /*
136      * Backup: is the current system wallpaper image eligible for off-device backup?
137      */
isWallpaperBackupEligible(int which, int userId)138     boolean isWallpaperBackupEligible(int which, int userId);
139 
140     /*
141      * Keyguard: register a callback for being notified that lock-state relevant
142      * wallpaper content has changed.
143      */
setLockWallpaperCallback(IWallpaperManagerCallback cb)144     boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);
145 
146     /**
147      * Returns the colors used by the lock screen or system wallpaper.
148      *
149      * @param which either {@link WallpaperManager#FLAG_LOCK}
150      * or {@link WallpaperManager#FLAG_SYSTEM}
151      * @param displayId Which display is interested
152      * @return colors of chosen wallpaper
153      */
getWallpaperColors(int which, int userId, int displayId)154     WallpaperColors getWallpaperColors(int which, int userId, int displayId);
155 
156     /**
157      * Register a callback to receive color updates from a display
158      */
registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)159     void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
160 
161     /**
162      * Unregister a callback that was receiving color updates from a display
163      */
unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)164     void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
165 
166     /**
167      * Called from SystemUI when it shows the AoD UI.
168      */
setInAmbientMode(boolean inAmbientMode, long animationDuration)169     oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration);
170 }
171