/**@class android.service.wallpaper.WallpaperService.Engine @extends java.lang.Object The actual implementation of a wallpaper. A wallpaper service may have multiple instances running (for example as a real wallpaper and as a preview), each of which is represented by its own Engine instance. You must implement {@link android.service.wallpaper.WallpaperService#onCreateEngine()} to return your concrete Engine implementation. */ var Engine = { /**Provides access to the surface in which this wallpaper is drawn. */ getSurfaceHolder : function( ) {}, /**Convenience for {@link WallpaperManager#getDesiredMinimumWidth() WallpaperManager.getDesiredMinimumWidth()}, returning the width that the system would like this wallpaper to run in. */ getDesiredMinimumWidth : function( ) {}, /**Convenience for {@link WallpaperManager#getDesiredMinimumHeight() WallpaperManager.getDesiredMinimumHeight()}, returning the height that the system would like this wallpaper to run in. */ getDesiredMinimumHeight : function( ) {}, /**Return whether the wallpaper is currently visible to the user, this is the last value supplied to {@link #onVisibilityChanged}(boolean). */ isVisible : function( ) {}, /**Returns true if this engine is running in preview mode -- that is, it is being shown to the user before they select it as the actual wallpaper. */ isPreview : function( ) {}, /**Returns true if this engine is running in ambient mode -- that is, it is being shown in low power mode, on always on display. @hide */ isInAmbientMode : function( ) {}, /**Control whether this wallpaper will receive raw touch events from the window manager as the user interacts with the window that is currently displaying the wallpaper. By default they are turned off. If enabled, the events will be received in {@link #onTouchEvent}(MotionEvent). */ setTouchEventsEnabled : function( ) {}, /**Control whether this wallpaper will receive notifications when the wallpaper has been scrolled. By default, wallpapers will receive notifications, although the default static image wallpapers do not. It is a performance optimization to set this to false. @param {Boolean} enabled whether the wallpaper wants to receive offset notifications */ setOffsetNotificationsEnabled : function( ) {}, /**{@hide} */ setFixedSizeAllowed : function( ) {}, /**Called once to initialize the engine. After returning, the engine's surface will be created by the framework. */ onCreate : function( ) {}, /**Called right before the engine is going away. After this the surface will be destroyed and this Engine object is no longer valid. */ onDestroy : function( ) {}, /**Called to inform you of the wallpaper becoming visible or hidden. <em>It is very important that a wallpaper only use CPU while it is visible.</em>. */ onVisibilityChanged : function( ) {}, /**Called with the current insets that are in effect for the wallpaper. This gives you the part of the overall wallpaper surface that will generally be visible to the user (ignoring position offsets applied to it). @param {Object {WindowInsets}} insets Insets to apply. */ onApplyWindowInsets : function( ) {}, /**Called as the user performs touch-screen interaction with the window that is currently showing this wallpaper. Note that the events you receive here are driven by the actual application the user is interacting with, so if it is slow you will get fewer move events. */ onTouchEvent : function( ) {}, /**Called to inform you of the wallpaper's offsets changing within its contain, corresponding to the container's call to {@link WallpaperManager#setWallpaperOffsets(IBinder, float, float) WallpaperManager.setWallpaperOffsets()}. */ onOffsetsChanged : function( ) {}, /**Process a command that was sent to the wallpaper with {@link WallpaperManager#sendWallpaperCommand}. The default implementation does nothing, and always returns null as the result. @param {String} action The name of the command to perform. This tells you what to do and how to interpret the rest of the arguments. @param {Number} x Generic integer parameter. @param {Number} y Generic integer parameter. @param {Number} z Generic integer parameter. @param {Object {Bundle}} extras Any additional parameters. @param {Boolean} resultRequested If true, the caller is requesting that a result, appropriate for the command, be returned back. @return {Object {android.os.Bundle}} If returning a result, create a Bundle and place the result data in to it. Otherwise return null. */ onCommand : function( ) {}, /**Called when the device enters or exits ambient mode. @param {Boolean} inAmbientMode {@code true} if in ambient mode. @param {Number} animationDuration How long the transition animation to change the ambient state should run, in milliseconds. If 0 is passed as the argument here, the state should be switched immediately. @see #isInAmbientMode() @see WallpaperInfo#supportsAmbientMode() @hide */ onAmbientModeChanged : function( ) {}, /**Called when an application has changed the desired virtual size of the wallpaper. */ onDesiredSizeChanged : function( ) {}, /**Convenience for {@link SurfaceHolder.Callback#surfaceChanged SurfaceHolder.Callback.surfaceChanged()}. */ onSurfaceChanged : function( ) {}, /**Convenience for {@link SurfaceHolder.Callback2#surfaceRedrawNeeded SurfaceHolder.Callback.surfaceRedrawNeeded()}. */ onSurfaceRedrawNeeded : function( ) {}, /**Convenience for {@link SurfaceHolder.Callback#surfaceCreated SurfaceHolder.Callback.surfaceCreated()}. */ onSurfaceCreated : function( ) {}, /**Convenience for {@link SurfaceHolder.Callback#surfaceDestroyed SurfaceHolder.Callback.surfaceDestroyed()}. */ onSurfaceDestroyed : function( ) {}, /**Notifies the engine that wallpaper colors changed significantly. This will trigger a {@link #onComputeColors}() call. */ notifyColorsChanged : function( ) {}, /**Called by the system when it needs to know what colors the wallpaper is using. You might return null if no color information is available at the moment. In that case you might want to call {@link #notifyColorsChanged}() when color information becomes available. <p> The simplest way of creating a {@link android.app.WallpaperColors} object is by using {@link android.app.WallpaperColors#fromBitmap(Bitmap)} or {@link android.app.WallpaperColors#fromDrawable(Drawable)}, but you can also specify your main colors by constructing a {@link android.app.WallpaperColors} object manually. @return {Object {android.app.WallpaperColors}} Wallpaper colors. */ onComputeColors : function( ) {}, /**Sets internal engine state. Only for testing. @param {Boolean} created {@code true} or {@code false}. @hide */ setCreated : function( ) {}, /**The {@link Context} with resources that match the current display the wallpaper is on. For multiple display environment, multiple engines can be created to render on each display, but these displays may have different densities. Use this context to get the corresponding resources for currently display, avoiding the context of the service. <p> The display context will never be {@code null} after {@link android.service.wallpaper.WallpaperService.Engine#onCreate(SurfaceHolder)} has been called. @return {Object {android.content.Context}} A {@link Context} for current display. */ getDisplayContext : function( ) {}, /**Executes life cycle event and updates internal ambient mode state based on message sent from handler. @param {Boolean} inAmbientMode {@code true} if in ambient mode. @param {Number} animationDuration For how long the transition will last, in ms. @hide */ doAmbientModeChanged : function( ) {}, };