summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.h
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2015-05-26 17:25:07 -0700
committerRuben Brunk <rubenbrunk@google.com>2015-06-01 16:53:45 -0700
commit99e69716215cd0665379bc90d708f2ea8689831d (patch)
treed013b8e9273ea6032ddf24ba701eccb755b672bb /services/camera/libcameraservice/CameraService.h
parent4a95e69406aa2e9896d865962d6d947ebbdac6fc (diff)
downloadframeworks_av-99e69716215cd0665379bc90d708f2ea8689831d.zip
frameworks_av-99e69716215cd0665379bc90d708f2ea8689831d.tar.gz
frameworks_av-99e69716215cd0665379bc90d708f2ea8689831d.tar.bz2
Track camera and flashlight usage in battery stats.
Bug: 15986092 Change-Id: I9dc6828332e4091fd93bf2d82839e8e3862a2fc2
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r--services/camera/libcameraservice/CameraService.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 9b7163a..2e4743f 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -46,6 +46,7 @@
#include <string>
#include <map>
#include <memory>
+#include <utility>
namespace android {
@@ -327,6 +328,20 @@ public:
}; // class Client
+ /**
+ * A listener class that implements the LISTENER interface for use with a ClientManager, and
+ * implements the following methods:
+ * void onClientRemoved(const ClientDescriptor<KEY, VALUE>& descriptor);
+ * void onClientAdded(const ClientDescriptor<KEY, VALUE>& descriptor);
+ */
+ class ClientEventListener {
+ public:
+ void onClientAdded(const resource_policy::ClientDescriptor<String8,
+ sp<CameraService::BasicClient>>& descriptor);
+ void onClientRemoved(const resource_policy::ClientDescriptor<String8,
+ sp<CameraService::BasicClient>>& descriptor);
+ }; // class ClientEventListener
+
typedef std::shared_ptr<resource_policy::ClientDescriptor<String8,
sp<CameraService::BasicClient>>> DescriptorPtr;
@@ -338,9 +353,10 @@ public:
* This class manages the eviction behavior for the camera clients. See the parent class
* implementation in utils/ClientManager for the specifics of this behavior.
*/
- class CameraClientManager :
- public resource_policy::ClientManager<String8, sp<CameraService::BasicClient>> {
+ class CameraClientManager : public resource_policy::ClientManager<String8,
+ sp<CameraService::BasicClient>, ClientEventListener> {
public:
+ CameraClientManager();
virtual ~CameraClientManager();
/**
@@ -624,13 +640,15 @@ private:
sp<CameraFlashlight> mFlashlight;
// guard mTorchStatusMap
Mutex mTorchStatusMutex;
- // guard mTorchClientMap
+ // guard mTorchClientMap, mTorchUidMap
Mutex mTorchClientMapMutex;
// camera id -> torch status
KeyedVector<String8, ICameraServiceListener::TorchStatus> mTorchStatusMap;
// camera id -> torch client binder
// only store the last client that turns on each camera's torch mode
- KeyedVector<String8, sp<IBinder> > mTorchClientMap;
+ KeyedVector<String8, sp<IBinder>> mTorchClientMap;
+ // camera id -> [incoming uid, current uid] pair
+ std::map<String8, std::pair<int, int>> mTorchUidMap;
// check and handle if torch client's process has died
void handleTorchClientBinderDied(const wp<IBinder> &who);