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

Commit 0b8529fb authored by Ivan Lozano's avatar Ivan Lozano Committed by Android (Google) Code Review
Browse files

Merge "Generate the IPlayer interface with AIDL."

parents f238bd3c 8cf3a078
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@

namespace android {

namespace media {

// The native VolumeShaper class mirrors the java VolumeShaper class;
// in addition, the native class contains implementation for actual operation.
//
@@ -101,7 +103,7 @@ public:
     * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
     * details on the Java implementation.
     */
    class Configuration : public Interpolator<S, T>, public RefBase {
    class Configuration : public Interpolator<S, T>, public RefBase, public Parcelable {
    public:
        // Must match with VolumeShaper.java in frameworks/base.
        enum Type : int32_t {
@@ -283,7 +285,7 @@ public:
        }

        // The parcel layout must match VolumeShaper.java
        status_t writeToParcel(Parcel *parcel) const {
        status_t writeToParcel(Parcel *parcel) const override {
            if (parcel == nullptr) return BAD_VALUE;
            return parcel->writeInt32((int32_t)mType)
                    ?: parcel->writeInt32(mId)
@@ -294,17 +296,17 @@ public:
                            ?: Interpolator<S, T>::writeToParcel(parcel);
        }

        status_t readFromParcel(const Parcel &parcel) {
        status_t readFromParcel(const Parcel *parcel) override {
            int32_t type, optionFlags;
            return parcel.readInt32(&type)
            return parcel->readInt32(&type)
                    ?: setType((Type)type)
                    ?: parcel.readInt32(&mId)
                    ?: parcel->readInt32(&mId)
                    ?: mType == TYPE_ID
                        ? NO_ERROR
                        : parcel.readInt32(&optionFlags)
                        : parcel->readInt32(&optionFlags)
                            ?: setOptionFlags((OptionFlag)optionFlags)
                            ?: parcel.readDouble(&mDurationMs)
                            ?: Interpolator<S, T>::readFromParcel(parcel)
                            ?: parcel->readDouble(&mDurationMs)
                            ?: Interpolator<S, T>::readFromParcel(*parcel)
                            ?: checkCurve();
        }

@@ -336,7 +338,7 @@ public:
     * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
     * details on the Java implementation.
     */
    class Operation : public RefBase {
    class Operation : public RefBase, public Parcelable {
    public:
        // Must match with VolumeShaper.java.
        enum Flag : int32_t {
@@ -418,18 +420,18 @@ public:
            return NO_ERROR;
        }

        status_t writeToParcel(Parcel *parcel) const {
        status_t writeToParcel(Parcel *parcel) const override {
            if (parcel == nullptr) return BAD_VALUE;
            return parcel->writeInt32((int32_t)mFlags)
                    ?: parcel->writeInt32(mReplaceId)
                    ?: parcel->writeFloat(mXOffset);
        }

        status_t readFromParcel(const Parcel &parcel) {
        status_t readFromParcel(const Parcel *parcel) override {
            int32_t flags;
            return parcel.readInt32(&flags)
                    ?: parcel.readInt32(&mReplaceId)
                    ?: parcel.readFloat(&mXOffset)
            return parcel->readInt32(&flags)
                    ?: parcel->readInt32(&mReplaceId)
                    ?: parcel->readFloat(&mXOffset)
                    ?: setFlags((Flag)flags);
        }

@@ -455,7 +457,7 @@ public:
     * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
     * details on the Java implementation.
     */
    class State : public RefBase {
    class State : public RefBase, public Parcelable {
    public:
        State(T volume, S xOffset)
            : mVolume(volume)
@@ -481,15 +483,15 @@ public:
            mXOffset = xOffset;
        }

        status_t writeToParcel(Parcel *parcel) const {
        status_t writeToParcel(Parcel *parcel) const override {
            if (parcel == nullptr) return BAD_VALUE;
            return parcel->writeFloat(mVolume)
                    ?: parcel->writeFloat(mXOffset);
        }

        status_t readFromParcel(const Parcel &parcel) {
            return parcel.readFloat(&mVolume)
                     ?: parcel.readFloat(&mXOffset);
        status_t readFromParcel(const Parcel *parcel) override {
            return parcel->readFloat(&mVolume)
                     ?: parcel->readFloat(&mXOffset);
        }

        std::string toString() const {
@@ -1020,6 +1022,8 @@ private:
    std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase
}; // VolumeHandler

} // namespace media

} // namespace android

#pragma pop_macro("LOG_TAG")
+2 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ LOCAL_SRC_FILES = \
    binding/RingBufferParcelable.cpp \
    binding/SharedMemoryParcelable.cpp \
    binding/SharedRegionParcelable.cpp \
    ../../libaudioclient/aidl/android/media/IAudioRecord.aidl
    ../../libaudioclient/aidl/android/media/IAudioRecord.aidl \
    ../../libaudioclient/aidl/android/media/IPlayer.aidl

LOCAL_CFLAGS += -Wno-unused-parameter -Wall -Werror

+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ cc_library_shared {
        // The headers for these interfaces will be available to any modules that
        // include libaudioclient, at the path "aidl/package/path/BnFoo.h"
        "aidl/android/media/IAudioRecord.aidl",
        "aidl/android/media/IPlayer.aidl",

        "AudioEffect.cpp",
        "AudioPolicy.cpp",
@@ -49,7 +50,7 @@ cc_library_shared {
    ],
    export_shared_lib_headers: ["libbinder"],

    local_include_dirs: ["include/media"],
    local_include_dirs: ["include/media", "aidl"],
    header_libs: ["libaudioclient_headers"],
    export_header_lib_headers: ["libaudioclient_headers"],

+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ static const int kMaxLoopCountNotifications = 32;
namespace android {
// ---------------------------------------------------------------------------

using media::VolumeShaper;

// TODO: Move to a separate .h

template <typename T>
@@ -553,7 +555,7 @@ status_t AudioTrack::set(
    mFramesWritten = 0;
    mFramesWrittenServerOffset = 0;
    mFramesWrittenAtRestore = -1; // -1 is a unique initializer.
    mVolumeHandler = new VolumeHandler();
    mVolumeHandler = new media::VolumeHandler();
    return NO_ERROR;
}

+5 −3
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@

namespace android {

using media::VolumeShaper;

enum {
    GET_CBLK = IBinder::FIRST_CALL_TRANSACTION,
    START,
@@ -185,7 +187,7 @@ public:
            return nullptr;
        }
        sp<VolumeShaper::State> state = new VolumeShaper::State;
        status = state->readFromParcel(reply);
        status = state->readFromParcel(&reply);
        if (status != NO_ERROR) {
            return nullptr;
        }
@@ -263,12 +265,12 @@ status_t BnAudioTrack::onTransact(
            status_t status = data.readInt32(&present);
            if (status == NO_ERROR && present != 0) {
                configuration = new VolumeShaper::Configuration();
                status = configuration->readFromParcel(data);
                status = configuration->readFromParcel(&data);
            }
            status = status ?: data.readInt32(&present);
            if (status == NO_ERROR && present != 0) {
                operation = new VolumeShaper::Operation();
                status = operation->readFromParcel(data);
                status = operation->readFromParcel(&data);
            }
            if (status == NO_ERROR) {
                status = (status_t)applyVolumeShaper(configuration, operation);
Loading