BaronKiko / LauncherHijack

For Amazon Fire Tablets and TV's
GNU General Public License v3.0
351 stars 61 forks source link

4k Firestick Accessibility Commands Issue #52

Closed dashriprock007 closed 4 years ago

dashriprock007 commented 5 years ago

I have tried multiple times and installed 4.0.2/3 and the renamed ones

I can get them sideloaded no problem through adb but after I do the adb access commands I still get the error that they are not disabled...over and over again.

oathzed commented 5 years ago

Will do. Glad I can help you out!

HotdogWithMustard commented 5 years ago

I setup a Tasker profile to fix the issue with sleep mode causing the default launcher to activate. You can either import it and use as is in Tasker or export it to an APK via app factory and install it to your Fire Stick, here's the XML for the profile:

<TaskerData sr="" dvi="1" tv="5.8.3">
    <Profile sr="prof63" ve="2">
        <cdate>1565902310384</cdate>
        <edate>1565920564951</edate>
        <id>63</id>
        <mid0>60</mid0>
        <nme>Wake</nme>
        <Event sr="con0" ve="2">
            <code>208</code>
            <pri>0</pri>
        </Event>
    </Profile>
    <Project sr="proj0" ve="2">
        <cdate>1565898422917</cdate>
        <name>LauncherHelper</name>
        <pids>63</pids>
        <tids>60</tids>
        <Kid sr="Kid">
            <launchID>60</launchID>
            <pkg>com.tasker.launcherhelper</pkg>
            <vTarg>28</vTarg>
            <vnme>1.0</vnme>
            <vnum>23</vnum>
        </Kid>
        <Img sr="icon" ve="2">
            <nme>hl_aaa_ext_home</nme>
        </Img>
    </Project>
    <Task sr="task60">
        <cdate>1565897351966</cdate>
        <edate>1565920564951</edate>
        <id>60</id>
        <nme>Launch Launcher</nme>
        <pri>6</pri>
        <rty>1</rty>
        <Kid sr="Kid">
            <launchID>60</launchID>
            <pkg>com.tasker.atvapp</pkg>
            <vTarg>28</vTarg>
            <vnme>1.0</vnme>
        </Kid>
        <Action sr="act0" ve="7">
            <code>344</code>
            <se>false</se>
            <Int sr="arg0" val="9"/>
            <Str sr="arg1" ve="3">%Package</Str>
            <Str sr="arg2" ve="3">%version</Str>
        </Action>
        <Action sr="act1" ve="7">
            <code>20</code>
            <se>false</se>
            <App sr="arg0">
                <appClass></appClass>
                <appPkg>%Package</appPkg>
                <label>%Package</label>
            </App>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="1"/>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%version</lhs>
                    <op>12</op>
                    <rhs></rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act10" ve="7">
            <code>548</code>
            <Str sr="arg0" ve="3">Value must be a number between 1 and %packages(#)!</Str>
            <Int sr="arg1" val="1"/>
            <ConditionList sr="if">
                <bool0>Or</bool0>
                <Condition sr="c0" ve="3">
                    <lhs>%input</lhs>
                    <op>6</op>
                    <rhs>1</rhs>
                </Condition>
                <Condition sr="c1" ve="3">
                    <lhs>%input</lhs>
                    <op>7</op>
                    <rhs>%packages(#)</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act11" ve="7">
            <code>135</code>
            <Int sr="arg0" val="1"/>
            <Int sr="arg1" val="8"/>
            <Str sr="arg2" ve="3">A</Str>
            <ConditionList sr="if">
                <bool0>Or</bool0>
                <Condition sr="c0" ve="3">
                    <lhs>%input</lhs>
                    <op>6</op>
                    <rhs>1</rhs>
                </Condition>
                <Condition sr="c1" ve="3">
                    <lhs>%input</lhs>
                    <op>7</op>
                    <rhs>%packages(#)</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act12" ve="7">
            <code>547</code>
            <Str sr="arg0" ve="3">%Package</Str>
            <Str sr="arg1" ve="3">%packages(%input)</Str>
            <Int sr="arg2" val="0"/>
            <Int sr="arg3" val="0"/>
            <Int sr="arg4" val="0"/>
            <Int sr="arg5" val="3"/>
        </Action>
        <Action sr="act13" ve="7">
            <code>20</code>
            <se>false</se>
            <App sr="arg0">
                <appClass></appClass>
                <appPkg>%Package</appPkg>
                <label>%Package</label>
            </App>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="1"/>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%Package</lhs>
                    <op>12</op>
                    <rhs></rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act14" ve="7">
            <code>38</code>
        </Action>
        <Action sr="act2" ve="7">
            <code>37</code>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%version</lhs>
                    <op>13</op>
                    <rhs></rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act3" ve="7">
            <code>344</code>
            <se>false</se>
            <Int sr="arg0" val="11"/>
            <Str sr="arg1" ve="3"/>
            <Str sr="arg2" ve="3">%self</Str>
        </Action>
        <Action sr="act4" ve="7">
            <code>815</code>
            <Int sr="arg0" val="0"/>
            <Str sr="arg1" ve="3"/>
            <Str sr="arg2" ve="3">%packages</Str>
        </Action>
        <Action sr="act5" ve="7">
            <code>129</code>
            <se>false</se>
            <Str sr="arg0" ve="3">var text = "";

setLocal("packages", packages.filter(function(package)
{
    if ((!package.match(/amazon|hijack/i)) &amp;&amp; (package != self) &amp;&amp; (package.match(/launcher/i)))
    {
        text = text + (text.split("\n").length + ". " + package + "\n");
        return true;
    }

    return false;
}).toString());</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
        <Action sr="act6" ve="7">
            <code>590</code>
            <Str sr="arg0" ve="3">%packages</Str>
            <Str sr="arg1" ve="3">,</Str>
            <Int sr="arg2" val="0"/>
        </Action>
        <Action sr="act7" ve="7">
            <code>548</code>
            <Str sr="arg0" ve="3">You must install a launcher before you can continue.</Str>
            <Int sr="arg1" val="1"/>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%packages(#)</lhs>
                    <op>6</op>
                    <rhs>1</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act8" ve="7">
            <code>135</code>
            <Int sr="arg0" val="4"/>
            <Int sr="arg1" val="1"/>
            <Str sr="arg2" ve="3"/>
            <ConditionList sr="if">
                <Condition sr="c0" ve="3">
                    <lhs>%packages(#)</lhs>
                    <op>6</op>
                    <rhs>1</rhs>
                </Condition>
            </ConditionList>
        </Action>
        <Action sr="act9" ve="7">
            <code>360</code>
            <label>A</label>
            <Bundle sr="arg0">
                <Vals sr="val">
                    <net.dinglisch.android.tasker.RELEVANT_VARIABLES>&lt;StringArray sr=""&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;%input
Input
The text that was inserted in the dialog&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;&lt;/StringArray&gt;</net.dinglisch.android.tasker.RELEVANT_VARIABLES>
                    <net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>[Ljava.lang.String;</net.dinglisch.android.tasker.RELEVANT_VARIABLES-type>
                </Vals>
            </Bundle>
            <Str sr="arg1" ve="3">Select Launcher</Str>
            <Str sr="arg2" ve="3">%text</Str>
            <Str sr="arg3" ve="3">1</Str>
            <Int sr="arg4" val="120"/>
            <Str sr="arg5" ve="3">12290</Str>
            <Int sr="arg6" val="0"/>
            <Int sr="arg7" val="0"/>
        </Action>
    </Task>
</TaskerData>
oathzed commented 5 years ago

@hotdogwithmustard

If your in an app and the device goes to sleep and you wake the device up, will this stay inside the app? Or will it go to your new added launcher homescreen like ATV?

HotdogWithMustard commented 5 years ago

@oathzed

It will go back to the custom launcher. If that does happen the previous app will remain active in the background so you should be able to re-open it and resume from where you left off.

EDIT:

Actually, I did some more testing, looks like if it falls asleep normally it'll stay on whatever app it's on.

oathzed commented 5 years ago

@hotdogwithmustard

Can you do a test for me,

Go in an app you can back out of to home without pressing home. Now let it fall asleep, now wake it up and start pressing the back button inside the app, does it go back to the Amazon launcher?

Cheers!

HotdogWithMustard commented 5 years ago

@oathzed

I tested on Smart YouTube TV, spamming back took be back to ATV launcher.

HotdogWithMustard commented 5 years ago

@oathzed

I should of clarified a bit, pushing the power button to put it to sleep then waking it up will make it go back to ATV, but if you let it fall asleep on it's own it should stay on whatever app you're on. This isn't really a problem for me as like I said before the app is still active in the background and can be resumed by re-opening it.

HotdogWithMustard commented 5 years ago

You could probably use AutoInput UI Query with Tasker to get the active package. After that just store it in a global variable and have the screen on action check for that variable and launch the package if the variable exists.

oathzed commented 5 years ago

Any idea on how to enable it?

HotdogWithMustard commented 5 years ago

Tasker can write to secure settings if you grant it the permission via ADB:

https://tasker.joaoapps.com/userguide/en/help/ah_secure_setting_grant.html

oathzed commented 5 years ago

@hotdogwithmustard any ideas?

dashriprock007 commented 5 years ago

Hey guys this is all good info... BUT I fear it is really making my original reason for the thread very confusing....can we start a new thread regarding the advanced Tasker stuff past @oathzed great info on profiles ?

I feel this should be separate for more advanced testing

oathzed commented 5 years ago

@dashriprock007 no worries, I've made another issue.

dashriprock007 commented 5 years ago

@dashriprock007 no worries, I've made another issue.

And you can copy paste and delete here to clean it up.... So you had success on button mapper? Your work or other...

dashriprock007 commented 5 years ago

Where can others find it?

Also can you and @hotdogwithmustard delete and move to your new thread?

wilhela4 commented 5 years ago

Ok, here is a quick and dirty solution:

Edit: before doing this first uninstall LauncherHijack if you have it still installed.

First install the cloned LauncherHijack apk from here

Then install the apk inside this zip (don't pay attention to its UI if it shows, it's just a template, the important part is that when it opens it configures the accessibility variables as needed)

Then grant it the required permission by running: adb shell pm grant com.example.settest.settingstest android.permission.WRITE_SECURE_SETTINGS

Then open the application (SettingsTest), after you do that, LauncherHijack should open automatically. (if it doesn't and it still complains when you open it then something did not work as intended)

After you're done you can uninstall SettingsTest.

This worked for me, but had a weird artefact. Whenever I go into Youtube app or Netflex app subsequent to running these steps firestick behaves as if VoiceView is ON. I've tried turning On and off again, but consistently happening. Wondered if anybody else has had the same issue? Potential Bug?

oathzed commented 5 years ago

@wilhela4 I had this same problem because I was trying to do the original way and I think it messed things up so I restored my firetv to factory then followed this guide again and no voice view issue happened.

oathzed commented 5 years ago

@dashriprock007

  1. https://github.com/wilkovatch/LauncherHijack

  2. pm grant com.baronkiko.launcherhijack android.permission.WRITE_SECURE_SETTINGS

I don't know why people think Amazon is blocking package names. They're not, this works fine.

dashriprock007 commented 5 years ago

@dashriprock007

  1. https://github.com/wilkovatch/LauncherHijack
  2. pm grant com.baronkiko.launcherhijack android.permission.WRITE_SECURE_SETTINGS

I don't know why people think Amazon is blocking package names. They're not, this works fine.

huh?

oathzed commented 5 years ago

This is an answer to your open issue.

dashriprock007 commented 5 years ago

YOu have participated in this to know that many were having issues with the old way to do things so I am confused as to why youre saying this now?

oathzed commented 5 years ago

I know, but I'm just answering the issue. Since that guy forked it and added the proper changes so you no longer need a seperate app to activate the accessibility.

co5mo commented 5 years ago

@wilkovatch can i make your app work for setting this app service too? firetv is killing it

i know its a bit offtoppic but still

whole logcat here https://paste.kodi.tv/iceciravax.kodi

10-09 18:48:29.348 594 634 W ActivityManager: Unable to launch app com.urbandroid.lux/10167 for service Intent { act=com.urbandroid.lux.action_command_restart_on_low_memory cmp=com.urbandroid.lux/.TwilightService }: process is bad

dashriprock007 commented 5 years ago

@wilkovatch can i make your app work for setting this app service too? firetv is killing it

i know its a bit offtoppic but still

whole logcat here https://paste.kodi.tv/iceciravax.kodi

10-09 18:48:29.348 594 634 W ActivityManager: Unable to launch app com.urbandroid.lux/10167 for service Intent { act=com.urbandroid.lux.action_command_restart_on_low_memory cmp=com.urbandroid.lux/.TwilightService }: process is bad

Delete this....why are you posting this here....confusing as hell. Start your own thread so people can use this for help

dmulrooney commented 4 years ago

adb shell pm uninstall com.baronkiko.launcherhijack adb shell pm uninstall com.baronkiko.launcherhijack2 adb shell pm uninstall com.example.settest.settingstest

adb install app-debug.apk adb install LauncherHijackCloned.apk

adb shell pm grant com.example.settest.settingstest android.permission.WRITE_SECURE_SETTINGS adb shell am start -n com.example.settest.settingstest/com.example.settest.settingstest.MainActivity

adb shell settings put secure enabled_accessibility_services com.baronkiko.launcherhijack2/com.baronkiko.launcherhijack2.AccServ adb shell settings put secure accessibility_enabled 1

r3dlobst3r commented 4 years ago

adb shell pm uninstall com.baronkiko.launcherhijack adb shell pm uninstall com.baronkiko.launcherhijack2 adb shell pm uninstall com.example.settest.settingstest adb install app-debug.apk adb install LauncherHijackCloned.apk adb shell pm grant com.example.settest.settingstest android.permission.WRITE_SECURE_SETTINGS adb shell am start -n com.example.settest.settingstest/com.example.settest.settingstest.MainActivity adb shell settings put secure enabled_accessibility_services com.baronkiko.launcherhijack2/com.baronkiko.launcherhijack2.AccServ adb shell settings put secure accessibility_enabled 1

After following this, Launcher Hijack works. However now the fire tv is reading everything on screen out loud. @dmulrooney

sweenwolf commented 4 years ago

@r3dlobst3r uninstall Settings Test and other launcher hijack, then download this https://www.dropbox.com/s/gxqoj2ffzlopms2/LH4.0.3.apk?dl=01 Its a Modified launcher hijack with integrated Accessibility Settings, just Install the App and follow the on screen instructions, its specially for Firestick 4k

Simply install the app by adb install -g LH4.0.3.apk Then simply press DONE, you are all set This will grant Accessibility Settings and then you don't have to enter any commands even

r3dlobst3r commented 4 years ago

Thanks for the reply @sweenwolf , I am still getting a prompt that accessibility services are disabled with the apk you attached. I installed my launcher first with adb, then I used adb -g to install the modified LH apk.

sweenwolf commented 4 years ago

Thanks for the reply @sweenwolf , I am still getting a prompt that accessibility services are disabled with the apk you attached. I installed my launcher first with adb, then I used adb -g to install the modified LH apk.

Can you attach a screenshot?

BTW You have to press "Done" to save the settings

@r3dlobst3r you tried?

dashriprock007 commented 4 years ago

How are people still commenting and polluting my thread after I closed it?

MPenSol commented 4 years ago

I’m sorry to open the thread, today I’m done the steps to install the own launcher but it don’t work’s. It seems Amazon has change something since the OS Version 6.2.7.3. Have anyone a new solution?