mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-25 05:53:05 +00:00
Fix crash on HarmonyOS due to broken TV content provider APIs
Fixes #883
This commit is contained in:
parent
35bd9ecda3
commit
ce0b19605a
@ -252,7 +252,19 @@ public class TvChannelHelper {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
private boolean isAndroidTV() {
|
||||
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
PackageManager pm = context.getPackageManager();
|
||||
|
||||
// HarmonyOS devices report PackageManager.FEATURE_LEANBACK yet
|
||||
// when we attempt to actually use TvContract, it will die with
|
||||
// an IllegalArgumentException because TvContract.Channels.CONTENT_URI
|
||||
// is an unknown URL. I don't know if this is a perfect check for
|
||||
// HarmonyOS-powered TVs (excluding any Android TVs), but it will
|
||||
// suffice for now.
|
||||
if (pm.hasSystemFeature("com.huawei.software.features.tv")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
|
Loading…
x
Reference in New Issue
Block a user