Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

launcher: treat Fire OS's CTS settings stub as missing; fall back through settings_fallback_components

DeltaWhiplash7ddebff01a93
diff --git a/launcher/app/src/main/AndroidManifest.xml b/launcher/app/src/main/AndroidManifest.xml
index c23b68638..fe55de630 100644
--- a/launcher/app/src/main/AndroidManifest.xml
+++ b/launcher/app/src/main/AndroidManifest.xml
@@ -43,9 +43,11 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="com.gathin.tvhome.category.DOCK_CARD" />
</intent>
- <!-- China-market MIUI TV firmware: the Settings and Wi-Fi pills fall back to Xiaomi's settings app. -->
+ <!-- China-market MIUI TV firmware: the Settings and Wi-Fi pills fall back to Xiaomi's settings app.
+ Fire TV: the real settings menu lives in the stock launcher (see settings_fallback_components). -->
<package android:name="com.xiaomi.mitv.settings" />
<package android:name="com.tcl.settings" />
+ <package android:name="com.amazon.tv.launcher" />
</queries>
<application
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java b/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java
index 464dc9a4b..ae8731763 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java
@@ -4,6 +4,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
/** 标准设置入口不可用时,尝试配置中声明的厂商设置入口。 */
final class SystemSettings {
@@ -12,14 +13,21 @@ final class SystemSettings {
static Intent intent(Context context, String action) {
PackageManager pm = context.getPackageManager();
Intent standard = new Intent(action);
- if (pm.resolveActivity(standard, PackageManager.MATCH_DEFAULT_ONLY) != null) return standard;
+ ResolveInfo resolved = pm.resolveActivity(standard, PackageManager.MATCH_DEFAULT_ONLY);
+ // Fire OS resolves the standard actions to a CTS compliance stub that opens nothing;
+ // treat it as missing so the vendor fallback runs.
+ if (resolved != null && !resolved.activityInfo.name.contains("CTSDummy")) return standard;
for (String value : context.getResources().getStringArray(R.array.settings_fallback_components)) {
ComponentName component = ComponentName.unflattenFromString(value);
if (component == null) continue;
- Intent fallback = new Intent().setComponent(component);
- // 显式 Intent 的 resolveActivity() 会直接返回指定组件,不能用它判断是否已安装。
- if (pm.resolveActivity(fallback, 0) != null) return fallback;
+ // Explicit resolveActivity() always succeeds, so check the package exists instead.
+ try {
+ pm.getPackageInfo(component.getPackageName(), 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ continue;
+ }
+ return new Intent().setComponent(component);
}
return standard;
}
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index 5c62ae1ad..32be92f5d 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -11,6 +11,7 @@
<string-array name="settings_fallback_components" translatable="false">
<item>com.xiaomi.mitv.settings/com.xiaomi.mitv.settings.entry.MainActivity</item>
<item>com.tcl.settings/com.tcl.settings.ui.MainActivity</item>
+ <item>com.amazon.tv.launcher/com.amazon.tv.launcher.ui.MainSettingsActivity</item>
</string-array>
<!-- Apps pinned to the dock row at the bottom, in this order. Missing apps are skipped. -->