[MOD][Xposed] Google Search / Now API

Search This thread

avenant

Senior Member
Mar 24, 2014
62
10
Just wondering...

For updating the app to have current hooks from latest google updates, If it breaks with the 3 dots option in the app.

How does this work? One uses this source code: https://github.com/MohammadAG/Google-Search-API ?

How do you update the hooks? Some tutorial would be useful. So more people can update this app. There are lots of people out there who could update this app, if they knew how to.

Also with more and more phones having 64 bit android nowadays, is it possible to compile the above code in 64 bit?
 

iHelp101

Senior Member
Feb 7, 2014
1,512
4,036
Here is an updated version of the module. You will need to open the module -> Three Dot Icon -> Update Hooks. You will also notice a Change Hooks option. This will allow you to update the hooks yourself. The module has one hook. The hooks class can be found by search for "setFinal", which will point to the needed class. In Linux you can use grep -Ril 'setFinal' to find the hook. I am not sure how you would do this in Windows.

The current hook is "com.google.android.apps.gsa.search.shared.service.w". When it break it usually goes up one letter So the next time it breaks it will likely be "com.google.android.apps.gsa.search.shared.service.x". My version of the module has always been open source (Linked below). It uses Android Studio and yes it will work with ARM, ARM64, and x86.

https://github.com/iHelp101/Google-Search-API
 

Attachments

  • GoogleSearchAPI.apk
    357.6 KB · Views: 503

zbombattack

Member
Jun 9, 2016
21
1
Getting Current Hooks

Could you go a little more in-depth as to how to find the hook for the version of the Google app you have and how you would apply it? Do you input the new hook in the change hooks dialogue and then reboot? Do you have to update the hooks as well before rebooting? Thanks for all your hard work on this great extension to my device.
 

zbombattack

Member
Jun 9, 2016
21
1
Current Hooks

So i found out a way to get the hooks for each google search package. I used apktool to extract the google search app and then ran
Code:
ls searchbox_6.6.14/smali/com/google/android/apps/gsa/search/shared/service
the smali files that have $ in them will have the last part of the hook in the front. For instance, the output for this is
Code:
a            ab$8.smali                        m.smali
aa.smali     ab$9.smali                        n.smali
ab$10.smali  ab.smali                          OnTranscriptionUpdateEventParcelable.smali
ab$11.smali  af.smali                          o.smali
ab$12.smali  ag.smali                          p.smali
ab$13.smali  ah.smali                          q.smali
ab$14.smali  a.smali                           r.smali
ab$15.smali  b.smali                           SearchServiceClient.smali
ab$16.smali  ClientConfig$1.smali              SearchServiceMessenger.smali
ab$17.smali  ClientConfig.smali                ServiceEventCallback.smali
ab$18.smali  ClientConfig$SuggestConfig.smali  ServiceEventData$1.smali
ab$19.smali  ClientEventData$1.smali           ServiceEventData$2.smali
ab$1.smali   ClientEventData$2.smali           ServiceEventData.smali
ab$20.smali  ClientEventData.smali             ShowVoiceActionsEventParcelable.smali
ab$21.smali  c.smali                           StartActivityParcelable.smali
ab$2.smali   d.smali                           w.smali
ab$3.smali   g.smali                           x.smali
ab$4.smali   h.smali                           y.smali
ab$5.smali   i.smali                           z.smali
ab$6.smali   k.smali
ab$7.smali   l.smali
so the last part of the hook would be 'ab', making the full hook for google search 6.6 'com.google.android.apps.gsa.search.shared.service.ab'. Using this I found out that the hook for search 6.5 is 'com.google.android.apps.gsa.search.shared.service.y'. Just input that into the change hooks dialogue, reboot, and you should be good. For some reason xda is putting a space before the last part of the hook but you shouldn't.
Could you go a little more in-depth as to how to find the hook for the version of the Google app you have and how you would apply it? Do you input the new hook in the change hooks dialogue and then reboot? Do you have to update the hooks as well before rebooting? Thanks for all your hard work on this great extension to my device.
 

etc6849

Senior Member
Mar 12, 2010
98
19
It quit working again for me. Anyone have any suggestions?

Here is an updated version of the module. You will need to open the module -> Three Dot Icon -> Update Hooks. You will also notice a Change Hooks option. This will allow you to update the hooks yourself. The module has one hook. The hooks class can be found by search for "setFinal", which will point to the needed class. In Linux you can use grep -Ril 'setFinal' to find the hook. I am not sure how you would do this in Windows.

The current hook is "com.google.android.apps.gsa.search.shared.service.w". When it break it usually goes up one letter So the next time it breaks it will likely be "com.google.android.apps.gsa.search.shared.service.x". My version of the module has always been open source (Linked below). It uses Android Studio and yes it will work with ARM, ARM64, and x86.

https://github.com/iHelp101/Google-Search-API
 

etc6849

Senior Member
Mar 12, 2010
98
19
I pasted
Code:
com.google.android.apps.gsa.search.shared.service.y
to manually update my hook and it works now. Not sure what i did wrong before. Might have had the space from the other post or pasted the single quotes lol.

