towards android 12 fixing
This commit is contained in:
parent
c7d158f860
commit
19c1bafeb8
5 changed files with 99 additions and 97 deletions
|
@ -9,14 +9,14 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 31
|
||||||
|
|
||||||
renderscriptTargetApi 29//must match target sdk and build tools
|
renderscriptTargetApi 29//must match target sdk and build tools
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
applicationId "code.name.monkey.retromusic"
|
applicationId "code.name.monkey.retromusic"
|
||||||
versionCode 10519
|
versionCode 10537
|
||||||
versionName '5.0.0' + "_" + getDate()
|
versionName '5.2.1 ' + "_" + getDate()
|
||||||
|
|
||||||
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
|
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
tools:targetApi="m">
|
tools:targetApi="m">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MainActivity"
|
android:name=".activities.MainActivity"
|
||||||
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/SplashTheme">
|
android:theme="@style/SplashTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -147,7 +148,8 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.AppCompat.NoActionBar">
|
android:theme="@style/Theme.AppCompat.NoActionBar"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -176,13 +178,17 @@
|
||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
<receiver android:name=".service.MediaButtonIntentReceiver">
|
<receiver
|
||||||
|
android:name=".service.MediaButtonIntentReceiver"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<receiver android:name=".appwidgets.BootReceiver">
|
<receiver
|
||||||
|
android:name=".appwidgets.BootReceiver"
|
||||||
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||||
|
@ -274,17 +280,6 @@
|
||||||
android:name="com.android.vending.splits.required"
|
android:name="com.android.vending.splits.required"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
|
||||||
<!-- Android Auto -->
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.android.gms.car.application"
|
|
||||||
android:resource="@xml/automotive_app_desc" />
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.android.gms.car.application.theme"
|
|
||||||
android:resource="@style/CarTheme" />
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.android.gms.car.notification.SmallIcon"
|
|
||||||
android:resource="@drawable/ic_notification" />
|
|
||||||
|
|
||||||
<!-- ChromeCast -->
|
<!-- ChromeCast -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||||
|
|
|
@ -1594,11 +1594,14 @@ public class MusicService extends MediaBrowserServiceCompat
|
||||||
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
||||||
mediaButtonIntent.setComponent(mediaButtonReceiverComponentName);
|
mediaButtonIntent.setComponent(mediaButtonReceiverComponentName);
|
||||||
|
|
||||||
PendingIntent mediaButtonReceiverPendingIntent =
|
PendingIntent mediaButtonReceiverPendingIntent;
|
||||||
PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
|
||||||
|
mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, PendingIntent.FLAG_MUTABLE);
|
||||||
|
} else {
|
||||||
|
mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
|
||||||
|
}
|
||||||
|
|
||||||
mediaSession =
|
mediaSession = new MediaSessionCompat(
|
||||||
new MediaSessionCompat(
|
|
||||||
this,
|
this,
|
||||||
"RetroMusicPlayer",
|
"RetroMusicPlayer",
|
||||||
mediaButtonReceiverComponentName,
|
mediaButtonReceiverComponentName,
|
||||||
|
|
|
@ -69,13 +69,21 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
|
||||||
action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel)
|
action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel)
|
||||||
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||||
val clickIntent =
|
val clickIntent =
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
} else {
|
||||||
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT)
|
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
}
|
||||||
|
|
||||||
val serviceName = ComponentName(service, MusicService::class.java)
|
val serviceName = ComponentName(service, MusicService::class.java)
|
||||||
val intent = Intent(ACTION_QUIT)
|
val intent = Intent(ACTION_QUIT)
|
||||||
intent.component = serviceName
|
intent.component = serviceName
|
||||||
val deleteIntent = PendingIntent.getService(service, 0, intent, 0)
|
val deleteIntent = PendingIntent.getService(
|
||||||
|
service,
|
||||||
|
0,
|
||||||
|
intent,
|
||||||
|
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
|
)
|
||||||
val bigNotificationImageSize = service.resources
|
val bigNotificationImageSize = service.resources
|
||||||
.getDimensionPixelSize(R.dimen.notification_big_image_size)
|
.getDimensionPixelSize(R.dimen.notification_big_image_size)
|
||||||
service.runOnUiThread {
|
service.runOnUiThread {
|
||||||
|
@ -191,6 +199,6 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
|
||||||
val serviceName = ComponentName(service, MusicService::class.java)
|
val serviceName = ComponentName(service, MusicService::class.java)
|
||||||
val intent = Intent(action)
|
val intent = Intent(action)
|
||||||
intent.component = serviceName
|
intent.component = serviceName
|
||||||
return PendingIntent.getService(service, 0, intent, 0)
|
return PendingIntent.getService(service, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<automotiveApp>
|
|
||||||
<uses name="media" />
|
|
||||||
</automotiveApp>
|
|
Loading…
Reference in a new issue