diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index ab2f4fefac..3d7b9e4605 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -45,6 +45,7 @@ import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper; import org.dolphinemu.dolphinemu.utils.FileBrowserHelper; import org.dolphinemu.dolphinemu.utils.Java_GCAdapter; import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter; +import org.dolphinemu.dolphinemu.utils.TvUtil; import java.lang.annotation.Retention; import java.util.List; @@ -589,7 +590,9 @@ public final class EmulationActivity extends AppCompatActivity return; case MENU_ACTION_EXIT: - toggleMenu(); // Hide the menu (it will be showing since we just clicked it) + // ATV menu is built using a fragment, this will pop that fragment before emulation ends. + if(TvUtil.isLeanback(getApplicationContext())) + toggleMenu(); // Hide the menu (it will be showing since we just clicked it) mEmulationFragment.stopEmulation(); exitWithAnimation(); return; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java index d13cace229..a07b00e456 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/TvUtil.java @@ -6,6 +6,7 @@ import android.app.job.JobScheduler; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; @@ -293,4 +294,8 @@ public class TvUtil } return subs; } + public static Boolean isLeanback(Context context) + { + return(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)); + } } diff --git a/Source/Android/app/src/main/res/menu/menu_emulation.xml b/Source/Android/app/src/main/res/menu/menu_emulation.xml index 5f4c1272b1..bbb418018c 100644 --- a/Source/Android/app/src/main/res/menu/menu_emulation.xml +++ b/Source/Android/app/src/main/res/menu/menu_emulation.xml @@ -106,4 +106,8 @@ app:showAsAction="never" android:title="@string/emulation_change_disc"/> +