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

Commit 23525ac2 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

Merge commit 'korg/cupcake'

parents 06ee417b 490b2ba5
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -107,12 +107,12 @@ static const KeycodeLabel KEYCODES[] = {
    { "MENU", 82 },
    { "NOTIFICATION", 83 },
    { "SEARCH", 84 },
    { "PLAYPAUSE", 85 },
    { "STOP", 86 },
    { "NEXTSONG", 87 },
    { "PREVIOUSSONG", 88 },
    { "REWIND", 89 },
    { "FORWARD", 90 },
    { "MEDIA_PLAY_PAUSE", 85 },
    { "MEDIA_STOP", 86 },
    { "MEDIA_NEXT", 87 },
    { "MEDIA_PREVIOUS", 88 },
    { "MEDIA_REWIND", 89 },
    { "MEDIA_FAST_FORWARD", 90 },
    { "MUTE", 91 },

    // NOTE: If you add a new keycode here you must also add it to:
+39 −11
Original line number Diff line number Diff line
@@ -99,9 +99,8 @@ status_t A2dpAudioInterface::setParameter(const char *key, const char *value)
    if (strcmp(key, "a2dp_sink_address") == 0) {
        return mOutput->setAddress(value);
    }
    if (strcmp(key, "bluetooth_enabled") == 0 &&
        strcmp(value, "false") == 0) {
        return mOutput->close();
    if (strcmp(key, "bluetooth_enabled") == 0) {
        mOutput->setBluetoothEnabled(strcmp(value, "true") == 0);
    }

    return 0;
@@ -130,7 +129,10 @@ status_t A2dpAudioInterface::dump(int fd, const Vector<String16>& args)
// ----------------------------------------------------------------------------

A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() :
    mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL)
    mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL),
    // assume BT enabled to start, this is safe because its only the
    // enabled->disabled transition we are worried about
    mBluetoothEnabled(true)
{
    // use any address by default
    strcpy(mA2dpAddress, "00:00:00:00:00:00");
@@ -166,7 +168,14 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
    Mutex::Autolock lock(mLock);

    size_t remaining = bytes;
    status_t status = init();
    status_t status = -1;

    if (!mBluetoothEnabled) {
        LOGW("A2dpAudioStreamOut::write(), but bluetooth disabled");
        goto Error;
    }

    status = init();
    if (status < 0)
        goto Error;

@@ -235,7 +244,26 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setAddress(const char* address)
    return NO_ERROR;
}

status_t A2dpAudioInterface::A2dpAudioStreamOut::setBluetoothEnabled(bool enabled)
{
    LOGD("setBluetoothEnabled %d", enabled);

    Mutex::Autolock lock(mLock);

    mBluetoothEnabled = enabled;
    if (!enabled) {
        return close_l();
    }
    return NO_ERROR;
}

status_t A2dpAudioInterface::A2dpAudioStreamOut::close()
{
    Mutex::Autolock lock(mLock);
    return close_l();
}

status_t A2dpAudioInterface::A2dpAudioStreamOut::close_l()
{
    if (mData) {
        a2dp_cleanup(mData);
+4 −1
Original line number Diff line number Diff line
@@ -88,7 +88,9 @@ private:
        friend class A2dpAudioInterface;
                status_t    init();
                status_t    close();
                status_t    close_l();
                status_t    setAddress(const char* address);
                status_t    setBluetoothEnabled(bool enabled);

    private:
                int         mFd;
@@ -98,6 +100,7 @@ private:
                char        mA2dpAddress[20];
                void*       mData;
                Mutex       mLock;
                bool        mBluetoothEnabled;
    };

    A2dpAudioStreamOut*     mOutput;
+5 −8
Original line number Diff line number Diff line
@@ -958,21 +958,18 @@ status_t AudioFlinger::MixerThread::dumpTracks(int fd, const Vector<String16>& a
    result.append(buffer);
    result.append("   Name Clien Typ Fmt Chn Buf S M F SRate LeftV RighV Serv User\n");
    for (size_t i = 0; i < mTracks.size(); ++i) {
        wp<Track> wTrack = mTracks[i];
        if (wTrack != 0) {
            sp<Track> track = wTrack.promote();
        sp<Track> track = mTracks[i];
        if (track != 0) {
            track->dump(buffer, SIZE);
            result.append(buffer);
        }
    }
    }

    snprintf(buffer, SIZE, "Output %d mixer thread active tracks\n", mOutputType);
    result.append(buffer);
    result.append("   Name Clien Typ Fmt Chn Buf S M F SRate LeftV RighV Serv User\n");
    for (size_t i = 0; i < mActiveTracks.size(); ++i) {
        wp<Track> wTrack = mTracks[i];
        wp<Track> wTrack = mActiveTracks[i];
        if (wTrack != 0) {
            sp<Track> track = wTrack.promote();
            if (track != 0) {