Enable ADB Wifi Access (OnePlus only) 1.0

Enable ADB Wifi without necessity of enabling it with adb command from the computer.

Tags:
  1. autormali
    Normally every time you reboot your device you need to give ADB Wifi Permission via the adb command to have access to ADB Wifi. But if you have OnePlus device, there is no PC, Mac or other device, or hardware needed to give that permission. You can enable ADB Wifi Access directly from your device after each reboot.

    To successfully run the profile the requirements are:
    • "Wireless ADB debugging" setting/toggle avialable in Developer Options - see image. Only OnePlus devices (running Oxygen OS and Android 10 and above) have this option for now.
    • Write Secure Settings Permission granted to Tasker.


    How does it works? Simply, after rebooting your device AutoInput will take care about the rest.

    Taskernet link

    Profile description:
    Code (Text):
        Profile: ADB Wifi Access Enable (705)
        Priority: 50 Restore: no
        Event: Device Boot
        Enter: ADB Wifi Access Enable AI (3)

        <‼️ Set this variable to <b>no</b>  if you want to keep "Wireless ADB debugging" disabled, set it to anything to keep it enabled.<br>
        You should set it to <b>no</b> if in your setup you are using "ADB Wifi" actions with "Enable Debugging" option set to on>
        A1: Variable Set [ Name:%wifi_debugging_enabled To:yes Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]

        A2: Tasker Function [  Function:CheckADBWifi() ]

        A3: Flash [ Text:ADB Wifi Access already enabled Long:Off ] If [ %has_adb_wifi ~ true ]

        <⚠️ <b>Stop task</b> Sorry...ADB WiFi Access must do not be accessible before proceeding this task otherwise you mess up with AutoInput clicks sequence and task final result.<br>For testing purpose of this task without rebooting your device, go to Developer Options and disable both "USB debugging" and "Wireless ADB debugging" options then run this task.>
        A4: Stop [ With Error:Off Task: ] If [ %has_adb_wifi ~ true ]

        <Disable USB debugging.>
        A5: Custom Setting [ Type:Global Name:adb_enabled Value:0 Use Root:Off Read Setting To: ]

        A6: Status Bar [ Set:Collapsed ]

        <Open Developer Settings>
        A7: Developer Settings

        A8: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]

        <Scroll to debugging options>
        A9: Anchor

        A10: Variable Set [ Name:%search To:ADB\s|\sADB\s|\sADB Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]

        A11: AutoInput UI Query [ Configuration:App Package: com.android.settings Timeout (Seconds):20 ]

        A12: If [ %aitext(#?~R%search) eq 0 ]

        A13: AutoInput Action [ Configuration:Type: Text
        Value: %aitext(<)
        Action : Scroll Forward Timeout (Seconds):20 ]

        A14: Array Clear [ Variable Array:%aitext ]

        A15: Wait [ MS:250 Seconds:0 Minutes:0 Hours:0 Days:0 ]

        A16: Goto [ Type:Action Label Number:1 Label:Scroll to debugging options ]

        A17: End If

        A18: Wait [ MS:250 Seconds:0 Minutes:0 Hours:0 Days:0 ]

        <Enable Wireless ADB debugging>
        A19: AutoInput Action [ Configuration:Type: Id
        Value: android:id/switch_widget
        Nearby Text: ADB
        Action : Click Timeout (Seconds):25 ]

        <Enable USB debugging>
        A20: Custom Setting [ Type:Global Name:adb_enabled Value:1 Use Root:Off Read Setting To: ]

        A21: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]

        A22: If [ %wifi_debugging_enabled ~ no ]

        <Disable Wireless ADB debugging>
        A23: AutoInput Action [ Configuration:Type: Id
        Value: android:id/switch_widget
        Nearby Text: ADB
        Action : Click Timeout (Seconds):23 ]

        A24: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ]

        A25: End If

        A26: AutoInput Global Action [ Configuration:Action: Back Timeout (Seconds):20 ]

        A27: Tasker Function [  Function:CheckADBWifi() ]

        A28: Flash [ Text:ADB Wifi Access enabled Long:Off ] If [ %has_adb_wifi ~ true ]

        A29: Flash [ Text:Wireless ADB debugging enabled Long:Off ] If [ %wifi_debugging_enabled !~ no ]

        A30: Flash [ Text:Wireless ADB debugging disabled Long:Off ] If [ %wifi_debugging_enabled ~ no ]