The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 19 | import android.graphics.Rect; |
Dianne Hackborn | 284ac93 | 2009-08-28 10:34:25 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.os.ParcelFileDescriptor; |
Dianne Hackborn | 8cc6a50 | 2009-08-05 21:29:42 -0700 | [diff] [blame] | 22 | import android.app.IWallpaperManagerCallback; |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 23 | import android.app.WallpaperInfo; |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 24 | import android.content.ComponentName; |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 25 | import android.app.WallpaperColors; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | |
| 27 | /** @hide */ |
Dianne Hackborn | 8cc6a50 | 2009-08-05 21:29:42 -0700 | [diff] [blame] | 28 | interface IWallpaperManager { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | |
| 30 | /** |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 31 | * Set the wallpaper for the current user. |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 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 |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 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. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | */ |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 46 | ParcelFileDescriptor setWallpaper(String name, in String callingPackage, |
Christopher Tate | d7faf53 | 2016-02-25 12:43:38 -0800 | [diff] [blame] | 47 | in Rect cropHint, boolean allowBackup, out Bundle extras, int which, |
Jorim Jaggi | 6c902d0 | 2016-08-18 10:44:54 -0700 | [diff] [blame] | 48 | IWallpaperManagerCallback completion, int userId); |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 49 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 51 | * Set the live wallpaper. This only affects the system wallpaper. |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 52 | */ |
Adrian Roos | 40ea083 | 2016-07-14 14:19:55 -0700 | [diff] [blame] | 53 | void setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId); |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 54 | |
| 55 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 56 | * Set the live wallpaper. This only affects the system wallpaper. |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 57 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 58 | @UnsupportedAppUsage |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 59 | void setWallpaperComponent(in ComponentName name); |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 60 | |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 61 | /** |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 62 | * Get the wallpaper for a given user. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 63 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 64 | @UnsupportedAppUsage |
Christopher Tate | 93252de | 2017-06-15 14:48:41 -0700 | [diff] [blame] | 65 | ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which, |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 66 | out Bundle outParams, int userId); |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 67 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | /** |
Christopher Tate | e409f0e | 2016-03-21 14:53:15 -0700 | [diff] [blame] | 69 | * Retrieve the given user's current wallpaper ID of the given kind. |
| 70 | */ |
| 71 | int getWallpaperIdForUser(int which, int userId); |
| 72 | |
| 73 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 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. |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 77 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 78 | @UnsupportedAppUsage |
Jorim Jaggi | e31f6b8 | 2016-07-01 16:15:09 -0700 | [diff] [blame] | 79 | WallpaperInfo getWallpaperInfo(int userId); |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 80 | |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 81 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 82 | * Clear the system wallpaper. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | */ |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 84 | void clearWallpaper(in String callingPackage, int which, int userId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | |
| 86 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 87 | * Return whether the current system wallpaper has the given name. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 88 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 89 | @UnsupportedAppUsage |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 90 | boolean hasNamedWallpaper(String name); |
| 91 | |
| 92 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 93 | * Sets the dimension hint for the wallpaper. These hints indicate the desired |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 94 | * minimum width and height for the wallpaper in a particular display. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 95 | */ |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 96 | void setDimensionHints(in int width, in int height, in String callingPackage, int displayId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | |
| 98 | /** |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 99 | * Returns the desired minimum width for the wallpaper in a particular display. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 101 | @UnsupportedAppUsage |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 102 | int getWidthHint(int displayId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 103 | |
| 104 | /** |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 105 | * Returns the desired minimum height for the wallpaper in a particular display. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 106 | */ |
Andrei Onea | 4b2116c | 2019-02-28 15:13:42 +0000 | [diff] [blame] | 107 | @UnsupportedAppUsage |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 108 | int getHeightHint(int displayId); |
Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 109 | |
| 110 | /** |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 111 | * Sets extra padding that we would like the wallpaper to have outside of the display. |
| 112 | */ |
wilsonshih | 81e10a7 | 2018-11-15 10:54:21 +0800 | [diff] [blame] | 113 | void setDisplayPadding(in Rect padding, in String callingPackage, int displayId); |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 114 | |
| 115 | /** |
Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 116 | * 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 Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Check whether wallpapers are supported for the calling user. |
| 127 | */ |
| 128 | boolean isWallpaperSupported(in String callingPackage); |
Oleksandr Peletskyi | f251981 | 2016-01-26 20:16:06 +0100 | [diff] [blame] | 129 | |
| 130 | /** |
| 131 | * Check whether setting of wallpapers are allowed for the calling user. |
| 132 | */ |
Christopher Tate | 98d609c | 2016-05-18 17:31:58 -0700 | [diff] [blame] | 133 | boolean isSetWallpaperAllowed(in String callingPackage); |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 134 | |
| 135 | /* |
Christopher Tate | d7faf53 | 2016-02-25 12:43:38 -0800 | [diff] [blame] | 136 | * Backup: is the current system wallpaper image eligible for off-device backup? |
| 137 | */ |
Christopher Tate | 6172266 | 2016-08-10 16:13:14 -0700 | [diff] [blame] | 138 | boolean isWallpaperBackupEligible(int which, int userId); |
Christopher Tate | d7faf53 | 2016-02-25 12:43:38 -0800 | [diff] [blame] | 139 | |
| 140 | /* |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 141 | * Keyguard: register a callback for being notified that lock-state relevant |
| 142 | * wallpaper content has changed. |
| 143 | */ |
| 144 | boolean setLockWallpaperCallback(IWallpaperManagerCallback cb); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 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} |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 151 | * @param displayId Which display is interested |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 152 | * @return colors of chosen wallpaper |
| 153 | */ |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 154 | WallpaperColors getWallpaperColors(int which, int userId, int displayId); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 155 | |
| 156 | /** |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 157 | * Register a callback to receive color updates from a display |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 158 | */ |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 159 | void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 160 | |
| 161 | /** |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 162 | * Unregister a callback that was receiving color updates from a display |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 163 | */ |
wilsonshih | 36597d4 | 2018-12-05 18:56:39 +0800 | [diff] [blame] | 164 | void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId); |
Lucas Dupin | 7517b5d | 2017-08-22 12:51:25 -0700 | [diff] [blame] | 165 | |
| 166 | /** |
| 167 | * Called from SystemUI when it shows the AoD UI. |
| 168 | */ |
Lucas Dupin | 4c8c327 | 2018-11-06 17:47:48 -0800 | [diff] [blame] | 169 | oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 170 | } |