Skip to content

Commit 69e8e4d

Browse files
authored
Merge pull request #9306 from Stypox/target-api-33
Set compileSdk and targetSdk to 33 (Android 13)
2 parents 231e677 + 9d01d88 commit 69e8e4d

5 files changed

Lines changed: 74 additions & 34 deletions

File tree

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ plugins {
88
}
99

1010
android {
11-
compileSdk 32
11+
compileSdk 33
1212
namespace 'org.schabi.newpipe'
1313

1414
defaultConfig {
1515
applicationId "org.schabi.newpipe"
1616
resValue "string", "app_name", "NewPipe"
1717
minSdk 21
18-
targetSdk 29
18+
targetSdk 33
1919
versionCode 991
2020
versionName "0.24.1"
2121

@@ -107,7 +107,7 @@ ext {
107107
groupieVersion = '2.10.1'
108108
markwonVersion = '4.6.2'
109109

110-
leakCanaryVersion = '2.5'
110+
leakCanaryVersion = '2.9.1'
111111
stethoVersion = '1.6.0'
112112
mockitoVersion = '4.0.0'
113113
assertJVersion = '3.23.1'

app/src/main/AndroidManifest.xml

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
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.POST_NOTIFICATIONS"/>
1213

1314
<uses-feature
1415
android:name="android.hardware.touchscreen"
@@ -24,11 +25,12 @@
2425
android:icon="@mipmap/ic_launcher"
2526
android:label="@string/app_name"
2627
android:logo="@mipmap/ic_launcher"
27-
android:theme="@style/OpeningTheme"
2828
android:resizeableActivity="true"
29+
android:theme="@style/OpeningTheme"
2930
tools:ignore="AllowBackup">
3031
<activity
3132
android:name=".MainActivity"
33+
android:exported="true"
3234
android:label="@string/app_name"
3335
android:launchMode="singleTask">
3436
<intent-filter>
@@ -39,15 +41,17 @@
3941
</intent-filter>
4042
</activity>
4143

42-
<receiver android:name="androidx.media.session.MediaButtonReceiver">
44+
<receiver
45+
android:name="androidx.media.session.MediaButtonReceiver"
46+
android:exported="true">
4347
<intent-filter>
4448
<action android:name="android.intent.action.MEDIA_BUTTON" />
4549
</intent-filter>
4650
</receiver>
4751

4852
<service
4953
android:name=".player.PlayerService"
50-
android:exported="false"
54+
android:exported="true"
5155
android:foregroundServiceType="mediaPlayback">
5256
<intent-filter>
5357
<action android:name="android.intent.action.MEDIA_BUTTON" />
@@ -56,15 +60,18 @@
5660

5761
<activity
5862
android:name=".player.PlayQueueActivity"
63+
android:exported="false"
5964
android:label="@string/title_activity_play_queue"
6065
android:launchMode="singleTask" />
6166

6267
<activity
6368
android:name=".settings.SettingsActivity"
69+
android:exported="false"
6470
android:label="@string/settings" />
6571

6672
<activity
6773
android:name=".about.AboutActivity"
74+
android:exported="false"
6875
android:label="@string/title_activity_about" />
6976

7077
<service android:name=".local.subscription.services.SubscriptionsImportService" />
@@ -73,6 +80,7 @@
7380

7481
<activity
7582
android:name=".PanicResponderActivity"
83+
android:exported="true"
7684
android:launchMode="singleInstance"
7785
android:noHistory="true"
7886
android:theme="@android:style/Theme.NoDisplay">
@@ -85,20 +93,26 @@
8593

8694
<activity
8795
android:name=".ExitActivity"
96+
android:exported="false"
8897
android:label="@string/general_error"
8998
android:theme="@android:style/Theme.NoDisplay" />
90-
<activity android:name=".error.ErrorActivity" />
99+
100+
<activity
101+
android:name=".error.ErrorActivity"
102+
android:exported="false" />
91103

92104
<!-- giga get related -->
93105
<activity
94106
android:name=".download.DownloadActivity"
107+
android:exported="false"
95108
android:label="@string/app_name"
96109
android:launchMode="singleTask" />
97110

98111
<service android:name="us.shandian.giga.service.DownloadManagerService" />
99112

100113
<activity
101114
android:name=".util.FilePickerActivityHelper"
115+
android:exported="true"
102116
android:label="@string/app_name"
103117
android:theme="@style/FilePickerThemeDark">
104118
<intent-filter>
@@ -109,6 +123,7 @@
109123

110124
<activity
111125
android:name=".error.ReCaptchaActivity"
126+
android:exported="false"
112127
android:label="@string/recaptcha" />
113128

114129
<provider
@@ -124,6 +139,7 @@
124139
<activity
125140
android:name=".RouterActivity"
126141
android:excludeFromRecents="true"
142+
android:exported="true"
127143
android:label="@string/preferred_open_action_share_menu_title"
128144
android:taskAffinity=""
129145
android:theme="@style/RouterActivityThemeDark">
@@ -353,30 +369,30 @@
353369

354370
<!-- Bandcamp filter for tracks, albums and playlists -->
355371
<intent-filter>
356-
<action android:name="android.intent.action.VIEW"/>
357-
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
358-
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
372+
<action android:name="android.intent.action.VIEW" />
373+
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
374+
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
359375

360-
<category android:name="android.intent.category.DEFAULT"/>
361-
<category android:name="android.intent.category.BROWSABLE"/>
376+
<category android:name="android.intent.category.DEFAULT" />
377+
<category android:name="android.intent.category.BROWSABLE" />
362378

363-
<data android:scheme="http"/>
364-
<data android:scheme="https"/>
365-
<data android:host="*.bandcamp.com"/>
379+
<data android:scheme="http" />
380+
<data android:scheme="https" />
381+
<data android:host="*.bandcamp.com" />
366382
</intent-filter>
367383

368384
<!-- Bandcamp filter for radio -->
369385
<intent-filter>
370-
<action android:name="android.intent.action.VIEW"/>
371-
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
372-
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
386+
<action android:name="android.intent.action.VIEW" />
387+
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
388+
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
373389

374-
<category android:name="android.intent.category.DEFAULT"/>
375-
<category android:name="android.intent.category.BROWSABLE"/>
390+
<category android:name="android.intent.category.DEFAULT" />
391+
<category android:name="android.intent.category.BROWSABLE" />
376392

377-
<data android:scheme="http"/>
378-
<data android:scheme="https"/>
379-
<data android:sspPattern="bandcamp.com/?show=*"/>
393+
<data android:scheme="http" />
394+
<data android:scheme="https" />
395+
<data android:sspPattern="bandcamp.com/?show=*" />
380396
</intent-filter>
381397

382398
</activity>
@@ -385,11 +401,17 @@
385401
android:exported="false" />
386402

387403
<!-- opting out of sending metrics to Google in Android System WebView -->
388-
<meta-data android:name="android.webkit.WebView.MetricsOptOut" android:value="true" />
404+
<meta-data
405+
android:name="android.webkit.WebView.MetricsOptOut"
406+
android:value="true" />
389407
<!-- see https://github.com/TeamNewPipe/NewPipe/issues/3947 -->
390408
<!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
391-
<meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
409+
<meta-data
410+
android:name="com.samsung.android.keepalive.density"
411+
android:value="true" />
392412
<!-- Version >= 3.0. DeX Dual Mode support -->
393-
<meta-data android:name="com.samsung.android.multidisplay.keep_process_alive" android:value="true"/>
413+
<meta-data
414+
android:name="com.samsung.android.multidisplay.keep_process_alive"
415+
android:value="true" />
394416
</application>
395417
</manifest>

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ protected void onCreate(final Bundle savedInstanceState) {
157157
}
158158
openMiniPlayerUponPlayerStarted();
159159

160-
// Schedule worker for checking for new streams and creating corresponding notifications
161-
// if this is enabled by the user.
162-
NotificationWorker.initialize(this);
160+
if (PermissionHelper.checkPostNotificationsPermission(this,
161+
PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE)) {
162+
// Schedule worker for checking for new streams and creating corresponding notifications
163+
// if this is enabled by the user.
164+
NotificationWorker.initialize(this);
165+
}
163166
}
164167

165168
@Override
@@ -599,6 +602,9 @@ public void onRequestPermissionsResult(final int requestCode,
599602
((VideoDetailFragment) fragment).openDownloadDialog();
600603
}
601604
break;
605+
case PermissionHelper.POST_NOTIFICATIONS_REQUEST_CODE:
606+
NotificationWorker.initialize(this);
607+
break;
602608
}
603609
}
604610

