It's already built in android lockscreen feature. Password or pattern unlocking feature I mean. Basically you need to unlock the phone before the pc is allow access. Plugging it puts it in technically a charge only mode.
Kinda makes sense if you didn't have locked pin or password. Your friend...