OSDN Git Service

Update remote display API.
authorJeff Brown <jeffbrown@google.com>
Thu, 6 Sep 2012 00:48:03 +0000 (17:48 -0700)
committerJeff Brown <jeffbrown@google.com>
Thu, 6 Sep 2012 00:48:03 +0000 (17:48 -0700)
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

include/media/IRemoteDisplay.h
include/media/IRemoteDisplayClient.h
media/libmedia/IRemoteDisplay.cpp
media/libmediaplayerservice/MediaPlayerService.cpp
media/libmediaplayerservice/RemoteDisplay.cpp
media/libmediaplayerservice/RemoteDisplay.h

index f39286e..a61704e 100644 (file)
@@ -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;
 };
 
 
index 38a0c9a..553ad36 100644 (file)
@@ -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
 
index 5d6ab34..da25a15 100644 (file)
@@ -22,7 +22,7 @@
 namespace android {
 
 enum {
-    DISCONNECT = IBinder::FIRST_CALL_TRANSACTION,
+    DISPOSE = IBinder::FIRST_CALL_TRANSACTION,
 };
 
 class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
@@ -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:
index 9005500..423d6ce 100644 (file)
@@ -283,7 +283,7 @@ sp<ICrypto> MediaPlayerService::makeCrypto() {
 
 sp<IRemoteDisplay> MediaPlayerService::listenForRemoteDisplay(
         const sp<IRemoteDisplayClient>& 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();
     }
 
index 1cc605e..5542bb5 100644 (file)
@@ -39,7 +39,7 @@ RemoteDisplay::RemoteDisplay(
 RemoteDisplay::~RemoteDisplay() {
 }
 
-status_t RemoteDisplay::disconnect() {
+status_t RemoteDisplay::dispose() {
     mSource->stop();
 
     mLooper->stop();
index 63c5286..0d87250 100644 (file)
@@ -33,7 +33,7 @@ struct WifiDisplaySource;
 struct RemoteDisplay : public BnRemoteDisplay {
     RemoteDisplay(const sp<IRemoteDisplayClient> &client, const char *iface);
 
-    virtual status_t disconnect();
+    virtual status_t dispose();
 
 protected:
     virtual ~RemoteDisplay();