I am developing an android application for mirroring android screen to car display. I used MediaProjection for getting screen; using that api I was able to mirror screen and now I want to lock android screen during mirroring to avoid distraction of user.
Is there any way to lock only Android device screen during streaming? for example showing a fixed picture or freeze Device screen and stream the other layouts? Maybe using some APIs or etc?
I personally lock/unlock the UI for users by setting / clearing flags :
This will prevent the user to interact with the screen. You can then create a RelativeLayout with grayish color to make it obvious that the user needs to wait, and playing with its visibility when performing your actions :
You can also add a ProgressDialog at the same time, that you show / dismiss :
If you combine those three, I think it make a good waiting screen, then you can put those methods together like so :
And you just need to call lockUI() when you start and unlockUI() when the user can interact again with the screen.
Hope this helps, let us know how it went !