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 
onStatusChanged(int status, String cameraId)54     oneway void onStatusChanged(int status, String cameraId);
55 
56     /**
57      * Notify registered client about status changes for a physical camera backing
58      * a logical camera.
59      */
onPhysicalCameraStatusChanged(int status, String cameraId, String physicalCameraId)60     oneway void onPhysicalCameraStatusChanged(int status, String cameraId, String physicalCameraId);
61 
62     /**
63      * The torch mode status of a camera.
64      *
65      * Initial status will be transmitted with onTorchStatusChanged immediately
66      * after this listener is added to the service listener list.
67      *
68      * The enums must match the values in
69      * include/hardware/camera_common.h
70      */
71     // The camera's torch mode has become not available to use via
72     // setTorchMode().
73     const int TORCH_STATUS_NOT_AVAILABLE = 0;
74     // The camera's torch mode is off and available to be turned on via
75     // setTorchMode().
76     const int TORCH_STATUS_AVAILABLE_OFF = 1;
77     // The camera's torch mode is on and available to be turned off via
78     // setTorchMode().
79     const int TORCH_STATUS_AVAILABLE_ON  = 2;
80 
81     // Use to initialize variables only
82     const int TORCH_STATUS_UNKNOWN = -1;
83 
onTorchStatusChanged(int status, String cameraId)84     oneway void onTorchStatusChanged(int status, String cameraId);
85 
86     /**
87      * Notify registered clients about camera access priority changes.
88      * Clients which were previously unable to open a certain camera device
89      * can retry after receiving this callback.
90      */
onCameraAccessPrioritiesChanged()91     oneway void onCameraAccessPrioritiesChanged();
92 
93     /**
94      * Notify registered clients about cameras being opened/closed.
95      * Only clients with android.permission.CAMERA_OPEN_CLOSE_LISTENER permission
96      * will receive such callbacks.
97      */
onCameraOpened(String cameraId, String clientPackageId)98     oneway void onCameraOpened(String cameraId, String clientPackageId);
onCameraClosed(String cameraId)99     oneway void onCameraClosed(String cameraId);
100 }
101