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 19 import android.graphics.Rect; 20 import android.graphics.RectF; 21 import android.os.Bundle; 22 import android.os.ParcelFileDescriptor; 23 import android.app.IWallpaperManagerCallback; 24 import android.app.ILocalWallpaperColorConsumer; 25 import android.app.WallpaperInfo; 26 import android.content.ComponentName; 27 import android.app.WallpaperColors; 28 29 /** @hide */ 30 interface IWallpaperManager { 31 32 /** 33 * Set the wallpaper for the current user. 34 * 35 * If 'extras' is non-null, on successful return it will contain: 36 * EXTRA_SET_WALLPAPER_ID : integer ID that the new wallpaper will have 37 * 38 * 'which' is some combination of: 39 * FLAG_SET_SYSTEM 40 * FLAG_SET_LOCK 41 * 42 * A 'null' cropHint rectangle is explicitly permitted as a sentinel for "whatever 43 * the source image's bounding rect is." 44 * 45 * The completion callback's "onWallpaperChanged()" method is invoked when the 46 * new wallpaper content is ready to display. 47 */ setWallpaper(String name, in String callingPackage, in Rect cropHint, boolean allowBackup, out Bundle extras, int which, IWallpaperManagerCallback completion, int userId)48 ParcelFileDescriptor setWallpaper(String name, in String callingPackage, 49 in Rect cropHint, boolean allowBackup, out Bundle extras, int which, 50 IWallpaperManagerCallback completion, int userId); 51 52 /** 53 * Set the live wallpaper. This only affects the system wallpaper. 54 */ setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId)55 void setWallpaperComponentChecked(in ComponentName name, in String callingPackage, int userId); 56 57 /** 58 * Set the live wallpaper. This only affects the system wallpaper. 59 */ 60 @UnsupportedAppUsage setWallpaperComponent(in ComponentName name)61 void setWallpaperComponent(in ComponentName name); 62 63 64 /** 65 * @deprecated Use {@link #getWallpaperWithFeature(String, IWallpaperManagerCallback, int, 66 * Bundle, int)} 67 */ 68 @UnsupportedAppUsage getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId)69 ParcelFileDescriptor getWallpaper(String callingPkg, IWallpaperManagerCallback cb, int which, 70 out Bundle outParams, int userId); 71 72 /** 73 * Get the wallpaper for a given user. 74 */ getWallpaperWithFeature(String callingPkg, String callingFeatureId, IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId)75 ParcelFileDescriptor getWallpaperWithFeature(String callingPkg, String callingFeatureId, 76 IWallpaperManagerCallback cb, int which, out Bundle outParams, int userId); 77 78 /** 79 * Retrieve the given user's current wallpaper ID of the given kind. 80 */ getWallpaperIdForUser(int which, int userId)81 int getWallpaperIdForUser(int which, int userId); 82 83 /** 84 * If the current system wallpaper is a live wallpaper component, return the 85 * information about that wallpaper. Otherwise, if it is a static image, 86 * simply return null. 87 */ 88 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getWallpaperInfo(int userId)89 WallpaperInfo getWallpaperInfo(int userId); 90 91 /** 92 * Clear the system wallpaper. 93 */ clearWallpaper(in String callingPackage, int which, int userId)94 void clearWallpaper(in String callingPackage, int which, int userId); 95 96 /** 97 * Return whether the current system wallpaper has the given name. 98 */ 99 @UnsupportedAppUsage hasNamedWallpaper(String name)100 boolean hasNamedWallpaper(String name); 101 102 /** 103 * Sets the dimension hint for the wallpaper. These hints indicate the desired 104 * minimum width and height for the wallpaper in a particular display. 105 */ setDimensionHints(in int width, in int height, in String callingPackage, int displayId)106 void setDimensionHints(in int width, in int height, in String callingPackage, int displayId); 107 108 /** 109 * Returns the desired minimum width for the wallpaper in a particular display. 110 */ 111 @UnsupportedAppUsage getWidthHint(int displayId)112 int getWidthHint(int displayId); 113 114 /** 115 * Returns the desired minimum height for the wallpaper in a particular display. 116 */ 117 @UnsupportedAppUsage getHeightHint(int displayId)118 int getHeightHint(int displayId); 119 120 /** 121 * Sets extra padding that we would like the wallpaper to have outside of the display. 122 */ setDisplayPadding(in Rect padding, in String callingPackage, int displayId)123 void setDisplayPadding(in Rect padding, in String callingPackage, int displayId); 124 125 /** 126 * Returns the name of the wallpaper. Private API. 127 */ getName()128 String getName(); 129 130 /** 131 * Informs the service that wallpaper settings have been restored. Private API. 132 */ settingsRestored()133 void settingsRestored(); 134 135 /** 136 * Check whether wallpapers are supported for the calling user. 137 */ isWallpaperSupported(in String callingPackage)138 boolean isWallpaperSupported(in String callingPackage); 139 140 /** 141 * Check whether setting of wallpapers are allowed for the calling user. 142 */ isSetWallpaperAllowed(in String callingPackage)143 boolean isSetWallpaperAllowed(in String callingPackage); 144 145 /* 146 * Backup: is the current system wallpaper image eligible for off-device backup? 147 */ isWallpaperBackupEligible(int which, int userId)148 boolean isWallpaperBackupEligible(int which, int userId); 149 150 /* 151 * Keyguard: register a callback for being notified that lock-state relevant 152 * wallpaper content has changed. 153 */ setLockWallpaperCallback(IWallpaperManagerCallback cb)154 boolean setLockWallpaperCallback(IWallpaperManagerCallback cb); 155 156 /** 157 * Returns the colors used by the lock screen or system wallpaper. 158 * 159 * @param which either {@link WallpaperManager#FLAG_LOCK} 160 * or {@link WallpaperManager#FLAG_SYSTEM} 161 * @param displayId Which display is interested 162 * @return colors of chosen wallpaper 163 */ getWallpaperColors(int which, int userId, int displayId)164 WallpaperColors getWallpaperColors(int which, int userId, int displayId); 165 166 /** 167 * @hide 168 */ removeOnLocalColorsChangedListener( in ILocalWallpaperColorConsumer callback, in List<RectF> area, int which, int userId, int displayId)169 void removeOnLocalColorsChangedListener( 170 in ILocalWallpaperColorConsumer callback, in List<RectF> area, 171 int which, int userId, int displayId); 172 173 /** 174 * @hide 175 */ addOnLocalColorsChangedListener(in ILocalWallpaperColorConsumer callback, in List<RectF> regions, int which, int userId, int displayId)176 void addOnLocalColorsChangedListener(in ILocalWallpaperColorConsumer callback, 177 in List<RectF> regions, int which, int userId, int displayId); 178 179 /** 180 * Register a callback to receive color updates from a display 181 */ registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)182 void registerWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId); 183 184 /** 185 * Unregister a callback that was receiving color updates from a display 186 */ unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId)187 void unregisterWallpaperColorsCallback(IWallpaperManagerCallback cb, int userId, int displayId); 188 189 /** 190 * Called from SystemUI when it shows the AoD UI. 191 */ setInAmbientMode(boolean inAmbientMode, long animationDuration)192 oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration); 193 194 /** 195 * Called from SystemUI when the device is waking up. 196 * 197 * @hide 198 */ notifyWakingUp(int x, int y, in Bundle extras)199 oneway void notifyWakingUp(int x, int y, in Bundle extras); 200 201 /** 202 * Called from SystemUI when the device is going to sleep. 203 * 204 * @hide 205 */ notifyGoingToSleep(int x, int y, in Bundle extras)206 void notifyGoingToSleep(int x, int y, in Bundle extras); 207 } 208