1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware; 18 19 /** @hide */ 20 interface ICameraServiceListener 21 { 22 23 /** 24 * Initial status will be transmitted with onStatusChange immediately 25 * after this listener is added to the service listener list. 26 * 27 * Allowed transitions: 28 * 29 * (Any) -> NOT_PRESENT 30 * NOT_PRESENT -> PRESENT 31 * NOT_PRESENT -> ENUMERATING 32 * ENUMERATING -> PRESENT 33 * PRESENT -> NOT_AVAILABLE 34 * NOT_AVAILABLE -> PRESENT 35 * 36 * A state will never immediately transition back to itself. 37 * 38 * The enums must match the values in 39 * include/hardware/camera_common.h when applicable 40 */ 41 // Device physically unplugged 42 const int STATUS_NOT_PRESENT = 0; 43 // Device physically has been plugged in and the camera can be used exclusively 44 const int STATUS_PRESENT = 1; 45 // Device physically has been plugged in but it will not be connect-able until enumeration is 46 // complete 47 const int STATUS_ENUMERATING = 2; 48 // Camera is in use by another app and cannot be used exclusively 49 const int STATUS_NOT_AVAILABLE = -2; 50 51 // Use to initialize variables only 52 const int STATUS_UNKNOWN = -1; 53 54 // We pass deviceId associated with a camera in the callbacks, which is the id of the virtual 55 // device owning the camera (for virtual cameras), or kDefaultDeviceId (for real 56 // cameras). The deviceId is being passed so that the API layer (CameraManagerGlobal) can filter 57 // out the cameras that don't correspond to the context associated with the caller who 58 // registers a callback. 59 onStatusChanged(int status, @utf8InCpp String cameraId, int deviceId)60 oneway void onStatusChanged(int status, @utf8InCpp String cameraId, int deviceId); 61 62 /** 63 * Notify registered client about status changes for a physical camera backing 64 * a logical camera. 65 */ onPhysicalCameraStatusChanged(int status, @utf8InCpp String cameraId, @utf8InCpp String physicalCameraId, int deviceId)66 oneway void onPhysicalCameraStatusChanged(int status, @utf8InCpp String cameraId, 67 @utf8InCpp String physicalCameraId, int deviceId); 68 69 /** 70 * The torch mode status of a camera. 71 * 72 * Initial status will be transmitted with onTorchStatusChanged immediately 73 * after this listener is added to the service listener list. 74 * 75 * The enums must match the values in 76 * include/hardware/camera_common.h 77 */ 78 // The camera's torch mode has become not available to use via 79 // setTorchMode(). 80 const int TORCH_STATUS_NOT_AVAILABLE = 0; 81 // The camera's torch mode is off and available to be turned on via 82 // setTorchMode(). 83 const int TORCH_STATUS_AVAILABLE_OFF = 1; 84 // The camera's torch mode is on and available to be turned off via 85 // setTorchMode(). 86 const int TORCH_STATUS_AVAILABLE_ON = 2; 87 88 // Use to initialize variables only 89 const int TORCH_STATUS_UNKNOWN = -1; 90 onTorchStatusChanged(int status, @utf8InCpp String cameraId, int deviceId)91 oneway void onTorchStatusChanged(int status, @utf8InCpp String cameraId, int deviceId); 92 onTorchStrengthLevelChanged(@tf8InCpp String cameraId, int newTorchStrength, int deviceId)93 oneway void onTorchStrengthLevelChanged(@utf8InCpp String cameraId, int newTorchStrength, int deviceId); 94 95 /** 96 * Notify registered clients about camera access priority changes. 97 * Clients which were previously unable to open a certain camera device 98 * can retry after receiving this callback. 99 */ onCameraAccessPrioritiesChanged()100 oneway void onCameraAccessPrioritiesChanged(); 101 102 /** 103 * Notify registered clients about cameras being opened/closed. 104 * Only clients with android.permission.CAMERA_OPEN_CLOSE_LISTENER permission 105 * will receive such callbacks. 106 */ onCameraOpened(@tf8InCpp String cameraId, @utf8InCpp String clientPackageId, int deviceId)107 oneway void onCameraOpened(@utf8InCpp String cameraId, @utf8InCpp String clientPackageId, int deviceId); onCameraClosed(@tf8InCpp String cameraId, int deviceId)108 oneway void onCameraClosed(@utf8InCpp String cameraId, int deviceId); 109 } 110