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

Commit 482083c5 authored by Wu-cheng Li's avatar Wu-cheng Li Committed by Android Git Automerger
Browse files

am f6bd761f: Use back-facing camera as default in camera/camcorder profile.do not merge

* commit 'f6bd761f':
  Use back-facing camera as default in camera/camcorder profile.do not merge
parents 9cebb86c f6bd761f
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package android.media;

import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;

/**
 * The CamcorderProfile class is used to retrieve the
 * predefined camcorder profile settings for camcorder applications.
@@ -119,12 +122,21 @@ public class CamcorderProfile
    public int audioChannels;

    /**
     * Returns the camcorder profile for the default camera at the given
     * quality level.
     * Returns the camcorder profile for the first back-facing camera on the
     * device at the given quality level. If the device has no back-facing
     * camera, this returns null.
     * @param quality the target quality level for the camcorder profile
     */
    public static CamcorderProfile get(int quality) {
        return get(0, quality);
        int numberOfCameras = Camera.getNumberOfCameras();
        CameraInfo cameraInfo = new CameraInfo();
        for (int i = 0; i < numberOfCameras; i++) {
            Camera.getCameraInfo(i, cameraInfo);
            if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
                return get(i, quality);
            }
        }
        return null;
    }

    /**
+14 −2
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package android.media;

import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;

import java.util.Arrays;
import java.util.HashMap;

@@ -46,12 +49,21 @@ public class CameraProfile
    /**
     * Returns a pre-defined still image capture (jpeg) quality level
     * used for the given quality level in the Camera application for
     * the default camera.
     * the first back-facing camera on the device. If the device has no
     * back-facing camera, this returns 0.
     *
     * @param quality The target quality level
     */
    public static int getJpegEncodingQualityParameter(int quality) {
        return getJpegEncodingQualityParameter(0, quality);
        int numberOfCameras = Camera.getNumberOfCameras();
        CameraInfo cameraInfo = new CameraInfo();
        for (int i = 0; i < numberOfCameras; i++) {
            Camera.getCameraInfo(i, cameraInfo);
            if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
                return getJpegEncodingQualityParameter(i, quality);
            }
        }
        return 0;
    }

    /**