From 9ecd5dff09d98aaa70ef71dc9bdb8c24ccf8313c Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 16 Jan 2023 13:56:45 +0100 Subject: [PATCH] Orientation is locked if there is no sensor for it --- .../java/org/schabi/newpipe/player/helper/PlayerHelper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index abde7c3d1..8d8e0414e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -14,6 +14,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.provider.Settings; import android.view.accessibility.CaptioningManager; @@ -382,8 +383,11 @@ public final class PlayerHelper { public static boolean globalScreenOrientationLocked(final Context context) { // 1: Screen orientation changes using accelerometer // 0: Screen orientation is locked + // if the accelerometer sensor is missing completely, assume locked orientation return android.provider.Settings.System.getInt( - context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0; + context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0 + || !context.getPackageManager() + .hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER); } public static int getProgressiveLoadIntervalBytes(@NonNull final Context context) {