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 418da02fbf..4d65ff24ae 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 @@ protected void onCreate(Bundle state) { 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 3b9e1d0136..5b2690b091 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 @@ static Intent appInfo(Context context, String pkg) { 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); + } }