BaronKiko / LauncherHijack

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

Add support for Fire TV Devices please #16

Closed Speeddymon closed 5 years ago

Speeddymon commented 6 years ago

Hi, this app works on the Fire Stick, but on FireTV 3 and Fire TV Cube, it doesn't work.

I know currently these devices are not supported so I am making this a feature request to add support.

I am aware that the same exploit may no longer be possible so it might take time to find a new exploit. I'm willing to donate a test device if that will help at all.

Please advise if you can consider this or not.

BaronKiko commented 6 years ago

Been a while since I have touched to project. Assuming you can get the name of the launcher to override it should be possible to to swap it out. In short somewhere in the code it specifies the fire launchers package and when that opens it loads the custom launcher. I assume the launcher has a different name on those devices. If you can find that name, through ADB and a bit of common sense, then you can swap it out in this app and it should work. There might be more too it as I don't own any of the devices so I am speculating. If you are having trouble swapping out the name I can help with that but it's basically just find and replace, I think it's in a couple place/files.

Speeddymon commented 6 years ago

I'll see about looking into it soon.

Speeddymon commented 6 years ago

Looks like com.amazon.tv.launcher is the process name

Speeddymon commented 6 years ago

It may be part of either or both of these files:

/system/priv-app/com.amazon.tv.launcher/com.amazon.tv.launcher.apk /system/priv-app/FireTVSystemUI/FireTVSystemUI.apk

BaronKiko commented 6 years ago

Great, so you should be able to build the project by grabbing Android studio, downloading and opening up this repository, plugging a device in and hitting run. You will probably have to enable developer mode on the device. I'm sure google can help you there as I have never owned a fire TV. Once you have made a build with the clean code you should just be able to change com.amazon.launcher in accserv.java to the package mentioned above. I am pretty certain it's only mentioned there however it's deffinatly worth doing a search of the whole project incase I forgot about a reference. Let me know if you have any trouble.

BaronKiko commented 6 years ago

Oh and remember to enable the accessibility setting after every build as it gets reset every time.

Speeddymon commented 6 years ago

Yep, changes made in a fork, and just finished downloading Android Studio.

If you could, I'd like a suggestion on how to have support for both FireOS5 and FireOS8 (see my comments in #19 )

BaronKiko commented 6 years ago

Presumably you have tested your branch? Unfortunately I can't approve you pull request as it would break fire OS 5 support, which as I am aware is on all devices bar the fire tv. As for having both you could probably add a toggle option to the menu in the top right of the app, With that option you can then change that string to the desired launcher but you would need to store it in a config file similar to how the user selected launcher is stored. Do you do much programming? It's really too long to explain beyond that and without some programming experience you would probably struggle.

Speeddymon commented 6 years ago

I'm working on building it right now.

I didn't expect to have it approved as-is. :-)

I am more experienced with perl and javascript than I am with pure java, but I will be looking into android books eventually. :-)

BaronKiko commented 6 years ago

Ok well generally with pull requests, regardless of the repo, you should fully test your code before making any pull requests. You only need to do the pull request when you actually want to put it up onto the main branch. Android dev is really strange, that being said it's always good to see people interested in learning programming (or anything for that matter). If you are sure you want to give it a go I would suggest you get a tablet or other device that uses fire OS 5 so you can make sure you aren't breaking anything with your changes. I am happy to test on my device if really needed. and I will need to for a pull request, but I can't test the fire tv side at all so I would just have to take your word for it.

Speeddymon commented 6 years ago

I have 3 TV devices (a stick running FireOS5, a pendant aka FireTV3 running FireOS7, and a cube running FireOS8)

I'll be happy to test on all three and report back.

On Thu, Jul 19, 2018, 7:12 PM BaronKiko notifications@github.com wrote:

Ok well generally with pull requests, regardless of the repo, you should fully test your code before making any pull requests. You only need to do the pull request when you actually want to put it up onto the main branch. Android dev is really strange, that being said it's always good to see people interested in learning programming (or anything for that matter). If you are sure you want to give it a go I would suggest you get a tablet or other device that uses fire OS 5 so you can make sure you aren't breaking anything with your changes. I am happy to test on my device if really needed. and I will need to for a pull request, but I can't test the fire tv side at all so I would just have to take your word for it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406450981, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWOIK-LTG5ti9xWhW8BgeXvG8aO1bks5uISBrgaJpZM4VI08J .

BaronKiko commented 6 years ago

You sure do like those fire tv's :P Does the current version work on any of them? If not then the OS version clearly doesn't really matter and it's all about the device type. Just looking at the package name I imagine all the fire tv's use the same launcher and all the tablets use the same launcher. I might be easier to just make an option to select any package to override. That would pretty conclusively cover any device/update Amazon could release and presumably any other device that locks your choice of launcher, not that I know of any.

Speeddymon commented 6 years ago

Yes it works on the stick but the launcher name is definitely different on FireOS8.

On Thu, Jul 19, 2018, 7:54 PM BaronKiko notifications@github.com wrote:

You sure do like those fire tv's :P Does the current version work on any of them? If not then the OS version clearly doesn't really matter and it's all about the device type. Just looking at the package name I imagine all the fire tv's use the same launcher and all the tablets use the same launcher. I might be easier to just make an option to select any package to override. That would pretty conclusively cover any device/update Amazon could release and presumably any other device that locks your choice of launcher, not that I know of any.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406456891, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWA9VE_uF6u91mIRnNKmwkEhi8kPTks5uISowgaJpZM4VI08J .

BaronKiko commented 6 years ago

I meant does the currect public version work on any fire TV? IE without any modifications by you. Does really seem like a general solution is needed.

Speeddymon commented 6 years ago

It's working on the stick.

On Thu, Jul 19, 2018, 8:00 PM BaronKiko notifications@github.com wrote:

I meant does the currect public version work on any fire TV? IE without any modifications by you. Does really seem like a general solution is needed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406457738, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWHaRizUGMEz9LR89Bd4PNLz7bem3ks5uISuzgaJpZM4VI08J .

BaronKiko commented 6 years ago

Ok great, you can use that to test you didn't break anything. Good luck on the update.

Speeddymon commented 6 years ago

After building the package without changes and testing it on the stick, I can confirm it works fine there.

Unfortunately, the app crashes even with the stock launcher name changed, on the cube.

I found that I was able to get it to not crash when I change the gradle properties to compile for sdk version 25 instead of 22.

So, both changes are required to get it working on the stick.

Now I just have to figure out how to modify the menu. :-)

BaronKiko commented 6 years ago

Hmm that's a pretty bad change as the SDK needs to be on 22 for compatibility with most, in not all, fire tablets. While it's a pain in terms of maintanence it may be best to just make 2 seperate versions of the app. I am hesitant to do that as any changes would need to be merged between the two branches but it would mean you don't have to mess with the menu and you there is no concern about API versions. There isn't many updates so it's not totally unreasonable. That being said I don't really see why it can't run on API 22. It's a min version, so getting it to work on API 22 is the ideal solution.

Speeddymon commented 6 years ago

I'll see if I can't find a way to logcat the device when the unmodified app crashes

On Fri, Jul 20, 2018, 1:18 AM BaronKiko notifications@github.com wrote:

Hmm that's a pretty bad change as the SDK needs to be on 22 for compatibility with most, in not all, fire tablets. While it's a pain in terms of maintanence it may be best to just make 2 seperate versions of the app. I am hesitant to do that as any changes would need to be merged between the two branches but it would mean you don't have to mess with the menu and you there is no concern about API versions. There isn't many updates so it's not totally unreasonable. That being said I don't really see why it can't run on API 22. It's a min version, so getting it to work on API 22 is the ideal solution.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406500270, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWCTTw0Rgx8Is-X4vXbF0nPVN30CUks5uIXY6gaJpZM4VI08J .

BaronKiko commented 6 years ago

You should just be able to attach the Android studio debugger to get the info but logcat through ADB will work. Just remember to enable USB debugging in the developer options of the device. Looking into it deeper it looks like minsdk and target are seperate parameters so setting it to 25 may not break it. I would suggest you try it with the change on your stick. Anyway I'm off to bed so I will read any updates you leave once I am up. Best of luck. I would really like to see you crack it as fire TV support has been asked for a number of times so it would be good to appease those that want it. Shame I never had the devices to do it myself.

Speeddymon commented 6 years ago

I am not sure what I did to get it working as I worked on it literally all night last night, and once I got it working, I stupidly deleted the project files, so all I have as of right now is an APK that works on both FireOS versions available on the FireTV.

Since the launcher name changed between the two FireOS versions, but it is working for certain on both right now, I'm curious if the app works on your Fire tablet.

Would you be willing to give it a shot?

https://drive.google.com/drive/folders/1MuArigXBKtLXdb8w_Z-hMvPXmUDCSO-g?usp=sharing

