Camera:Retain dumpsys logs from prev open session.
This change also fixes the deadlock in cameraserver caused when all
apps are cleared during an open camera session. The mServiceLock is
acquired by evictClientIdByRemote during disconnect and cacheDump was
trying to acquire it again.
Bug: 185140738
Bug: 190821843
Test: Tested locally by Open camera->clear allapps->Open camera
100 iterations of Evcition test pass.
Change-Id: Ib513aa754a12023580af864228d96c47cc05409c
Change-Id: Ib544ea077584daec98a743939ff303ee061724c8
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index d1ed59a..cccdc7a 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -205,6 +205,9 @@
// Monitored UIDs availability notification
void notifyMonitoredUids();
+ // Stores current open session device info in temp file.
+ void cacheDump();
+
// Register an offline client for a given active camera id
status_t addOfflineClient(String8 cameraId, sp<BasicClient> offlineClient);
@@ -788,6 +791,12 @@
// Container for managing currently active application-layer clients
CameraClientManager mActiveClientManager;
+ // Adds client logs during open session to the file pointed by fd.
+ void dumpOpenSessionClientLogs(int fd, const Vector<String16>& args, const String8& cameraId);
+
+ // Adds client logs during closed session to the file pointed by fd.
+ void dumpClosedSessionClientLogs(int fd, const String8& cameraId);
+
// Mapping from camera ID -> state for each device, map is protected by mCameraStatesLock
std::map<String8, std::shared_ptr<CameraState>> mCameraStates;
@@ -940,6 +949,10 @@
*/
void filterSPerfClassCharacteristics();
+ // File descriptor to temp file used for caching previous open
+ // session dumpsys info.
+ int mMemFd;
+
// Number of camera devices (excluding hidden secure cameras)
int mNumberOfCameras;
// Number of camera devices (excluding hidden secure cameras and