Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 455d02ec authored by Jeff Brown's avatar Jeff Brown
Browse files

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
parent 0b73d473
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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;
};


+4 −3
Original line number Diff line number Diff line
@@ -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

+5 −5
Original line number Diff line number Diff line
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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();
    }

+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ RemoteDisplay::RemoteDisplay(
RemoteDisplay::~RemoteDisplay() {
}

status_t RemoteDisplay::disconnect() {
status_t RemoteDisplay::dispose() {
    mSource->stop();

    mLooper->stop();
Loading