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

Commit 9e2769c9 authored by Jag Saund's avatar Jag Saund
Browse files

Camera Extensions - Remove fallback logic for Get

- get API had fallback logic to rely on camera2 cameracharacteristics
  value if the value associated with the key was not present
- this can potentially introduce inconsistencies and incorrect results
- it's more correct to not fallback
- ensure that when the interface does support the get api it doesn't
  return an empty / null set

Test: atest
Bug: 323626521
Change-Id: I20a31bc1cbc1a668bb228f270fee3b377a3c0093
parent 7b237a48
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -808,13 +808,11 @@ public final class CameraExtensionCharacteristics {
                extender.init(mCameraId, mCharacteristicsMapNative);
                CameraMetadataNative metadata =
                        extender.getAvailableCharacteristicsKeyValues(mCameraId);
                CameraCharacteristics fallbackCharacteristics = mCharacteristicsMap.get(mCameraId);
                if (metadata == null) {
                    return fallbackCharacteristics.get(key);
                    return null;
                }
                CameraCharacteristics characteristics = new CameraCharacteristics(metadata);
                T value = characteristics.get(key);
                return value == null ? fallbackCharacteristics.get(key) : value;
                return characteristics.get(key);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to query the extension for the specified key! Extension "
+18 −15
Original line number Diff line number Diff line
@@ -1204,7 +1204,11 @@ public class CameraExtensionsProxyService extends Service {
                List<Pair<CameraCharacteristics.Key, Object>> entries =
                        mAdvancedExtender.getAvailableCharacteristicsKeyValues();

                if ((entries != null) && !entries.isEmpty()) {
                if (entries == null || entries.isEmpty()) {
                    throw new RuntimeException("A valid set of key/value pairs are required that "
                            + "are supported by the extension.");
                }

                CameraMetadataNative ret = new CameraMetadataNative();
                long vendorId = mMetadataVendorIdMap.containsKey(cameraId)
                        ? mMetadataVendorIdMap.get(cameraId) : Long.MAX_VALUE;
@@ -1221,7 +1225,6 @@ public class CameraExtensionsProxyService extends Service {

                return ret;
            }
            }

            return null;
        }