Skip to content

codec2: restore legacy sync fence ABI - #54

Open
pbzin wants to merge 68 commits into
crdroidandroid:16.0from
pbzin:agent/codec2-legacy-sync-fence-abi
Open

pbzin wants to merge 68 commits into
crdroidandroid:16.0from
pbzin:agent/codec2-legacy-sync-fence-abi

Conversation

@pbzin

@pbzin pbzin commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Restore the legacy one-argument _C2FenceFactory::CreateSyncFence(int) ABI.
  • Keep the current validated two-argument implementation as the canonical path.

Root cause

Some Android 16 vendor Codec2 libraries still import the one-argument symbol. Without it, the vendor Codec2 service fails to load with a missing-symbol error, preventing video decoder initialization.

Compatibility

The overload delegates to CreateSyncFence(fenceFd, true), so existing callers retain the current validation behavior while older vendor implementations regain binary compatibility.

Validation

  • Confirmed the missing symbol while loading a newer Android 16 QTI Codec2 stack.
  • git diff --cached --check passed.

This change is framework-generic and contains no Sapphire-specific blobs or device files.

rmp22 and others added 30 commits March 15, 2026 20:27
Change-Id: I2438a0d511daeddd1cc076d61566f332137f10c1
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
-Add support for receiving dataCallback with fd/buffer as frame buffer

CRs-fixed: 654901
Change-Id: I5c16e560f1e209a6ab4afa4f3437602b02992b9b
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* Give freedom to screen recorder apps

Change-Id: I726bde4f44bba6fc8cd771ae90c8864b26cdd919
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
In the event of a binder death, there is a chance of deadlock
due to recursive lock acquisition in the death handling sequence.
Fix:
Clear evicted client list before acquiring service lock.

Change-Id: I6fc5fa6e01c002bc46be058fcd977be14cae0270
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
-Avoid waiting on results once flush is completed
-Help improve camera switch KPI

CRs-Fixed: 2525025
Change-Id: I0db7877b6582c281a178035d4c202a5bd6aaaca8
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
- The cacheDump() call was added for better debugging by always
  dumping the state of the last camera session. Since LT/VT chipsets
  it is adding significant delay during camera close. Hence we are
  removing cachedump call during disconnect.
  https://partnerissuetracker.corp.google.com/issues/237992867

CRs-Fixed: 3228616
Change-Id: Ibba2a51f08c592bf15b046642101e11d890ed248
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
 * Values end up NULL on some drivers, don't crash.

Change-Id: Ic897dbd4629cf3af98c85f93be202c382dde806b
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Below changes are squashed with this change.

Stagefright: Allow setting high-framerates in CameraSource
ChangeId: If66211dd81b2a08d4df4c6f23e87304e9e7013f4

Stagefright: Allow setting of high-framerates in CameraSource for HSR
ChangeId: I30cb3b656570de1b615d55c20c0b4f98ae6e0c12

Stagefright: Create CameraSource for HSR
ChangeId: I7f420f5b15fb3c05bb7f918430ca9b7a630ed18e

Stagefright: Do not skip frames in time-lapse-source for high-speed
ChangeId: I8420e44ab96484f0d6301c366a24eefc8efeaf0f

media : Changing time stamp manipulation in HFR recording.
ChangeId: I98cdb14bb2b9c86013df9b2c8f2e558f184b633e

media: Modify timestamps for HFR use case
ChangeId: I3faf7294f743b1031ccc6624c3348f7e12b339b8

CRs-Fixed: 2226740
Change-Id: I079d880252992b94bd78ac43aed732f5000175d3
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: I631ba6267b3769d9da498329a39ac89c609be6d8
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* Required by OnePlus / Oplus Camera.
* Unused by others.

Signed-off-by: cjh1249131356 <cjh1249131356@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
 * Remove unnecessary check condition.

Change-Id: Ia5055195f1a74cdba96ad0b7598da321c25fe27c
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* From CAF.

Change-Id: I32bb7470c2abede313d6392dede4873270d720cc
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
…oder lib

[HELLBOY017]: Also allow to load dolby codec in MediaCodecList

Change-Id: I3b85c15889c9e3aef152e726a83936234103254e
Requires proprietary Dolby changes in libstagefright.

This partially reverts commit 01090fa125c2993654e18e024ddf7cef87bca30e.

Change-Id: Ifdf36ad253155e77ba14d0624612bf6be6711ca6
- Imported from Xiaomi Android 13 Changes

