Blocking Gemini and other AI features in Google Messgaes

Blocking AI Features

blocking ai features in google messages is very hard because unlike other google apps that use some url/domain endpoint that can be blocked in hosts or something like that google messages gemini is just an rcs chat so if you block that you lose all rcs.

solution - All Ai features in google messages require a google account to be logged in (RCS does not have this requirement) so i modified services.jar to hide all Accounts from google messages. so you can still log in to google and any other app will see the logged in account except for google messages which never sees any accounts. simple the only tradeoff of doing this is you cant do device pairing using your google account but qr code still works

The Fix

The smali file is located at /smali/com/android/server/accounts/AccountManagerService.smali

the code changes were the same for both the qin and tiq but i dont know about other devices so you can use ai to figure it out. be careful when recompiling services.jar to make sure it is recompiled properly

Original Smali
.method private resolveAccountVisibility(Landroid/accounts/Account;Ljava/lang/String;Lcom/android/server/accounts/AccountManagerService$UserAccounts;)Ljava/lang/Integer;
    .locals 7
    .param p1, "account"    # Landroid/accounts/Account;
    .param p2, "packageName"    # Ljava/lang/String;
    .param p3, "accounts"    # Lcom/android/server/accounts/AccountManagerService$UserAccounts;

    .line 670
    const-string/jumbo v0, "packageName cannot be null"

    invoke-static {p2, v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
New Smali
.method private resolveAccountVisibility(Landroid/accounts/Account;Ljava/lang/String;Lcom/android/server/accounts/AccountManagerService$UserAccounts;)Ljava/lang/Integer;
    .locals 7
    .param p1, "account"    # Landroid/accounts/Account;
    .param p2, "packageName"    # Ljava/lang/String;
    .param p3, "accounts"    # Lcom/android/server/accounts/AccountManagerService$UserAccounts;

    const-string v0, "com.google.android.apps.messaging"          # <-- ADD
    invoke-virtual {v0, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z   # <-- ADD
    move-result v0                                                # <-- ADD
    if-eqz v0, :kosher_orig                                       # <-- ADD
    const/4 v0, 0x3                                               # <-- ADD
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;     # <-- ADD
    move-result-object v0                                         # <-- ADD
    return-object v0                                              # <-- ADD
    :kosher_orig                                                  # <-- ADD

    .line 670
    const-string/jumbo v0, "packageName cannot be null"

    invoke-static {p2, v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;

QIN F21 PRO

QIN using root
adb push services-patched-qin.jar /sdcard
adb shell su -c mount -o rw,remount /
adb shell su -c mv /sdcard/services-patched-qin.jar /system/framework/services.jar
adb shell su -c chmod 644 /system/framework/services.jar
adb shell su -c chown root:root /system/framework/services.jar
adb shell su -c chcon u:object_r:system_file:s0 /system/framework/services.jar
adb reboot
QIn using twrp
adb shell twrp mount system
adb shell mount -o rw,remount /system_root
adb shell push services-patched-qin.jar /system/framework/services.jar
adb reboot

TIQ M5

(includes last app fix mentioned here Guide: ROM Modifications For TIQ M5 - #3 by dfrydman)

Tiq using root
adb push services-patched-tiq.jar /sdcard
adb shell su -c mount -o rw,remount /
adb shell su -c mv /sdcard/services-patched-tiq.jar /system/framework/services.jar
adb shell su -c chmod 644 /system/framework/services.jar
adb shell su -c chown root:root /system/framework/services.jar
adb shell su -c chcon u:object_r:system_file:s0 /system/framework/services.jar
adb reboot
QIn using twrp
adb shell twrp mount system
adb shell mount -o rw,remount /system_root
adb shell push services-patched-tiq.jar /system/framework/services.jar
adb reboot

Smart. Does device pairing for messages on web still work with a QR code?

:+1:
Qin services.jar is 6.1.3?

i think this will work for 6.1.3

Not asking if it will work. The 6.1.3 has a patched services.jar want to know which version qin you patched if I’m gonna lose the 6.1.3 updated file

whats the patch for on 6.1.3 for

Don’t remember all but one is it shouldn’t aggressively kill apps

This is services.jar from 6.1.3

i think this one also has that. i used the 1.1.1 that was modifed by ars18 for that fix

can someone test pls

1. Check the current value:

su
grep -r 'enable_penpal_conversation' /data/data/com.google.android.apps.messaging/shared_prefs/

Expect <boolean name="bugle_phenotype__enable_penpal_conversation" value="true" />

2. Force it off:

su -c 'am broadcast -a com.google.android.gms.phenotype.FLAG_OVERRIDE \
  --es package "com.google.android.apps.messaging" --es user "*" \
  --esa flags "bugle_phenotype__enable_penpal_conversation" \
  --esa types "boolean" --esa values "false" \
  com.google.android.gms'

3. Commit + reboot:

su -c 'am broadcast -a com.google.android.gms.phenotype.UPDATE com.google.android.gms'
su -c 'am force-stop com.google.android.apps.messaging'
su -c 'reboot'

4. Verify — re-run the Step 1 grep and look for value="false", then confirm in the app that the bot is dead, RCS still sends, and pairing still works.

cant test right now. but i think it will either reset itself or when the user toggles it on insettings it will reset

also i dont know if this blocks nano image editor

If it works we can build on this so the user can’t switch it back

Guys, don’t use services.jar from 1.1.1 on 6.1.3 - just apply the patch