Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
- api-level: 21
target: default
arch: x86
- api-level: 33
target: google_apis # emulator API 33 only exists with Google APIs
- api-level: 35
target: default
arch: x86_64

permissions:
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ plugins {
}

android {
compileSdk 34
compileSdk 36
namespace 'org.schabi.newpipe'

defaultConfig {
applicationId "org.schabi.newpipe"
resValue "string", "app_name", "NewPipe"
minSdk 21
targetSdk 33
targetSdk 35
if (System.properties.containsKey('versionCodeOverride')) {
versionCode System.getProperty('versionCodeOverride') as Integer
} else {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<!-- We need to be able to open links in the browser on API 30+ -->
Expand Down Expand Up @@ -96,7 +98,8 @@

<service android:name=".local.subscription.services.SubscriptionsImportService" />
<service android:name=".local.subscription.services.SubscriptionsExportService" />
<service android:name=".local.feed.service.FeedLoadService" />
<service android:name=".local.feed.service.FeedLoadService"
android:foregroundServiceType="dataSync" />

<activity
android:name=".PanicResponderActivity"
Expand Down Expand Up @@ -128,7 +131,8 @@
android:label="@string/app_name"
android:launchMode="singleTask" />

<service android:name="us.shandian.giga.service.DownloadManagerService" />
<service android:name="us.shandian.giga.service.DownloadManagerService"
android:foregroundServiceType="dataSync" />

<activity
android:name=".util.FilePickerActivityHelper"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
Expand Down Expand Up @@ -890,7 +891,8 @@ public void onReceive(final Context context, final Intent intent) {
};
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
registerReceiver(broadcastReceiver, intentFilter);
ContextCompat.registerReceiver(this, broadcastReceiver, intentFilter,
ContextCompat.RECEIVER_EXPORTED);

// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.widget.Toast
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.PendingIntentCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager
import com.google.android.material.snackbar.Snackbar
Expand Down Expand Up @@ -136,9 +137,11 @@ class ErrorUtil {
NotificationManagerCompat.from(context)
.notify(ERROR_REPORT_NOTIFICATION_ID, notificationBuilder.build())

// since the notification is silent, also show a toast, otherwise the user is confused
Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT)
.show()
ContextCompat.getMainExecutor(context).execute {
// since the notification is silent, also show a toast, otherwise the user is confused
Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT)
.show()
}
}

private fun getErrorActivityIntent(context: Context, errorInfo: ErrorInfo): Intent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,8 @@ public void onReceive(final Context context, final Intent intent) {
intentFilter.addAction(ACTION_SHOW_MAIN_PLAYER);
intentFilter.addAction(ACTION_HIDE_MAIN_PLAYER);
intentFilter.addAction(ACTION_PLAYER_STARTED);
activity.registerReceiver(broadcastReceiver, intentFilter);
ContextCompat.registerReceiver(activity, broadcastReceiver, intentFilter,
ContextCompat.RECEIVER_EXPORTED);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.PendingIntentCompat
import androidx.core.app.ServiceCompat
import androidx.core.content.ContextCompat
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Flowable
import io.reactivex.rxjava3.disposables.Disposable
Expand Down Expand Up @@ -200,7 +201,7 @@ class FeedLoadService : Service() {
}
}
}
registerReceiver(broadcastReceiver, IntentFilter(ACTION_CANCEL))
ContextCompat.registerReceiver(this, broadcastReceiver, IntentFilter(ACTION_CANCEL), ContextCompat.RECEIVER_NOT_EXPORTED)
}

// /////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.math.MathUtils;
import androidx.preference.PreferenceManager;

Expand Down Expand Up @@ -764,7 +765,8 @@ private void onBroadcastReceived(final Intent intent) {
private void registerBroadcastReceiver() {
// Try to unregister current first
unregisterBroadcastReceiver();
context.registerReceiver(broadcastReceiver, intentFilter);
ContextCompat.registerReceiver(context, broadcastReceiver, intentFilter,
ContextCompat.RECEIVER_EXPORTED);
}

private void unregisterBroadcastReceiver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,15 @@ internal class PackageValidator(context: Context) {
private fun buildCallerInfo(callingPackage: String): CallerPackageInfo? {
val packageInfo = getPackageInfo(callingPackage) ?: return null

val appName = packageInfo.applicationInfo.loadLabel(packageManager).toString()
val uid = packageInfo.applicationInfo.uid

This comment was marked as resolved.

val appName = packageInfo.applicationInfo?.loadLabel(packageManager).toString()
val uid = packageInfo.applicationInfo?.uid ?: -1
val signature = getSignature(packageInfo)

val requestedPermissions = packageInfo.requestedPermissions
val permissionFlags = packageInfo.requestedPermissionsFlags
val activePermissions = mutableSetOf<String>()
requestedPermissions?.forEachIndexed { index, permission ->
if (permissionFlags[index] and REQUESTED_PERMISSION_GRANTED != 0) {
activePermissions += permission

This comment was marked as outdated.

}
}
val requestedPermissions = packageInfo.requestedPermissions?.asSequence().orEmpty()
val permissionFlags = packageInfo.requestedPermissionsFlags?.asSequence().orEmpty()
val activePermissions = (requestedPermissions zip permissionFlags)
.filter { (permission, flag) -> flag and REQUESTED_PERMISSION_GRANTED != 0 }
.mapTo(mutableSetOf()) { (permission, flag) -> permission }

return CallerPackageInfo(appName, callingPackage, uid, signature, activePermissions.toSet())
}
Expand Down Expand Up @@ -189,12 +186,12 @@ internal class PackageValidator(context: Context) {
*/
@Suppress("deprecation")
private fun getSignature(packageInfo: PackageInfo): String? =
if (packageInfo.signatures == null || packageInfo.signatures.size != 1) {
if (packageInfo.signatures == null || packageInfo.signatures!!.size != 1) {
// Security best practices dictate that an app should be signed with exactly one (1)
// signature. Because of this, if there are multiple signatures, reject it.
null
} else {
val certificate = packageInfo.signatures[0].toByteArray()
val certificate = packageInfo.signatures!![0].toByteArray()
getSignatureSha256(certificate)
}

Expand Down
27 changes: 27 additions & 0 deletions app/src/main/res/values-v35/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- Base Theme -->
<style name="Base.V35" parent="Base.V29">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
<style name="Base" parent="Base.V35"/>

<!-- Light Theme -->
<style name="Base.V35.LightTheme" parent="Base.V29.LightTheme">
</style>
<style name="Base.LightTheme" parent="Base.V35.LightTheme" />

<!-- Dark Theme -->
<style name="Base.V35.DarkTheme" parent="Base.V29.DarkTheme">

</style>
<style name="Base.DarkTheme" parent="Base.V35.DarkTheme" />

<!-- Black Theme -->
<style name="Base.V35.BlackTheme" parent="Base.V29.BlackTheme">

</style>
<style name="Base.BlackTheme" parent="Base.V35.BlackTheme" />

</resources>