summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.h
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2015-04-30 17:44:07 -0700
committerRuben Brunk <rubenbrunk@google.com>2015-05-14 18:49:53 -0700
commit6267b539d0d1ee7118aafd976d75cb8db397bc24 (patch)
tree5c950439fc8243ffd960bd72a666b4fce172a24d /services/camera/libcameraservice/CameraService.h
parent51c834c8d321cee50cd07026771e46167a640dd3 (diff)
downloadframeworks_av-6267b539d0d1ee7118aafd976d75cb8db397bc24.zip
frameworks_av-6267b539d0d1ee7118aafd976d75cb8db397bc24.tar.gz
frameworks_av-6267b539d0d1ee7118aafd976d75cb8db397bc24.tar.bz2
camera2: Fix work-profile eviction handling.
Bug: 20124384 Change-Id: I6fb82dbfd5f98746ed4befed81a583e3709bfee8
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r--services/camera/libcameraservice/CameraService.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 1041550..9b7163a 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -83,11 +83,6 @@ public:
// Default number of messages to store in eviction log
static const size_t DEFAULT_EVENT_LOG_LENGTH = 100;
- enum {
- // Default last user id
- DEFAULT_LAST_USER_ID = 0,
- };
-
// Implementation of BinderService<T>
static char const* getServiceName() { return "media.camera"; }
@@ -141,7 +136,7 @@ public:
virtual status_t setTorchMode(const String16& cameraId, bool enabled,
const sp<IBinder>& clientBinder);
- virtual void notifySystemEvent(int eventId, int arg0);
+ virtual void notifySystemEvent(int32_t eventId, const int32_t* args, size_t length);
// OK = supports api of that version, -EOPNOTSUPP = does not support
virtual status_t supportsCameraApi(
@@ -200,6 +195,9 @@ public:
virtual void notifyError(ICameraDeviceCallbacks::CameraErrorCode errorCode,
const CaptureResultExtras& resultExtras) = 0;
+ // Get the UID of the application client using this
+ virtual uid_t getClientUid() const;
+
// Get the PID of the application client using this
virtual int getClientPid() const;
@@ -469,7 +467,6 @@ private:
const String16& clientPackageName, int clientUid, apiLevel effectiveApiLevel,
bool legacyMode, bool shimUpdateOnly, /*out*/sp<CLIENT>& device);
-
// Lock guarding camera service state
Mutex mServiceLock;
@@ -492,8 +489,8 @@ private:
RingBuffer<String8> mEventLog;
Mutex mLogLock;
- // UID of last user.
- int mLastUserId;
+ // Currently allowed user IDs
+ std::set<userid_t> mAllowedUsers;
/**
* Get the camera state for a given camera id.
@@ -542,7 +539,7 @@ private:
/**
* Handle a notification that the current device user has changed.
*/
- void doUserSwitch(int newUserId);
+ void doUserSwitch(const int32_t* newUserId, size_t length);
/**
* Add an event log message.
@@ -568,7 +565,8 @@ private:
/**
* Add an event log message that the current device user has been switched.
*/
- void logUserSwitch(int oldUserId, int newUserId);
+ void logUserSwitch(const std::set<userid_t>& oldUserIds,
+ const std::set<userid_t>& newUserIds);
/**
* Add an event log message that a device has been removed by the HAL
@@ -699,6 +697,11 @@ private:
int facing, int clientPid, uid_t clientUid, int servicePid, bool legacyMode,
int halVersion, int deviceVersion, apiLevel effectiveApiLevel,
/*out*/sp<BasicClient>* client);
+
+ status_t checkCameraAccess(const String16& opPackageName);
+
+ static String8 toString(std::set<userid_t> intSet);
+
};
template<class Func>
@@ -775,15 +778,6 @@ status_t CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String
if((ret = validateConnectLocked(cameraId, /*inout*/clientUid)) != NO_ERROR) {
return ret;
}
- int userId = multiuser_get_user_id(clientUid);
-
- if (userId != mLastUserId && clientPid != getpid() ) {
- // If no previous user ID had been set, set to the user of the caller.
- logUserSwitch(mLastUserId, userId);
- LOG_ALWAYS_FATAL_IF(mLastUserId != DEFAULT_LAST_USER_ID,
- "Invalid state: Should never update user ID here unless was default");
- mLastUserId = userId;
- }
// Check the shim parameters after acquiring lock, if they have already been updated and
// we were doing a shim update, return immediately