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

Commit ede3eeb7 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Android (Google) Code Review
Browse files

Merge changes Ia6300c23,Idd2ae8ad into klp-dev

* changes:
  Camera2: Immutable metadata
  Camera2: Listener rework and other API updates
parents 91019c9e 70c2207c
Loading
Loading
Loading
Loading
+42 −34
Original line number Original line Diff line number Diff line
@@ -10815,16 +10815,17 @@ package android.hardware.camera2 {
  }
  }
  public abstract interface CameraDevice implements java.lang.AutoCloseable {
  public abstract interface CameraDevice implements java.lang.AutoCloseable {
    method public abstract void capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener) throws android.hardware.camera2.CameraAccessException;
    method public abstract void capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener) throws android.hardware.camera2.CameraAccessException;
    method public abstract void captureBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void close() throws java.lang.Exception;
    method public abstract void close() throws java.lang.Exception;
    method public abstract void configureOutputs(java.util.List<android.view.Surface>) throws android.hardware.camera2.CameraAccessException;
    method public abstract void configureOutputs(java.util.List<android.view.Surface>) throws android.hardware.camera2.CameraAccessException;
    method public abstract android.hardware.camera2.CaptureRequest createCaptureRequest(int) throws android.hardware.camera2.CameraAccessException;
    method public abstract android.hardware.camera2.CaptureRequest.Builder createCaptureRequest(int) throws android.hardware.camera2.CameraAccessException;
    method public abstract void flush() throws android.hardware.camera2.CameraAccessException;
    method public abstract void flush() throws android.hardware.camera2.CameraAccessException;
    method public abstract java.lang.String getId();
    method public abstract android.hardware.camera2.CameraProperties getProperties() throws android.hardware.camera2.CameraAccessException;
    method public abstract android.hardware.camera2.CameraProperties getProperties() throws android.hardware.camera2.CameraAccessException;
    method public abstract void setErrorListener(android.hardware.camera2.CameraDevice.ErrorListener);
    method public abstract void setDeviceListener(android.hardware.camera2.CameraDevice.CameraDeviceListener, android.os.Handler);
    method public abstract void setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener) throws android.hardware.camera2.CameraAccessException;
    method public abstract void setRepeatingBurst(java.util.List<android.hardware.camera2.CaptureRequest>, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener) throws android.hardware.camera2.CameraAccessException;
    method public abstract void setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraDevice.CaptureListener, android.os.Handler) throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
    method public abstract void waitUntilIdle() throws android.hardware.camera2.CameraAccessException;
    method public abstract void waitUntilIdle() throws android.hardware.camera2.CameraAccessException;
    field public static final int TEMPLATE_MANUAL = 5; // 0x5
    field public static final int TEMPLATE_MANUAL = 5; // 0x5
