From 64953bb63a8e4a54cd9ac37e81d77453783b6620 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 1 Feb 2020 22:07:29 +0100 Subject: [PATCH] Android: More robust check for whether to sync channels This changes channel syncing to happen when the operating system is Android TV rather than when TvMainActivity is launched. (You can run TvMainActivity on a phone by specifying a launch activity manually in Android Studio, which I do sometimes for testing purposes. Without this change, you get an exception when channel syncing runs.) --- .../org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java | 2 -- .../java/org/dolphinemu/dolphinemu/utils/StartupHandler.java | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index ef1aed4ea8..2f450ade7a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -59,8 +59,6 @@ public final class TvMainActivity extends FragmentActivity implements MainView { StartupHandler.HandleInit(this); } - // Setup and/or sync channels - TvUtil.scheduleSyncingChannel(getApplicationContext()); } @Override diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java index a7f479cde8..68f3ff3a49 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/StartupHandler.java @@ -27,6 +27,10 @@ public final class StartupHandler // Ask the user if he wants to enable analytics if we haven't yet. Analytics.checkAnalyticsInit(parent); + // Set up and/or sync Android TV channels + if (TvUtil.isLeanback(parent)) + TvUtil.scheduleSyncingChannel(parent); + String[] start_files = null; Bundle extras = parent.getIntent().getExtras(); if (extras != null)