Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3b26818b authored by Cliff Wu's avatar Cliff Wu
Browse files

Solve the issue that the injection camera cannot be injected when the stream...

Solve the issue that the injection camera cannot be injected when the stream configuration is completed and the camera device is active

It runs normally in “First call injectCamera() and then run
configureStreamsLocked()" case, but there are the following issues in
"First run configureStreamsLocked() and then call injectCamera()"
case:

- The streaming configuration of the internal camera is not stored
correctly.
  Solution: Added storeInjectionConfig() to store internal configure
when the stream configuration is completed and injectCamera() has not
been called.

- After internalPauseAndWaitLocked(), readOneCameraMetadataLocked()
will have the problem of "Cannot read camera metadata from fmq",
resulting in removeInFlightRequestIfReadyLocked() unable to completely
clear mInFlightMap. The root cause is to directly override
mResultMetadataQueue in injectionInitialize(), but the above issue
will occur when the camera device is active.
  Solution: Generate mInjectionResultMetadataQueue during
injectionInitialize(). When injecting camera, save the original
mResultMetadataQueue into mBackupResultMetadataQueue, and replace the
original mResultMetadataQueue with mInjectionResultMetadataQueue.

- When the camera device is active, injectCamera() and stopInjection()
will call internalPauseAndWaitLocked() and internalResumeLocked(), and
then they will call mStatusChanged.waitRelative(mLock, timeout) of
waitUntilStateThenRelock(). But mStatusChanged.waitRelative(mLock,
timeout)'s parameter: mutex "mLock" must be in the locked state
(https://source.corp.google.com/android/system/core/libutils/include/utils/Condition.h;l=67)
, so we need to add "Mutex::Autolock l(mLock)" here to lock the
"mLock" before calling internalPauseAndWaitLocked() or
internalResumeLocked(). If we don't do this, it may cause the mutex
"mLock" state to be out of order. After that, all functions that use
the mutex "mLock" will be in a waiting state, such as
clearStreamingRequest() called when the camera is closed.
  Solution: Added "Mutex::Autolock l(mLock)" in injectCamera() and
stopInjection().

- Unable to run stopInjection() function from app.
  Solution: First obtain the client descriptor from ActiveClientManager,
and then call clearInjectionParameters(), otherwise
mInjectionInternalCamId iscleared and the corresponding client
descriptor cannot be obtained.

Bug: 189289800
Test: Manual

Change-Id: If5ca8d7a8431d58d97214d5e6faa7a0e5013f862
parent bfe03aa9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment