towards android 12 fixing

This commit is contained in:
Hemanth S 2021-11-08 21:43:49 +05:30 committed by Prathamesh More
parent c7d158f860
commit 19c1bafeb8
5 changed files with 99 additions and 97 deletions

View file

@ -9,14 +9,14 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 31
renderscriptTargetApi 29//must match target sdk and build tools
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 10519
versionName '5.0.0' + "_" + getDate()
versionCode 10537
versionName '5.2.1 ' + "_" + getDate()
buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
}

View file

@ -35,6 +35,7 @@
tools:targetApi="m">
<activity
android:name=".activities.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/SplashTheme">
<intent-filter>
@ -147,7 +148,8 @@
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">
android:theme="@style/Theme.AppCompat.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
@ -176,13 +178,17 @@
android:resource="@xml/provider_paths" />
</provider>
<receiver android:name=".service.MediaButtonIntentReceiver">
<receiver
android:name=".service.MediaButtonIntentReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<receiver android:name=".appwidgets.BootReceiver">
<receiver
android:name=".appwidgets.BootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
@ -274,17 +280,6 @@
android:name="com.android.vending.splits.required"
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 -->
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"

View file

@ -1594,11 +1594,14 @@ public class MusicService extends MediaBrowserServiceCompat
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(mediaButtonReceiverComponentName);
PendingIntent mediaButtonReceiverPendingIntent =
PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
PendingIntent mediaButtonReceiverPendingIntent;
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 =
new MediaSessionCompat(
mediaSession = new MediaSessionCompat(
this,
"RetroMusicPlayer",
mediaButtonReceiverComponentName,

View file

@ -69,13 +69,21 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel)
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
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)
}
val serviceName = ComponentName(service, MusicService::class.java)
val intent = Intent(ACTION_QUIT)
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
.getDimensionPixelSize(R.dimen.notification_big_image_size)
service.runOnUiThread {
@ -191,6 +199,6 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
val serviceName = ComponentName(service, MusicService::class.java)
val intent = Intent(action)
intent.component = serviceName
return PendingIntent.getService(service, 0, intent, 0)
return PendingIntent.getService(service, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
}
}

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<automotiveApp>
<uses name="media" />
</automotiveApp>