diff options
author | Glenn Kasten <gkasten@google.com> | 2013-07-15 14:45:07 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-07-19 09:30:37 -0700 |
commit | 4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61 (patch) | |
tree | c7ed5d9b71f919bf664dd0cb6cbdd1c3de2f9241 /services/audioflinger/AudioFlinger.cpp | |
parent | 0d61251648b5110bfc33ef5b3d19bbf65db0a7b5 (diff) | |
download | frameworks_av-4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61.zip frameworks_av-4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61.tar.gz frameworks_av-4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61.tar.bz2 |
Use AudioSystem::setLowRamDevice() to configure memory
Bug: 9798886
Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
Diffstat (limited to 'services/audioflinger/AudioFlinger.cpp')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 6a3007b..99e077c 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -62,6 +62,7 @@ #include <media/nbaio/Pipe.h> #include <media/nbaio/PipeReader.h> #include <media/AudioParameter.h> +#include <private/android_filesystem_config.h> // ---------------------------------------------------------------------------- @@ -139,7 +140,9 @@ AudioFlinger::AudioFlinger() mMasterMute(false), mNextUniqueId(1), mMode(AUDIO_MODE_INVALID), - mBtNrecIsOff(false) + mBtNrecIsOff(false), + mIsLowRamDevice(true), + mIsDeviceTypeKnown(false) { getpid_cached = getpid(); char value[PROPERTY_VALUE_MAX]; @@ -1381,6 +1384,23 @@ size_t AudioFlinger::getPrimaryOutputFrameCount() // ---------------------------------------------------------------------------- +status_t AudioFlinger::setLowRamDevice(bool isLowRamDevice) +{ + uid_t uid = IPCThreadState::self()->getCallingUid(); + if (uid != AID_SYSTEM) { + return PERMISSION_DENIED; + } + Mutex::Autolock _l(mLock); + if (mIsDeviceTypeKnown) { + return INVALID_OPERATION; + } + mIsLowRamDevice = isLowRamDevice; + mIsDeviceTypeKnown = true; + return NO_ERROR; +} + +// ---------------------------------------------------------------------------- + audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, |