From 98bdf3b1ceae94a35e3f47158966967d1c947d99 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Thu, 24 Jun 2021 17:24:29 +0200 Subject: [PATCH] Partially revert "Android: Clean up hardcoded platform names" This partially reverts commit cbc4989095baff7b84694802bb195c0c79d56ebe due to a crash: https://bugs.dolphin-emu.org/issues/12561 I can't debug what the cause of the crash is due to not having an Android TV device. Let's just revert this for now to fix the crash. --- .../dolphinemu/services/SyncChannelJobService.java | 2 +- .../dolphinemu/services/SyncProgramsJobService.java | 3 +-- .../java/org/dolphinemu/dolphinemu/utils/TvUtil.java | 12 +++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java index 7b15ea2490..3698f3cbfe 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncChannelJobService.java @@ -85,7 +85,7 @@ public class SyncChannelJobService extends JobService } else { - subscriptions = TvUtil.createUniversalSubscriptions(context); + subscriptions = TvUtil.createUniversalSubscriptions(); for (HomeScreenChannel subscription : subscriptions) { long channelId = createChannel(subscription); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java index 340c3684c9..2c6f121122 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/services/SyncProgramsJobService.java @@ -96,8 +96,7 @@ public class SyncProgramsJobService extends JobService Channel channel = TvUtil.getChannelById(context, channelId); for (Platform platform : Platform.values()) { - if (channel != null && - channel.getAppLinkIntentUri().equals(AppLinkHelper.buildBrowseUri(platform))) + if (channel != null && channel.getDisplayName().equals(platform.getIdString())) { getGamesByPlatform(platform); syncPrograms(channelId); 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 47a1d4943e..4e10821dac 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 @@ -251,19 +251,21 @@ public class TvUtil /** * Generates all subscriptions for homescreen channels. */ - public static List createUniversalSubscriptions(Context context) + public static List createUniversalSubscriptions() { - return new ArrayList<>(createPlatformSubscriptions(context)); + return new ArrayList<>(createPlatformSubscriptions()); } - private static List createPlatformSubscriptions(Context context) + private static List createPlatformSubscriptions() { List subs = new ArrayList<>(); for (Platform platform : Platform.values()) { + // TODO: Replace the getIdString calls with getHeaderName to get localized names. + // This would require SyncProgramsJobService to stop using the display name as a key subs.add(new HomeScreenChannel( - context.getString(platform.getHeaderName()), - context.getString(platform.getHeaderName()), + platform.getIdString(), + platform.getIdString(), AppLinkHelper.buildBrowseUri(platform))); } return subs;