/**@class android.service.quicksettings.TileService @extends android.app.Service A TileService provides the user a tile that can be added to Quick Settings. Quick Settings is a space provided that allows the user to change settings and take quick actions without leaving the context of their current app. <p>The lifecycle of a TileService is different from some other services in that it may be unbound during parts of its lifecycle. Any of the following lifecycle events can happen indepently in a separate binding/creation of the service.</p> <ul> <li>When a tile is added by the user its TileService will be bound to and {@link #onTileAdded}() will be called.</li> <li>When a tile should be up to date and listing will be indicated by {@link #onStartListening}() and {@link #onStopListening}().</li> <li>When the user removes a tile from Quick Settings {@link #onTileRemoved}() will be called.</li> </ul> <p>TileService will be detected by tiles that match the {@value #ACTION_QS_TILE} and require the permission "android.permission.BIND_QUICK_SETTINGS_TILE". The label and icon for the service will be used as the default label and icon for the tile. Here is an example TileService declaration.</p> <pre class="prettyprint"> {@literal <service android:name=".MyQSTileService" android:label="@string/my_default_tile_label" android:icon="@drawable/my_default_icon_label" android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> <intent-filter> <action android:name="android.service.quicksettings.action.QS_TILE" /> </intent-filter> </service>} </pre> @see Tile Tile for details about the UI of a Quick Settings Tile. */ var TileService = { /** An activity that provides a user interface for adjusting TileService preferences. Optional but recommended for apps that implement a TileService. <p> This intent may also define a {@link Intent#EXTRA_COMPONENT_NAME} value to indicate the {@link ComponentName} that caused the preferences to be opened. <p> To ensure that the activity can only be launched through quick settings UI provided by this service, apps can protect it with the BIND_QUICK_SETTINGS_TILE permission. */ ACTION_QS_TILE_PREFERENCES : "android.service.quicksettings.action.QS_TILE_PREFERENCES", /** Action that identifies a Service as being a TileService. */ ACTION_QS_TILE : "android.service.quicksettings.action.QS_TILE", /** Meta-data for tile definition to set a tile into active mode. <p> Active mode is for tiles which already listen and keep track of their state in their own process. These tiles may request to send an update to the System while their process is alive using {@link #requestListeningState}. The System will only bind these tiles on its own when a click needs to occur. To make a TileService an active tile, set this meta-data to true on the TileService's manifest declaration. <pre class="prettyprint"> {@literal <meta-data android:name="android.service.quicksettings.ACTIVE_TILE" android:value="true" /> } </pre> */ META_DATA_ACTIVE_TILE : "android.service.quicksettings.ACTIVE_TILE", /** Used to notify SysUI that Listening has be requested. @hide */ ACTION_REQUEST_LISTENING : "android.service.quicksettings.action.REQUEST_LISTENING", /** @hide */ EXTRA_SERVICE : "service", /** @hide */ EXTRA_TOKEN : "token", /** @hide */ EXTRA_STATE : "state", /** */ onDestroy : function( ) {}, /**Called when the user adds this tile to Quick Settings. <p/> Note that this is not guaranteed to be called between {@link #onCreate}() and {@link #onStartListening}(), it will only be called when the tile is added and not on subsequent binds. */ onTileAdded : function( ) {}, /**Called when the user removes this tile from Quick Settings. */ onTileRemoved : function( ) {}, /**Called when this tile moves into a listening state. <p/> When this tile is in a listening state it is expected to keep the UI up to date. Any listeners or callbacks needed to keep this tile up to date should be registered here and unregistered in {@link #onStopListening}(). @see #getQsTile() @see Tile#updateTile() */ onStartListening : function( ) {}, /**Called when this tile moves out of the listening state. */ onStopListening : function( ) {}, /**Called when the user clicks on this tile. */ onClick : function( ) {}, /**Sets an icon to be shown in the status bar. <p> The icon will be displayed before all other icons. Can only be called between {@link #onStartListening} and {@link #onStopListening}. Can only be called by system apps. @param {Object {Icon}} icon The icon to be displayed, null to hide @param {String} contentDescription Content description of the icon to be displayed @hide */ setStatusIcon : function( ) {}, /**Used to show a dialog. This will collapse the Quick Settings panel and show the dialog. @param {Object {Dialog}} dialog Dialog to show. @see #isLocked() */ showDialog : function( ) {}, /**Prompts the user to unlock the device before executing the Runnable. <p> The user will be prompted for their current security method if applicable and if successful, runnable will be executed. The Runnable will not be executed if the user fails to unlock the device or cancels the operation. */ unlockAndRun : function( ) {}, /**Checks if the device is in a secure state. TileServices should detect when the device is secure and change their behavior accordingly. @return {Boolean} true if the device is secure. */ isSecure : function( ) {}, /**Checks if the lock screen is showing. When a device is locked, then {@link #showDialog} will not present a dialog, as it will be under the lock screen. If the behavior of the Tile is safe to do while locked, then the user should use {@link #startActivity} to launch an activity on top of the lock screen, otherwise the tile should use {@link #unlockAndRun}(Runnable) to give the user their security challenge. @return {Boolean} true if the device is locked. */ isLocked : function( ) {}, /**Start an activity while collapsing the panel. */ startActivityAndCollapse : function( ) {}, /**Gets the {@link android.service.quicksettings.Tile} for this service. <p/> This tile may be used to get or set the current state for this tile. This tile is only valid for updates between {@link #onStartListening}() and {@link #onStopListening}(). */ getQsTile : function( ) {}, /** */ onBind : function( ) {}, /** @return {Boolean} True if the device supports quick settings and its assocated APIs. @hide */ isQuickSettingsSupported : function( ) {}, /**Requests that a tile be put in the listening state so it can send an update. This method is only applicable to tiles that have {@link #META_DATA_ACTIVE_TILE} defined as true on their TileService Manifest declaration, and will do nothing otherwise. */ requestListeningState : function( ) {}, };