app/src/main/java/org/schabi/newpipe/player/gesture/PopupPlayerGestureListener.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ class PopupPlayerGestureListener(
160160
}
161161
}
162162

163-
override fun onLongPress(e: MotionEvent?) {
163+
override fun onLongPress(e: MotionEvent) {
164164
playerUi.updateScreenSize()
165165
playerUi.checkPopupPositionBounds()
166166
playerUi.changePopupSize(playerUi.screenWidth)
167167
}
168168

169169
override fun onFling(
170-
e1: MotionEvent?,
171-
e2: MotionEvent?,
170+
e1: MotionEvent,
171+
e2: MotionEvent,
172172
velocityX: Float,
173173
velocityY: Float
174174
): Boolean {

app/src/main/java/org/schabi/newpipe/util/PermissionHelper.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.schabi.newpipe.settings.NewPipeSettings;
2222

2323
public final class PermissionHelper {
24+
public static final int POST_NOTIFICATIONS_REQUEST_CODE = 779;
2425
public static final int DOWNLOAD_DIALOG_REQUEST_CODE = 778;
2526
public static final int DOWNLOADS_REQUEST_CODE = 777;
2627

@@ -71,8 +72,7 @@ public static boolean checkWriteStoragePermissions(final Activity activity,
7172

7273
// No explanation needed, we can request the permission.
7374
ActivityCompat.requestPermissions(activity,
74-
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
75-
requestCode);
75+
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, requestCode);
7676

7777
// PERMISSION_WRITE_STORAGE is an
7878
// app-defined int constant. The callback method gets the
@@ -83,6 +83,18 @@ public static boolean checkWriteStoragePermissions(final Activity activity,
8383
return true;
8484
}
8585

86+
public static boolean checkPostNotificationsPermission(final Activity activity,
87+
final int requestCode) {
88+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
89+
&& ContextCompat.checkSelfPermission(activity,
90+
Manifest.permission.POST_NOTIFICATIONS)
91+
!= PackageManager.PERMISSION_GRANTED) {
92+
ActivityCompat.requestPermissions(activity,
93+
new String[] {Manifest.permission.POST_NOTIFICATIONS}, requestCode);
94+
return false;
95+
}
96+
return true;
97+
}
8698

8799
/**
88100
* In order to be able to draw over other apps,

0 commit comments

Comments
 (0)