Autowear: more easily activate WRITE_SECURE_SETTINGS without pc

Discussion in 'App/Feature Suggestion' started by Humpie, Oct 13, 2019.

  1. Humpie

    Humpie New Member

    Joined:
    Apr 7, 2015
    Messages:
    7
    Likes Received:
    1
    Hi there!
    While writing a small app, Permanent Proxy, for Wear Os to enable Google Pay support in any country I found out I needed WRITE_SECURE_SETTINGS permission to be able to achieve this. I knew I would be able to activate it with ADB, like you do for Autowear (and Autotools I believe), but debugging a watch is more cumbersome than debugging a phone for most people. So I remembered my Tasker Adb shell Plugin, that allows the user to send adb shell commands over the network (or to localhost) and that you could thus grant the permission that way.
    On the watch, the user can simply turn on adb over Bluetooth or wifi from the developer options and then the adb shell will be available at localhost:7272 or localhost:5555 respectively!
    This will, on wear OS, even survive a reboot! So in theory even more powerful shell commands could be executed in automated manner from the watch than from a phone :).
    It might be an interesting option for you to ease the Autowear secure settings setup process and maybe allow for even more powerful commands.
    Both permanent proxy and the adb shell plugin can be found on my GitHub:
    https://github.com/Jolanrensen/PermanentProxy-for-WearOS
    https://github.com/Jolanrensen/ADBPlugin
    So feel free to have a look if you like.
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    8,876
    Likes Received:
    747
    Hi there! Thank you very much for the info :) That's very cool! I have a question though, are you able to run the WRITE_SECURE_SETTINGS command for Tasker itself (on the phone) using the Wifi ADB technique too?
     
  3. Humpie

    Humpie New Member

    Joined:
    Apr 7, 2015
    Messages:
    7
    Likes Received:
    1
    Yes you can! You can run any ADB command from/to the device itself, as long as ADB over WiFi is enabled. Many of my ADBPlugin users use it to call "input keyevent POWER" to localhost:5555 to simulate a power press, which works cleaner than using a Device Admin. But yeah, just can just as easily execute a "pm grant" command :). However, the user must then have ADB over WiFi enabled on their device. This can (as far as I know) only be turned on via a USB connection (either from a PC or from another Android device, using an app like Bugjaeger) and it will turn off at a reboot. Only some devices, like Wear OS- or Android TV devices have the option to turn on ADB over WiFi/Bluetooth from the Developer options...
     

Share This Page