Skip to content

Commit 1c91119

Browse files
Isira-Seneviratnewhistlingwoods
authored andcommitted
Merge pull request TeamNewPipe#12388 from mikooomich/sdk35
Target SDK 35
1 parent 6b55569 commit 1c91119

10 files changed

Lines changed: 62 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ jobs:
6868
- api-level: 21
6969
target: default
7070
arch: x86
71-
- api-level: 33
72-
target: google_apis # emulator API 33 only exists with Google APIs
71+
- api-level: 35
72+
target: default
7373
arch: x86_64
7474

7575
permissions:

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ plugins {
1212
}
1313

1414
android {
15-
compileSdk 34
15+
compileSdk 36
1616
namespace 'org.schabi.newpipe'
1717

1818
defaultConfig {
1919
applicationId "apps.palmtree.foxpipe"
2020
resValue "string", "app_name", "FoxPipe"
2121
minSdk 21
22-
targetSdk 33
22+
targetSdk 35
2323
if (System.properties.containsKey('versionCodeOverride')) {
2424
versionCode System.getProperty('versionCodeOverride') as Integer
2525
} else {

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
1010
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
1111
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
12+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
13+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
1214
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1315

1416
<!-- We need to be able to open links in the browser on API 30+ -->
@@ -88,7 +90,8 @@
8890

8991
<service android:name=".local.subscription.services.SubscriptionsImportService" />
9092
<service android:name=".local.subscription.services.SubscriptionsExportService" />
91-
<service android:name=".local.feed.service.FeedLoadService" />
93+
<service android:name=".local.feed.service.FeedLoadService"
94+
android:foregroundServiceType="dataSync" />
9295

9396
<activity
9497
android:name=".PanicResponderActivity"
@@ -120,7 +123,8 @@
120123
android:label="@string/app_name"
121124
android:launchMode="singleTask" />
122125

123-
<service android:name="us.shandian.giga.service.DownloadManagerService" />
126+
<service android:name="us.shandian.giga.service.DownloadManagerService"
127+
android:foregroundServiceType="dataSync" />
124128

125129
<activity
126130
android:name=".util.FilePickerActivityHelper"

app/src/main/java/org/schabi/newpipe/MainActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import androidx.appcompat.app.ActionBarDrawerToggle;
5050
import androidx.appcompat.app.AppCompatActivity;
5151
import androidx.core.app.ActivityCompat;
52+
import androidx.core.content.ContextCompat;
5253
import androidx.core.view.GravityCompat;
5354
import androidx.drawerlayout.widget.DrawerLayout;
5455
import androidx.fragment.app.Fragment;
@@ -876,7 +877,8 @@ public void onReceive(final Context context, final Intent intent) {
876877
};
877878
final IntentFilter intentFilter = new IntentFilter();
878879
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
879-
registerReceiver(broadcastReceiver, intentFilter);
880+
ContextCompat.registerReceiver(this, broadcastReceiver, intentFilter,
881+
ContextCompat.RECEIVER_EXPORTED);
880882

881883
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
882884
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.

app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.widget.Toast
1010
import androidx.core.app.NotificationCompat
1111
import androidx.core.app.NotificationManagerCompat
1212
import androidx.core.app.PendingIntentCompat
13+
import androidx.core.content.ContextCompat
1314
import androidx.fragment.app.Fragment
1415
import androidx.preference.PreferenceManager
1516
import com.google.android.material.snackbar.Snackbar
@@ -136,9 +137,11 @@ class ErrorUtil {
136137
NotificationManagerCompat.from(context)
137138
.notify(ERROR_REPORT_NOTIFICATION_ID, notificationBuilder.build())
138139

139-
// since the notification is silent, also show a toast, otherwise the user is confused
140-
Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT)
141-
.show()
140+
ContextCompat.getMainExecutor(context).execute {
141+
// since the notification is silent, also show a toast, otherwise the user is confused
142+
Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT)
143+
.show()
144+
}
142145
}
143146

144147
private fun getErrorActivityIntent(context: Context, errorInfo: ErrorInfo): Intent {

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,8 @@ public void onReceive(final Context context, final Intent intent) {
14281428
intentFilter.addAction(ACTION_SHOW_MAIN_PLAYER);
14291429
intentFilter.addAction(ACTION_HIDE_MAIN_PLAYER);
14301430
intentFilter.addAction(ACTION_PLAYER_STARTED);
1431-
activity.registerReceiver(broadcastReceiver, intentFilter);
1431+
ContextCompat.registerReceiver(activity, broadcastReceiver, intentFilter,
1432+
ContextCompat.RECEIVER_EXPORTED);
14321433
}
14331434

14341435

app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import androidx.core.app.NotificationCompat
3131
import androidx.core.app.NotificationManagerCompat
3232
import androidx.core.app.PendingIntentCompat
3333
import androidx.core.app.ServiceCompat
34+
import androidx.core.content.ContextCompat
3435
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
3536
import io.reactivex.rxjava3.core.Flowable
3637
import io.reactivex.rxjava3.disposables.Disposable
@@ -200,7 +201,7 @@ class FeedLoadService : Service() {
200201
}
201202
}
202203
}
203-
registerReceiver(broadcastReceiver, IntentFilter(ACTION_CANCEL))
204+
ContextCompat.registerReceiver(this, broadcastReceiver, IntentFilter(ACTION_CANCEL), ContextCompat.RECEIVER_NOT_EXPORTED)
204205
}
205206

