mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-26 06:22:45 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri channelUri = context.getContentResolver().insert(
|
Uri channelUri;
|
||||||
TvContract.Channels.CONTENT_URI, builder.toContentValues());
|
|
||||||
|
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) {
|
if (channelUri != null) {
|
||||||
long id = ContentUris.parseId(channelUri);
|
long id = ContentUris.parseId(channelUri);
|
||||||
updateChannelIcon(id);
|
updateChannelIcon(id);
|
||||||
@ -144,8 +154,15 @@ public class TvChannelHelper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getContentResolver().insert(TvContract.PreviewPrograms.CONTENT_URI,
|
try {
|
||||||
builder.toContentValues());
|
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);
|
TvContract.requestChannelBrowsable(context, channelId);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user