BradyBrenot / huestacean

Philips Hue control app for desktop with screen syncing. C++ with Qt Quick GUI.
http://huestacean.com
Apache License 2.0
566 stars 54 forks source link

Android - Handle non touch based input #63

Closed dtanquary closed 5 years ago

dtanquary commented 6 years ago

It would be great to be able to try this out on an android device hooked up to my TV such as a fire TV or Android TV. I was able to install the latest build on my fire tv and open it, but I am not able to navigate or select anything using the firetv remote.

BradyBrenot commented 6 years ago

I'm not sure if Qt has any sort of built-in handling of Android TV. If it does it probably works like keyboard nav, which is apparently broken right now (not setting a default focus; works if you click a control).

Investigating in an emulator.

BradyBrenot commented 6 years ago

Emulator's running, confirmed it's hosed. Trying to figure out what I can do with it.

Collisionc commented 6 years ago

I'll try installing it to my shield tv and see if anything is different, it's probably broken there as well but it's worth a shot.

BradyBrenot commented 6 years ago

Give the new release a shot. I've tested keyboard navigation out in two Android TV AVDs (Android 5 and Android 7) and it seems to work now. Arrow keys should also work on PC.

dtanquary commented 6 years ago

Just tested the new build on the fire tv. The arrow navigation is now working but I am not able to select anything.

BradyBrenot commented 6 years ago

Sigh, you'd think I would have tried that but nope. It's a little hard given that I can't seem to even get the emulator talking with my bridge.

Going to see if I can figure out what key Qt thinks that center button is, and then see if I can get it to act like Spacebar on the PC... somehow...

dtanquary commented 6 years ago

If it helps I am pretty sure the center button is the same thing as pressing "A" (KEYCODE_BUTTON_A) on any connected controller: https://developer.amazon.com/docs/fire-tv/remote-input.html#capturing-input

BradyBrenot commented 6 years ago

It's "Enter" in the AVD (as far as Qt sees it). Will see...

BradyBrenot commented 6 years ago

k @dtanquary I've added a new release with this "force the enter key to fire a spacebar event" hack. It definitely works in the AVD now, which is how Amazon recommends testing it, so it really ought to work.

BradyBrenot commented 6 years ago

rather, added a new APK to the existing release. Called it huestacean_v2.0-alpha.3.1_android.apk

Collisionc commented 6 years ago

Shield TV works fine with it, although the UI doesn't scale very well as there doesn't seem to be a way to scroll down the app screen to see "Center Slowness" and "Side Slowness".
mvimg_20180325_023807_exported_8670243072523810912

Unrelated to this issue, but I do have to sideload the .apk to get it to work, and even when sideloaded it doesn't show up as an app anywhere, I have to go into settings --> apps ---> app details and select hustacean, and then open it there -- where it doesn't save anything from the previous session, so I have to relink the bridge.

As far as DRM protected stuff goes, youtube/espn are working fine with huestacean. The "Frame read" time on the program randomly jumps to 500 ms for a couple of frames then dips down to 50 ms every 5-6 seconds.

BradyBrenot commented 6 years ago

Frame time jumping around is probably OK, Android doesn't actually seem to send frames unless something's changing on the screen.

BradyBrenot commented 6 years ago

And as far as playing Netflix goes, rooting + installing Xposed + installing the DisableSecureFlag extension seems to be the only way (I'm playing a video on Netflix right now on my phone and it's working). I can't recommend Xposed to users generally given how potentially dangerous it is but eh it exists.

dtanquary commented 6 years ago

@BradyBrenot I just tested out the latest build on the fire tv. I was able to navigate and select things for the most part but there are still 1 or 2 buttons that seem impossible to navigate to. I will try to make a little video of me navigating around and put it on youtube for you to see where I am getting stuck.

The firetv also seems to be killing the background process off nearly immediately after I navigate away from the app but that's a separate issue and I will see if there is anything I can tweak on the fire tv to control that. I may end up having to root to get the optimal experience but that would be worth it imo.

Collisionc commented 6 years ago

It might be a matter of processing power difference between the shield and fire tv. The fire tv is likely suspending everything that's in the background to reserve processing time for the foreground. Shield on the other hand has the capability of hosting a plex server + smartthings hub while playing media.

You'd definitely be able to get around it via rooting the five tv, but it might not be the best experience if processing power is the issue.

BradyBrenot commented 6 years ago

Setting the app up to act as a Foreground Service might help, see

https://developer.amazon.com/docs/fire-tv/faq-general.html https://developer.android.com/reference/android/app/Service.html

BradyBrenot commented 6 years ago

Which means reworking a good chunk of this thing to separate the GUI from the rest, which is... probably a good idea for all sorts of reasons, but a huge pain in the neck.

mrmidnight273 commented 6 years ago

Installed on my Sony X900E. App starts and I can select stuff. Only issue I have is the syncing doesn't stick when I switch from the app to anything else (including Android TV home screen)

Disregard this error report. I was attempting to sync with an HDMI input, obviously this won't work.

BradyBrenot commented 6 years ago

Split the foreground service thing off to #68 / #69

mrmidnight273 commented 6 years ago

2.3 release won't allow me to click the link button. I can't even select it. Sony X900E

Collisionc commented 6 years ago

Yeah, looks like this:

image

Added issue here https://github.com/BradyBrenot/huestacean/issues/76

BradyBrenot commented 5 years ago

Folded into #126