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

Commit 27049987 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "camera2: Mark onCameraOpened/Closed callbacks @SystemApi."

parents 56e77d8f f3b7a85f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ package android {
    field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
    field @Deprecated public static final String BROADCAST_NETWORK_PRIVILEGED = "android.permission.BROADCAST_NETWORK_PRIVILEGED";
    field public static final String CAMERA_DISABLE_TRANSMIT_LED = "android.permission.CAMERA_DISABLE_TRANSMIT_LED";
    field public static final String CAMERA_OPEN_CLOSE_LISTENER = "android.permission.CAMERA_OPEN_CLOSE_LISTENER";
    field public static final String CAPTURE_AUDIO_HOTWORD = "android.permission.CAPTURE_AUDIO_HOTWORD";
    field public static final String CAPTURE_MEDIA_OUTPUT = "android.permission.CAPTURE_MEDIA_OUTPUT";
    field public static final String CAPTURE_TV_INPUT = "android.permission.CAPTURE_TV_INPUT";
@@ -2460,6 +2461,11 @@ package android.hardware.camera2 {
    field public static final int SESSION_OPERATION_MODE_VENDOR_START = 32768; // 0x8000
  }
  public abstract static class CameraManager.AvailabilityCallback {
    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraClosed(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraOpened(@NonNull String, @NonNull String);
  }
}
package android.hardware.camera2.params {
+5 −0
Original line number Diff line number Diff line
@@ -743,6 +743,11 @@ package android.hardware.camera2 {
    method public String[] getCameraIdListNoLazy() throws android.hardware.camera2.CameraAccessException;
  }

  public abstract static class CameraManager.AvailabilityCallback {
    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraClosed(@NonNull String);
    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraOpened(@NonNull String, @NonNull String);
  }

}

package android.hardware.display {
+14 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
@@ -850,13 +851,17 @@ public final class CameraManager {
         * A camera device has been opened by an application.
         *
         * <p>The default implementation of this method does nothing.</p>
         *
         * @param cameraId The unique identifier of the new camera.
         *    android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER is required to receive this
         *    callback
         * @param cameraId The unique identifier of the camera opened.
         * @param packageId The package Id of the application opening the camera.
         *
         * @see #onCameraClosed
         * @hide
         */
        /** @hide */
        @SystemApi
        @TestApi
        @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER)
        public void onCameraOpened(@NonNull String cameraId, @NonNull String packageId) {
            // default empty implementation
        }
@@ -865,10 +870,14 @@ public final class CameraManager {
         * A previously-opened camera has been closed.
         *
         * <p>The default implementation of this method does nothing.</p>
         *
         *    android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER is required to receive this
         *    callback.
         * @param cameraId The unique identifier of the closed camera.
         * @hide
         */
        /** @hide */
        @SystemApi
        @TestApi
        @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER)
        public void onCameraClosed(@NonNull String cameraId) {
            // default empty implementation
        }
+1 −1
Original line number Diff line number Diff line
@@ -1361,7 +1361,7 @@
        android:description="@string/permdesc_systemCamera"
        android:protectionLevel="system|signature" />

    <!-- Allows receiving the camera service notifications when a camera is opened
    <!-- @SystemApi Allows receiving the camera service notifications when a camera is opened
            (by a certain application package) or closed.
        @hide -->
    <permission android:name="android.permission.CAMERA_OPEN_CLOSE_LISTENER"
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@
    <!-- Permissions needed to test system only camera devices -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.SYSTEM_CAMERA" />
      <!-- Permissions needed to test onCameraOpened/Closed callbacks -->
    <uses-permission android:name="android.permission.CAMERA_OPEN_CLOSE_LISTENER" />
    <!-- Permissions needed for CTS camera test: RecordingTest.java when assuming shell id -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <!-- Permission needed to enable/disable Bluetooth/Wifi -->