@@ -10834,39 +10835,38 @@ package android.hardware.camera2 {
    field public static final int TEMPLATE_VIDEO_SNAPSHOT = 4; // 0x4
    field public static final int TEMPLATE_VIDEO_SNAPSHOT = 4; // 0x4
  }
  }
  public static abstract interface CameraDevice.CaptureListener {
  public static abstract class CameraDevice.CameraDeviceListener {
    method public abstract void onCaptureComplete(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
    ctor public CameraDevice.CameraDeviceListener();
    method public abstract void onCaptureFailed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest);
    method public void onCameraDisconnected(android.hardware.camera2.CameraDevice);
    method public void onCameraError(android.hardware.camera2.CameraDevice, int);
    method public void onCameraIdle(android.hardware.camera2.CameraDevice);
    field public static final int ERROR_CAMERA_DEVICE = 1; // 0x1
    field public static final int ERROR_CAMERA_SERVICE = 2; // 0x2
  }
  }
  public static abstract interface CameraDevice.ErrorListener {
  public static abstract class CameraDevice.CaptureListener {
    method public abstract void onCameraDeviceError(android.hardware.camera2.CameraDevice, int);
    ctor public CameraDevice.CaptureListener();
    field public static final int DEVICE_DISCONNECTED = 1; // 0x1
    method public void onCaptureCompleted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
    field public static final int DEVICE_ERROR = 2; // 0x2
    method public void onCaptureFailed(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest);
    field public static final int SERVICE_ERROR = 3; // 0x3
    method public void onCaptureStarted(android.hardware.camera2.CameraDevice, android.hardware.camera2.CaptureRequest, long);
  }
  }
  public final class CameraManager {
  public final class CameraManager {
    method public void addAvailabilityListener(android.hardware.camera2.CameraManager.AvailabilityListener, android.os.Handler);
    method public java.lang.String[] getCameraIdList() throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraProperties getCameraProperties(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraProperties getCameraProperties(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public java.lang.String[] getDeviceIdList() throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraDevice openCamera(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public android.hardware.camera2.CameraDevice openCamera(java.lang.String) throws android.hardware.camera2.CameraAccessException;
    method public void registerCameraListener(android.hardware.camera2.CameraManager.CameraListener);
    method public void removeAvailabilityListener(android.hardware.camera2.CameraManager.AvailabilityListener);
    method public void unregisterCameraListener(android.hardware.camera2.CameraManager.CameraListener);
  }
  }
  public static abstract interface CameraManager.CameraListener {
  public static abstract class CameraManager.AvailabilityListener {
    method public abstract void onCameraAvailable(java.lang.String);
    ctor public CameraManager.AvailabilityListener();
    method public abstract void onCameraUnavailable(java.lang.String);
    method public void onCameraAvailable(java.lang.String);
    method public void onCameraUnavailable(java.lang.String);
  }
  }
  public class CameraMetadata implements java.lang.AutoCloseable android.os.Parcelable {
  public abstract class CameraMetadata {
    ctor public CameraMetadata();
    method public abstract T get(android.hardware.camera2.CameraMetadata.Key<T>);
    method public void close() throws java.lang.Exception;
    method public int describeContents();
    method public T get(android.hardware.camera2.CameraMetadata.Key<T>);
    method public void readFromParcel(android.os.Parcel);
    method public void set(android.hardware.camera2.CameraMetadata.Key<T>, T);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
    field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
    field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
    field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
    field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
    field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
@@ -10950,7 +10950,6 @@ package android.hardware.camera2 {
    field public static final int CONTROL_SCENE_MODE_SUNSET = 10; // 0xa
    field public static final int CONTROL_SCENE_MODE_SUNSET = 10; // 0xa
    field public static final int CONTROL_SCENE_MODE_THEATRE = 7; // 0x7
    field public static final int CONTROL_SCENE_MODE_THEATRE = 7; // 0x7
    field public static final int CONTROL_SCENE_MODE_UNSUPPORTED = 0; // 0x0
    field public static final int CONTROL_SCENE_MODE_UNSUPPORTED = 0; // 0x0
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int EDGE_MODE_FAST = 1; // 0x1
    field public static final int EDGE_MODE_FAST = 1; // 0x1
    field public static final int EDGE_MODE_HIGH_QUALITY = 2; // 0x2
    field public static final int EDGE_MODE_HIGH_QUALITY = 2; // 0x2
    field public static final int EDGE_MODE_OFF = 0; // 0x0
    field public static final int EDGE_MODE_OFF = 0; // 0x0
@@ -10983,14 +10982,13 @@ package android.hardware.camera2 {
  }
  }
  public static class CameraMetadata.Key {
  public static class CameraMetadata.Key {
    ctor public CameraMetadata.Key(java.lang.String, java.lang.Class<T>);
    method public final boolean equals(java.lang.Object);
    method public final boolean equals(java.lang.Object);
    method public final java.lang.String getName();
    method public final java.lang.String getName();
    method public final int hashCode();
    method public final int hashCode();
  }
  }
  public final class CameraProperties extends android.hardware.camera2.CameraMetadata {
  public final class CameraProperties extends android.hardware.camera2.CameraMetadata {
    ctor public CameraProperties();
    method public T get(android.hardware.camera2.CameraMetadata.Key<T>);
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_COMPENSATION_RANGE;
    field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_COMPENSATION_RANGE;
@@ -11033,10 +11031,10 @@ package android.hardware.camera2 {
  }
  }
  public final class CaptureRequest extends android.hardware.camera2.CameraMetadata implements android.os.Parcelable {
  public final class CaptureRequest extends android.hardware.camera2.CameraMetadata implements android.os.Parcelable {
    method public void addTarget(android.view.Surface);
    method public int describeContents();
    method public T get(android.hardware.camera2.CameraMetadata.Key<T>);
    method public java.lang.Object getTag();
    method public java.lang.Object getTag();
    method public void removeTarget(android.view.Surface);
    method public void writeToParcel(android.os.Parcel, int);
    method public void setTag(java.lang.Object);
    field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK;
    field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_MODE;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_MODE;
@@ -11086,7 +11084,17 @@ package android.hardware.camera2 {
    field public static final android.hardware.camera2.CameraMetadata.Key TONEMAP_MODE;
    field public static final android.hardware.camera2.CameraMetadata.Key TONEMAP_MODE;
  }
  }
  public static final class CaptureRequest.Builder {
    method public void addTarget(android.view.Surface);
    method public android.hardware.camera2.CaptureRequest build();
    method public T get(android.hardware.camera2.CameraMetadata.Key<T>);
    method public void removeTarget(android.view.Surface);
    method public void set(android.hardware.camera2.CameraMetadata.Key<T>, T);
    method public void setTag(java.lang.Object);
  }
  public final class CaptureResult extends android.hardware.camera2.CameraMetadata {
  public final class CaptureResult extends android.hardware.camera2.CameraMetadata {
    method public T get(android.hardware.camera2.CameraMetadata.Key<T>);
    field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK;
    field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_TRANSFORM;
    field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_TRANSFORM;
+299 −97

File changed.

Preview size limit exceeded, changes collapsed.

+78 −32
Original line number Original line Diff line number Diff line
@@ -20,17 +20,19 @@ import android.content.Context;
import android.hardware.ICameraService;
import android.hardware.ICameraService;
import android.hardware.ICameraServiceListener;
import android.hardware.ICameraServiceListener;
import android.hardware.IProCameraUser;
import android.hardware.IProCameraUser;
import android.hardware.camera2.impl.CameraMetadataNative;
import android.hardware.camera2.utils.CameraBinderDecorator;
import android.hardware.camera2.utils.CameraBinderDecorator;
import android.hardware.camera2.utils.CameraRuntimeException;
import android.hardware.camera2.utils.CameraRuntimeException;
import android.hardware.camera2.utils.BinderHolder;
import android.hardware.camera2.utils.BinderHolder;
import android.os.IBinder;
import android.os.IBinder;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.util.Log;
import android.util.Log;
import android.util.ArrayMap;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;


/**
/**
 * <p>An interface for iterating, listing, and connecting to
 * <p>An interface for iterating, listing, and connecting to
@@ -55,7 +57,10 @@ public final class CameraManager {


    private final ICameraService mCameraService;
    private final ICameraService mCameraService;
    private ArrayList<String> mDeviceIdList;
    private ArrayList<String> mDeviceIdList;
    private final HashSet<CameraListener> mListenerSet = new HashSet<CameraListener>();

    private ArrayMap<AvailabilityListener, Handler> mListenerMap =
            new ArrayMap<AvailabilityListener, Handler>();

    private final Context mContext;
    private final Context mContext;
    private final Object mLock = new Object();
    private final Object mLock = new Object();


@@ -85,14 +90,16 @@ public final class CameraManager {
    }
    }


    /**
    /**
     * <p>Return the list of currently connected camera devices by
     * Return the list of currently connected camera devices by
     * identifier. Non-removable cameras use integers starting at 0 for their
     * identifier.
     *
     * <p>Non-removable cameras use integers starting at 0 for their
     * identifiers, while removable cameras have a unique identifier for each
     * identifiers, while removable cameras have a unique identifier for each
     * individual device, even if they are the same model.</p>
     * individual device, even if they are the same model.</p>
     *
     *
     * @return The list of currently connected camera devices.
     * @return The list of currently connected camera devices.
     */
     */
    public String[] getDeviceIdList() throws CameraAccessException {
    public String[] getCameraIdList() throws CameraAccessException {
        synchronized (mLock) {
        synchronized (mLock) {
            try {
            try {
                return getOrCreateDeviceIdListLocked().toArray(new String[0]);
                return getOrCreateDeviceIdListLocked().toArray(new String[0]);
@@ -107,13 +114,25 @@ public final class CameraManager {
    /**
    /**
     * Register a listener to be notified about camera device availability.
     * Register a listener to be notified about camera device availability.
     *
     *
     * Registering a listener more than once has no effect.
     * <p>Registering the same listener again will replace the handler with the
     * new one provided.</p>
     *
     *
     * @param listener The new listener to send camera availability notices to
     * @param listener The new listener to send camera availability notices to
     * @param handler The handler on which the listener should be invoked, or
     * {@code null} to use the current thread's {@link android.os.Looper looper}.
     */
     */
    public void registerCameraListener(CameraListener listener) {
    public void addAvailabilityListener(AvailabilityListener listener, Handler handler) {
        if (handler == null) {
            Looper looper = Looper.myLooper();
            if (looper == null) {
                throw new IllegalArgumentException(
                        "No handler given, and current thread has no looper!");
            }
            handler = new Handler(looper);
        }

        synchronized (mLock) {
        synchronized (mLock) {
            mListenerSet.add(listener);
            mListenerMap.put(listener, handler);
        }
        }
    }
    }


@@ -121,13 +140,13 @@ public final class CameraManager {
     * Remove a previously-added listener; the listener will no longer receive
     * Remove a previously-added listener; the listener will no longer receive
     * connection and disconnection callbacks.
     * connection and disconnection callbacks.
     *
     *
     * Removing a listener that isn't registered has no effect.
     * <p>Removing a listener that isn't registered has no effect.</p>
     *
     *
     * @param listener The listener to remove from the notification list
     * @param listener The listener to remove from the notification list
     */
     */
    public void unregisterCameraListener(CameraListener listener) {
    public void removeAvailabilityListener(AvailabilityListener listener) {
        synchronized (mLock) {
        synchronized (mLock) {
            mListenerSet.remove(listener);
            mListenerMap.remove(listener);
        }
        }
    }
    }


@@ -144,7 +163,7 @@ public final class CameraManager {
     * @throws SecurityException if the application does not have permission to
     * @throws SecurityException if the application does not have permission to
     * access the camera
     * access the camera
     *
     *
     * @see #getDeviceIdList
     * @see #getCameraIdList
     * @see android.app.admin.DevicePolicyManager#setCameraDisabled
     * @see android.app.admin.DevicePolicyManager#setCameraDisabled
     */
     */
    public CameraProperties getCameraProperties(String cameraId)
    public CameraProperties getCameraProperties(String cameraId)
@@ -160,14 +179,14 @@ public final class CameraManager {
        // TODO: implement and call a service function to get the capabilities on C++ side
        // TODO: implement and call a service function to get the capabilities on C++ side


        // TODO: get properties from service
        // TODO: get properties from service
        return new CameraProperties();
        return new CameraProperties(new CameraMetadataNative());
    }
    }


    /**
    /**
     * Open a connection to a camera with the given ID. Use
     * Open a connection to a camera with the given ID. Use
     * {@link #getDeviceIdList} to get the list of available camera
     * {@link #getCameraIdList} to get the list of available camera
     * devices. Note that even if an id is listed, open may fail if the device
     * devices. Note that even if an id is listed, open may fail if the device
     * is disconnected between the calls to {@link #getDeviceIdList} and
     * is disconnected between the calls to {@link #getCameraIdList} and
     * {@link #openCamera}.
     * {@link #openCamera}.
     *
     *
     * @param cameraId The unique identifier of the camera device to open
     * @param cameraId The unique identifier of the camera device to open
@@ -179,7 +198,7 @@ public final class CameraManager {
     * @throws SecurityException if the application does not have permission to
     * @throws SecurityException if the application does not have permission to
     * access the camera
     * access the camera
     *
     *
     * @see #getDeviceIdList
     * @see #getCameraIdList
     * @see android.app.admin.DevicePolicyManager#setCameraDisabled
     * @see android.app.admin.DevicePolicyManager#setCameraDisabled
     */
     */
    public CameraDevice openCamera(String cameraId) throws CameraAccessException {
    public CameraDevice openCamera(String cameraId) throws CameraAccessException {
@@ -218,29 +237,43 @@ public final class CameraManager {
    }
    }


    /**
    /**
     * Interface for listening to cameras becoming available or unavailable.
     * Interface for listening to camera devices becoming available or
     * Cameras become available when they are no longer in use, or when a new
     * unavailable.
     *
     * <p>Cameras become available when they are no longer in use, or when a new
     * removable camera is connected. They become unavailable when some
     * removable camera is connected. They become unavailable when some
     * application or service starts using a camera, or when a removable camera
     * application or service starts using a camera, or when a removable camera
     * is disconnected.
     * is disconnected.</p>
     *
     * @see addAvailabilityListener
     */
     */
    public interface CameraListener {
    public static abstract class AvailabilityListener {

        /**
        /**
         * A new camera has become available to use.
         * A new camera has become available to use.
         *
         *
         * <p>The default implementation of this method does nothing.</p>
         *
         * @param cameraId The unique identifier of the new camera.
         * @param cameraId The unique identifier of the new camera.
         */
         */
        public void onCameraAvailable(String cameraId);
        public void onCameraAvailable(String cameraId) {
            // default empty implementation
        }


        /**
        /**
         * A previously-available camera has become unavailable for use. If an
         * A previously-available camera has become unavailable for use.
         * application had an active CameraDevice instance for the
         *
         * now-disconnected camera, that application will receive a {@link
         * <p>If an application had an active CameraDevice instance for the
         * CameraDevice.ErrorListener#DEVICE_DISCONNECTED disconnection error}.
         * now-disconnected camera, that application will receive a
         * {@link CameraDevice.CameraDeviceListener#onCameraDisconnected disconnection error}.</p>
         *
         * <p>The default implementation of this method does nothing.</p>
         *
         *
         * @param cameraId The unique identifier of the disconnected camera.
         * @param cameraId The unique identifier of the disconnected camera.
         */
         */
        public void onCameraUnavailable(String cameraId);
        public void onCameraUnavailable(String cameraId) {
            // default empty implementation
        }
    }
    }


    private ArrayList<String> getOrCreateDeviceIdListLocked() throws CameraAccessException {
    private ArrayList<String> getOrCreateDeviceIdListLocked() throws CameraAccessException {
@@ -285,7 +318,7 @@ public final class CameraManager {
        public static final int STATUS_NOT_AVAILABLE = 0x80000000;
        public static final int STATUS_NOT_AVAILABLE = 0x80000000;


        // Camera ID -> Status map
        // Camera ID -> Status map
        private final HashMap<String, Integer> mDeviceStatus = new HashMap<String, Integer>();
        private final ArrayMap<String, Integer> mDeviceStatus = new ArrayMap<String, Integer>();


        private static final String TAG = "CameraServiceListener";
        private static final String TAG = "CameraServiceListener";


@@ -322,7 +355,7 @@ public final class CameraManager {
                Log.v(TAG,
                Log.v(TAG,
                        String.format("Camera id %d has status changed to 0x%x", cameraId, status));
                        String.format("Camera id %d has status changed to 0x%x", cameraId, status));


                String id = String.valueOf(cameraId);
                final String id = String.valueOf(cameraId);


                if (!validStatus(status)) {
                if (!validStatus(status)) {
                    Log.e(TAG, String.format("Ignoring invalid device %d status 0x%x", cameraId,
                    Log.e(TAG, String.format("Ignoring invalid device %d status 0x%x", cameraId,
@@ -363,12 +396,25 @@ public final class CameraManager {
                    return;
                    return;
                }
                }


                for (CameraListener listener : mListenerSet) {
                final int listenerCount = mListenerMap.size();
                for (int i = 0; i < listenerCount; i++) {
                    Handler handler = mListenerMap.valueAt(i);
                    final AvailabilityListener listener = mListenerMap.keyAt(i);
                    if (isAvailable(status)) {
                    if (isAvailable(status)) {
                        handler.post(
                            new Runnable() {
                                public void run() {
                                    listener.onCameraAvailable(id);
                                    listener.onCameraAvailable(id);
                                }
                            });
                    } else {
                    } else {
                        handler.post(
                            new Runnable() {
                                public void run() {
                                    listener.onCameraUnavailable(id);
                                    listener.onCameraUnavailable(id);
                                }
                                }
                            });
                    }
                } // for
                } // for
            } // synchronized
            } // synchronized
        } // onStatusChanged
        } // onStatusChanged
+13 −651

File changed.

Preview size limit exceeded, changes collapsed.

+17 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package android.hardware.camera2;
package android.hardware.camera2;


import android.hardware.camera2.impl.CameraMetadataNative;

/**
/**
 * <p>The properties describing a
 * <p>The properties describing a
 * {@link CameraDevice CameraDevice}.</p>
 * {@link CameraDevice CameraDevice}.</p>
@@ -29,6 +31,21 @@ package android.hardware.camera2;
 */
 */
public final class CameraProperties extends CameraMetadata {
public final class CameraProperties extends CameraMetadata {


    private final CameraMetadataNative mProperties;

    /**
     * Takes ownership of the passed-in properties object
     * @hide
     */
    public CameraProperties(CameraMetadataNative properties) {
        mProperties = properties;
    }

    @Override
    public <T> T get(Key<T> key) {
        return mProperties.get(key);
    }

    /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
    /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
     * The key entries below this point are generated from metadata
     * The key entries below this point are generated from metadata
     * definitions in /system/media/camera/docs. Do not modify by hand or
     * definitions in /system/media/camera/docs. Do not modify by hand or
Loading