blob: 7ac22233ecf84a949061766705501bee4b044170 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/**
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
Dianne Hackborn067e5f62014-09-07 23:14:30 -070019import android.graphics.Rect;
Dianne Hackborn284ac932009-08-28 10:34:25 -070020import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.os.ParcelFileDescriptor;
Dianne Hackborn8cc6a502009-08-05 21:29:42 -070022import android.app.IWallpaperManagerCallback;
Dianne Hackborneb034652009-09-07 00:49:58 -070023import android.app.WallpaperInfo;
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070024import android.content.ComponentName;
Lucas Dupinea1fb1e2017-04-05 17:39:44 -070025import android.app.WallpaperColors;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026
27/** @hide */
Dianne Hackborn8cc6a502009-08-05 21:29:42 -070028interface IWallpaperManager {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029
30 /**
Christopher Tatebe132e62016-02-10 12:59:49 -080031 * Set the wallpaper for the current user.
Christopher Tatead3c2592016-01-20 18:13:17 -080032 *
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
Christopher Tate1e1e2e02016-01-25 15:34:36 -080039 *
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.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045 */
Christopher Tatead3c2592016-01-20 18:13:17 -080046 ParcelFileDescriptor setWallpaper(String name, in String callingPackage,
Christopher Tated7faf532016-02-25 12:43:38 -080047 in Rect cropHint, boolean allowBackup, out Bundle extras, int which,
Jorim Jaggi6c902d02016-08-18 10:44:54 -070048 IWallpaperManagerCallback completion, int userId);
Christopher Tate1e1e2e02016-01-25 15:34:36 -080049
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080051 * Set the live wallpaper. This only affects the system wallpaper.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070052 */
Adrian Roos40ea0832016-07-14 14:19:55 -070053 void setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId);
Benjamin Franzf3ece362015-02-11 10:51:10 +000054
55 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080056 * Set the live wallpaper. This only affects the system wallpaper.
Benjamin Franzf3ece362015-02-11 10:51:10 +000057 */
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070058 void setWallpaperComponent(in ComponentName name);
Benjamin Franzf3ece362015-02-11 10:51:10 +000059
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070060 /**
Christopher Tatebe132e62016-02-10 12:59:49 -080061 * Get the wallpaper for a given user.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 */
Christopher Tatebe132e62016-02-10 12:59:49 -080063 ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, int which,
64 out Bundle outParams, int userId);
Christopher Tate1e1e2e02016-01-25 15:34:36 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 /**
Christopher Tatee409f0e2016-03-21 14:53:15 -070067 * Retrieve the given user's current wallpaper ID of the given kind.
68 */
69 int getWallpaperIdForUser(int which, int userId);
70
71 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080072 * 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.
Dianne Hackborneb034652009-09-07 00:49:58 -070075 */
Jorim Jaggie31f6b82016-07-01 16:15:09 -070076 WallpaperInfo getWallpaperInfo(int userId);
Christopher Tate1e1e2e02016-01-25 15:34:36 -080077
Dianne Hackborneb034652009-09-07 00:49:58 -070078 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080079 * Clear the system wallpaper.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 */
Christopher Tatebe132e62016-02-10 12:59:49 -080081 void clearWallpaper(in String callingPackage, int which, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082
83 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080084 * Return whether the current system wallpaper has the given name.
Dianne Hackborn5dc5a002012-09-15 19:33:48 -070085 */
86 boolean hasNamedWallpaper(String name);
87
88 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 * Sets the dimension hint for the wallpaper. These hints indicate the desired
90 * minimum width and height for the wallpaper.
91 */
Benjamin Franzf3ece362015-02-11 10:51:10 +000092 void setDimensionHints(in int width, in int height, in String callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093
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();
Amith Yamasani30f8eb42013-11-06 14:54:50 -0800103
104 /**
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700105 * Sets extra padding that we would like the wallpaper to have outside of the display.
106 */
Benjamin Franzf3ece362015-02-11 10:51:10 +0000107 void setDisplayPadding(in Rect padding, in String callingPackage);
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700108
109 /**
Amith Yamasani30f8eb42013-11-06 14:54:50 -0800110 * 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();
Benjamin Franzf3ece362015-02-11 10:51:10 +0000118
119 /**
120 * Check whether wallpapers are supported for the calling user.
121 */
122 boolean isWallpaperSupported(in String callingPackage);
Oleksandr Peletskyif2519812016-01-26 20:16:06 +0100123
124 /**
125 * Check whether setting of wallpapers are allowed for the calling user.
126 */
Christopher Tate98d609c2016-05-18 17:31:58 -0700127 boolean isSetWallpaperAllowed(in String callingPackage);
Christopher Tatebe132e62016-02-10 12:59:49 -0800128
129 /*
Christopher Tated7faf532016-02-25 12:43:38 -0800130 * Backup: is the current system wallpaper image eligible for off-device backup?
131 */
Christopher Tate61722662016-08-10 16:13:14 -0700132 boolean isWallpaperBackupEligible(int which, int userId);
Christopher Tated7faf532016-02-25 12:43:38 -0800133
134 /*
Christopher Tatebe132e62016-02-10 12:59:49 -0800135 * Keyguard: register a callback for being notified that lock-state relevant
136 * wallpaper content has changed.
137 */
138 boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700139
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 */
Lucas Dupin26fb43c2017-07-14 11:55:05 -0700147 WallpaperColors getWallpaperColors(int which, int userId);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700148
149 /**
150 * Register a callback to receive color updates
151 */
Lucas Dupin26fb43c2017-07-14 11:55:05 -0700152 void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700153
154 /**
155 * Unregister a callback that was receiving color updates
156 */
Lucas Dupin26fb43c2017-07-14 11:55:05 -0700157 void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800158}