Change-Id: Ia7da9da19bfa10c64a82eb68eef3857a78e12469
Add changes to pick the right media xml's from vendor/etc
of the target based on target specific system property

CRs-Fixed: 2083569

[neobuddy89: Squashed similar commits]

Change-Id: I18d89821e765e8cd1b6003f99bc21dcd87a1458c
Signed-off-by: tejas101k <tejassingh649@rediffmail.com>
* Some devices copy init.qti.media.rc or such qcom scripts which makes MediaProfiles
  to select platform specific xml without checking if that xml is present.
* Issue highlighted by [Electimon]

Change-Id: If1e27a77298fea75a4f1c22e49fa078b1b14c1d7
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: tejas101k <tejassingh649@rediffmail.com>
b/422390714

HTTPBase::toString will get mName
MediaHTTP::disconnect will do nName assignment
different thread do HTTPBase::toString and MediaHTTP::disconnect()
may cause mName's race condition issue, and occur mediaserver NE.

Google: 3652570
Change-Id: I05b1adc4d2bf212e1a7159627117257f56f72841
…reen, music will play from the earphones. At this point, disconnect the earphones, click play, and the projection will be silent

Analysis: The screen projection device is remote_stubmix, and the output: deepubuffer does not support this device. If the Bluetooth earphones in the testing steps are replaced with wired earphones, restoreTrack_1 will be called after disconnecting the earphones because hasCurrentEncodedFFormat returns true. When the Bluetooth earphones are disconnected, the mCurrentEncodedFFormat is set to AUDIO-FORMAT-DEFAULT in setDeviceConnectionStateInt, so the return value of hasCurrentEncodedFFormat remains false

Solution: Add a true judgment when Bluetooth earphones are disconnected in hasCurrentEncodedFFormat

issue ID: 405883200

Google: 3598871
Change-Id: I1e3237109cf5f59137e44ccafc706dc50894742c
Signed-off-by: fengxiaoshuang <fengxiaoshuang@xiaomi.corp-partner.google.com>
Change-Id: I23a25f11eab0126d0dab3c200af8934de734d54b
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* OEMs like OnePlus and Nothing detect camera package name to unlock features like 48mp.

[PA Edit: Make this generic by defining the package
 name rather than the OEM]

Change-Id: Ic0b537820ef1874647911379bcf142f0768a7a76
Co-Authored-By: Jake Weinstein <jake@aospa.co>
Co-Authored-By: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: cjh1249131356 <cjh1249131356@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
…ckage name