Edit: I will play with it some more next weekend to see if I can't build another working one so I can make a proper fork

Speeddymon commented 6 years ago

Something really weird I just discovered is that even though this app works just fine on the stick, the stick uses the same launcher name as the cube (com.amazon.tv.launcher, rather than com.amazon.firelauncher)

I'm really curious now whether it was the SDK version or the launcher name change that actually got the apk I have working right now, working.

BaronKiko commented 6 years ago

It doesn't surprise me that they share a package name. One is just updated for the newer OS. Unfortunately if you change the package name it will break it for the tablet side of things. I will have a look into it a bit after some dinner. I have a theory that if it holds true should resolve the whole thing but I will refrain from saying more until I have tested it as I am speculating.

BaronKiko commented 6 years ago

Seems I thought it was a little more complex than I was. Give this build a go: LauncherHijackV31.apk.zip There is a new branch with my changes but the stuff that's relevant is up to 295a6cf15b9548a6c810614821ae95e93a6aa05b It was so simple that I probably got something wrong but as I went to the effort of setting up my ide again I did some other housekeeping, updating versions and adding an highlight showing the current chosen launcher.

Regardless hopefully that works out on all your devices. Assuming you test it and it works then I will work on publishing it more officially. I have tested it on my device and it works well.

Speeddymon commented 6 years ago

I'll be testing it shortly! Thanks!

On Sat, Jul 21, 2018, 10:05 PM BaronKiko notifications@github.com wrote:

Seems I thought it was a little more complex than I was. Give this build a go: LauncherHijackV31.apk.zip https://github.com/BaronKiko/LauncherHijack/files/2216683/LauncherHijackV31.apk.zip There is a new branch with my changes but the stuff that's relevant is up to 295a6cf https://github.com/BaronKiko/LauncherHijack/commit/295a6cf15b9548a6c810614821ae95e93a6aa05b It was so simple that I probably got something wrong but as I went to the effort of setting up my ide again I did some other housekeeping, updating versions and adding an highlight showing the current chosen launcher.

Regardless hopefully that works out on all your devices. Assuming you test it and it works then I will work on publishing it more officially. I have tested it on my device and it works well.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406837654, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWN7MLMmLqjk9y6S0uAroC_cmMZf4ks5uI-vdgaJpZM4VI08J .

Speeddymon commented 6 years ago

Still crashes, so I started watching logcat and hit up google.

20

BaronKiko commented 6 years ago

Ok, I have some concerns just reading through the pull request but I will have to test it to understand what your changes do. Little bit busy at present so I will have a look later when I get a chance. Have you fully tested it on your devices? With multiple launchers and ensuring settings persist after a reboot.

Speeddymon commented 6 years ago

Everything except for the reboot. I'll test that tonight for you.

On Jul 22, 2018 1:37 PM, "BaronKiko" notifications@github.com wrote:

Ok, I have some concerns just reading through the pull request but I will have to test it to understand what your changes do. Little bit busy at present so I will have a look later when I get a chance. Have you fully tested it on your devices? With multiple launchers and ensuring settings persist after a reboot.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-406887424, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWLRFov-2m-j-JRVxH765uZf6wyE0ks5uJMZ0gaJpZM4VI08J .

BaronKiko commented 6 years ago

Ok, I doubt it will happen but I defiantly had that bug at one point. Cheers for your work.

Speeddymon commented 6 years ago

Yeah, looking at the pull request myself, it looks like its a lot scarier than it is. The real changes are a small subset of the total of the 3 commits. With those first 2 commits, I had gotten it working and thought it was good, then found it was broken on the opposite device that I had been trying to fix! lol

Speeddymon commented 6 years ago

No issues during tonight's testing. All told, it went really, really well!

Rebooted both devices, installed a couple of other Android TV Launchers, and configured LHJ to use each one, and they all came up with the home button. :-)

BaronKiko commented 6 years ago

Replied to your pull request with some concerns, we should move discussions over there.

Speeddymon commented 6 years ago

Agreed

On Mon, Jul 23, 2018, 6:30 PM BaronKiko notifications@github.com wrote:

Replied to your pull request with some concerns, we should move discussions over there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BaronKiko/LauncherHijack/issues/16#issuecomment-407232458, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVNWHYPhIz-cbJqevgAGIRN49hFHfWLks5uJlyRgaJpZM4VI08J .

BaronKiko commented 5 years ago

As detailed in this pullrequest this issues has now been resolved with update 4.0.2