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

Commit 526239e8 authored by Yuchen He's avatar Yuchen He
Browse files

Fix AeModeAndLock test cases.

Bug: 36103813

Change-Id: Ie2e9938f6ae607f5fced5048c5ff5e41e4f7836b
(cherry picked from commit e256bc9f)
parent fdb3d315
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
@@ -1139,8 +1139,17 @@ public class StaticMetadata {
        }
        List<Integer> modeList = new ArrayList<Integer>();
        for (int mode : modes) {
            // Skip vendor-added modes
            if (mode <= CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE) {
                modeList.add(mode);
            }
        }
        checkTrueForKey(modesKey, "value is empty", !modeList.isEmpty());
        modes = new int[modeList.size()];
        for (int i = 0; i < modeList.size(); i++) {
            modes[i] = modeList.get(i);
        }

        checkTrueForKey(modesKey, "value is empty", !modeList.isEmpty());

        // All camera device must support ON
@@ -1227,7 +1236,17 @@ public class StaticMetadata {
            return new int[0];
        }

        List<Integer> modesList = Arrays.asList(CameraTestUtils.toObject(afModes));
        List<Integer> modesList = new ArrayList<Integer>();
        for (int afMode : afModes) {
            // Skip vendor-added AF modes
            if (afMode > CameraCharacteristics.CONTROL_AF_MODE_EDOF) continue;
            modesList.add(afMode);
        }
        afModes = new int[modesList.size()];
        for (int i = 0; i < modesList.size(); i++) {
            afModes[i] = modesList.get(i);
        }

        if (isHardwareLevelLimitedOrBetter()) {
            // Some LEGACY mode devices do not support AF OFF
            checkTrueForKey(key, " All camera devices must support OFF mode",
@@ -1417,6 +1436,16 @@ public class StaticMetadata {
        return fpsRanges;
    }

    public static String getAeModeName(int aeMode) {
        return (aeMode >= AE_MODE_NAMES.length) ? String.format("VENDOR_AE_MODE_%d", aeMode) :
            AE_MODE_NAMES[aeMode];
    }

    public static String getAfModeName(int afMode) {
        return (afMode >= AF_MODE_NAMES.length) ? String.format("VENDOR_AF_MODE_%d", afMode) :
            AF_MODE_NAMES[afMode];
    }

    /**
     * Get the highest supported target FPS range.
     * Prioritizes maximizing the min FPS, then the max FPS without lowering min FPS.