Fixed
Status Update
Comments
sc...@google.com <sc...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
sc...@google.com <sc...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
sc...@gmail.com <sc...@gmail.com> #4
#3, Sounds great! I am not triggering a cancel action myself, so I'm assuming you mean to say this could be fixed within the library. Thank you for the quick reply. I might have another test device so I could try it out later and let you know.
sc...@gmail.com <sc...@gmail.com> #5
#3, I tested on a Galaxy S6 (sorry, I don't have anything newer), and tap to focus works as intended (i can refocus back and forward more than 10 times), so you are probably correct.
DEVICE NAME:
Samsung Galaxy S6 (SAMSUNG-SM-G920A)
ANDROID OS BUILD NUMBER: (Settings > About > Build number)
NRD90M.G920AUCS7ERA2
DEVICE NAME:
Samsung Galaxy S6 (SAMSUNG-SM-G920A)
ANDROID OS BUILD NUMBER: (Settings > About > Build number)
NRD90M.G920AUCS7ERA2
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 416bda5ed11c93d4dca79f9d1f8f943b428803a7
Author: Scott Nien <scottnien@google.com>
Date: Tue Jun 16 17:10:53 2020
Fix touch focus fail on Samsung S7
when starting a focusAndMetering action , if there is a active
action, it will try to cancel it first. and that will trigger
a CONTROL_AF_TRIGGER_CANCEL which causes the issue because it will
cancel the upcoming AF_TRIGGER as well.
The solution is not to call CONTROL_AF_TRIGGER_CANCEL when we are
about to start another AF_TRIGGER action.
Relnote: "Fixed the issue where startFocusAndMetering fails to
focus successfully on Samsung Galaxy S7."
Bug: 159039233
Test: CameraControlDeviceTest, FocusMeteringControlTest
Change-Id: If3be7c3359687a47a61fbd0f9c7f018d5d8fd323
M camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/FocusMeteringControl.java
https://android-review.googlesource.com/1336460
Branch: androidx-master-dev
commit 416bda5ed11c93d4dca79f9d1f8f943b428803a7
Author: Scott Nien <scottnien@google.com>
Date: Tue Jun 16 17:10:53 2020
Fix touch focus fail on Samsung S7
when starting a focusAndMetering action , if there is a active
action, it will try to cancel it first. and that will trigger
a CONTROL_AF_TRIGGER_CANCEL which causes the issue because it will
cancel the upcoming AF_TRIGGER as well.
The solution is not to call CONTROL_AF_TRIGGER_CANCEL when we are
about to start another AF_TRIGGER action.
Relnote: "Fixed the issue where startFocusAndMetering fails to
focus successfully on Samsung Galaxy S7."
Bug: 159039233
Test: CameraControlDeviceTest, FocusMeteringControlTest
Change-Id: If3be7c3359687a47a61fbd0f9c7f018d5d8fd323
M camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/FocusMeteringControl.java
sc...@google.com <sc...@google.com> #7
the fix will be included in beta-06 scheduled to be released on Jun-24.
Description
// If at all possible, capture an Android logcat (
CAMERAX VERSION (ex - 1.0.0-alpha07)
androidx.camera:camera-camera2:1.0.0-beta05
androidx.camera:camera-lifecycle:1.0.0-beta05
androidx.camera:camera-view:1.0.0-alpha12
CAMERA APPLICATION NAME AND VERSION: (Settings > Apps > (app name) > version)
1.0
ANDROID OS BUILD NUMBER: (Settings > About > Build number)
R16NW.G930VVRU8CRJ3
DEVICE NAME: (Nexus 5X, Samsung S6, etc)
Samsung Galaxy S7 (SM-G930V)
DESCRIPTION:
Tap to focus (via startFocusAndMetering()) only works a few times. Anywhere between 2 and 4 times before it stops actually focusing the requested point. Instead of focusing on the requested point it clearly makes an attempt and then reverts back to the original focus point. Equivalent behavior to attempting to focus on an object too close.
See screenshot to see the screen I'm testing with. Phone is on a stand, focusing another smaller stand.
LIST ANY EXPERIMENTAL FEATURES: (As an example - @ExperimentalCamera2Interop)
Unaware of any.
STEPS TO REPRODUCE:
1. Add tap to focus
2. Run app
3. Tap on an object far away
4. Tap on an object nearby
5. Repeat step 3-4 until it stops working (usually stops working after 2 changes to focus)
OBSERVED RESULTS:
The lens blurs for a second or so as it attempts to focus the requested point, then reverts back to original focus point.
EXPECTED RESULTS:
The lens blurs for a second and then focuses on the requested point
REPRODUCIBILITY: (5 of 5, 1 of 100, etc)
5 of 5 (100%)
ADDITIONAL INFORMATION:
I have attempted to add a call to cancelFocusAndMetering() (and using the future to await the completion) prior to calling startFocusAndMetering() to no avail.
The code I used is adapted from the official recommended way of doing tap to focus, including trying to add disableAutoCancel() since I saw it mentioned in one of the issues reported by another user in here. I tried the following:
1. Calling cancelFocusAndMetering prior
2. Adding .disableAutoCancel() to the action builder
3. Checking that the coordinates are accurate (they are)
4. Searching for similar issues
5. Searching the github sample code for any examples of tap to focus (there are none)
5. Disabling the scaleDetector code but ensuring we only focus once (on ACTION_UP)
Sometimes it seems to recover after a while. I'm not entirely sure what triggers it but it may be related to autofocus.
CODE FRAGMENTS (this will help us troubleshoot your issues):
```
viewFinder.setOnTouchListener { v, event ->
if (event.action != MotionEvent.ACTION_UP) {
return@setOnTouchListener scaleDetector.onTouchEvent(event)
}
val camera = camera ?: return@setOnTouchListener true
// Create a factory for creating a MeteringPoint
val factory = viewFinder.createMeteringPointFactory(cameraSelector)
// Convert UI coordinates into camera sensor coordinates
val point = factory.createPoint(event.x, event.y)
// Prepare focus action to be triggered
val action = FocusMeteringAction.Builder(point)
.disableAutoCancel()
.build()
// Execute focus action
camera.cameraControl.startFocusAndMetering(action).addListener(Runnable {
Log.d(TAG, "Focused at ${point.x} x ${point.y}.")
}, cameraExecutor)
v.performClick();
}
```