Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport][Android] Avoid crash when create recommendation channels a… #23166

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions tools/android/packaging/xbmc/src/channels/util/TvUtil.java.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ public class TvUtil
builder.setMinimumLatency(10000);

Log.d(TAG, "Scheduled channel creation.");
scheduler.schedule(builder.build());

try {
scheduler.schedule(builder.build());
} catch (IllegalStateException e) {
Log.w(TAG, "TvUtil: scheduleSyncingChannel - Exception: " + e.getMessage());
}
}

/**
Expand Down Expand Up @@ -241,7 +246,12 @@ public class TvUtil
builder.setExtras(bundle);

scheduler.cancel(getTriggeredJobIdForChannelId(channelId));
scheduler.schedule(builder.build());

try {
scheduler.schedule(builder.build());
} catch (IllegalStateException e) {
Log.w(TAG, "TvUtil: scheduleTriggeredSyncingProgramsForChannel - Exception: " + e.getMessage());
}
}

/**
Expand Down Expand Up @@ -271,7 +281,11 @@ public class TvUtil
JobInfo job = builder.build();
Log.d(TAG, "scheduleTimedSyncingProgramsForChannel: minperiod=" + job.getMinPeriodMillis());

scheduler.schedule(job);
try {
scheduler.schedule(job);
} catch (IllegalStateException e) {
Log.w(TAG, "TvUtil: scheduleTimedSyncingProgramsForChannel - Exception: " + e.getMessage());
}
}

public static int getTriggeredJobIdForChannelId(long channelId)
Expand Down