This repository has been archived by the owner on Jul 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Google Assistant for Google app 6.6.14.21.arm64 (other version…
…s will likely not work) (#1030)
- Loading branch information
1 parent
f2b053a
commit 4f14cce
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
app/src/main/java/tk/wasdennnoch/androidn_ify/AssistantHooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package tk.wasdennnoch.androidn_ify; | ||
|
||
import android.content.SharedPreferences; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XC_MethodReplacement; | ||
|
||
import static de.robv.android.xposed.XposedBridge.log; | ||
import static de.robv.android.xposed.XposedHelpers.callMethod; | ||
import static de.robv.android.xposed.XposedHelpers.findAndHookConstructor; | ||
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; | ||
import static de.robv.android.xposed.XposedHelpers.findClass; | ||
|
||
class AssistantHooks { | ||
|
||
private static final String ASSISTANT_PACKAGE = "com.google.android.apps.gsa.assistant"; | ||
|
||
public static void hook(ClassLoader classLoader) { | ||
try { | ||
Class a = findClass(ASSISTANT_PACKAGE + ".a.e", classLoader); | ||
|
||
findAndHookConstructor(a, findClass("com.google.android.apps.gsa.search.core.config.GsaConfigFlags", classLoader), SharedPreferences.class, new XC_MethodHook() { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
callMethod(param.thisObject, "aG", true); | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "aG", boolean.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
param.args[0] = true; | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "pa", new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
return true; | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "pb", new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
return true; | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "pc", new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
return true; | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "oY", new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
return true; | ||
} | ||
}); | ||
|
||
findAndHookMethod(a, "oZ", new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
return true; | ||
} | ||
}); | ||
} catch (Throwable t) { | ||
log(t); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters