Fixed that the camera will not be blocked on the virtual display in special cases
- Root cause: When an app uses the system default camera app to open the camera on the phone, and another app uses an Intent (MediaStore.ACTION_IMAGE_CAPTURE) (the system default camera app) to open the camera on the virtual display, because they will use the same thread in the camera service, the camera will only reconfigure the stream without creating it again. Therefore, the onCameraOpened callback will not be triggered, causing the issue that the camera on the virtual display is not blocked. - Solution: The camera mechanism is that only one camera can run at a time. If two apps open the camera at the same time, it will first open and close the camera of one of two apps, and then open the camera of another app. So we identify above issue according to this rule: track the app that opens the camera on the phone (main display). When it is detected that this app also appears on the virtual display, it means that the app appears on both sides at the same time, which belongs to the above issue, and the camera of this app is set to a blocked state. Bug: 210795569 Test: Manual Change-Id: Idabee8a38085c8aae1f47f3579cead1adde385ea
Loading
Please register or sign in to comment