I'm looking for a way to lock computer USB connection with second password, not with the regular lock screen password but with a different password. Thus, people who already know the password of my device will not be able to transfer files and connect it to the computer without the other password.
There is an app on the play store that called:
Smart AppLock (App Protector)
https://play.google.com/store/apps/details?id=com.sp.protector.free
It has the so-called option "USB Connection Lock", but it isn't working... Is there a similar way to do it? I searched the internet but did not find anything close.. maybe some code to use with ADB?
com.android.settings/.Settings$UsbDetailsActivity
activity is in the foreground or not. If in foreground, than create an overlay or a new activity on top of it which would act as a password lock (the type of which you are seeking). So far, I have not been able to find an app that offers detection of a specific activity launch.