misOrz

IT Tech & Life

Fix TTS init failure on Xiaomi (MIUI): add for TTS_SERVICE in AndroidManifest

Symptom: In my QRCode scan app, TextToSpeech init failed on a Xiaomi phone (China MIUI ROM) — status=-1 for engine com.google.android.tts, completely silent. The same APK worked fine on a Realme phone.

What I ruled out first:

  • Media volume was on, in-app TTS toggle was on.
  • Xiaomi's "Text-to-speech output": preferred engine was Google TTS, language Chinese (Taiwan), and the system "Listen to an example" test played sound fine — the engine itself was healthy.
  • Explicitly specifying Google TTS and adding an engine fallback list both failed the same way (system default was already Google, nothing to fall back to).

Root cause: Android 11+ package visibility. Since API 30, an app cannot see — and therefore cannot bind — another app's service unless it declares the intent in <queries>. Google TTS is a third-party app providing a TTS service; without the declaration, binding the TTS engine is silently blocked and TextToSpeech init returns ERROR (-1). Some OEM ROMs (e.g. Realme) don't enforce this strictly, which is why the same APK worked there.

Fix — add to AndroidManifest.xml:

<queries>
    <intent>
        <action android:name="android.intent.action.TTS_SERVICE" />
    </intent>
</queries>

After adding this (shipped as v1.1), TTS worked on both Xiaomi and Realme.

Lesson: whenever your app binds a service provided by another app (TTS engine, etc.) on Android 11+, declare the matching <queries> entry — otherwise the bind fails silently on strict OEM ROMs.


 

Create VLANs in Linux

 

ip link add link eth0 name eth0.3001 type vlan id 3001

ip addr add 192.168.100.1/24 brd 192.168.100.255 dev eth0.3001

ip link set dev eth0.3001 up

ip -d addr show



Reference: https://www.baeldung.com/linux/vlans-create





Login as Root in Ubuntu GUI

GDM – GNOME Display Manager

/etc/pam.d/gdm-autologin

/etc/pam.d/gdm-password

註解掉 # auth required pam_succeed_if.so user != root quiet_success

sudo service gdm restart





How to connect hidden ssid on debian 11

root@LINUX:~# rfkill unblock wifi

root@LINUX:~# killall wpa_supplicant

root@LINUX:~# wpa_passphrase SSID-NAME Password > wpa.conf

root@LINUX:~# wpa_supplicant -i wlan0 -c wpa.conf -B

root@LINUX:~# dhclient wlan0





changed its 'Version' value from '11.5' to '11.8'

 N: Repository 'http://opensource.nchc.org.tw/debian bullseye InRelease' changed its 'Version' value from '11.5' to '11.8'


root@LINUX:~/tmp# apt-get update --allow-releaseinfo-change




Change root password using sed

1. Generate new root password & Su2Root

# openssl passwd -1 -salt root hello123

2. Replace first line in shadow file

# sed -i '1c root:$1$root$wrNKG1lgeNwlb0I1oJbR9/.:19613:0:99999:7:::' /etc/shadow





Using UserAccountControl Flags to Manipulate Properties (LDAP, AD)

 userAccountControl == 66048 (512+65536) 

 userAccountControl == 66050 Disabled, Don’t Expire Password

 userAccountControl == 514 (512+2) Account Disable





Reference: https://shellgeek.com/useraccountcontrol-flags-to-manipulate-properties/#UserAccountControl_66050_Disabled_and_Dont_Expire_Password