Skip to content

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

Launcher: open Xiaomi picture settings from Quick Settings on Mi TVs

Vivek Sharma71c700df5419
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/QuickSettingsActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/QuickSettingsActivity.java
index 418da02fb..4d65ff24a 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/QuickSettingsActivity.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/QuickSettingsActivity.java
@@ -41,7 +41,7 @@ public final class QuickSettingsActivity extends Activity {
findViewById(R.id.scrim).setOnClickListener(v -> finish());
LinearLayout rows = findViewById(R.id.rows);
addRow(rows, R.drawable.ic_settings, R.string.tv_settings, 0, SystemSettings.intent(this, Settings.ACTION_SETTINGS));
- addRow(rows, R.drawable.ic_picture, R.string.quick_picture, 0, SystemSettings.intent(this, Settings.ACTION_DISPLAY_SETTINGS));
+ addRow(rows, R.drawable.ic_picture, R.string.quick_picture, 0, SystemSettings.displayIntent(this));
addRow(rows, R.drawable.ic_wifi, R.string.quick_network, 0, SystemSettings.intent(this, Settings.ACTION_WIFI_SETTINGS));
addRow(rows, R.drawable.ic_apps, R.string.quick_apps, R.string.quick_apps_hint,
SystemSettings.intent(this, Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS));
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 3b9e1d013..5b2690b09 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/SystemSettings.java
@@ -63,4 +63,17 @@ final class SystemSettings {
Intent info = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + pkg));
return context.getPackageManager().resolveActivity(info, PackageManager.MATCH_DEFAULT_ONLY) != null ? info : null;
}
+
+ /**
+ * The TV's display or picture settings. On Xiaomi sets, the AOSP DISPLAY_SETTINGS action resolves to
+ * an empty stub in DroidTvSettings; prefer Xiaomi's own PictureActivity where installed.
+ */
+ static Intent displayIntent(Context context) {
+ ComponentName xiaomi = new ComponentName("com.android.tv.settings",
+ "com.xiaomi.mitv.settings.picture.PictureActivity");
+ if (context.getPackageManager().resolveActivity(new Intent().setComponent(xiaomi), 0) != null) {
+ return new Intent().setComponent(xiaomi);
+ }
+ return intent(context, Settings.ACTION_DISPLAY_SETTINGS);
+ }
}