I really appreaciate what you do to help the xda community and thank you for your quick response. Sorry I took so long, been really busy.

PM me your Xposed log and I will post the required hooked change.
 

Gamersware

Member
Oct 28, 2014
7
0
voice recogniton

Do someone know how to activate "Google Now" on a TVbox, I have tried with bluetooth-headset and a Airmouse with build-in Mic ( connects with USB-Dongle) and a driverless USBcam with MIC (witch workes by the Telegramm App)
But the TV-Box ( mini m8s 5.01 rooted) gives me after to try -OK Google- a "the Mic is not started" out.
 

zbombattack

Member
Jun 9, 2016
21
1
New Hooks for v6.9 (ends in y)

Here are the hooks for the current Google app versions:
v6.5
Code:
com.google.android.apps.gsa.search.shared.service.y
v6.6-6.8
Code:
com.google.android.apps.gsa.search.shared.service.ab
v6.9
Code:
com.google.android.apps.gsa.search.shared.service.y
 

fedexist

Senior Member
Nov 15, 2011
150
16
Genoa
I decompiled the latest google app apk (6.11.13.21.arm64), but I didn't find the .smali files with '$' symbol in the path above. Any clue about the new hooks?
 
Last edited:

pablo71

Senior Member
Apr 19, 2008
475
171
Android Wear 2.0 Question

does anyone have autovoice working through their Wear 2.0 watch? I was reading that voice transcription on 2.0 is faster because it 'bypasses the phone entirely' and this has me thinking I won't be upgrading to Wear 2.0 ... ( I got about 20 autovoice tasker tasks I need for work, so reverting my work-watch back into a gadget-in-search-of-a-use isn't an option)

if wear 2.0 isn't compatible I post this adb command that can be used to disable Wear OS update checks (it works on my huawei watch) :

su -c pm disable com.google.android.gms/.update.SystemUpdateService; su -c pm disable com.google.android.gms/.update.SystemUpdateService$ActiveReceiver; su -c pm disable com.google.android.gms/.update.SystemUpdateService$Receiver; su -c pm disable com.google.android.gms/.update.SystemUpdateService$SecretCodeReceiver; su -c pm disable com.google.android.gsf/.update.SystemUpdateActivity; su -c pm disable com.google.android.gsf/.update.SystemUpdatePanoActivity; su -c pm disable com.google.android.gsf/.update.SystemUpdateService; su -c pm disable com.google.android.gsf/.update.SystemUpdateService$Receiver; su -c pm disable com.google.android.gsf/.update.SystemUpdateService$SecretCodeReceiver
 

fedexist

Senior Member
Nov 15, 2011
150
16
Genoa
Anyone have the hooks for 6.12.25.21.arm?

No luck man. This is for example the latest content of the folder where the hooks could be found. I think they changed something in the App and the module is no longer compatible.

Code:
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       24/02/2017     18:46                p343a
d-----       24/02/2017     18:46                p345b
-a----       24/02/2017     18:46           2053 aa.java
-a----       24/02/2017     18:46           1049 ab.java
-a----       24/02/2017     18:46           2223 ac.java
-a----       24/02/2017     18:46           1073 ad.java
-a----       24/02/2017     18:46            928 ae.java
-a----       24/02/2017     18:46           4283 aj.java
-a----       24/02/2017     18:46            431 ak.java
-a----       24/02/2017     18:46            761 al.java
-a----       24/02/2017     18:46            894 am.java
-a----       24/02/2017     18:46            461 ar.java
-a----       24/02/2017     18:46           8107 C1617u.java
-a----       24/02/2017     18:46            283 C3771r.java
-a----       24/02/2017     18:46           1697 C3772s.java
-a----       24/02/2017     18:46           1162 C3775e.java
-a----       24/02/2017     18:46            450 C3776f.java
-a----       24/02/2017     18:46            508 C3777i.java
-a----       24/02/2017     18:46            860 C3778j.java
-a----       24/02/2017     18:46            956 C3779k.java
-a----       24/02/2017     18:46            260 C3780l.java
-a----       24/02/2017     18:46            931 C3781n.java
-a----       24/02/2017     18:46            372 C3782o.java
-a----       24/02/2017     18:46           3622 C3783p.java
-a----       24/02/2017     18:46           3229 C3784q.java
-a----       24/02/2017     18:46           1303 C3785t.java
-a----       24/02/2017     18:46            980 C3786z.java
-a----       24/02/2017     18:46          16743 ClientConfig.java
-a----       24/02/2017     18:46           1314 ClientEventData.java
-a----       24/02/2017     18:46           1129 OnTranscriptionUpdateEventParcelable.java
-a----       24/02/2017     18:46          15406 SearchServiceClient.java
-a----       24/02/2017     18:46            755 SearchServiceMessenger.java
-a----       24/02/2017     18:46            162 ServiceEventCallback.java
-a----       24/02/2017     18:46           1374 ServiceEventData.java
-a----       24/02/2017     18:46           1472 ShowVoiceActionsEventParcelable.java
-a----       24/02/2017     18:46            778 StartActivityParcelable.java
-a----       24/02/2017     18:46            952 StartClientEventParcelable.java
 
