How to Stop Apps from Reading the Android Clipboard to Protect your Privacy

4300

4

2017-08-12 02:46



Android’s clipboard is notoriously insecure because any app on your phone can read from it without your permission, so it’s generally recommended that you never copy any sensitive data.

Follow the Tutorial and you can Stop any Apps from Reading the Android Clipboard


Note: by removing this permission from an app, you can no longer use the “paste” feature while inputting text within that app. This shouldn’t be a problem for apps like games, but it may cause an inconvenience for other apps.

Stop Apps from Reading the Android Clipboard
  • You’ll first need to download and then install the USB drivers for your phone or tablet. This may only be necessary if you are on Windows. here  or   UniversalAdbDriver
  • Next, download the Android Debug Bridge (ADB) binary for your Operating System then extract the files from the zip archive to any folder on your computer.
  • Then, open the Settings app on your phone and find the “About Phone” option – usually near the bottom.
  • Scroll down and look for “Build Number.” Tap on this value 7 times to enable Developer Mode.
  • Go back to the main menu in Settings and enter the new Developer Options menu.
  • Enable USB Debugging Mode.


7.Plug in your device to your PC and change the USB mode from “charge only” to “file transfer (MTP)”.
8.On your computer, navigate to where you extracted the ADB binary earlier in step 2.



9.For Windows users, open a Command Prompt in this ADB directory. The easiest method to do this is to press Shift+Right-click then in the context menu that appears choose the “open command window here” option. For Mac or Linux users, open a Terminal.



10.Enter the following command: adb devices. If you are on Mac or Linux, you may need to prefix the command with the entire directory to where ADB is stored. So for example, /home/user/downloads/adb devices. If so, you’ll need to remember to prefix any further commands in this tutorial in the same way.
11.In any case, entering the command will start the ADB daemon. If this is your first time using ADB, you will see a prompt on your device asking you to authorize a connection. Allow it.


12.Re-run the command from step 10 and you’ll see the serial number of your device in the output. If you do, then go on to the next step. Otherwise, re-install your drivers.
13.Now send the following command: adb shell
14.
This will enter you into your device’s shell environment. Now, we need to figure out what apps are able to read the clipboard. Enter this: cmd appops query-op --user 0 READ_CLIPBOARD allow



15.As you can see, in the output you’ll see a list of packages that can read your clipboard. Some of what’s listed here may be obvious to you what app it correlates to, but if not, install App Inspector and then find the name of the package under each app name.
16.Once you know which app(s) you want to prevent from reading the clipboard, enter the following: cmd appops set <package> READ_CLIPBOARD ignore


17.If you don’t see an error message, then the command worked! Repeat the above step for any other apps you want to stop reading your clipboard.
18.If you want to undo what you just did, change “ignore” in step #16 to “allow”. Alternatively, you can uninstall then reinstall the app and it will reset all permissions.



If the commands in steps 14 and 16 aren’t working for you, try running them without the “cmd” in front. I’ve heard that this may be necessary for some phones running Android 6.0 Marshmallow or below.



ExplanationAny applications that declare the permission android.permission.READ_CLIPBOARD in their AndroidManifest.xml file is automatically granted this permission when it is installed, meaning they can read the Android clipboard. Although many devices have access to a permission management control system in Settings, READ_CLIPBOARD is not something users can restrict from apps unless you’re a user of certain custom ROMs such as LineageOS.


Source : xda-developers