Loading include/media/AudioSystem.h +3 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,9 @@ public: const char *device_address, const char *device_name); static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address); static status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name); static status_t setPhoneState(audio_mode_t state); static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage); Loading include/media/IAudioPolicyService.h +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,9 @@ public: const char *device_name) = 0; virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) = 0; virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) = 0; virtual status_t setPhoneState(audio_mode_t state) = 0; virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) = 0; Loading media/libaudioclient/AudioSystem.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -751,6 +751,25 @@ audio_policy_dev_state_t AudioSystem::getDeviceConnectionState(audio_devices_t d return aps->getDeviceConnectionState(device, device_address); } status_t AudioSystem::handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) { const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); const char *address = ""; const char *name = ""; if (aps == 0) return PERMISSION_DENIED; if (device_address != NULL) { address = device_address; } if (device_name != NULL) { name = device_name; } return aps->handleDeviceConfigChange(device, address, name); } status_t AudioSystem::setPhoneState(audio_mode_t state) { if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE; Loading media/libaudioclient/IAudioPolicyService.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ namespace android { enum { SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, GET_DEVICE_CONNECTION_STATE, HANDLE_DEVICE_CONFIG_CHANGE, SET_PHONE_STATE, SET_RINGER_MODE, // reserved, no longer used SET_FORCE_USE, Loading Loading @@ -116,6 +117,19 @@ public: return static_cast <audio_policy_dev_state_t>(reply.readInt32()); } virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast <uint32_t>(device)); data.writeCString(device_address); data.writeCString(device_name); remote()->transact(HANDLE_DEVICE_CONFIG_CHANGE, data, &reply); return static_cast <status_t> (reply.readInt32()); } virtual status_t setPhoneState(audio_mode_t state) { Parcel data, reply; Loading Loading @@ -838,6 +852,18 @@ status_t BnAudioPolicyService::onTransact( return NO_ERROR; } break; case HANDLE_DEVICE_CONFIG_CHANGE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); const char *device_address = data.readCString(); const char *device_name = data.readCString(); reply->writeInt32(static_cast<uint32_t> (handleDeviceConfigChange(device, device_address, device_name))); return NO_ERROR; } break; case SET_PHONE_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); reply->writeInt32(static_cast <uint32_t>(setPhoneState( Loading services/audiopolicy/AudioPolicyInterface.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public: // retrieve a device connection status virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) = 0; // indicate a change in device configuration virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) = 0; // indicate a change in phone state. Valid phones states are defined by audio_mode_t virtual void setPhoneState(audio_mode_t state) = 0; // force using a specific device category for the specified usage Loading Loading
include/media/AudioSystem.h +3 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,9 @@ public: const char *device_address, const char *device_name); static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address); static status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name); static status_t setPhoneState(audio_mode_t state); static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage); Loading
include/media/IAudioPolicyService.h +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,9 @@ public: const char *device_name) = 0; virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) = 0; virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) = 0; virtual status_t setPhoneState(audio_mode_t state) = 0; virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) = 0; Loading
media/libaudioclient/AudioSystem.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -751,6 +751,25 @@ audio_policy_dev_state_t AudioSystem::getDeviceConnectionState(audio_devices_t d return aps->getDeviceConnectionState(device, device_address); } status_t AudioSystem::handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) { const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); const char *address = ""; const char *name = ""; if (aps == 0) return PERMISSION_DENIED; if (device_address != NULL) { address = device_address; } if (device_name != NULL) { name = device_name; } return aps->handleDeviceConfigChange(device, address, name); } status_t AudioSystem::setPhoneState(audio_mode_t state) { if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE; Loading
media/libaudioclient/IAudioPolicyService.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ namespace android { enum { SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, GET_DEVICE_CONNECTION_STATE, HANDLE_DEVICE_CONFIG_CHANGE, SET_PHONE_STATE, SET_RINGER_MODE, // reserved, no longer used SET_FORCE_USE, Loading Loading @@ -116,6 +117,19 @@ public: return static_cast <audio_policy_dev_state_t>(reply.readInt32()); } virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast <uint32_t>(device)); data.writeCString(device_address); data.writeCString(device_name); remote()->transact(HANDLE_DEVICE_CONFIG_CHANGE, data, &reply); return static_cast <status_t> (reply.readInt32()); } virtual status_t setPhoneState(audio_mode_t state) { Parcel data, reply; Loading Loading @@ -838,6 +852,18 @@ status_t BnAudioPolicyService::onTransact( return NO_ERROR; } break; case HANDLE_DEVICE_CONFIG_CHANGE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); const char *device_address = data.readCString(); const char *device_name = data.readCString(); reply->writeInt32(static_cast<uint32_t> (handleDeviceConfigChange(device, device_address, device_name))); return NO_ERROR; } break; case SET_PHONE_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); reply->writeInt32(static_cast <uint32_t>(setPhoneState( Loading
services/audiopolicy/AudioPolicyInterface.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,10 @@ public: // retrieve a device connection status virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) = 0; // indicate a change in device configuration virtual status_t handleDeviceConfigChange(audio_devices_t device, const char *device_address, const char *device_name) = 0; // indicate a change in phone state. Valid phones states are defined by audio_mode_t virtual void setPhoneState(audio_mode_t state) = 0; // force using a specific device category for the specified usage Loading