Commit 4426e42a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi

Bug 5045498 New implementation of remote control API

Remote control displays expose an IRemoteControlDisplay interface
 which they register through AudioManager.
Remote control clients create a RemoteControlClient object, which
 implicitely exposes an IRemoteControlClient interface registered
 in AudioService through AudioManager.
AudioService tells all clients and displays when a new client
 is the one that should be displayed.
A client's data gets sent to the display when it is valid, or
 it sets new data (while being valid).

The implementation for setting metadata and album art is temporary,
 and will migrate to the MetadataEditor API in future CLs.

Change-Id: Ibab6ea1d94c68f32482c760c6ae269541f885548
parent 0197d825
......@@ -183,7 +183,8 @@ LOCAL_SRC_FILES += \
media/java/android/media/IAudioFocusDispatcher.aidl \
media/java/android/media/IMediaScannerListener.aidl \
media/java/android/media/IMediaScannerService.aidl \
media/java/android/media/IRemoteControlClientDispatcher.aidl \
media/java/android/media/IRemoteControlClient.aidl \
media/java/android/media/IRemoteControlDisplay.aidl \
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
telephony/java/com/android/internal/telephony/ITelephony.aidl \
......
......@@ -105,6 +105,7 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SystemUI_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/R/com/android/systemui/R.java)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java/android/media/IAudioService.P)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
This diff is collapsed.
This diff is collapsed.
......@@ -18,7 +18,8 @@ package android.media;
import android.content.ComponentName;
import android.media.IAudioFocusDispatcher;
import android.media.IRemoteControlClientDispatcher;
import android.media.IRemoteControlClient;
import android.media.IRemoteControlDisplay;
/**
* {@hide}
......@@ -88,13 +89,14 @@ interface IAudioService {
void unregisterMediaButtonEventReceiver(in ComponentName eventReceiver);
void registerRemoteControlClient(in ComponentName eventReceiver,
in IRemoteControlClientDispatcher rcClient, in String clientName,
in String callingPackageName);
oneway void registerRemoteControlClient(in ComponentName eventReceiver,
in IRemoteControlClient rcClient, in String clientName, in String callingPackageName);
oneway void unregisterRemoteControlClient(in ComponentName eventReceiver,
in IRemoteControlClient rcClient);
IRemoteControlClientDispatcher getRemoteControlClientDispatcher(in int rcClientId);
void notifyRemoteControlInformationChanged(in ComponentName eventReceiver, int infoFlag);
oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd);
oneway void unregisterRemoteControlDisplay(in IRemoteControlDisplay rcd);
oneway void remoteControlDisplayUsesBitmapSize(in IRemoteControlDisplay rcd, int w, int h);
void startBluetoothSco(IBinder cb);
......
/* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media;
import android.graphics.Bitmap;
import android.media.IRemoteControlDisplay;
/**
* @hide
* Interface registered by AudioManager to notify a source of remote control information
* that information is requested to be displayed on the remote control (through
* IRemoteControlDisplay).
* {@see AudioManager#registerRemoteControlClient(RemoteControlClient)}.
*/
oneway interface IRemoteControlClient
{
/**
* Notifies a remote control client that information for the given generation ID is
* requested. If the flags contains
* {@link RemoteControlClient#FLAG_INFORMATION_REQUESTED_ALBUM_ART} then the width and height
* parameters are valid.
* @param generationId
* @param infoFlags
* @param artWidth if > 0, artHeight must be > 0 too.
* @param artHeight
* FIXME: is infoFlags required? since the RCC pushes info, this might always be called
* with RC_INFO_ALL
*/
void onInformationRequested(int generationId, int infoFlags, int artWidth, int artHeight);
/**
* Sets the generation counter of the current client that is displayed on the remote control.
*/
void setCurrentClientGenerationId(int clientGeneration);
void plugRemoteControlDisplay(IRemoteControlDisplay rcd);
void unplugRemoteControlDisplay(IRemoteControlDisplay rcd);
}
\ No newline at end of file
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media;
import android.graphics.Bitmap;
/**
* @hide
* Interface registered by AudioManager to dispatch remote control information requests
* to the RemoteControlClient implementation. This is used by AudioService.
* {@see AudioManager#registerRemoteControlClient(ComponentName, RemoteControlClient)}.
*/
interface IRemoteControlClientDispatcher
{
/**
* Called by a remote control to retrieve a String of information to display.
* @param field the identifier for a metadata field to retrieve. Valid values are
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_ALBUM},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_ALBUMARTIST},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_TITLE},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_ARTIST},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_AUTHOR},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_CD_TRACK_NUMBER},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_COMPILATION},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_COMPOSER},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_DATE},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_DISC_NUMBER},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_DURATION},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_GENRE},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_TITLE},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_WRITER},
* {@link android.media.MediaMetadataRetriever#METADATA_KEY_YEAR}.
* @return null if the requested field is not supported, or the String matching the
* metadata field.
*/
String getMetadataStringForClient(String clientName, int field);
/**
* Called by a remote control to retrieve the current playback state.
* @return one of the following values:
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_STOPPED},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PAUSED},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_PLAYING},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_FAST_FORWARDING},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_REWINDING},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_FORWARDS},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_SKIPPING_BACKWARDS},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_BUFFERING},
* {@link android.media.AudioManager.RemoteControlParameters#PLAYSTATE_ERROR}.
*/
int getPlaybackStateForClient(String clientName);
/**
* Called by a remote control to retrieve the flags for the media transport control buttons
* that this client supports.
* @see {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PREVIOUS},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_REWIND},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PLAY_PAUSE},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_PAUSE},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_STOP},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_FAST_FORWARD},
* {@link android.media.AudioManager.RemoteControlParameters#FLAG_KEY_MEDIA_NEXT}
*/
int getTransportControlFlagsForClient(String clientName);
/**
* Called by a remote control to retrieve the album art picture at the requested size.
* Note that returning a bitmap smaller than the maximum requested dimension is accepted
* and it will be scaled as needed, but exceeding the maximum dimensions may produce
* unspecified results, such as the image being cropped or simply not being displayed.
* @param maxWidth the maximum width of the requested bitmap expressed in pixels.
* @param maxHeight the maximum height of the requested bitmap expressed in pixels.
* @return the bitmap for the album art, or null if there isn't any.
* @see android.graphics.Bitmap
*/
Bitmap getAlbumArtForClient(String clientName, int maxWidth, int maxHeight);
}
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media;
import android.graphics.Bitmap;
import android.os.Bundle;
/**
* @hide
* Interface registered through AudioManager of an object that displays information
* received from a remote control client.
* {@see AudioManager#registerRemoteControlDisplay(IRemoteControlDisplay)}.
*/
oneway interface IRemoteControlDisplay
{
/**
* Sets the generation counter of the current client that is displayed on the remote control.
*/
void setCurrentClientGenerationId(int clientGeneration);
void setPlaybackState(int generationId, int state);
void setMetadata(int generationId, in Bundle metadata);
void setTransportControlFlags(int generationId, int transportControlFlags);
void setArtwork(int generationId, in Bitmap artwork);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment