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