How to Customize which Radios are Disabled in Airplane Mode

There’s always been a fear that a phone’s radio frequencies can cause issues with airplane equipment. Before the smartphone era, airplane passengers were instructed to turn off all electronics just as a precaution. Smartphones introduced Airplane Mode so that we could still use them for other things like playing a game or watching a video. Some users even use Airplane Mode outside of travel to save a little battery life or as a way to go cold turkey from the Internet. When you enable Airplane Mode, it disables all radios on the device such as cellular, WiFi, NFC, and Bluetooth. However, Bluetooth is generally permitted on a plane and some even allow WiFi use. Here’s a tutorial on how to prevent WiFi, Bluetooth, or any other radio from being disabled when you turn on Airplane Mode.


How to Prevent Airplane Mode from Disabling Certain Radios

  1. Install the USB drivers for your device manufacturer (Google provides a list of some universal USB drivers here).
  2. Download the ADB binary for your operating system (WindowsMacLinux). These links will always point to the latest version of ADB.
  3. Extract the contents of the ADB binary ZIP file into a folder on your PC.
  4. Launch the Settings app on your device and tap on the About Phone option.
  5. Find the Build Number and tap on it 7 times so we can enable Developer Mode.
  6. Go back to the Settings main menu and enter Developer Options then toggle USB Debugging on.
  7. Plug your phone into the computer and change it from “charge only” mode to “file transfer (MTP)” mode. Some devices require this step as a security measure before permitting ADB to work.
  8. Go back to the PC and bring up the directory where you extracted the ADB binary.
  9. Launch a Command Prompt or Terminal in your ADB directory. For Windows users, this can be done by holding Shift and Right-clicking then selecting the “open command prompt here” option. (Some Windows 10 users may see “PowerShell” instead of “command prompt”.)
  10. Once you’re in the Command Prompt or Terminal environment, execute the following command: adb devices
  11. This will start the ADB daemon if it hasn’t been launched already. You may even see a prompt on your phone asking you to authorize a connection with the computer. Allow USB Debugging access here.
  12. Now if you re-run the adb devices command from step 10, the command prompt/terminal will print the serial number of your device. If so, then you’re ready to move on. If not, then the USB drivers are likely not installed properly.
  13. Execute the following command in the command prompt or terminal: adb shell
  14. Then run the following command to prevent Airplane Mode from turning off WiFi: settings put global airplane_mode_radios cell,bluetooth,nfc,wimax
     adb shell airplane mode radios
  15. Alternatively, you could do this command to prevent Airplane Mode from turning off WiFi and Bluetooth: settings put global airplane_mode_radios cell,nfc,wimax
  16. Each item we remove from the list tells Android to leave that radio on when Airplane Mode is toggled on.
  17. If you ever want to return things back to how they were, you can execute the following command in an ADB shell prompt: settings delete global airplane_mode_radios

Explanation

So as you can see from the steps above, we’re using ADB commands to manually customize exactly what radios are shut off when we hit that Airplane Mode button. Normally, Airplane Mode will shut off cellular, WiFi, NFC, Bluetooth and WiMAX (if it exists) radios, but removing one or more of these from the list with the ADB command shown in Step 14 makes it so that it’s ignored. In the example I gave above in step #15, I chose to have both WiFi and Bluetooth stay on when I enable Airplane Mode.

This is why the command only includes cellular, NFC, and WiMAX options. Since we’re leaving those two radios out of the ADB command in step #15 (WiFi and Bluetooth in this case), Android will leave those radios alone when you toggle Airplane Mode on. You can use any combination here by leaving out any of these options, and even make it so that cellular radios stay on when you turn Airplane Mode on. Just make sure you know what you’re doing because keeping the cellular radio on could get you in trouble with an airline.

As mentioned above, you can toggle some radios back on after you have turned on Airplane Mode. I know that I will often turn WiFi and Bluetooth back on after I turn off all other radios with a device I’m not actively using.

So you may want to know that there’s also a way to stop a device from turning on one of these radios when Airplane Mode has been enabled. The preference is controlled by changing the values in the global preference “airplane_mode_toggleable_radios”. For example, you can make it so that you are unable to turn WiFi back on if you choose by entering this command:

settings put global airplane_mode_toggleable_radios bluetooth,nfc

By default, the options given to this command are WiFi, Bluetooth, and NFC. But if you leave one of them out when executing the command above then you stop the device from turning that radio back on. This can be a good idea for a child’s smartphone or tablet, or even used as a fail safe to make sure the radio isn’t turned back on when Airplane Mode is on. This feature will likely be less useful than the one detailed in the big guide above, but it’s something that you may want to be aware of.

How to Pair Android Wear Watches to New Phones without Factory Resetting

Android Wear as a smartwatch operating system is not without its faults, but sadly while the more tech enthusiastic are likely to use it, the same people are also likely to install custom ROMs on their phones. This in most cases means having to wipe your smartwatch every time you switch to another flavor of Android on your device. There is, however, a simple way to bypass setting up your smartwatch from scratch when you buy a new smartphone or flash a new custom ROM on your device. This method does not require root on either the phone or watch, but it does require a few Android Debugging Bridge (ADB) commands. This has been tested on the Huawei Watch on Android Wear 1.5 and Android Wear 2.0, however it should also work to pair Android Wear watches with any new smartphone. If for some reason your watch is already rooted, you can ignore this tutorial and simply use the Reset Wear Client to pair Android Wear without factory resetting directly from your smartwatch.


Pair Android Wear to New/Same Phone Without Wiping

First, you will need to download the ADB tools. I personally use the “Minimal ADB and Fastboot Kit” found right here on XDA, but you are welcome to use the official binaries from Google if you wish. Next, you will need to enable ADB debugging on your smartwatch (both wired or over WiFi debugging are fine, though I find WiFi more convenient). This is enabled through Developer options on your smartwatch, which you will also need to enable. To do this, simply go to Settings → system → about  on your watch and tap the field labeled “Build number” until you see a  toast message stating “you are now a developer”.

Android Wear Reconnect without Factory Reset

Once you have followed these steps, you’re ready to begin!

Enabling ADB debugging

Open Developer options and enable “ADB debugging” or “Debug over wifi” if you wish to do it wirelessly. The process to sync Android Wear to your smartphone will work fine both ways, but they require slightly different commands.

Android Wear Reconnect no Factory Reset

Initial setup to sync Android Wear will require a different command whether you are doing it over WiFi or not. Please open adb tools, either by searching adb in your Windows search bar or navigating to the folder containing adb, holding shift then right clicking and selecting “open command window here”. Then enter the below commands.

Over WiFi

In my case, I would type:

adb connect 192.168.1.100:5555

To connect to my Android Wear watch. The IP address you need to enter is located under “Debug over WiFi”, as shown in the screenshot above. Accept the prompt on the watch allowing the computer to debug. If successful, it will simply go back to the command prompt where you can type. There is now text output.

Wired

Substantially easier in commands, simply connect your device to your computer and type:

adb devices

If your device shows up, you’re fine. Make sure you accepted the prompt on your watch to allow it to debug.

Sending the Commands

To continue on, first disable Bluetooth on your phone and then on your computer type:

adb shell “pm clear com.google.android.gms && reboot”

Your watch will reboot, but no Android Wear factory reset will occur. When it boots back up it should no longer show a crossed out cloud icon indicating that it can’t connect to your phone. You will now want to install the Android Wear app on your phone (if you don’t already have it), but don’t enable Bluetooth yet.

Next, connect to the smartwatch via ADB again with the exact same steps as before. This time however, the command you want to run is:

adb shell “am start -a android.bluetooth.adapter.action.REQUEST_DISCOVERABLE”

And then on your watch allow it to be discoverable to other devices so you can sync Android Wear with the smartphone. You may now connect to Android Wear from your smartphone by opening the Wear app, enable Bluetooth, and search for devices. Your Android Watch should show up and your phone will sync with it. If the app hangs on “Checking for updates”, simply restart the app and it should begin to connect to Android Wear.


Explanation

The simple explanation as to why this works is that all smartphone-smartwatch pairing data is contained in Google Play Services. This data is phone-specific as the keys are stored in the Play Services data located on the smartwatch. This is the reason why you can’t simply Titanium Backup the Android Wear application from your smartphone, because the keys you need are stored on the smartwatch. When you try to pair a new phone (or have installed a new custom ROM and the watch thinks it’s a new phone), the keys are normally wiped through an Android Wear factory reset.

The only way to get around this is to instead wipe the key data which allows you to pair Android Wear with a new device without factory resetting as the keys that pair it to your phone are also cleared. We then request the smartwatch’s Bluetooth to be made discoverable via an intent sent through adb, which creates the prompt you see that needs to be accepted. This means your phone can now find your watch and then create new pairing keys with the device.

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

Rather than typing or swiping on your keyboard, sometimes it is easier to just cut, copy, and paste some text. If you want to enter some long pieces of text such as an address, password, or website link, using Android’s copy and paste feature certainly beats having to precisely type each character out. But 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. Today, I’m going to show you how to protect your privacy by stopping apps from reading the Android clipboard.

For context, Android’s copy and paste framework allows any application to read from or write to the device’s clipboard. Using this framework, many developers have made third-party clipboard managers available on the Play Store. While these applications, as well as a few others such as Google Translate, put the clipboard framework to good use, there’s absolutely no telling what other applications may be doing with your clipboard. Some apps that request the permission are transparent about what they do with your clipboard data, but you would be surprised by how many apps on your phone have the ability to read your clipboard! That’s exactly why so many password manager apps on Android recommend you use their own keyboard when entering passwords – they want to protect you from apps that might steal your password from your clipboard!

But no longer will you have to tip toe around what you can and can’t copy because we’ll be showing you how to control which apps can read your Android clipboard. This is not something you can do on your phone without a hidden command line option, but we will be guiding you through the process of how to do so. Once you’ve followed this tutorial, you should be able to safely copy whatever data you want without worrying that some rogue app might be logging every single thing you copy and paste.

Stop Android Apps from Reading your Clipboard Stop Android Apps from Reading the Clipboard

Stop Apps from Reading the Android Clipboard

  1. 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.
  2. 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.
  3. Then, open the Settings app on your phone and find the “About Phone” option – usually near the bottom.
  4. Scroll down and look for “Build Number.” Tap on this value 7 times to enable Developer Mode.
  5. Go back to the main menu in Settings and enter the new Developer Options menu.
  6. 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

    Stop Android Apps from Reading the Clipboard

    Example: apps that can read my clipboard

  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

    Example: Preventing Tasker from Reading your Clipboard

  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.


Explanation

Any 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.

However, there’s actually a hidden way of restricting the permission apps use to read your clipboard, and it’s what we just did above. We used the hidden “appops” command line interface, which lets us restrict more permissions than is shown in Settings. The first command we did, query-ops, pulls a list of applications installed that have been granted the Android clipboard read permission. Using that list, we can then decide which apps we want to stop from reading your clipboard. If you decide to restrict the permission from every user/third-party app installed on your device, then you can even start to safely copy and paste your passwords without having to worry that another app might listen in and steal your passwords!

See other great tutorials like this in our tutorials category. Stay up to date on the latest news with the XDA Labs application.

How to Stop Pokemon Go (or other apps) From Stealing Audio Focus

Despite dwindling in popularity, Pokemon Go still has a ton of fans playing the game every day. Although most of the game’s issues have been related to cheating, there are other, more minor ones that annoy existing users. One such issue is related to audio focus in Android. Users who like to listen to music or podcasts when playing Pokemon Go find that audio playback immediately halts when they launch the game. This requires users to manually restart playback on their favorite media app such as Google Play Music, Spotify, or PocketCasts. Today, I’m going to show you how to stop Pokemon Go (or any other app) from stealing permanent audio focus – without root.

What happens when Pokemon Go launches is that it requests audio focus from the system, meaning any existing media playback over the same volume stream will be ducked. The issue here is that Android’s audio focus relies on an honor system among applications. Android does not pick and choose which applications should be prioritized to hold focus, instead it relies on applications requesting and releasing focus as needed. Thus, because Pokemon Go requests audio focus when it launches, other applications can’t stop it from taking over the media volume.

