mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-25 05:53:05 +00:00
Catch IllegalArgumentException when trying to insert an entry to TvContract.Channels.CONTENT_URI
HarmonyOS has FEATURE_LEANBACK but doesn't support this URI
This commit is contained in:
parent
34a1697d50
commit
9d8df04c5c
@ -77,8 +77,18 @@ public class TvChannelHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri channelUri = context.getContentResolver().insert(
|
||||
TvContract.Channels.CONTENT_URI, builder.toContentValues());
|
||||
Uri channelUri;
|
||||
|
||||
try {
|
||||
channelUri = context.getContentResolver().insert(
|
||||
TvContract.Channels.CONTENT_URI, builder.toContentValues());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// This can happen on HarmonyOS devices which report to
|
||||
// support Leanback APIs, yet don't implement this URI
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (channelUri != null) {
|
||||
long id = ContentUris.parseId(channelUri);
|
||||
updateChannelIcon(id);
|
||||
@ -144,8 +154,15 @@ public class TvChannelHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
context.getContentResolver().insert(TvContract.PreviewPrograms.CONTENT_URI,
|
||||
builder.toContentValues());
|
||||
try {
|
||||
context.getContentResolver().insert(TvContract.PreviewPrograms.CONTENT_URI,
|
||||
builder.toContentValues());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// This can happen on HarmonyOS devices which report to
|
||||
// support Leanback APIs, yet don't implement this URI
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
TvContract.requestChannelBrowsable(context, channelId);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user