Add an argument to IAudioFlinger::createEffect() API to
ask AudioFlinger to just run the pre flight checks but not
create the actual audio effect instance and allocate resources.
This is the basis of an API for apps to query if a given
effect can be created without having to allocate the resources
and risk an exception when calling the constructor.
Bug: 150699608
Test: CTS and GTS Tests for audio effects
Change-Id: Ibdda22fd945c88c33e3c7342a7a5ed3e02d399ac
The metadata object might be overriden later and has it memory
re-allocated; hence snaping the sensor timestamp value before
we call into any method that might change the metadata.
Test: build
Bug: 150944913
Merged-In: I0f944fc9133d3ab279859f20236d956d7ca338f8
Change-Id: I0f944fc9133d3ab279859f20236d956d7ca338f8
(cherry picked from commit 60afc2fd8dab203a5697adbdb8dd4718d00bd9f1)
Clear the cached previous request in case of
successful offline switch. The request can
potentially continue to have valid references
to offline streams.
Clear the online camera device reference after
composite streams switch to offline mode.
In this case, all internal offline streams must
be released by the offline session.
Bug: 149346795
Test: Camera CTS
Change-Id: If29308dd0f402ab492e304e0475005b2a9801e74
Test: Boot device, see if setup video plays
Test: atp/tv_***_video_playback_smoke_test
Bug: 151156096
Bug: 151163101
Change-Id: I768bf36765fdc5dbd81c4c7632741f47e148147b
Replace global static instances of non-primitive
types with function static instances. The latter
get initialized on the first call to the function
instead of module load time.
This also gets rid of ASAN UAF errors reported
during unit test execution.
Bug: 150649241
Test: atest audiopolicy_tests
Test: atest audio_health_tests
(for ASAN-instrumented libraries and test)
Change-Id: I514c9205b9d3e7a3f0a1d8aa71d71fcc792e7a7b
* changes:
Plumb the notification about audio HAL services update to APM
libaudiohal: Allow late registration of HIDL HAL services
Allow for late audio module discovery in APM
The onCameraOpened/onCameraClosed callbacks are used to notify camera
service client with [] permission that a certain camera device has been
opened/closed.
Test: Manually check callbacks are received in SystemUI app
Bug: 150540299
Change-Id: If6f3624c43927c30afef7df0a780eafe3ae4c527
Merged-In: If6f3624c43927c30afef7df0a780eafe3ae4c527
AudioFlinger registers a callback with libaudiohal to receive
notifications when new HAL services get registered. It relays
the notification to AudioPolicyManager via AudioSystem /
IAudioPolicyService interface.
Because AF / APM only interact via Binder interfaces and APM's
interface gets registered later than AF's, the notification
from AF is made asynchronous.
Bug: 149854039
Test: audio test on a regular phone configuration
audio test on a phone with MSD audio HAL module
Change-Id: I158e941b8f75e2a4614b9d84ca798b0f1f47aa6a
Extract code that loads hardware modules and fills out
mAvailable{Input|Output}Devices into a reusable function.
It is used both during APM initialization and on
receiving a notification that a new HAL service has
been discovered.
Bug: 149854039
Test: atest audiopolicy_tests
Change-Id: Ifb7f0b61b06a0609802e63dccb26f3472328ef48
The onCameraOpened/onCameraClosed callbacks are used to notify camera
service client with CAMERA_OPEN_CLOSE_LISTENER permission that a certain
camera device has been opened/closed.
Test: Manually check callbacks are received in SystemUI app
Bug: 150540299
Change-Id: If6f3624c43927c30afef7df0a780eafe3ae4c527
If effect chain has non-offloaded effect, and is enabled for direct
output, when there's no volume control for all the effect modules
within this chain, volume should still be set to HAL.
Test: Play Music, Videos with effects
Bug: 149899134
CRs-Fixed: 2625597
Change-Id: I77bd0d456d5fa4e88afb283002a5eb1e2b704ca8
Use SYSTEM_TIME_REALTIME instead.
As we always specify the time when the item arrives,
this has no real effect, just for internal consistency.
Test: atest mediametrics_tests
Bug: 149850236
Change-Id: I34d7bed0c4e25b288493ce1ecf3574c4d87334d9
1) Correct TransactionLog low water mark
2) Limit number of items historically stored in any TimeMachine property.
Test: Special instrumented atest
Bug: 150547711
Bug: 150598686
Change-Id: I67b25c84b1fb62ce83caa5ec48b800cab85467c9
Having a sp<ProviderInfo> in DeviceInfo resulting in the parent
ProviderInfo not being deallocated.
Test: Check camera characteristics object freed by killing provider
Bug: 149813446
Change-Id: Ic15ffcd3a5ce424187877e17a14b4db581e2c50a
Fix two concurrent capture scenarii when VoIP call is active:
1) when the audio mode is IN_COMMUNICATION, only allow capture
from the app owning the audio mode.
2) fix capture by a privileged app when a privacy sensitive capture is
active: capture was silecend if the privacy sensitive capture was
started after the privileged capture.
Bug: 148368476
Test: Manual test of various VoIP apps and phone calls scenarii
Test: cts AudioRecordTest
Change-Id: I166f91c43ce86bb23c2f171700ece634091caaad
AudioSystem.setAllowedPolicyCapture is only called from audio service.
In that case, checking if the calling uid is system uid to before taking
action.
Bug: 145115448
Test: dumpsys audio, query active playback configuration
Change-Id: I614ac881ecde6bad13f22f1382de701f314a7ada
Merged-In: I614ac881ecde6bad13f22f1382de701f314a7ada
(cherry picked from commit 140a34fbfe)
releaseAsync() kicks off shutdown sequence but don't wait for it to
finish. Instead, mark itself as pending removal to the resource manager.
Bug: 129008570
Test: atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small
Test: ResourceManagerServce_test
Change-Id: I119945684e4c101c44d64c13913fa01320662fa9
When creating native audio track, a IAudioTrackCallback will be created
systematically. All callbacks will be cached in Threads and protected by
a lock. Whenever there is a callback event from audio HAL, it will
finally trigger callback to native audio track. Currently, there is only
one callback event, which is codec format change.
Bug: 150301890
Test: manual
Change-Id: I32293627ed923b17dd25f11f0ee0a0c35cd7c01f
ensures that the @include'd policy files (code_coverage, crash_dump)
used by mainlined media processes are carried within the respective
APEX files. Parent policy files now @include the copy held within
the apex.
Bug: 147914640
Test: built/booted/examined filesystem
Change-Id: I34213fbc93ca51696b6a5a3c60bfd3ffa7ce6764
This was accidentally removed when converting MediaExtractorService
to AIDL, but is needed for large MediaBuffers
Bug: 147152626
Bug: 147835592
Test: CTS, manual test app
Change-Id: I403968efa4319f316aa2ba5c0d7db71a0781b883
This avoids unnecessary copying of camera metadata which can get
expensive in cases of large camera metadata blobs.
Bug: 71727540
Test: GCA (sanity)
Test: Add CallStack::logStack() in CameraMetadata's move asignment
operator -> see that it gets called for every insertResultLocked.
Change-Id: I6c75c7ce5267126916c865b028e5f7c7f50b763b
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
cameraserver should re-cache concurrent camera id combinations when it
receives cameraDeviceStatusChange callbacks from the camera provider in
case new concurrent camera id combinations have appeared / old ones have
gone away.
Bug: 148995918
Test: atest ConcurrentCameraTest.java
Change-Id: Ic433495d2dcf98d00cb247f434ad6c798ea17c54
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
The access to call audio (record and play) will be granted only to the app associated with Dialer role, who also includes a new system permission.
Test: Compilation and manual tests
Bug: 135197853
Change-Id: I65ca823c235d4d3420630837427103783ad1d1b0
Both EXIF_TAG_IMAGE_WIDTH and EXIF_TAG_IMAGE_LENGTH
expect short values as per EXIF spec. Call appropriate
libexif function to avoid possible heap corruption.
Bug: 148223871
Test: run sts-engbuild-no-spl-lock -m StsHostTestCases --test android.security.sts.Poc20_02#testPocBug_148223871
Change-Id: I57a774454b52c16d7da9f90d7e3a3407294606a5
This code has null checks with intervening unconditional dereferences of
the potentially-null variable.
It's not clear that `mOutput` can ever be null to begin with. If it can
be, we have a few dereferences to guard. :)
Caught by the static analyzer:
frameworks/av/services/audioflinger/Threads.cpp:2671:19: warning: Called
C++ object pointer is null [clang-analyzer-core.CallAndMessage]
frameworks/av/services/audioflinger/Threads.cpp:2852:9: warning: Called
C++ object pointer is null [clang-analyzer-core.CallAndMessage]
Bug: None
Test: TreeHugger
Change-Id: I456581204718390088998a1fe2514dff63f6578f
The logic in IOProfile::devicesSupportEncodedFormats()
was only checking if the first device in the list of supported devices
was supporting currently selected A2DP encoding format.
But if more than one devices match the queried types, we need to check
all devices in case one of them supports the selected encoding format.
Bug: 147789166
Test: repro steps in the bug.
Change-Id: I704c5c6278eed524f15e7b73cec68a24f04d3a8c
Add meteric to show the difference between drm
playback of protected vs unprotected content.
We log onQueueInputBuffer errors.
Bug: 138862395
Test: adb shell dumpsys media.metrics | grep -i InputBuffer
Change-Id: I26aae706267956b6f944955877347747e573e3c8
Methods like reconfigureCamera called by the RequestThread internally
call methods which might expect to have mInterfaceLock locked
(eg: configureStreamsLocked).
Also, function calls which expect to be serialized w.r.t
reconfigureCamera can cause reported camera status to be inconsistent
w.r.t the expected status.
For example the following situation might occur
through CameraTest.java#testVideoSnapshot :
For certain video sizes that would fail to configure the camera
startRecordingL
camera reconfiguration is triggered -> reconfigureCamera() starts
waitUntilDrained -> gets interleaved with reconfigureCamera()
reconfigureCamera() completes
Here the status of the camera device is active instead of CONFIGURED.
updateRecording
createStream() called expects the camera to not be in an ACTIVE
state since updateProcessorStream cannot handle stream
configuration failure gracefully when the device is streaming.
However since waitUntilDrained did not complete after
reconfigureCamera the camera status is STATUS_ACTIVE.
As a result, we should hold mInterfaceMutex while
calling these methods. To avoid deadlocks (b/143513518), we can have the thread
calling disconnect, relinquish mInterfaceMutex right before it starts
waiting on RequestThread to exit. It can re-acquire it when
RequestThread finishes.
Bug: 147313521
Test: atest CameraTest.java#testVideoSnapshot on pixel2 passes
Test: camera CTS
Test: GCA (sanity)
Change-Id: I384f62bc9936d9691dfe9c13ff743e3d07f2ed55
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
Make the list of keys in allowedKey to match the
statsd_handlers[] in iface_statsd.cpp for dumpsys
to display mediadrm and Widevine metrics.
Bug: 149246413
Test: adb shell dumpsys media.metrics | grep -i drm
Test: adb shell dumpsys media.metrics | grep -i widevine
Change-Id: I7811eb3a4228a906bb3dbc615ce42d1947082a07
This change fixes the CTS failure in AudioPlaybackCaptureTest caused
by ag/10111312 and ag/10111311.
It contains the following fixes/changes:
- Mix match for playback capture of USAGE_VOICE_COMMUNICATION now
also respects a new flag (AudioMix's mVoiceCommunicationCaptureAllowed)
which is set by AudioService only if the caller explicitly asked
to capture USAGE_VOICE_COMMUNICATION and have the
CAPTURE_VOICE_COMMUNICATION_OUTPUT.
- A permission check on the native side in case
mVoiceCommunicationCaptureAllowed is set.
- Code cleanup, mainly in AudioPolicy.h and AudioPolicy.cpp.
This change is accompanied by ag/10242955 on the Java side.
Bug: 148559127
Test: manual
Test: atest PlaybackCaptureTest (with the version prior to ag/10220852)
Test: atest com.google.android.gts.audio.AudioHostTest
Change-Id: I8ae6249f4da1de35e962c838d91f690eb906570e
In case of using Device Port Gain to control the volume, the logic
of setVolumeIndexForAttributes for device type check has been bypassed.
However, in case of unmuting, the volume will be applied to all streams
with requested device then will be set for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME
which is a convention used in case of no volume for device has been set
previously.
As this logic is bypassed, in case of HwGain, the final gain applied will
be the one for AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME, which may be completely
different from the gain of current device.
This CL fixes this by factorizing the device check logic for both SW/HW gains.
Test: build & play music & Vol - until mute then volume +. No gap expected.
Change-Id: I24c57df84496e404c05c92f08f907131ef79cf3a
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
When a volume curve is not found for a volume group
associated to a system strategy, use AUDIO_STREAM_PATCH
instead of AUDIO_STREAM_MUSIC as default config.
Bug:148588565
Test: play music and check volume
Change-Id: Ib3fb2a1b7b5f3118bf16a3cc9d8e578fa0431645
Merged-In: Ib3fb2a1b7b5f3118bf16a3cc9d8e578fa0431645
This CL fixes regression introduced in aosp/1213724
The regression happened when offloaded music is played, volume
is reduced, next song is requested then the volume is switching
to full scale.
It is linked to a "ghost volume source" without stream types that
is considered as a music stream before volume is set in AudioFlinger.
The music volume was overwritten by this volume source.
This CL fixes only the ghost volume source by preventing to add twice
the internal volumes sources linked to AUDIO_STREAM_PATCH and
AUDIO_STREAM_REROUTING.
The clean fix consists in aligning AudioFlinger on volume sources
rather than stream types.
Bug: 148588565
Test: plays offloaded music, reduce volume to min.
Then press next song.
No volume gap expected.
Change-Id: I0bb3b5ca1f13ba23351bcd658acf8d7f52555929
Merged-In: I0bb3b5ca1f13ba23351bcd658acf8d7f52555929
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
The assistant new stream CL has broken the strategies without
stream types. The attributes are not populated anymore preventing
to retrieve the volume group from attributes.
Bug: 136121584
Test: run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioProductStrategyTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupChangeHandlerTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testPermissionsForVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateProductStrategies
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateVolumeGroups
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributesWithInvalidAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testVolumeGroupCallback
Change-Id: I15a14e4cf85e6c4bbf09db24bb33b4b9fb9cab54
Merged-In: I15a14e4cf85e6c4bbf09db24bb33b4b9fb9cab54
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
Communicate current audio mode owner UID to native service
when changing audio mode via setPhoneState.
This will be used by call audio capture restriction rules.
Bug: 148368476
Test: manual phone call tests
Change-Id: Icf6f168bb431b5232f6127877c40789c0c537bde
Due to security constraints, platform profilers that do remote stack
unwinding need the target process' cooperation. This is implemented via
a bionic signal handler.
On debug builds, media extractor can end up being targeted by such
system-wide profiling, which can crash the process due to
seccomp/minijail (specifically, due to sendmsg that is used for sending
file descriptors over a unix socket).
Tested: synced updated binary to crosshatch-userdebug, confirmed that
sending signal 36 with si_val 1 doesn't crash mediaextractor.
Bug: 149328505
Change-Id: Idf34e08edf99a82c72146aebeb5e46e5cf5af2f3
The duplicate log allowed suffix ! (e.g. "event!") looked more like
"not equals" so changing from ! to #.
Test: adb shell dumpsys media.metrics
Bug: 138583596
Change-Id: I642334770ed8f5ff0d1f1e187e25eca596603252
Test: Ran the repro program vendor/google_toolbox/user/ytai/SoundTriggerPoc
Test: Manual verification that soundtrigger still works for hotword and music.
Fixes: 136005905
Change-Id: Icdfe5a823ba02eb7bd8c41f0fa503c9922d8f348
(cherry picked from commit ea51ad6e1d)
Merged-In: Icdfe5a823ba02eb7bd8c41f0fa503c9922d8f348
Routing strategy call assistant was added without
associated volume stream and wass reusing AUDIO_STREAM_PATCH.
This is violating the rule that two strategies cannot
share the same volume stream.
Bug:148588565
Test: play music and check volume
Change-Id: Ib3fb2a1b7b5f3118bf16a3cc9d8e578fa0431645
This CL fixes regression introduced in aosp/1213724
The regression happened when offloaded music is played, volume
is reduced, next song is requested then the volume is switching
to full scale.
It is linked to a "ghost volume source" without stream types that
is considered as a music stream before volume is set in AudioFlinger.
The music volume was overwritten by this volume source.
This CL fixes only the ghost volume source by preventing to add twice
the internal volumes sources linked to AUDIO_STREAM_PATCH and
AUDIO_STREAM_REROUTING.
The clean fix consists in aligning AudioFlinger on volume sources
rather than stream types.
Bug: 148588565
Test: plays offloaded music, reduce volume to min.
Then press next song.
No volume gap expected.
Change-Id: I0bb3b5ca1f13ba23351bcd658acf8d7f52555929
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
The assistant new stream CL has broken the strategies without
stream types. The attributes are not populated anymore preventing
to retrieve the volume group from attributes.
Bug: 136121584
Test: run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioProductStrategyTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioVolumeGroupChangeHandlerTest
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testPermissionsForVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateProductStrategies
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testGetAndValidateVolumeGroups
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributesWithInvalidAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testSetGetVolumePerAttributes
run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioManagerTest#testVolumeGroupCallback
Change-Id: I15a14e4cf85e6c4bbf09db24bb33b4b9fb9cab54
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
This is intended to recover from cases when the MIDI extractor gets
stuck in an infinite (or very long) loop.
The extractor code is 3rd party and hard to harden - this gives us
at least an eventual recovery.
Change-Id: I8d2fd85f91d1d2749c5620cf8518583076d2f6d7
Bug: 127313764
Bug: 127313537
Bug: 127313223
Bug: 127312550
Bug: 127310810
Bug: 126380818
Usage mapper will be retrieved from the preferred service if system
properties for mediaswcodec's ION usage are not set.
Test: Define system property "ro.com.android.media.swcodec.ion.heapmask"
and check the log during the startup of mediaswcodec.
Test: Manually log the mapper activity; test if gets invoked from
mediaswcodec and CCodec.
Test: atest CtsMediaTestCases -- \
--module-arg CtsMediaTestCases:size:small
Bug: 144995284
Change-Id: Ied254224b1edd7a42aca4e084c721384efc7db66
This reverts commit 3c713796c2.
Reason for revert: The submitted patch set was not the latest cherry-pick from qt-aml-media-dev.
Exempt-From-Owner-Approval: revert
Change-Id: I3118af50e19bde0411ae7690293ede8033d522b4
Also fixed missing implementation of Camera availability callbacks for
ExtendedAvailabilityCallback.
Test: Camera CTS, and vndk test
Bug: 148146086
Change-Id: I557d6db3900b2346b7bc7e12cd946bc4c2dc4076
Remove extraneous right brace in Time Machine dump.
Do not suppress repeated EVENT properties in the Time Machine.
Use "--" prefix instead of "-" for long dumpsys argv options.
Test: atest mediametrics_tests
Test: adb shell dumpsys media.metrics
Bug: 138583596
Change-Id: I874be909ac08641b14dd12fb2c83de7a276a1796
Current MediaResourceManager assume that the calling process actually use the resource.
In TV Input Framework, the actually user of the resource is different application.
To allow MediaResourceManager to use pid of actual user, we add overridePid method
bug: 139809797
Test: Manual
Change-Id: Ia113ca2387dfbcc092eb150d19b4751448e9f27a
Clients needing to differentiate between system/vendor used to be able
to use isServingCall. However, this was expensive to implement. This
alternative approach instead requires users of this API to use
libbinderthreadstateutils which does a slighty different operation.
Bug: 148692216
Test: atest VtsHalCameraServiceV2_0TargetTest
Test: running AImageReaderVendorTest
Test: try face unlock
Change-Id: I5615f4e8863487d0de8dad2d0529214750897036
Merged-In: I5615f4e8863487d0de8dad2d0529214750897036
Clients needing to differentiate between system/vendor used to be able
to use isServingCall. However, this was expensive to implement. This
alternative approach instead requires users of this API to use
libbinderthreadstateutils which does a slighty different operation.
Bug: 148692216
Test: atest VtsHalCameraServiceV2_0TargetTest
Test: running AImageReaderVendorTest
Test: try face unlock
Change-Id: I5615f4e8863487d0de8dad2d0529214750897036
use @include to bring in the minijail policy information needed so that
we can write out code coverage information on such builds; the included
code coverage policy files is appropriate full/empty based on code
coverage flags.
Bug: 139313557
Bug: 148178774
Bug: 148177815
Test: 'kill -37' on processes in a code-coverage-enabled build
Test: 'kill -37' on processes in a NON code-coverage-enabled build
Change-Id: I9d5880343347ddc586e50f9eafb65e1ff7ba3748
(cherry picked from commit 40d50f3fea)
This reverts commit 4b8d5ce58d.
Bug: 132241823
Reason for revert: Breaks Screen Mirroring during Live caption
Change-Id: I4bf711e5c5e4233fcf58bda5477380b488fde2fa
(cherry picked from commit e0d004fe12)
In order to avoid subsequent tracks using stale kernel timestamps while
computing track timestamps, clear the timestamp info upon flush.
Change-Id: I2b8af33b287aee986871b6415b89f9c53d92f3a6
Notable fixes:
- Rework FrameProcessorBase so it accept and work with
offline sessions.
- Erase internal composite streams from offline stream list.
Bug: 135142453
Test: Camera CTS
Change-Id: I9dbc01e62fa94c1e0bfb84a8ddaa9e39ab4a7e34
unlinkToDeath is no longer required, (this change in behavior is to
avoid leaks) so holding onto the service here (still calling
unlinkToDeath to avoid a log, but may for instance remove all
unlinkToDeath calls in the future).
Bug: 145692765
Test: boot, see linkToDeath maintained
Change-Id: Ib74ab470580643ff61fc684fdd4e16d5e38389af