Some applications such as Poweramp or Podcast Addict have experimental settings to hold on to audio focus to prevent other apps from stealing it away, but obviously many media applications out there do not. Some users have come up with their own way to retain audio focus through the use of Tasker profiles, which is something I likely would have tried if there wasn’t a better way – but thankfully there is. It involves the use of a hidden ADB command to access the command line interface for Android’s permission management system known as appops. With a single command, you can stop Pokemon Go (or any other app) from taking audio focus ever again!

The method we are using here is aimed at stock, unrooted users who are not running any sort of custom ROM. Custom ROM users, such as those on LineageOS, may have access to a more powerful permission control method that lets them bypass the need for this command.


Stop Pokemon Go from Taking Audio Focus – Tutorial

  1. Download then install USB drivers for your device – most likely only necessary if on Windows.
  2. Download the ADB binary for your OS and extract the file to any folder on your PC.
  3. On your phone, open Settings then find the “About Phone” option.
  4. Scroll down to find the “Build Number” value and tap on it 7 times, enabling Developer Mode.
  5. Back to the main menu in Settings, enter Developer Options.
  6. Enable USB Debugging Mode here, as shown below.
  7. Plug your phone into your PC and on your phone change the USB mode from “charge only” mode to “file transfer (MTP)” mode.
  8. Back to the PC, navigate to where you extracted the ADB binary.
  9. Open a Command Prompt in this ADB directory. On Windows, the easiest method to do this is to press Shift+Right-click. In the context menu, choose the “open command window here” option. Mac or Linux users, open a Terminal.
  10. Enter the following command: adb devices
  11. This will start the ADB daemon. If this is your first time running ADB, you will see a prompt 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 so, move on to the next step. If not, re-install your drivers.
  13. (Optional): if you want to restrict an app other than Pokemon Go from having audio focus, then install the App Inspector app and find the package listed under the app’s name.
  14. Send the following command: adb shell
  15. Then execute this command: cmd appops set <package> TAKE_AUDIO_FOCUS ignore

    Example: Command used for Pokemon Go

  16. As long as you don’t get an error message in the window, it should have worked. Congratulations! Now Pokemon Go won’t stop Google Play Music, Spotify, PocketCasts, or any other app from playing on top of it!

Explanation

As mentioned at the beginning, we are using the command line to interface with appops, which is Android’s user-facing system for handling app permissions. By default, there are only a handful of permissions that users can toggle by default through the Settings UI. Certain custom ROMs (such as LineageOS with its Privacy Guard) expose more permissions you can restrict, but for unrooted users the only way to handle these permissions is through the command line.

Anyways, the particular permission we are restricting is android.permission.TAKE_AUDIO_FOCUS which any application that requests it in their AndroidManifest.xml file is granted automatically upon installation. Thanks to the above appops command, we can take away this permission from Pokemon Go, meaning it can no longer request audio focus and thus can no longer stop other music or podcast apps on your phone from playing.

Although the tutorial above is aimed at Pokemon Go users, technically you can do the same thing for any other app also. Just modify the name of the package in step #15 with whatever other app you want. Just be careful you don’t go around restricting this permission all willy nilly, because Google intentionally hid this permission from being restricted so users wouldn’t mess things up.

See other great tutorials like this in our tutorials category. Stay up to date on the latest news with the XDA Labs application.

How to Disable Facebook Messenger Day Feature on Android

In Facebook’s never ending fight against Snapchat, the company launched a feature called the Facebook Messenger Day. But while Snapchat Stories feature was a way for you to show people what you did that day, Facebook Messenger Day’s filters and Active Now indicators are there to quickly find something to do or someone to talk to. The thing is, it’s turned into one of those features that gets pushed in your face. If you hate Facebook’s Day feature and wished it would stop asking you to “add to your day”, luckily there’s a way to disable Facebook Messenger Day. No longer will you be bothered by the Messenger Day Snapchat clone and its My Day feature as we’ll be disabling it entirely in the app.

While some users might find new Messenger features to be useful, others hate the features that are forced on them. Facebook My Day is one such hated feature, at least by some. Currently, Facebook Messenger Day can show up anywhere in your list of chats. Some find it sitting right at the top of the screen (even if they don’t care to use it), while others will find it tucked away between a couple of chats when they’re scrolling through them. Many wish that Facebook would just let the end user choose if they wanted to use the My Day feature or not instead of forcing it up on them.

