Accept data via Intent and pass them on to the host as keystrokes
Adds new functionality to the MousepadPlugin to accept data via Intent and pass them on to the host as keystrokes via the existing MousePadPlugin.PACKET_TYPE_MOUSEPAD_REQUEST PackageType
This allows other apps to send an Intent:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/x-keystrokes");
sendIntent.putExtra(Intent.EXTRA_TEXT, textToSend);
if (sendIntent.resolveActivity(this.context.getPackageManager()) != null) {
this.context.startActivity(sendIntent);
}
which then shows a confirm dialog and allows to pass the text as keystrokes to the host. The confirm dialog also has the option to whitelist a sending application (by its package name) and allow it to send without confirmation.
This could be used by other apps like password managers or OTP Tools to easily send the code to the desktop.
See here for a screen recording on how it works: https://imgur.com/a/uwjbESq / https://imgur.com/a/cBm5yOi
Ive also an open PR on AndOTP which would use this feature: https://github.com/andOTP/andOTP/pull/693
ToDo:
-
remove the flickering if the calling app is whitelisted, only show the Activity if needed