blob: 7f5350ddd4e089920a4ce8ee0e310768e5819eba [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 */
Andrei Onea4b2116c2019-02-28 15:13:42 +000058 @UnsupportedAppUsage
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070059 void setWallpaperComponent(in ComponentName name);
Benjamin Franzf3ece362015-02-11 10:51:10 +000060
Dianne Hackborn4c62fc02009-08-08 20:40:27 -070061 /**
Christopher Tatebe132e62016-02-10 12:59:49 -080062 * Get the wallpaper for a given user.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063 */
Andrei Onea4b2116c2019-02-28 15:13:42 +000064 @UnsupportedAppUsage
Christopher Tate93252de2017-06-15 14:48:41 -070065 ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which,
Christopher Tatebe132e62016-02-10 12:59:49 -080066 out Bundle outParams, int userId);
Christopher Tate1e1e2e02016-01-25 15:34:36 -080067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 /**
Christopher Tatee409f0e2016-03-21 14:53:15 -070069 * Retrieve the given user's current wallpaper ID of the given kind.
70 */
71 int getWallpaperIdForUser(int which, int userId);
72
73 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080074 * 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.
Dianne Hackborneb034652009-09-07 00:49:58 -070077 */
Andrei Onea4b2116c2019-02-28 15:13:42 +000078 @UnsupportedAppUsage
Jorim Jaggie31f6b82016-07-01 16:15:09 -070079 WallpaperInfo getWallpaperInfo(int userId);
Christopher Tate1e1e2e02016-01-25 15:34:36 -080080
Dianne Hackborneb034652009-09-07 00:49:58 -070081 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080082 * Clear the system wallpaper.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 */
Christopher Tatebe132e62016-02-10 12:59:49 -080084 void clearWallpaper(in String callingPackage, int which, int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085
86 /**
Christopher Tatead3c2592016-01-20 18:13:17 -080087 * Return whether the current system wallpaper has the given name.
Dianne Hackborn5dc5a002012-09-15 19:33:48 -070088 */
Andrei Onea4b2116c2019-02-28 15:13:42 +000089 @UnsupportedAppUsage
Dianne Hackborn5dc5a002012-09-15 19:33:48 -070090 boolean hasNamedWallpaper(String name);
91
92 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 * Sets the dimension hint for the wallpaper. These hints indicate the desired
wilsonshih81e10a72018-11-15 10:54:21 +080094 * minimum width and height for the wallpaper in a particular display.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 */
wilsonshih81e10a72018-11-15 10:54:21 +080096 void setDimensionHints(in int width, in int height, in String callingPackage, int displayId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097
98 /**
wilsonshih81e10a72018-11-15 10:54:21 +080099 * Returns the desired minimum width for the wallpaper in a particular display.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 */
Andrei Onea4b2116c2019-02-28 15:13:42 +0000101 @UnsupportedAppUsage
wilsonshih81e10a72018-11-15 10:54:21 +0800102 int getWidthHint(int displayId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103
104 /**
wilsonshih81e10a72018-11-15 10:54:21 +0800105 * Returns the desired minimum height for the wallpaper in a particular display.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 */
Andrei Onea4b2116c2019-02-28 15:13:42 +0000107 @UnsupportedAppUsage
wilsonshih81e10a72018-11-15 10:54:21 +0800108 int getHeightHint(int displayId);
Amith Yamasani30f8eb42013-11-06 14:54:50 -0800109
110 /**
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700111 * Sets extra padding that we would like the wallpaper to have outside of the display.
112 */
wilsonshih81e10a72018-11-15 10:54:21 +0800113 void setDisplayPadding(in Rect padding, in String callingPackage, int displayId);
Dianne Hackborn067e5f62014-09-07 23:14:30 -0700114
115 /**
Amith Yamasani30f8eb42013-11-06 14:54:50 -0800116 * Returns the name of the wallpaper. Private API.
117 */
118 String getName();
119
120 /**
121 * Informs the service that wallpaper settings have been restored. Private API.
122 */
123 void settingsRestored();
Benjamin Franzf3ece362015-02-11 10:51:10 +0000124
125 /**
126 * Check whether wallpapers are supported for the calling user.
127 */
128 boolean isWallpaperSupported(in String callingPackage);
Oleksandr Peletskyif2519812016-01-26 20:16:06 +0100129
130 /**
131 * Check whether setting of wallpapers are allowed for the calling user.
132 */
Christopher Tate98d609c2016-05-18 17:31:58 -0700133 boolean isSetWallpaperAllowed(in String callingPackage);
Christopher Tatebe132e62016-02-10 12:59:49 -0800134
135 /*
Christopher Tated7faf532016-02-25 12:43:38 -0800136 * Backup: is the current system wallpaper image eligible for off-device backup?
137 */
Christopher Tate61722662016-08-10 16:13:14 -0700138 boolean isWallpaperBackupEligible(int which, int userId);
Christopher Tated7faf532016-02-25 12:43:38 -0800139
140 /*
Christopher Tatebe132e62016-02-10 12:59:49 -0800141 * Keyguard: register a callback for being notified that lock-state relevant
142 * wallpaper content has changed.
143 */
144 boolean setLockWallpaperCallback(IWallpaperManagerCallback cb);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700145
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}
wilsonshih36597d42018-12-05 18:56:39 +0800151 * @param displayId Which display is interested
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700152 * @return colors of chosen wallpaper
153 */
wilsonshih36597d42018-12-05 18:56:39 +0800154 WallpaperColors getWallpaperColors(int which, int userId, int displayId);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700155
156 /**
wilsonshih36597d42018-12-05 18:56:39 +0800157 * Register a callback to receive color updates from a display
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700158 */
wilsonshih36597d42018-12-05 18:56:39 +0800159 void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700160
161 /**
wilsonshih36597d42018-12-05 18:56:39 +0800162 * Unregister a callback that was receiving color updates from a display
Lucas Dupinea1fb1e2017-04-05 17:39:44 -0700163 */
wilsonshih36597d42018-12-05 18:56:39 +0800164 void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId);
Lucas Dupin7517b5d2017-08-22 12:51:25 -0700165
166 /**
167 * Called from SystemUI when it shows the AoD UI.
168 */
Lucas Dupin4c8c3272018-11-06 17:47:48 -0800169 oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170}