make SDK33 happy

We have to upgrade the minsdk level to android 8 - which was released in 2017; 5 years ago.
This commit is contained in:
Adrian Ulrich 2022-09-05 21:18:24 +02:00
parent fcb0941e7b
commit c3175f756d
10 changed files with 59 additions and 46 deletions

View File

@ -29,8 +29,8 @@ android {
dependencies {
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.media:media:1.2.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.media:media:1.6.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'junit:junit:4.12'
compileOnly 'androidx.annotation:annotation:1.0.0'
}

View File

@ -69,6 +69,7 @@ THE SOFTWARE.
<activity
android:name="LibraryActivity"
android:theme="@style/Library"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -93,7 +94,8 @@ THE SOFTWARE.
android:launchMode="singleInstance" />
<receiver
android:name=".OneCellWidget"
android:label="Vanilla Music 1x1">
android:label="Vanilla Music 1x1"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -103,7 +105,8 @@ THE SOFTWARE.
</receiver>
<receiver
android:name=".FourLongWidget"
android:label="Vanilla Music 4x1 A">
android:label="Vanilla Music 4x1 A"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -113,7 +116,8 @@ THE SOFTWARE.
</receiver>
<receiver
android:name=".FourWhiteWidget"
android:label="Vanilla Music 4x1 White">
android:label="Vanilla Music 4x1 White"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -123,7 +127,8 @@ THE SOFTWARE.
</receiver>
<receiver
android:name=".WidgetE"
android:label="Vanilla Music 4x1 B">
android:label="Vanilla Music 4x1 B"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -133,7 +138,8 @@ THE SOFTWARE.
</receiver>
<receiver
android:name=".FourSquareWidget"
android:label="Vanilla Music 2x2 A">
android:label="Vanilla Music 2x2 A"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -143,7 +149,8 @@ THE SOFTWARE.
</receiver>
<receiver
android:name=".WidgetD"
android:label="Vanilla Music 2x2 B">
android:label="Vanilla Music 2x2 B"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@ -151,12 +158,14 @@ THE SOFTWARE.
android:name="android.appwidget.provider"
android:resource="@xml/widget_d" />
</receiver>
<receiver android:name="MediaButtonReceiver" >
<receiver android:name="MediaButtonReceiver"
android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<service android:name="PlaybackService">
<service android:name="PlaybackService"
android:exported="false">
<intent-filter>
<action android:name="ch.blinkenlights.android.vanilla.action.PLAY" />
<action android:name="ch.blinkenlights.android.vanilla.action.PAUSE" />
@ -169,7 +178,7 @@ THE SOFTWARE.
<service
android:name=".ScheduledLibraryUpdate"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"/>
android:exported="true" />
<activity
android:name="PreferencesActivity" />
@ -187,14 +196,17 @@ THE SOFTWARE.
<activity
android:name="ShortcutPseudoActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name="AudioPickerActivity" android:theme="@style/PopupDialog"
android:excludeFromRecents="true" android:exported="true" >
<activity android:name="AudioPickerActivity"
android:theme="@style/PopupDialog"
android:excludeFromRecents="true"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@ -218,6 +230,7 @@ THE SOFTWARE.
</activity>
<activity android:name="AudioSearchActivity" android:theme="@style/PopupDialog"
android:exported="true"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />

View File

@ -127,16 +127,16 @@ public class FourLongWidget extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.cover, pendingIntent);
views.setOnClickPendingIntent(R.id.text_layout, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
manager.updateAppWidget(new ComponentName(context, FourLongWidget.class), views);

View File

@ -129,16 +129,16 @@ public class FourSquareWidget extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.title, pendingIntent);
views.setOnClickPendingIntent(R.id.artist, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
manager.updateAppWidget(new ComponentName(context, FourSquareWidget.class), views);

View File

@ -131,20 +131,20 @@ public class FourWhiteWidget extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.cover, pendingIntent);
views.setOnClickPendingIntent(R.id.text_layout, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.previous, pendingIntent);
manager.updateAppWidget(new ComponentName(context, FourWhiteWidget.class), views);

View File

@ -103,11 +103,11 @@ public class OneCellWidget extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = ShortcutPseudoActivity.getIntent(context, doubleTap ? PlaybackService.ACTION_TOGGLE_PLAYBACK_DELAYED : PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, doubleTap ? PlaybackService.ACTION_NEXT_SONG_DELAYED : PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);

View File

@ -2088,11 +2088,11 @@ public final class PlaybackService extends Service
case NOT_ACTION_NEXT_SONG: {
Intent intent = new Intent(this, PlaybackService.class);
intent.setAction(PlaybackService.ACTION_NEXT_SONG_AUTOPLAY);
return PendingIntent.getService(this, 0, intent, 0);
return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
case NOT_ACTION_MINI_ACTIVITY: {
Intent intent = new Intent(this, MiniPlaybackActivity.class);
return PendingIntent.getActivity(this, 0, intent, 0);
return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
default:
Log.w("VanillaMusic", "Unknown value for notification_action. Defaulting to 0.");
@ -2100,12 +2100,12 @@ public final class PlaybackService extends Service
case NOT_ACTION_MAIN_ACTIVITY: {
Intent intent = new Intent(this, LibraryActivity.class);
intent.setAction(Intent.ACTION_MAIN);
return PendingIntent.getActivity(this, 0, intent, 0);
return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
case NOT_ACTION_FULL_ACTIVITY: {
Intent intent = new Intent(this, FullPlaybackActivity.class);
intent.setAction(Intent.ACTION_MAIN);
return PendingIntent.getActivity(this, 0, intent, 0);
return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
}
}
@ -2146,11 +2146,11 @@ public final class PlaybackService extends Service
.setSubText(song.artist)
.setContentIntent(mNotificationAction)
.addAction(new NotificationCompat.Action(R.drawable.previous,
getString(R.string.previous_song), PendingIntent.getService(this, 0, previous, 0)))
getString(R.string.previous_song), PendingIntent.getService(this, 0, previous, PendingIntent.FLAG_IMMUTABLE)))
.addAction(new NotificationCompat.Action(playButton,
getString(R.string.play_pause), PendingIntent.getService(this, 0, playPause, 0)))
getString(R.string.play_pause), PendingIntent.getService(this, 0, playPause, PendingIntent.FLAG_IMMUTABLE)))
.addAction(new NotificationCompat.Action(R.drawable.next,
getString(R.string.next_song), PendingIntent.getService(this, 0, next, 0)))
getString(R.string.next_song), PendingIntent.getService(this, 0, next, PendingIntent.FLAG_IMMUTABLE)))
.setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
.setMediaSession(mMediaSessionTracker.getSessionToken())
.setShowActionsInCompactView(0, 1, 2))

View File

@ -124,27 +124,27 @@ public class WidgetD extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.cover, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.previous, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_SHUFFLE);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.shuffle, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_REPEAT);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.end_action, pendingIntent);
manager.updateAppWidget(new ComponentName(context, WidgetD.class), views);

View File

@ -114,28 +114,28 @@ public class WidgetE extends AppWidgetProvider {
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;
intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.title, pendingIntent);
views.setOnClickPendingIntent(R.id.artist, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.previous, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_SHUFFLE);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.shuffle, pendingIntent);
intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_REPEAT);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
views.setOnClickPendingIntent(R.id.end_action, pendingIntent);
manager.updateAppWidget(new ComponentName(context, WidgetE.class), views);

View File

@ -16,5 +16,5 @@ allprojects {
ext {
compileSdkVersion = 33
targetSdkVersion = 33
minSdkVersion = 15
minSdkVersion = 26
}