From: Jeff Brown Date: Thu, 6 Sep 2012 00:48:03 +0000 (-0700) Subject: Update remote display API. X-Git-Tag: android-x86-4.4-r1~23^2~80^2~11^2~209^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ced24b36bbeed1ddd086a9304a9639c04ffe0962;p=android-x86%2Fframeworks-av.git Update remote display API. Renamed disconnect() to dispose() to emphasize the fact that this method is intended to clean up the IRemoteDisplay completely, not just temporarily disconnect the current client (which might be useful someday). Other minor tweaks. Change-Id: I1209639eb0cd8af09c724206642d7e52aab48257 --- diff --git a/include/media/IRemoteDisplay.h b/include/media/IRemoteDisplay.h index f39286e0ec..a61704eeb6 100644 --- a/include/media/IRemoteDisplay.h +++ b/include/media/IRemoteDisplay.h @@ -39,10 +39,8 @@ class IRemoteDisplay : public IInterface public: DECLARE_META_INTERFACE(RemoteDisplay); - // Disconnects the remote display. - // The remote display should respond back to the IRemoteDisplayClient with an - // onDisplayDisconnected() event when the disconnection is complete. - virtual status_t disconnect() = 0; + // Disconnects the remote display and stops listening for new connections. + virtual status_t dispose() = 0; }; diff --git a/include/media/IRemoteDisplayClient.h b/include/media/IRemoteDisplayClient.h index 38a0c9a35a..553ad36c2a 100644 --- a/include/media/IRemoteDisplayClient.h +++ b/include/media/IRemoteDisplayClient.h @@ -40,9 +40,9 @@ public: enum { // Error: An unknown / generic error occurred. - kErrorUnknown = 0, + kDisplayErrorUnknown = 1, // Error: The connection was dropped unexpectedly. - kErrorConnectionDropped = 1, + kDisplayErrorConnectionDropped = 2, }; // Indicates that the remote display has been connected successfully. @@ -52,7 +52,8 @@ public: uint32_t width, uint32_t height, uint32_t flags) = 0; // one-way // Indicates that the remote display has been disconnected normally. - // This method should only be called once the client has called 'disconnect()'. + // This method should only be called once the client has called 'dispose()' + // on the IRemoteDisplay. // It is currently an error for the display to disconnect for any other reason. virtual void onDisplayDisconnected() = 0; // one-way diff --git a/media/libmedia/IRemoteDisplay.cpp b/media/libmedia/IRemoteDisplay.cpp index 5d6ab34e27..da25a15d3c 100644 --- a/media/libmedia/IRemoteDisplay.cpp +++ b/media/libmedia/IRemoteDisplay.cpp @@ -22,7 +22,7 @@ namespace android { enum { - DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, + DISPOSE = IBinder::FIRST_CALL_TRANSACTION, }; class BpRemoteDisplay: public BpInterface @@ -33,11 +33,11 @@ public: { } - status_t disconnect() + status_t dispose() { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor()); - remote()->transact(DISCONNECT, data, &reply); + remote()->transact(DISPOSE, data, &reply); return reply.readInt32(); } }; @@ -50,9 +50,9 @@ status_t BnRemoteDisplay::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { - case DISCONNECT: { + case DISPOSE: { CHECK_INTERFACE(IRemoteDisplay, data, reply); - reply->writeInt32(disconnect()); + reply->writeInt32(dispose()); return NO_ERROR; } default: diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 9005500684..423d6ce119 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -283,7 +283,7 @@ sp MediaPlayerService::makeCrypto() { sp MediaPlayerService::listenForRemoteDisplay( const sp& client, const String8& iface) { - return new RemoteDisplay(client, iface.string());; + return new RemoteDisplay(client, iface.string()); } status_t MediaPlayerService::enableRemoteDisplay(const char *iface) { @@ -299,7 +299,7 @@ status_t MediaPlayerService::enableRemoteDisplay(const char *iface) { } if (mRemoteDisplay != NULL) { - mRemoteDisplay->disconnect(); + mRemoteDisplay->dispose(); mRemoteDisplay.clear(); } diff --git a/media/libmediaplayerservice/RemoteDisplay.cpp b/media/libmediaplayerservice/RemoteDisplay.cpp index 1cc605e984..5542bb5d06 100644 --- a/media/libmediaplayerservice/RemoteDisplay.cpp +++ b/media/libmediaplayerservice/RemoteDisplay.cpp @@ -39,7 +39,7 @@ RemoteDisplay::RemoteDisplay( RemoteDisplay::~RemoteDisplay() { } -status_t RemoteDisplay::disconnect() { +status_t RemoteDisplay::dispose() { mSource->stop(); mLooper->stop(); diff --git a/media/libmediaplayerservice/RemoteDisplay.h b/media/libmediaplayerservice/RemoteDisplay.h index 63c5286303..0d87250cbc 100644 --- a/media/libmediaplayerservice/RemoteDisplay.h +++ b/media/libmediaplayerservice/RemoteDisplay.h @@ -33,7 +33,7 @@ struct WifiDisplaySource; struct RemoteDisplay : public BnRemoteDisplay { RemoteDisplay(const sp &client, const char *iface); - virtual status_t disconnect(); + virtual status_t dispose(); protected: virtual ~RemoteDisplay();