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