206207
// /////////////////////////////////////////////////////////////////////////

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
import androidx.annotation.NonNull;
6464
import androidx.annotation.Nullable;
65+
import androidx.core.content.ContextCompat;
6566
import androidx.core.math.MathUtils;
6667
import androidx.preference.PreferenceManager;
6768

@@ -880,7 +881,8 @@ private void onBroadcastReceived(final Intent intent) {
880881
private void registerBroadcastReceiver() {
881882
// Try to unregister current first
882883
unregisterBroadcastReceiver();
883-
context.registerReceiver(broadcastReceiver, intentFilter);
884+
ContextCompat.registerReceiver(context, broadcastReceiver, intentFilter,
885+
ContextCompat.RECEIVER_EXPORTED);
884886
}
885887

886888
private void unregisterBroadcastReceiver() {

app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,15 @@ internal class PackageValidator(context: Context) {
147147
private fun buildCallerInfo(callingPackage: String): CallerPackageInfo? {
148148
val packageInfo = getPackageInfo(callingPackage) ?: return null
149149

150-
val appName = packageInfo.applicationInfo.loadLabel(packageManager).toString()
151-
val uid = packageInfo.applicationInfo.uid
150+
val appName = packageInfo.applicationInfo?.loadLabel(packageManager).toString()
151+
val uid = packageInfo.applicationInfo?.uid ?: -1
152152
val signature = getSignature(packageInfo)
153153

154-
val requestedPermissions = packageInfo.requestedPermissions
155-
val permissionFlags = packageInfo.requestedPermissionsFlags
156-
val activePermissions = mutableSetOf<String>()
157-
requestedPermissions?.forEachIndexed { index, permission ->
158-
if (permissionFlags[index] and REQUESTED_PERMISSION_GRANTED != 0) {
159-
activePermissions += permission
160-
}
161-
}
154+
val requestedPermissions = packageInfo.requestedPermissions?.asSequence().orEmpty()
155+
val permissionFlags = packageInfo.requestedPermissionsFlags?.asSequence().orEmpty()
156+
val activePermissions = (requestedPermissions zip permissionFlags)
157+
.filter { (permission, flag) -> flag and REQUESTED_PERMISSION_GRANTED != 0 }
158+
.mapTo(mutableSetOf()) { (permission, flag) -> permission }
162159

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- Base Theme -->
5+
<style name="Base.V35" parent="Base.V29">
6+
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
7+
</style>
8+
<style name="Base" parent="Base.V35"/>
9+
10+
<!-- Light Theme -->
11+
<style name="Base.V35.LightTheme" parent="Base.V29.LightTheme">
12+
</style>
13+
<style name="Base.LightTheme" parent="Base.V35.LightTheme" />
14+
15+
<!-- Dark Theme -->
16+
<style name="Base.V35.DarkTheme" parent="Base.V29.DarkTheme">
17+
18+
</style>
19+
<style name="Base.DarkTheme" parent="Base.V35.DarkTheme" />
20+
21+
<!-- Black Theme -->
22+
<style name="Base.V35.BlackTheme" parent="Base.V29.BlackTheme">
23+
24+
</style>
25+
<style name="Base.BlackTheme" parent="Base.V35.BlackTheme" />
26+
27+
</resources>

0 commit comments

Comments
 (0)