[Android Software/Hacking General [Developers Only]] chrismin13:
Hello everyone,

This is a work in progress thread meant to gather info about how to add hotword detection support while the screen is off and the processor is in deep sleep. Ideally, this will work just like the Pixel devices by Google, so you'll be able to get to the assistant by saying "Ok Google" without turning on your device.

Let's start off with the first big question: Is the hardware that's required to do this in our devices?

Well, not every device. I have only looked into Qualcomm SoCs, but this is also possible with some Exynos processors through S Voice.

Qualcomm first added support for Hotword detection with the Snapdragon 800. The only device prior to that processor that had support for Hotwords was the first gen Moto X, which had its own Custom chip separate from the processor. However, my research indicates that all devices after the Snapdragon 800's launch use the processor's DSP for this job.

You can view the announcement of this feature for the Snapdragon 800 at this link:

https://www.qualcomm.com/news/onq/2...akes-mobile-world-snapdragon-voice-activation

In the blog post, the feature is mentioned as Qualcomm Voice Activation. I also found out that this was eventually also backported to the Snapdragon 600. However, looking elsewhere online reveals that this has other names as well, as it is part of Qualcomm Fluent PRO and All-Ways Aware. There are marketing videos for both online, and they all work with the Hey Snapdragon hotword. However, it seems that all of these features are part of the Hexagon DSP on the actual SoC and that they are compatible with v5 and up. So that means that technically all processors in the 600, 700 (in the future) and 800 line should be able to do this.

As far as I'm aware, the only device that uses the Hey Snapdragon wakeup command is the OnePlus One, which has a Snapdragon 801. On its default firmware, CyanogenMod 11S, you could go into the device's settings and train the device by saying Hey Snapdragon three times. Then, you could select the activity that would run every time you said it.

Someone on XDA updated this feature for newer firmware versions and looking at the flashable zip files it has one application file, a modified mediaserver, a modified audio library for its processor and some lib files for voice detection. I haven't attempted to Port this feature for any other device, but I doubt that it would work, even on devices with the same SoC.

I have also looked at Qualcomm's forums and found this thread which has a reply with links that could probably help us out here:

https://developer.qualcomm.com/foru...timedia-optimization-hexagon-sdk/speech/28153

This is source code from the Google Pixel and AOSP which might be the solution to making this work. I am not familiar with C and AOSP's code, so if someone with more experience could check this out, that would be great!

Lastly, I want to mention that I have a couple of devices that could help with testing including my daily driver Xiaomi Mi 5 (Snapdragon 820), a now retired LG G2 (Snapdragon 800) and a Galaxy S7 Exynos which should be able to use S Voice for this but I have not tested it yet. My friend [MENTION=8129321]David_#27[/MENTION] also has a Redmi Note 4X (Snapdragon 625) and I could probably also borrow a Redmi 4X (Snapdragon 435) if we ever need it for testing.

Hopefully we can get some more info on this topic from people that have looked into this more than I have. Please reply to this topic with any info you may have, any help is very much appreciated! Making this work eventually on our devices would be incredible!

Thank you :D