Tuesday, September 25, 2012

HTC myTouch 2.3.2

It's crappy device =( It's doesnt support API-9 properly

On getSupportedPreviewFpsRange() it result null and error in log

E/Camera  ( 3116): Invalid range list string=null


WTF!!!! Let's look on the code and code. WTF again!!! firmware returned wrong values and splitRange() can't parse it. So one need to check getSupportedPreviewFpsRange() for null and if it's so set fps on legacy way.

    public static void setFPSLegacy(Camera l_camera) {
        Camera.Parameters params = l_camera.getParameters();
        List<Integer> framerates= params.getSupportedPreviewFrameRates();
        Collections.sort(framerates);
        Log.d(TAG,String.format("setFPSLegacy: setPreviewFpsRange: min: %d, max: %d", framerates.get(0), framerates.get(framerates.size() - 1)));
        Log.d(TAG,String.format("setFPSLegacy: setPreviewFrameRate: %d", framerates.get(framerates.size() - 1)));

        params.setPreviewFrameRate(framerates.get(framerates.size() - 1));
        try {
            l_camera.setParameters(params);
        } catch(RuntimeException e) {
            Log.e(TAG, String.format("setFPS: setPreviewFrameRate: FAIL to set FPS: %d", framerates.get(framerates.size() - 1)), e);
        }
    }

No comments:

Post a Comment