1 /* 2 * Copyright (C) 2011 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.media; 18 19 import android.app.PendingIntent; 20 import android.content.ComponentName; 21 import android.graphics.Bitmap; 22 import android.os.Bundle; 23 24 /** 25 * @hide 26 * Interface registered through AudioManager of an object that displays information 27 * received from a remote control client. 28 * {@see AudioManager#registerRemoteControlDisplay(IRemoteControlDisplay)}. 29 */ 30 oneway interface IRemoteControlDisplay 31 { 32 /** 33 * Sets the generation counter of the current client that is displayed on the remote control. 34 * @param clientGeneration the new RemoteControlClient generation 35 * @param clientMediaIntent the PendingIntent associated with the client. 36 * May be null, which implies there is no registered media button event receiver. 37 * @param clearing true if the new client generation value maps to a remote control update 38 * where the display should be cleared. 39 */ setCurrentClientId(int clientGeneration, in PendingIntent clientMediaIntent, boolean clearing)40 void setCurrentClientId(int clientGeneration, in PendingIntent clientMediaIntent, 41 boolean clearing); 42 43 /** 44 * Sets whether the controls of this display are enabled 45 * @param if false, the display shouldn't any commands 46 */ setEnabled(boolean enabled)47 void setEnabled(boolean enabled); 48 49 /** 50 * Sets the playback information (state, position and speed) of a client. 51 * @param generationId the current generation ID as known by this client 52 * @param state the current playback state, one of the following values: 53 * {@link RemoteControlClient#PLAYSTATE_STOPPED}, 54 * {@link RemoteControlClient#PLAYSTATE_PAUSED}, 55 * {@link RemoteControlClient#PLAYSTATE_PLAYING}, 56 * {@link RemoteControlClient#PLAYSTATE_FAST_FORWARDING}, 57 * {@link RemoteControlClient#PLAYSTATE_REWINDING}, 58 * {@link RemoteControlClient#PLAYSTATE_SKIPPING_FORWARDS}, 59 * {@link RemoteControlClient#PLAYSTATE_SKIPPING_BACKWARDS}, 60 * {@link RemoteControlClient#PLAYSTATE_BUFFERING}, 61 * {@link RemoteControlClient#PLAYSTATE_ERROR}. 62 * @param stateChangeTimeMs the time at which the client reported the playback information 63 * @param currentPosMs a 0 or positive value for the current media position expressed in ms 64 * Strictly negative values imply that position is not known: 65 * a value of {@link RemoteControlClient#PLAYBACK_POSITION_INVALID} is intended to express 66 * that an application doesn't know the position (e.g. listening to a live stream of a radio) 67 * or that the position information is not applicable (e.g. when state 68 * is {@link RemoteControlClient#PLAYSTATE_BUFFERING} and nothing had played yet); 69 * a value of {@link RemoteControlClient#PLAYBACK_POSITION_ALWAYS_UNKNOWN} implies that the 70 * application uses {@link RemoteControlClient#setPlaybackState(int)} (legacy API) and will 71 * never pass a playback position. 72 * @param speed a value expressed as a ratio of 1x playback: 1.0f is normal playback, 73 * 2.0f is 2x, 0.5f is half-speed, -2.0f is rewind at 2x speed. 0.0f means nothing is 74 * playing (e.g. when state is {@link RemoteControlClient#PLAYSTATE_ERROR}). 75 */ setPlaybackState(int generationId, int state, long stateChangeTimeMs, long currentPosMs, float speed)76 void setPlaybackState(int generationId, int state, long stateChangeTimeMs, long currentPosMs, 77 float speed); 78 79 /** 80 * Sets the transport control flags and playback position capabilities of a client. 81 * @param generationId the current generation ID as known by this client 82 * @param transportControlFlags bitmask of the transport controls this client supports, see 83 * {@link RemoteControlClient#setTransportControlFlags(int)} 84 * @param posCapabilities a bit mask for playback position capabilities, see 85 * {@link RemoteControlClient#MEDIA_POSITION_READABLE} and 86 * {@link RemoteControlClient#MEDIA_POSITION_WRITABLE} 87 */ setTransportControlInfo(int generationId, int transportControlFlags, int posCapabilities)88 void setTransportControlInfo(int generationId, int transportControlFlags, int posCapabilities); 89 setMetadata(int generationId, in Bundle metadata)90 void setMetadata(int generationId, in Bundle metadata); 91 setArtwork(int generationId, in Bitmap artwork)92 void setArtwork(int generationId, in Bitmap artwork); 93 94 /** 95 * To combine metadata text and artwork in one binder call 96 */ setAllMetadata(int generationId, in Bundle metadata, in Bitmap artwork)97 void setAllMetadata(int generationId, in Bundle metadata, in Bitmap artwork); 98 } 99