Skip to content

Commit be662a9

Browse files
Merge branch 'dev' into Merge-dev-to-refactor
# Conflicts: # app/build.gradle # app/src/main/AndroidManifest.xml # app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java # app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt
2 parents 1534c88 + 22a709d commit be662a9

File tree

13 files changed

+69
-25
lines changed

13 files changed

+69
-25
lines changed

.github/workflows/ci.yml

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

7979
permissions:

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ plugins {
1717
}
1818

1919
android {
20-
compileSdk 35
20+
compileSdk 36
2121
namespace 'org.schabi.newpipe'
2222

2323
defaultConfig {
2424
applicationId "org.schabi.newpipe"
2525
resValue "string", "app_name", "NewPipe"
2626
minSdk 21
27-
targetSdk 33
27+
targetSdk 35
2828
if (System.properties.containsKey('versionCodeOverride')) {
2929
versionCode System.getProperty('versionCodeOverride') as Integer
3030
} else {

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
1111
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
1212
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
13+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
1314
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1415

1516
<!-- We need to be able to open links in the browser on API 30+ -->
@@ -104,7 +105,10 @@
104105
android:name="androidx.work.impl.foreground.SystemForegroundService"
105106
android:foregroundServiceType="dataSync"
106107
tools:node="merge" />
107-
<service android:name=".local.feed.service.FeedLoadService" />
108+
109+
<service
110+
android:name=".local.feed.service.FeedLoadService"
111+
android:foregroundServiceType="dataSync" />
108112

109113
<activity
110114
android:name=".PanicResponderActivity"
@@ -136,7 +140,9 @@
136140
android:label="@string/app_name"
137141
android:launchMode="singleTask" />
138142

139-
<service android:name="us.shandian.giga.service.DownloadManagerService" />
143+
<service
144+
android:name="us.shandian.giga.service.DownloadManagerService"
145+
android:foregroundServiceType="dataSync" />
140146

141147
<activity
142148
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
@@ -47,6 +47,7 @@
4747
import androidx.appcompat.app.ActionBarDrawerToggle;
4848
import androidx.appcompat.app.AppCompatActivity;
4949
import androidx.core.app.ActivityCompat;
50+
import androidx.core.content.ContextCompat;
5051
import androidx.core.view.GravityCompat;
5152
import androidx.drawerlayout.widget.DrawerLayout;
5253
import androidx.fragment.app.Fragment;
@@ -868,7 +869,8 @@ public void onReceive(final Context context, final Intent intent) {
868869
};
869870
final IntentFilter intentFilter = new IntentFilter();
870871
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
871-
registerReceiver(broadcastReceiver, intentFilter);
872+
ContextCompat.registerReceiver(this, broadcastReceiver, intentFilter,
873+
ContextCompat.RECEIVER_EXPORTED);
872874

873875
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
874876
// 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.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ class VideoDetailFragment :
13021302
intentFilter.addAction(ACTION_SHOW_MAIN_PLAYER)
13031303
intentFilter.addAction(ACTION_HIDE_MAIN_PLAYER)
13041304
intentFilter.addAction(ACTION_PLAYER_STARTED)
1305-
activity.registerReceiver(broadcastReceiver, intentFilter)
1305+
ContextCompat.registerReceiver(activity, broadcastReceiver, intentFilter, ContextCompat.RECEIVER_EXPORTED)
13061306
}
13071307

13081308
/*//////////////////////////////////////////////////////////////////////////

app/src/main/java/org/schabi/newpipe/fragments/list/BaseListInfoFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.view.View;
99

1010
import androidx.annotation.NonNull;
11+
import androidx.annotation.Nullable;
1112

1213
import com.evernote.android.state.State;
1314

@@ -42,6 +43,7 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
4243

4344
private final UserAction errorUserAction;
4445
protected L currentInfo;
46+
@Nullable
4547
protected Page currentNextPage;
4648
protected Disposable currentWorker;
4749

app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
146146

147147
private final SparseArrayCompat<String> menuItemToFilterName = new SparseArrayCompat<>();
148148
private StreamingService service;
149+
@Nullable
149150
private Page nextPage;
150151
private boolean showLocalSuggestions = true;
151152
private boolean showRemoteSuggestions = true;
@@ -1096,7 +1097,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage<?> result) {
10961097
infoListAdapter.addInfoItemList(result.getItems());
10971098
nextPage = result.getNextPage();
10981099

1099-
if (!result.getErrors().isEmpty()) {
1100+
if (!result.getErrors().isEmpty() && nextPage != null) {
11001101
showSnackBarError(new ErrorInfo(result.getErrors(), UserAction.SEARCHED,
11011102
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
11021103
+ "pageIds: " + nextPage.getIds() + ", "

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
@@ -60,6 +60,7 @@
6060

6161
import androidx.annotation.NonNull;
6262
import androidx.annotation.Nullable;
63+
import androidx.core.content.ContextCompat;
6364
import androidx.core.math.MathUtils;
6465
import androidx.preference.PreferenceManager;
6566

@@ -767,7 +768,8 @@ private void onBroadcastReceived(final Intent intent) {
767768
private void registerBroadcastReceiver() {
768769
// Try to unregister current first
769770
unregisterBroadcastReceiver();
770-
context.registerReceiver(broadcastReceiver, intentFilter);
771+
ContextCompat.registerReceiver(context, broadcastReceiver, intentFilter,
772+
ContextCompat.RECEIVER_EXPORTED);
771773
}
772774

773775
private void unregisterBroadcastReceiver() {

0 commit comments

Comments
 (0)