Match prior cc_defaults implementation:
* Fix libcameraservice cflags to use correct #ifdef variable (vital, fixes issues)
* Add cflags to cameraserver as before (probably not needed but it seems to be working this way & doesn't impact those not using this config)
* Add escaped double quotes for passing variable name to match previous behavior
* Whitespace cleanup (always!)
Directly set camera package name by using OnePlusCameraProvider service.

Co-authored-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Match prior cc_defaults implementation:
* Fix libcameraservice cflags to use correct #ifdef variable (vital, fixes issues)
* Add shared libs to both cameraserver & libcameraservice as before (probably not needed for cameraserver but it doesn't seem to hurt & won't affect those not using this config)
On some devices such as OnePlus 12, newer blobs have a strange crash
which is entirely proprietary stacktraced with torch control support,
and Oplus stock disables in platform.

We previously had a hack to manually implement it in an extension,
but this device was also the only one that had other issues with it.

Additionally, >2.3 aidl isn't expected to lack this support. So this
hack simply always uses the same strength (legacy path), and does
not use torch control.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Maybe updatePolicyState after updating all EffectHandle state makes more sense than before

Change-Id: I9ed3e25eede842000c56865af3193711d8485980
Signed-off-by: xialei6 <xialei6@xiaomi.com>
Some devices are capable of doing this but not their camera HAL.

Squashed:

    From: Hridaya Prajapati <info.hridayaprajapati@gmail.com>
    Date: Mon, 28 Apr 2025 10:32:05 +0545
    Subject: services: Move libcameraservice_ext_lib_defaults to select()

    Change-Id: I9c961215d0cffefa0c3507f6c097fa41e88177cf

Change-Id: Ib154aa4a1e6137a6b8ecab9245905f72b951db16
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
kuowei.li and others added 29 commits March 15, 2026 20:27
Mixer status set incorrectly when async write is not used, causing
test failure.
Adjust mixer status to MIXER_DRAIN_ALL when async write is
disabled.

Test: atest CtsMediaPlayerTestCases:android.media.player.cts.MediaPlayerTest#testPositionAtEnd
Change-Id: I4b4338a1f57e79750c9c02e90391ea7089a180a6
The decryption priority of MediaCrypto is determined by the priority of the Client's Binder call.
For asynchronous decryption threads, the priority needs to be increased to ANDROID_PRIORITY_AUDIO.

Bug: 468888713

Change-Id: I5069a79c9f313d2c761c433aff8bd202e171502f
Signed-off-by: shipeng.sun <shipeng.sun@amlogic.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
RECORD_AUDIO wasn't required before Android 15 QPR1, MODIFY_AUDIO_ROUTING permission was enough.

REMOTE_SUBMIX audio source is used by Android Auto to reroute audio output to the car.

Change-Id: I32013d38efdbc0d0ee8bb6873e8d9d8806f5b9e9
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* This happens with cortex-a76 arch setup.

Log:

FAILED: out/soong/.intermediates/frameworks/av/media/codec2/components/aom/libcodec2_soft_av1enc/android_arm64_armv8-2a-dotprod_shared_cfi_apex31/unstripped/libcodec2_soft_av1enc.so
prebuilts/clang/host/linux-x86/clang-r563880c/bin/clang++ out/soong/.intermediates/bionic/libc/crtbegin_so/android_arm64_armv8-2a-dotprod_apex31/crtbegin_so.o @out/soong/.intermediates
/frameworks/av/media/codec2/components/aom/libcodec2_soft_av1enc/android_arm64_armv8-2a-dotprod_shared_cfi_apex31/unstripped/libcodec2_soft_av1enc.so.rsp out/soong/.intermediates/bioni
c/libc/crtend_so/android_arm64_armv8-2a-dotprod_apex31/crtend_so.o out/soong/.intermediates/bionic/libc/crt_pad_segment/android_arm64_armv8-2a-dotprod_apex31/crt_pad_segment.o -o out/s
oong/.intermediates/frameworks/av/media/codec2/components/aom/libcodec2_soft_av1enc/android_arm64_armv8-2a-dotprod_shared_cfi_apex31/unstripped/libcodec2_soft_av1enc.so -target aarch64
-linux-android29 -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--fatal-warnings -Wl,--no-undefined-version -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_str
ipped.a -Wl,--exclude-libs,libunwind_llvm.a -Wl,--exclude-libs,libunwind.a -Wl,--compress-debug-sections=zstd -fuse-ld=lld -Wl,--icf=safe -Wl,--no-demangle -Wl,--no-undefined -Wl,-z,se
parate-code -Wl,-z,separate-loadable-segments -Wl,-z,max-page-size=4096   -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags -nostdlib -Wl,--gc-sections -shared -Wl,-soname
,libcodec2_soft_av1enc.so -Wl,-Bsymbolic -Wl,--version-script,frameworks/av/media/codec2/components/base/exports.lds -Wl,--version-script,build/soong/cc/config/cfi_exports.map -flto -f
sanitize-cfi-cross-dso -fsanitize=cfi -Wl,-plugin-opt,O1 -fsanitize=unsigned-integer-overflow,signed-integer-overflow,cfi -fno-sanitize-link-runtime -Wl,--exclude-libs=libclang_rt.buil
tins-aarch64-android.a -Wl,--exclude-libs=libclang_rt.ubsan_minimal-aarch64-android.a
ld.lld: error: linking module flags 'CFI Canonical Jump Tables': IDs have conflicting override values in 'out/soong/.intermediates/external/libaom/libaom/android_arm64_armv8-2a-dotprod
_static_cfi_apex31/libaom.a(av1_config.o at 7434244)' and 'ld-temp.o'
clang++-real: error: linker command failed with exit code 1 (use -v to see invocation)
22:50:16 ninja failed with: exit status 1

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Dhina17: Ported to 14 QPR2
nurkeinneid: Ported to 16 QPR2

Change-Id: Ib22a04d7b99706042b903a223d0b3900c0838fbd
Signed-off-by: cjybyjk <cjybyjk@zjnu.edu.cn>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* Apply per-app volume to portid_volume_management

Change-Id: Id02507e7a426cc0b5c6b1095005d170200f8842a
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: Ibb5ec56bfc923db417048ab88c90c2a3ed790b20
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: I767ee8165ec77749b2850eacb877768de8f48eff
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
We need to use this from SystemUI which runs under app uid.
Instead check for MODIFY_AUDIO_ROUTING permission which is granted only
to select system apps (including SystemUI) and also matches the API
@RequiresPermission annotation in framework.

Change-Id: Ib78565c15cbdc8619bf94240a2329e97fd40c6a9
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: If4a63ad1d892af3fb1f87d9b3b1128ab59a106c9
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Summary: when media player is stopped flush is called to flush the remaining buffer and the output surface is set to null.
However while the buffer is getting flushed the output can still be used causing the null dereference crash.
This diff adds a check in renderOneBufferItem_l to check if output is valid and go through the regular abandon flow instead of using the null output.

Test: successful build on master

Change-Id: Ic3d6707e2f8e0943ca2368a8e50ea683b6dac46a
Signed-off-by: Abdelrahman Daim <adaim@meta.com>
PlanesLockGuard constructor never stored hwBuffer into mHwBuffer.
The destructor checks mHwBuffer == nullptr and bails out, so
AHardwareBuffer_unlock was never called — leaking a buffer lock
on every JPEG capture.

Test: atest virtual_camera_tests
Change-Id: I1a0a2f56faf7aa4178178f3dbd98d5f9ceac5bfa
Implementation declared int return type while the header and
sister class YCbCrLockGuard both use status_t. Align the
implementation to match.

Test: atest virtual_camera_tests
Change-Id: I069417febdae83d5567243a2507231412bd47687
The deleted copy-assignment operator had wrong parameter type
YCbCrLockGuard instead of PlanesLockGuard — a copy-paste
error from the sister class.

Test: atest virtual_camera_tests
Change-Id: Ibe7e11f08ba0cd401c13ea58304a3722bc3ab65a
…parameter

[Why] C2 parameter of changing picture size will be overridden if mediaplayer doesn't enable sample aspect ratio

[How] Add sample aspect ratio to input format if compontent output format contains aspect ratio parameter change

Change-Id: I8ad6aa68f9f5e2ec2446d4653fd0af6129b9d2ae
…Store"

Breaks dolby decoders

This reverts commit 07b6b15.

Signed-off-by: Debayan Kar <kardebayan3@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
MediaSync::onBufferReleasedByOutput is called via the
IProducerListener::onBufferReleased callback when the output Surface's
BufferQueueConsumer::releaseBuffer is called. It calls
mOutput->detachNextBuffer() to retrieve the released buffer from the
output Surface's producer, but only handles the NO_INIT error code,
falling through to dereference the buffer sp<> (which is nullptr on
any error) for all other error codes. When the output Surface's
BnGraphicBufferProducer is hosted in a different process than MediaSync,
detachNextBuffer is a binder call that can return DEAD_OBJECT (-32) or
FAILED_TRANSACTION (-2147483646) if that process dies or has its binder
interface frozen, causing a nullptr dereference (SIGSEGV).

These errors arise from two distinct races:

1. DEAD_OBJECT: If the process hosting the output Surface's
   BnGraphicBufferProducer sends an onBufferReleased binder transaction
   to MediaSync's IProducerListener and then dies before MediaSync calls
   detachNextBuffer, detachNextBuffer targets the dead process and
   returns DEAD_OBJECT. Because onBufferReleased is a oneway binder
   transaction, it is not guaranteed to be processed before the death
   notification is delivered and binderDied runs, though in the common
   case it will be. If the death notification is delivered while
   onBufferReleasedByOutput holds mMutex, binderDied blocks on mMutex
   and cannot run cleanup before the nullptr dereference. If it has not
   yet been delivered, onBufferReleasedByOutput completes (and crashes)
   before binderDied runs at all.

2. FAILED_TRANSACTION: If the process hosting the output Surface's
   BnGraphicBufferProducer sends an onBufferReleased binder transaction
   to MediaSync's IProducerListener and then has its binder interface
   frozen before MediaSync calls detachNextBuffer, detachNextBuffer
   targets the frozen process and returns FAILED_TRANSACTION. This race
   became possible in Android 11 when commit 3e91d35fa70a
   ("CachedAppOptimizer: freeze/unfreeze binder") introduced binder
   interface freezing for cached apps freezing and can also manifest
   through other paths outside of cached apps freezer such as
   ActivityManager.forceStopPackage() since commit 79825c6f2f8b
   ("Freeze package cgroup before killing") in Android 14 extended
   binder interface freezing to ProcessList.killPackageProcessesLSP().

These races can manifest, for example, when a Surface from a
SurfaceView in one app process is passed over Binder to a different
app process that creates a MediaSync with it as output. The
SurfaceView's BLASTBufferQueue creates the BnGraphicBufferProducer in
the first process, so detachNextBuffer from the process hosting the
MediaSync to the process hosting the BnGraphicBufferProducer is a
cross-process binder call subject to both races above.

Fix this by returning early from onBufferReleasedByOutput when
detachNextBuffer returns any error other than NO_INIT. The buffer sp<>
is nullptr in this case. For DEAD_OBJECT, the existing binderDied
cleanup path will handle teardown once it is delivered and acquires
mMutex. FAILED_TRANSACTION is returned when the binder driver returns
BR_FROZEN_REPLY or BR_FAILED_REPLY, which are indistinguishable in
userspace. For FAILED_TRANSACTION from BR_FROZEN_REPLY, when the binder
interface of the process hosting the output Surface's
BnGraphicBufferProducer is frozen as part of killing package processes
the freeze is immediately followed by SIGKILL, so binderDied handles
cleanup the same way as the DEAD_OBJECT case. When the binder interface
is frozen for cached apps freezing, since detachNextBuffer is a
synchronous binder transaction, this results in the process being killed
when it is unfrozen due to the behavior introduced in commit
5b5fdb80ec9f ("ActivityManager: kill frozen processes receiving sync
transactions"), so binderDied again handles cleanup. For
FAILED_TRANSACTION from BR_FAILED_REPLY, returning early strands the
buffer in the output Surface BufferQueue and inflates
mNumOutstandingBuffers, but this is strictly better than the
pre-existing nullptr dereference (SIGSEGV). Also add tests to verify
that onBufferReleasedByOutput handles errors from detachNextBuffer
without crashing.

Flag: EXEMPT bugfix
Test: PoC app using MediaSync SDK API with output Surface in a
  separate process crashes without fix and no longer crashes with fix
  on aosp_cf_x86_64_phone-bp4a-eng
Test: atest MediaSyncTest on aosp_cf_x86_64_phone-bp4a-eng
Test: atest CtsMediaMiscTestCases:android.media.misc.cts.MediaSyncTest
  on aosp_cf_x86_64_phone-bp4a-eng
Change-Id: Ie73f75fed37438684c969a95de415eab9013b48c
Commit b62ae14 ("bufferqueues: Replace usage of BnConsumerListener
with IConsumerListener") removed the linkToDeath registration on the
input IGraphicBufferConsumer as part of a topic that removed binder
support for IGraphicBufferConsumer entirely. However, it left
InputListener derived from IBinder::DeathRecipient with a binderDied
implementation that can no longer be called. Remove the
IBinder::DeathRecipient base class and binderDied method from
InputListener as this is dead code.

Flag: EXEMPT remove dead code
Test: atest CtsMediaMiscTestCases:android.media.misc.cts.MediaSyncTest
  on aosp_cf_x86_64_phone-bp4a-eng
Change-Id: I7618c52cbb36db67ad0db54987001ae2fac7083b
When MediaSync::OutputListener::binderDied fires because the process
hosting the output Surface's BnGraphicBufferProducer has died, it calls
MediaSync::onAbandoned_l on the output-abandoned path, which
dereferences mInput. However, mInput is only assigned in
createInputSurface(). When that process dies before createInputSurface()
has been called, this can lead to a nullptr dereference of mInput
depending on the outcome of a race between two libbinder code paths that
the binder driver triggers in the MediaSync process in response to that
death. Both paths operate on the OutputListener BBinder's strong
refcount, and they run on binder threads in the MediaSync process,
possibly in parallel:

1. wp<IBinder::DeathRecipient>::promote() inside
   BpBinder::reportOneDeath, called when the binder driver delivers
   BR_DEAD_BINDER. If promote succeeds, it returns a strong reference
   and binderDied is invoked, which calls onAbandoned_l and dereferences
   mInput.

2. decStrong on the OutputListener BBinder, called by libbinder in
   response to BR_RELEASE. The binder driver delivers BR_RELEASE because
   the strong reference held by the output BufferQueue's
   mConnectedProducerListener in the (now-dead) process is dropped when
   the binder driver releases the dying process's binder references. If
   decStrong drops the OutputListener's strong refcount to zero before
   (1) runs, the OutputListener is destroyed and (1)'s promote returns
   nullptr, so binderDied is never invoked.

If (1) wins the race, onAbandoned_l runs with a null mInput, causing the
SIGSEGV. Since mInput is only assigned in createInputSurface() and never
cleared, it is null exactly when createInputSurface() has not been
called. Fix the SIGSEGV by skipping the mInput dereference on the
output-abandoned path in that case.

Flag: EXEMPT bugfix
Test: PoC app that uses MediaSync SDK API with output Surface in a
  separate process, without calling createInputSurface(), and kills the
  separate process: crashes within a few iterations without fix and no
  longer crashes with fix on aosp_cf_x86_64_phone-bp4a-eng
Test: atest MediaSyncTest on aosp_cf_x86_64_phone-bp4a-eng
Test: atest CtsMediaMiscTestCases:android.media.misc.cts.MediaSyncTest
  on aosp_cf_x86_64_phone-bp4a-eng
Change-Id: I86b042a71bf7d8a5e5705d2965f714396e44a17d
This diff fixes the calculation logic in getMaxResolution().

Test: atest virtual_camera_tests
Change-Id: I5bd28804856885ffec001bcc3b6be964c826eabe
mLastAcquisitionTimestampNanoseconds wasn't initialized explicilty. If it was initialized to a random large number, it would cause
```
    const std::chrono::nanoseconds frameDuration =
        timestamp - lastAcquisitionTimestamp;
```
to be a large negative number, which would cause
```
      const std::chrono::nanoseconds sleepTime =
          minFrameDuration - frameDuration;
```

to be a large number, causing the thread to sleep for a long time.

Change-Id: I1e3ec7423398aab88110d5c78c35f0c903295234
Add necessary stubs and hooks to load and delegate Binder transactions
to the proprietary OnePlus camera extension library (libcsextimpl.so).

- Add empty ICameraServiceExt constructor/destructor to satisfy linker
  symbols required by the extension.
- Implement CameraServiceExtFactory to dlopen libcsextimpl.so, resolve
  getExtFactoryImpl and onTransact symbols, and provide a function table
  as expected by OxygenOS.
- Hook CameraService::onTransact: delegate all non‑shell commands to
  CameraServiceExtFactory::onTransact, which calls the extension's
  onTransact method. This handles transaction 10015 (CMD_UI_EVENT) used
  for zoom.
- Add missing CameraSessionStats constants (CAMERA_STATE_EXCEPTION,
  CAMERA_STATE_SESSION_CONFIGURED, CAMERA_STATE_FIRST_FRAME_ARRIVED)
  used by the extension.
- Add OxygenOS‑compatible overload of collectReturnableOutputBuffers
  to support the extension's buffer handling.
- Add four‑parameter overload of CameraProviderManager::getCameraCharacteristics
  to match the signature expected by the extension.

Test: Camera zoom works on custom ROM with prebuilt libcsextimpl.so.
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Used by portrait mode in xiaomi 8650 (peridot) stock camera

540422489 = Y16

202981: 06-07 18:50:30.025  2243  6084 E cameraserver: roundBufferDimensionNearest: No configurations for format 540422489 width 4096, height 3072, maxResolution ? false
Change-Id: I75bac917cc06840ce48ad41d58e3b729f6645221
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
PMDeathRecipient held a raw pointer to AWakeLock. If binderDied()
fired on a binder thread after AWakeLock was destroyed, the raw
pointer dereference caused a use-after-free.

Replace the raw pointer with a weak pointer (wp<AWakeLock>) so that
promote() returns NULL when the parent is already gone. Additionally,
clear the weak reference in ~AWakeLock() to make the window explicit
and avoid any stale callback.

Test: manual stress test triggering binder death during NuPlayer
Change-Id: I39b46b308999f7491c6c88027b6a3e00cc58e352
…g the screen, music will play from the earphones. At this point, disconnect the earphones, click play, and the projection will be silent"

This reverts commit f332fc5.
…nection

The actual problem is an order-of-operations bug: during Bluetooth disconnection,
the framework wipes out the device's known codec format (AUDIO_FORMAT_DEFAULT) before running
the routing logic that decides if a track needs restoration.

By deferring that codec reset to the end of the disconnection sequence is fixing the screen
projection silence bug without breaking global template descriptors or destroying codec
routing pipeline

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.