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 | */ |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 58 | void setWallpaperComponent(in ComponentName name); |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 59 | |
Dianne Hackborn | 4c62fc0 | 2009-08-08 20:40:27 -0700 | [diff] [blame] | 60 | /** |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 61 | * Get the wallpaper for a given user. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 62 | */ |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 63 | ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, int which, |
| 64 | out Bundle outParams, int userId); |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 65 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 66 | /** |
Christopher Tate | e409f0e | 2016-03-21 14:53:15 -0700 | [diff] [blame] | 67 | * Retrieve the given user's current wallpaper ID of the given kind. |
| 68 | */ |
| 69 | int getWallpaperIdForUser(int which, int userId); |
| 70 | |
| 71 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 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. |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 75 | */ |
Jorim Jaggi | e31f6b8 | 2016-07-01 16:15:09 -0700 | [diff] [blame] | 76 | WallpaperInfo getWallpaperInfo(int userId); |
Christopher Tate | 1e1e2e0 | 2016-01-25 15:34:36 -0800 | [diff] [blame] | 77 | |
Dianne Hackborn | eb03465 | 2009-09-07 00:49:58 -0700 | [diff] [blame] | 78 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 79 | * Clear the system wallpaper. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 80 | */ |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 81 | void clearWallpaper(in String callingPackage, int which, int userId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 82 | |
| 83 | /** |
Christopher Tate | ad3c259 | 2016-01-20 18:13:17 -0800 | [diff] [blame] | 84 | * Return whether the current system wallpaper has the given name. |
Dianne Hackborn | 5dc5a00 | 2012-09-15 19:33:48 -0700 | [diff] [blame] | 85 | */ |
| 86 | boolean hasNamedWallpaper(String name); |
| 87 | |
| 88 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | * Sets the dimension hint for the wallpaper. These hints indicate the desired |
| 90 | * minimum width and height for the wallpaper. |
| 91 | */ |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 92 | void setDimensionHints(in int width, in int height, in String callingPackage); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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(); |
Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 103 | |
| 104 | /** |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 105 | * Sets extra padding that we would like the wallpaper to have outside of the display. |
| 106 | */ |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 107 | void setDisplayPadding(in Rect padding, in String callingPackage); |
Dianne Hackborn | 067e5f6 | 2014-09-07 23:14:30 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 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(); |
Benjamin Franz | f3ece36 | 2015-02-11 10:51:10 +0000 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Check whether wallpapers are supported for the calling user. |
| 121 | */ |
| 122 | boolean isWallpaperSupported(in String callingPackage); |
Oleksandr Peletskyi | f251981 | 2016-01-26 20:16:06 +0100 | [diff] [blame] | 123 | |
| 124 | /** |
| 125 | * Check whether setting of wallpapers are allowed for the calling user. |
| 126 | */ |
Christopher Tate | 98d609c | 2016-05-18 17:31:58 -0700 | [diff] [blame] | 127 | boolean isSetWallpaperAllowed(in String callingPackage); |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 128 | |
| 129 | /* |
Christopher Tate | d7faf53 | 2016-02-25 12:43:38 -0800 | [diff] [blame] | 130 | * Backup: is the current system wallpaper image eligible for off-device backup? |
| 131 | */ |
Christopher Tate | 6172266 | 2016-08-10 16:13:14 -0700 | [diff] [blame] | 132 | boolean isWallpaperBackupEligible(int which, int userId); |
Christopher Tate | d7faf53 | 2016-02-25 12:43:38 -0800 | [diff] [blame] | 133 | |
| 134 | /* |
Christopher Tate | be132e6 | 2016-02-10 12:59:49 -0800 | [diff] [blame] | 135 | * Keyguard: register a callback for being notified that lock-state relevant |
| 136 | * wallpaper content has changed. |
| 137 | */ |
| 138 | boolean setLockWallpaperCallback(IWallpaperManagerCallback cb); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 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 | */ |
Lucas Dupin | 26fb43c | 2017-07-14 11:55:05 -0700 | [diff] [blame] | 147 | WallpaperColors getWallpaperColors(int which, int userId); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * Register a callback to receive color updates |
| 151 | */ |
Lucas Dupin | 26fb43c | 2017-07-14 11:55:05 -0700 | [diff] [blame] | 152 | void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId); |
Lucas Dupin | ea1fb1e | 2017-04-05 17:39:44 -0700 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * Unregister a callback that was receiving color updates |
| 156 | */ |
Lucas Dupin | 26fb43c | 2017-07-14 11:55:05 -0700 | [diff] [blame] | 157 | void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 158 | } |