Merge pull request #13056 from HatakeKakashri/bump_min_sdk_23

Bump minimum SDK version to API 23
This commit is contained in:
Aayush Gupta 2026-01-21 11:32:46 +08:00 committed by GitHub
commit 61c25d4589
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 26 deletions

View File

@ -69,7 +69,7 @@ jobs:
strategy:
matrix:
include:
- api-level: 21
- api-level: 23
target: default
arch: x86
- api-level: 35

View File

@ -44,7 +44,7 @@ android {
defaultConfig {
applicationId = "org.schabi.newpipe"
resValue("string", "app_name", "NewPipe")
minSdk = 21
minSdk = 23
targetSdk = 35
versionCode = System.getProperty("versionCodeOverride")?.toInt() ?: 1005

View File

@ -307,8 +307,7 @@ public class ErrorActivity extends AppCompatActivity {
}
private String getOsString() {
final String osBase = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
? Build.VERSION.BASE_OS : "Android";
final String osBase = Build.VERSION.BASE_OS;
return System.getProperty("os.name")
+ " " + (osBase.isEmpty() ? "Android" : osBase)
+ " " + Build.VERSION.RELEASE

View File

@ -24,7 +24,6 @@ import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
@ -1587,19 +1586,15 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
// make sure there is nothing left over from previous calls
clearVideoSurface();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // >=API23
surfaceHolderCallback = new SurfaceHolderCallback(context, player.getExoPlayer());
binding.surfaceView.getHolder().addCallback(surfaceHolderCallback);
surfaceHolderCallback = new SurfaceHolderCallback(context, player.getExoPlayer());
binding.surfaceView.getHolder().addCallback(surfaceHolderCallback);
// ensure player is using an unreleased surface, which the surfaceView might not be
// when starting playback on background or during player switching
if (binding.surfaceView.getHolder().getSurface().isValid()) {
// initially set the surface manually otherwise
// onRenderedFirstFrame() will not be called
player.getExoPlayer().setVideoSurfaceHolder(binding.surfaceView.getHolder());
}
} else {
player.getExoPlayer().setVideoSurfaceView(binding.surfaceView);
// ensure player is using an unreleased surface, which the surfaceView might not be
// when starting playback on background or during player switching
if (binding.surfaceView.getHolder().getSurface().isValid()) {
// initially set the surface manually otherwise
// onRenderedFirstFrame() will not be called
player.getExoPlayer().setVideoSurfaceHolder(binding.surfaceView.getHolder());
}
surfaceIsSetup = true;
@ -1607,8 +1602,7 @@ public abstract class VideoPlayerUi extends PlayerUi implements SeekBar.OnSeekBa
}
private void clearVideoSurface() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M // >=API23
&& surfaceHolderCallback != null) {
if (surfaceHolderCallback != null) {
binding.surfaceView.getHolder().removeCallback(surfaceHolderCallback);
surfaceHolderCallback.release();
surfaceHolderCallback = null;

View File

@ -2,7 +2,6 @@ package org.schabi.newpipe.settings;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.format.DateUtils;
@ -33,8 +32,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
// on M and above, if user chooses to minimise to popup player on exit
// and the app doesn't have display over other apps permission,
// show a snackbar to let the user give permission
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& getString(R.string.minimize_on_exit_key).equals(key)) {
if (getString(R.string.minimize_on_exit_key).equals(key)) {
final String newSetting = sharedPreferences.getString(key, null);
if (newSetting != null
&& newSetting.equals(getString(R.string.minimize_on_exit_popup_key))

View File

@ -12,7 +12,6 @@ import android.provider.Settings;
import android.text.Html;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@ -116,7 +115,6 @@ public final class PermissionHelper {
* @param context {@link Context}
* @return {@link Settings#canDrawOverlays(Context)}
**/
@RequiresApi(api = Build.VERSION_CODES.M)
public static boolean checkSystemAlertWindowPermission(final Context context) {
if (!Settings.canDrawOverlays(context)) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
@ -174,8 +172,7 @@ public final class PermissionHelper {
* @return whether the popup is enabled
*/
public static boolean isPopupEnabledElseAsk(final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|| checkSystemAlertWindowPermission(context)) {
if (checkSystemAlertWindowPermission(context)) {
return true;
} else {
Toast.makeText(context, R.string.msg_popup_permission, Toast.LENGTH_LONG).show();