Loading include/audiomanager/IPlayer.h +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <media/VolumeShaper.h> #include <utils/RefBase.h> #include <utils/Errors.h> #include <binder/IInterface.h> Loading @@ -45,6 +46,9 @@ public: virtual void setStartDelayMs(int delayMs) = 0; virtual void applyVolumeShaper( const sp<VolumeShaper::Configuration>& configuration, const sp<VolumeShaper::Operation>& operation) = 0; }; // ---------------------------------------------------------------------------- Loading services/audiomanager/IPlayer.cpp +53 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ enum { SET_VOLUME = IBinder::FIRST_CALL_TRANSACTION + 3, SET_PAN = IBinder::FIRST_CALL_TRANSACTION + 4, SET_START_DELAY_MS = IBinder::FIRST_CALL_TRANSACTION + 5, APPLY_VOLUME_SHAPER = IBinder::FIRST_CALL_TRANSACTION + 6, }; class BpPlayer : public BpInterface<IPlayer> Loading Loading @@ -88,6 +89,36 @@ public: data.writeInt32(delayMs); remote()->transact(SET_START_DELAY_MS, data, &reply); } virtual void applyVolumeShaper( const sp<VolumeShaper::Configuration>& configuration, const sp<VolumeShaper::Operation>& operation) { Parcel data, reply; data.writeInterfaceToken(IPlayer::getInterfaceDescriptor()); status_t status = configuration.get() == nullptr ? data.writeInt32(0) : data.writeInt32(1) ?: configuration->writeToParcel(&data); if (status != NO_ERROR) { ALOGW("applyVolumeShaper failed configuration parceling: %d", status); return; // ignore error } status = operation.get() == nullptr ? status = data.writeInt32(0) : data.writeInt32(1) ?: operation->writeToParcel(&data); if (status != NO_ERROR) { ALOGW("applyVolumeShaper failed operation parceling: %d", status); return; // ignore error } status = remote()->transact(APPLY_VOLUME_SHAPER, data, &reply); ALOGW_IF(status != NO_ERROR, "applyVolumeShaper failed transact: %d", status); return; // one way transaction, ignore error } }; IMPLEMENT_META_INTERFACE(Player, "android.media.IPlayer"); Loading Loading @@ -128,6 +159,28 @@ status_t BnPlayer::onTransact( setStartDelayMs(data.readInt32()); return NO_ERROR; } break; case APPLY_VOLUME_SHAPER: { CHECK_INTERFACE(IPlayer, data, reply); sp<VolumeShaper::Configuration> configuration; sp<VolumeShaper::Operation> operation; int32_t present; status_t status = data.readInt32(&present); if (status == NO_ERROR && present != 0) { configuration = new VolumeShaper::Configuration(); status = configuration->readFromParcel(data); } status = status ?: data.readInt32(&present); if (status == NO_ERROR && present != 0) { operation = new VolumeShaper::Operation(); status = operation->readFromParcel(data); } if (status == NO_ERROR) { // one way transaction, no error returned applyVolumeShaper(configuration, operation); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading Loading
include/audiomanager/IPlayer.h +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <media/VolumeShaper.h> #include <utils/RefBase.h> #include <utils/Errors.h> #include <binder/IInterface.h> Loading @@ -45,6 +46,9 @@ public: virtual void setStartDelayMs(int delayMs) = 0; virtual void applyVolumeShaper( const sp<VolumeShaper::Configuration>& configuration, const sp<VolumeShaper::Operation>& operation) = 0; }; // ---------------------------------------------------------------------------- Loading
services/audiomanager/IPlayer.cpp +53 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ enum { SET_VOLUME = IBinder::FIRST_CALL_TRANSACTION + 3, SET_PAN = IBinder::FIRST_CALL_TRANSACTION + 4, SET_START_DELAY_MS = IBinder::FIRST_CALL_TRANSACTION + 5, APPLY_VOLUME_SHAPER = IBinder::FIRST_CALL_TRANSACTION + 6, }; class BpPlayer : public BpInterface<IPlayer> Loading Loading @@ -88,6 +89,36 @@ public: data.writeInt32(delayMs); remote()->transact(SET_START_DELAY_MS, data, &reply); } virtual void applyVolumeShaper( const sp<VolumeShaper::Configuration>& configuration, const sp<VolumeShaper::Operation>& operation) { Parcel data, reply; data.writeInterfaceToken(IPlayer::getInterfaceDescriptor()); status_t status = configuration.get() == nullptr ? data.writeInt32(0) : data.writeInt32(1) ?: configuration->writeToParcel(&data); if (status != NO_ERROR) { ALOGW("applyVolumeShaper failed configuration parceling: %d", status); return; // ignore error } status = operation.get() == nullptr ? status = data.writeInt32(0) : data.writeInt32(1) ?: operation->writeToParcel(&data); if (status != NO_ERROR) { ALOGW("applyVolumeShaper failed operation parceling: %d", status); return; // ignore error } status = remote()->transact(APPLY_VOLUME_SHAPER, data, &reply); ALOGW_IF(status != NO_ERROR, "applyVolumeShaper failed transact: %d", status); return; // one way transaction, ignore error } }; IMPLEMENT_META_INTERFACE(Player, "android.media.IPlayer"); Loading Loading @@ -128,6 +159,28 @@ status_t BnPlayer::onTransact( setStartDelayMs(data.readInt32()); return NO_ERROR; } break; case APPLY_VOLUME_SHAPER: { CHECK_INTERFACE(IPlayer, data, reply); sp<VolumeShaper::Configuration> configuration; sp<VolumeShaper::Operation> operation; int32_t present; status_t status = data.readInt32(&present); if (status == NO_ERROR && present != 0) { configuration = new VolumeShaper::Configuration(); status = configuration->readFromParcel(data); } status = status ?: data.readInt32(&present); if (status == NO_ERROR && present != 0) { operation = new VolumeShaper::Operation(); status = operation->readFromParcel(data); } if (status == NO_ERROR) { // one way transaction, no error returned applyVolumeShaper(configuration, operation); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading