mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Merge pull request #9693 from Redirion/accelerometerfix
Orientation is locked if there is no sensor for it
This commit is contained in:
		| @@ -14,6 +14,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; | |||||||
| import android.annotation.SuppressLint; | import android.annotation.SuppressLint; | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
| import android.content.SharedPreferences; | import android.content.SharedPreferences; | ||||||
|  | import android.content.pm.PackageManager; | ||||||
| import android.provider.Settings; | import android.provider.Settings; | ||||||
| import android.view.accessibility.CaptioningManager; | import android.view.accessibility.CaptioningManager; | ||||||
|  |  | ||||||
| @@ -382,8 +383,11 @@ public final class PlayerHelper { | |||||||
|     public static boolean globalScreenOrientationLocked(final Context context) { |     public static boolean globalScreenOrientationLocked(final Context context) { | ||||||
|         // 1: Screen orientation changes using accelerometer |         // 1: Screen orientation changes using accelerometer | ||||||
|         // 0: Screen orientation is locked |         // 0: Screen orientation is locked | ||||||
|  |         // if the accelerometer sensor is missing completely, assume locked orientation | ||||||
|         return android.provider.Settings.System.getInt( |         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) { |     public static int getProgressiveLoadIntervalBytes(@NonNull final Context context) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stypox
					Stypox