-
Notifications
You must be signed in to change notification settings - Fork 7
Fixes miui camera crash #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: fourteen-v3
Are you sure you want to change the base?
Conversation
This reverts commit 1e7c09b.
- Miui Camera requires it E CAM_MiCamAlgoInterfaceJNI: can not load library:camera_algoup_jni.xiaomi : java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android18BnProducerListener16onBufferDetachedEi" referenced by "/system/lib64/libcamera_algoup_jni.xiaomi.so"... Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
WalkthroughThe recent changes enhance the buffer management system by introducing new methods for handling buffer detachment across various components. Key modifications include restructuring the Changes
Sequence Diagram(s)sequenceDiagram
participant Consumer
participant Producer
participant BufferQueue
Consumer->>BufferQueue: Detach Buffer
BufferQueue->>Producer: Notify Buffer Detachment
Producer-->>BufferQueue: Acknowledge Detachment
BufferQueue->>Consumer: Confirm Detachment
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
libs/gui/bufferqueue/1.0/WProducerListener.cpp (1)
52-53: Add a TODO comment for the empty implementation.The method
onBufferDetachedcurrently has an empty implementation. If the functionality is pending, consider adding a TODO comment.void LWProducerListener::onBufferDetached(int /*slot*/) { // TODO: Implement buffer detachment handling }libs/gui/bufferqueue/2.0/H2BProducerListener.cpp (1)
58-59: Add a TODO comment for the empty implementation.The method
onBufferDetachedcurrently has an empty implementation. If the functionality is pending, consider adding a TODO comment.void H2BProducerListener::onBufferDetached(int /*slot*/) { // TODO: Implement buffer detachment handling }libs/gui/include/gui/IProducerListener.h (1)
91-91: The methodonBufferDetachedis not implemented forStubProducerListener.
- The
StubProducerListenerclass is defined inlibs/gui/include/gui/IProducerListener.h.- There is no corresponding implementation of
onBufferDetachedin any.cppfile.Please ensure that the method is implemented correctly in the appropriate
.cppfile.Analysis chain
Ensure the new method is implemented correctly.
The new method
onBufferDetached(int slot)is added to theStubProducerListenerclass. Ensure that this method is correctly implemented in the corresponding.cppfile.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new method `onBufferDetached` in the corresponding `.cpp` file. # Test: Search for the method implementation. Expect: The method should be implemented in the corresponding `.cpp` file. rg --type cpp --pcre2 'void\s+StubProducerListener::onBufferDetached\s*\(\s*int\s+slot\s*\)'Length of output: 94
Script:
#!/bin/bash # Description: Verify the implementation of the new method `onBufferDetached` in the corresponding `.cpp` file. # Test: Search for the method implementation. Expect: The method should be implemented in the corresponding `.cpp` file. rg --type cpp --pcre2 'void\s+StubProducerListener::onBufferDetached\s*\(\s*int\s*\w*\s*\)'Length of output: 93
Script:
#!/bin/bash # Description: Verify the implementation of the new method `onBufferDetached` and locate the `StubProducerListener` class definition. # Search for the `StubProducerListener` class definition. rg --type cpp --pcre2 'class\s+StubProducerListener' # Search for any comments or TODOs related to `onBufferDetached`. rg --type cpp --pcre2 'onBufferDetached' # Reattempt to locate the method implementation with broader search patterns. rg --type cpp --pcre2 'onBufferDetached\s*\(\s*int\s*\w*\s*\)'Length of output: 2390
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- libs/gui/BufferQueueConsumer.cpp (1 hunks)
- libs/gui/IProducerListener.cpp (5 hunks)
- libs/gui/bufferqueue/1.0/WProducerListener.cpp (1 hunks)
- libs/gui/bufferqueue/2.0/H2BProducerListener.cpp (1 hunks)
- libs/gui/include/gui/IProducerListener.h (3 hunks)
- libs/gui/include/gui/Surface.h (2 hunks)
- libs/gui/include/gui/bufferqueue/1.0/WProducerListener.h (1 hunks)
- libs/gui/include/gui/bufferqueue/2.0/H2BProducerListener.h (1 hunks)
- libs/gui/tests/BufferQueue_test.cpp (1 hunks)
Files skipped from review due to trivial changes (1)
- libs/gui/tests/BufferQueue_test.cpp
Additional comments not posted (12)
libs/gui/include/gui/bufferqueue/2.0/H2BProducerListener.h (1)
50-50: LGTM! Verify the base class method.The addition of the virtual method
onBufferDetachedlooks good.Ensure that the base class method is correctly overridden and the method signature matches.
Verification successful
Verified: The method signature matches the base class.
The
onBufferDetachedmethod inH2BProducerListenercorrectly overrides the method from its base class with the matching signature.
libs/gui/include/gui/IProducerListener.h:virtual void onBufferDetached(int slot) = 0;libs/gui/include/gui/Surface.h:virtual void onBufferDetached(int slot);Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the base class method for `onBufferDetached`. # Test: Search for the base class method. Expect: Method signature matches. rg --type cpp -A 5 $'virtual void onBufferDetached(int slot)'Length of output: 62
Script:
#!/bin/bash # Description: Search for any `onBufferDetached` method in the codebase to verify its existence and signature. # Find all occurrences of `onBufferDetached` method. rg --type cpp 'onBufferDetached'Length of output: 1452
libs/gui/include/gui/bufferqueue/1.0/WProducerListener.h (1)
58-58: Ensure the new method is implemented correctly.The new method
onBufferDetached(int slot)is added to theLWProducerListenerclass. Ensure that this method is correctly implemented in the corresponding.cppfile and that it aligns with the interface it overrides.Verification successful
The method
onBufferDetached(int slot)is correctly implemented in the base classBnProducerListenerand will be available inLWProducerListenerthrough inheritance.
libs/gui/include/gui/bufferqueue/1.0/WProducerListener.h:class LWProducerListener : public BnProducerListenerlibs/gui/IProducerListener.cpp:void BnProducerListener::onBufferDetached(int slot)Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new method `onBufferDetached` in the corresponding `.cpp` file. # Test: Search for the method implementation. Expect: The method should be implemented in the corresponding `.cpp` file. rg --type cpp --pcre2 'void\s+LWProducerListener::onBufferDetached\s*\(\s*int\s+slot\s*\)'Length of output: 92
Script:
#!/bin/bash # Description: Verify the implementation of the method `onBufferDetached` in the `.cpp` files. # Test: Search for the method implementation. Expect: The method should be implemented in one of the `.cpp` files. rg --type cpp --pcre2 'void\s+\w+::onBufferDetached\s*\(\s*int\s+slot\s*\)'Length of output: 162
Script:
#!/bin/bash # Description: Verify the definition and relationship of the `LWProducerListener` class. # Test: Search for the definition of `LWProducerListener`. Expect: The class should be defined in one of the header files. rg --type cpp --type h --pcre2 'class\s+LWProducerListener'Length of output: 173
libs/gui/include/gui/IProducerListener.h (2)
77-77: Ensure the new method is implemented correctly.The new method
onBufferDetached(int slot)is added to theBnProducerListenerclass. Ensure that this method is correctly implemented in the corresponding.cppfile.Verification successful
The
onBufferDetachedmethod is implemented correctly inBnProducerListener. The method logs the slot number, which appears to be the intended behavior for this specific class, consistent with the context in which it is used.
libs/gui/IProducerListener.cpp: The implementation logs the slot number as expected.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new method `onBufferDetached` in the corresponding `.cpp` file. # Test: Search for the method implementation. Expect: The method should be implemented in the corresponding `.cpp` file. rg --type cpp --pcre2 'void\s+BnProducerListener::onBufferDetached\s*\(\s*int\s+slot\s*\)'Length of output: 177
Script:
#!/bin/bash # Description: Extract the implementation details of the `onBufferDetached` method from `libs/gui/IProducerListener.cpp`. # Extract the implementation of the method `onBufferDetached`. rg --type cpp --pcre2 -A 10 'void\s+BnProducerListener::onBufferDetached\s*\(\s*int\s+slot\s*\)' libs/gui/IProducerListener.cppLength of output: 273
Script:
#!/bin/bash # Description: Search for references to `onBufferDetached` in the codebase to understand its expected behavior. # Search for references to `onBufferDetached`. rg --type cpp --pcre2 'onBufferDetached\s*\('Length of output: 1371
Script:
#!/bin/bash # Description: Extract the surrounding code of `onBufferDetached` calls in `IProducerListener.cpp` to understand the context. # Extract the surrounding code of `onBufferDetached` calls. rg --type cpp --pcre2 -A 10 -B 10 'onBufferDetached\s*\(' libs/gui/IProducerListener.cppLength of output: 2399
53-53: Ensure derived classes implement the pure virtual method.The new pure virtual method
onBufferDetached(int slot)is added to theProducerListenerclass. Ensure that all derived classes implement this method.libs/gui/IProducerListener.cpp (5)
28-28: Enum valueON_BUFFER_DETACHEDadded.The new enum value
ON_BUFFER_DETACHEDis added to signify a buffer detachment event. Ensure that this value is used consistently in the method implementations.
69-74: Ensure the new method is implemented correctly.The new method
onBufferDetached(int slot)is implemented in theBpProducerListenerclass. The method constructs aParcelto transmit the slot information and invokes a transaction with theON_BUFFER_DETACHEDcode. Ensure that the transaction code and parcel handling are correct.
100-102: Ensure the new method is implemented correctly.The new method
onBufferDetached(int slot)is implemented in theHpProducerListenerclass. The method calls the corresponding method on its base class. Ensure that the base class method is correctly called.
130-135: Ensure the new method is handled correctly inonTransact.The
ON_BUFFER_DETACHEDtransaction code is handled in theonTransactmethod of theBnProducerListenerclass. The method reads the slot information from the incomingParceland calls theonBufferDetachedmethod. Ensure that the parcel handling and method call are correct.
149-151: Ensure the new method logs the slot number correctly.The new method
onBufferDetached(int slot)is implemented in theBnProducerListenerclass. The method logs the slot number when a buffer is detached. Ensure that the logging is correct.libs/gui/include/gui/Surface.h (2)
59-63: LGTM!The
onBufferDetachedmethod is correctly defined as virtual with a default implementation that does nothing. This is appropriate for a base class.
420-424: LGTM!The
onBufferDetachedmethod correctly calls the listener'sonBufferDetachedmethod, ensuring proper event propagation.libs/gui/BufferQueueConsumer.cpp (1)
320-348: LGTM!The restructuring of the
detachBuffermethod improves control flow and readability. The early return pattern for the abandonment check is a good practice.
Summary by CodeRabbit
New Features
onBufferDetached(int slot)method across various listener classes to improve buffer management communication.Bug Fixes
Chores
BufferDetachedListenerstruct from tests, which impacts coverage on buffer detachment handling.