Last edited:

zbombattack

Member
Jun 9, 2016
21
1
Attempt at New Hooks

Hey guys, so I tried to find the hooks by searching for "setFinal" this time in that folder that I normally used "ls" on. It was in one file for 6.10-12 so I figured why not and took down the file names for the hook endings. I ended up with this:
v6.10
Code:
com.google.android.apps.gsa.search.shared.service.ad
v6.11
Code:
com.google.android.apps.gsa.search.shared.service.ac
v6.12
Code:
com.google.android.apps.gsa.search.shared.service.ac

FYI I have NOT TESTED these hooks because my device is running nougat so no xposed. Let me know if they work so I can post them on reddit and whatnot.

Also, I made a quick site for easy reference of all the google app hooks I've found so far. Check it out
 
Last edited:
  • Like
Reactions: tineprogramming

Top Liked Posts

  • There are no posts matching your filters.
  • 118
    Requires Xposed Framework!

    This module adds an API to the Google Search app, commonly referred to as Google Now.
    This allows developers to make plugins that react to searches done in Google Search.

    As of right now, the developers cannot interact with the cards UI, not sure how feasible that is, if it is, it'll be in future versions.

    (I showed this on reddit some days ago: http://www.reddit.com/r/Android/comments/1rmvxs/heres_a_preview_of_my_google_search_now_api/)

    Screenshots:
    IWbHojml.png
    0TQkSlkl.png


    Demos:
    Lyrics fetching: https://www.youtube.com/watch?v=OsNCHo5JZuA
    Song recognition outside US with Shazam: https://www.youtube.com/watch?v=ThbW5glU7zM
    AutoVoice: http://www.youtube.com/watch?v=usjqq5hwlSE

    Compatibility:
    Any 4.1+ device that can run Xposed Framework. ICS not supported at the moment, not sure how recent the Google Search port is.

    Download:
    Please note that this is a 1.0 release, it may or may not have bugs.
    http://repo.xposed.info/module/com.mohammadag.googlesearchapi

    Source:
    This is open source, you're free to contribute to the source, but you're in now way allowed to release this anywhere else.
    https://github.com/MohammadAG/Google-Search-API

    Plugins:
    This doesn't do anything without plugins, which needs developer support. More on that below. Here are some fully working examples:
    • Music Controls: Control music playback. Supported commands: "play/pause/resume music", "play songs by <artist>", "play song <title>", "next/previous track/song", "volume up/down/max", "what song is this" opens in Shazam, requires Shazam, no idea what happens without it.
    • Voice Toggles: Turn on/off Wi-Fi, Mobile Data, or Bluetooth.
    • AZLyrics Viewer: Shows lyrics for songs from AZLyrics.com. Supported commands: "show lyrics for <song> by <artist>", exact syntax required here, artist is not optional.
    • Autovoice, by @joaomgcd, run Tasker commands from Google Search.

    Plugin sources:
    1. Music Controls: https://github.com/MohammadAG/GNAPI-MusicControls
    2. Voice Toggles: https://github.com/MohammadAG/GNAPI-VoiceToggles
    3. AZLyrics Viewer: https://github.com/MohammadAG/Android-AZLyricsViewer

    Developers:
    Implementing plugins is as easy as copying one file to your source, and implementing a BroadcastReceiver that listens for the search queries (sent as text). If you're implementing a UI, implement TextToSpeech for voice feedback, if not, use GoogleNowApi.speak for voice replies.
    All this is demonstrated in the examples above.
    You'll also need to add a permission to AndroidManifest.xml: "com.mohammadag.googlesearchapi.permission.ACCESS_GGOGLE_SEARCH_API"
    Remember that any package needs one activity to be started to work, see the music controls example for a way around that.
    Of course, you're free to make your plugins free/paid/whatever.

    What are the two checkboxes for?
    If you're using GEL, you basically need to have the first checkbox checked. This is because GEL uses an overlay for the first part of the search, then opens the usual search app without the transitions. This means that if a developer already started an activity, it'll be sent to the background cause search was started after it.

    Second checkbox prevents duplicate searches, this can be useful (you'll see how), and not so useful (when you do two volume ups/downs). Experiment as needed.

    Support development
    This took quite a lot of research, Google Search's code is huge, if you found this useful, please consider a donation.
    26
    3.6.13 Google Search Update

    bir -> bpn
    bjb -> bpy
    bur -> cby
    cmh -> cuc
    w -> x
    azL -> aCT
    heb -> hmu
    bul -> cbs
    bkt ->bqk

    Tested and everything is working including text searches. APK is attached.
    21
    Okay, I mean I have no real life and stuff.
    So I forked @MohammadAG project on Github and fixed it.

    All credits go to the OP! It's confirmed working on Auto voice again, didn't test it myself, though. Needs more testing.
    I've incremented the build number and opened a pull request on Github. The apk above is signed with debug keys if anyone cares.

    If OP doesn't want it, please report this post. Calling @GermainZ just to let him know.
    18
    MohammadAG You are the man! Here is a video I put together on some of the things you can do with it, fantastic Job!

    15
    Enjoy. Updated to 1.31 and should be working perfectly.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone