Ultima Ratio
unread,Nov 16, 2023, 8:36:04 AM11/16/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, Ultima Ratio
Hi again.
Ok, after some testing: also happens with APK.. it just didnt happen for the testers (Redmi devices).
Also happens with latest 1.4.0 alpha.
But: I tried to implement the interface and give that the CameraSelector filter mechanic..
private val wideLensFilter: CameraFilter = object : CameraFilter {
override fun filter(cameraInfos: MutableList<CameraInfo>): MutableList<CameraInfo> {
val list = mutableListOf<CameraInfo>()
for (cameraInfo in cameraInfos) {
if (cameraInfo.isWidelens()) {
list.add(cameraInfo)
}
}
return list
}
override fun getIdentifier(): Identifier {
return Identifier.create("TEST")
}
}
And applying the filter then:
CameraSelector.Builder()
.addCameraFilter(wideLensFilter)
.build()
Lets see if it will work. Will keep you updated.
Because the problem is the 2nd line here (taken from ProcessCameraprovider.java):
for (CameraFilter cameraFilter : cameraSelector.getCameraFilterSet()) {
if (cameraFilter.getIdentifier() != CameraFilter.DEFAULT_ID) {
CameraConfig extendedCameraConfig =
ExtendedCameraConfigProviderStore.getConfigProvider(
cameraFilter.getIdentifier()).getConfig(
lifecycleCameraToBind.getCameraInfo(), mContext);
if (extendedCameraConfig == null) { // ignore IDs unrelated to camera configs.
continue;
}
CameraFilter is an interface and getIdentifier() is a default function.