Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71a331d6 authored by Emilian Peev's avatar Emilian Peev Committed by android-build-merger
Browse files

Merge "CameraProxy: Clear calling identity before scheduling" into pi-dev

am: fdad4c51

Change-Id: Ia6bf69e08b8b2949077e93345e27bc61b6bcc073
parents 3ae9a11c fdad4c51
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -165,12 +165,22 @@ public class CameraServiceProxy extends SystemService
    private final ICameraServiceProxy.Stub mCameraServiceProxy = new ICameraServiceProxy.Stub() {
        @Override
        public void pingForUserUpdate() {
            if (Binder.getCallingUid() != Process.CAMERASERVER_UID) {
                Slog.e(TAG, "Calling UID: " + Binder.getCallingUid() + " doesn't match expected " +
                        " camera service UID!");
                return;
            }
            notifySwitchWithRetries(30);
        }

        @Override
        public void notifyCameraState(String cameraId, int newCameraState, int facing,
                String clientName, int apiLevel) {
            if (Binder.getCallingUid() != Process.CAMERASERVER_UID) {
                Slog.e(TAG, "Calling UID: " + Binder.getCallingUid() + " doesn't match expected " +
                        " camera service UID!");
                return;
            }
            String state = cameraStateToString(newCameraState);
            String facingStr = cameraFacingToString(facing);
            if (DEBUG) Slog.v(TAG, "Camera " + cameraId + " facing " + facingStr + " state now " +
@@ -301,7 +311,12 @@ public class CameraServiceProxy extends SystemService
            }
            mCameraUsageHistory.clear();
        }
        final long ident = Binder.clearCallingIdentity();
        try {
            CameraStatsJobService.schedule(mContext);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    private void switchUserLocked(int userHandle) {