There are two different ways to disable Facebook Messenger Day, with one requiring you to have root access and the other not requiring root access. The root method will actively disable the My Day feature inside your own existing Facebook Messenger application while the non-root method is possible thanks to a modded version of Facebook Messenger from someone in our own community.


Disable Facebook Messenger Day (Root Method)

  1. Download and launch the Terminal Emulator application
  2. Execute the following command into the prompt: su
  3. Then execute the following command into the prompt: am start -n "com.facebook.orca/com.facebook.messaging.internalprefs.MessengerInternalPreferenceActivity"
    terminal emulator
  4. Once you execute that second command it should launch a hidden settings page within Facebook Messenger
  5. Tap on the Gate Override option
    gatekeeper override
  6. Tap the Search Gatekeepers option
    search gatekeeper
  7. Search for the following text: internal
    internal
  8. Then set the messenger_internal_prefs_android option to YES
    internal prefs
  9. Tap the back button in your navigation bar
  10. Now look for and tap the MobileConfig option
    mobileconfig
  11. Search for the following text: wave2
    wave2
  12. Make the “wave2 montage enabled” option to false
    wave2 false
  13. Then tap the Restart Now option at the bottom to restart Messenger
    restart

Disable Facebook Messenger Day (Without Root)

As mentioned earlier, the previous method requires root but there is another method available to those who do not have root access. XDA Member evilwombat has created a modded version of the Facebook and Messenger applications. These modded versions reduce ads, cut out useless features, and more. In addition, this modded version also enables access to the Internal settings option without having to use a shell command.

Normally, that Internal settings menu requires root access in order to open it with the stock Messenger application as the internal settings menu is an unexported activity, but evilwombat has gone in and modded the Facebook Messenger application so that it is freely accessible right when you install their version. Since this modded version of Messenger can simply be sideloaded onto any supported Android smartphone or tablet, his means you can bypass the steps 1 through 9 of the guide above if you choose to use this modded application.

However, Facebook uses key-based authentication for data sharing between its family of applications. So in order to use this method that does not require root access, you will need to uninstall all other applications that are made by Facebook. This includes Facebook itself, Facebook Messenger, Facebook Messenger Lite, Page Manager, etc. Since evilwombat has to sign the modded APK with their own key, it causes conflicts with the other applications in the Facebook family.

So once you uninstall those applications and then sideload the modded application(s) from evilwombat, we can follow these steps below.

  1. Launch the Messenger app
  2. Dive into the Settings
  3. Tap on the Internal menu option
  4. Look for and tap the MobileConfig option
    mobileconfig
  5. Search for the following text: wave2
    wave2
  6. Change the wave2 montage enabled feature to false
    wave2 false
  7. Then tap the Restart Now option at the bottom to restart Facebook Messenger
    restart

So again, the steps to actually disable Facebook My Day from the modded version is the same as the root method. We just get to skip a lot of the tutorial since the Internal menu option in the settings of the Facebook Messenger application has already been enabled. All we’re doing is going in and toggling off this new feature from this hidden internal menu and that will prevent the Facebook My Day feature from clogging up your application.


Explanation

So what we’re doing here in this guide is surfacing a hidden menu from within the Facebook Messenger application. We can do this with a terminal emulator that has root access or with a modded APK that has the menu exposed to the user. In the hidden menu, we can start to toggle a couple of options not normally available to most users.

To actually disable Facebook Messenger Day, we need to look for and tap on the MobileConfig option from within the Facebook Messenger internal settings section. Once you go there, you’ll be able to search for something so just type in wave2 and you’ll see the wave2 montage feature that we need to change. There will be a Value section on this page that by default is set to True but we just need to tap the False option (was right above True for me).

When you change this from True to False, you should see a message appear at the bottom of the page saying your override has been set and tells you to restart the application for your changes to take effect. Go ahead and tap the Restart Now blue text and Facebook Messenger will close and then open again. This method was discovered thanks to /u/jagotu in the /r/Android thread they created about it.