Enabled WRITE_EXTERNAL_STORAGE for A10 to avoid crashes

This commit is contained in:
Prathamesh More 2022-06-11 19:02:00 +05:30
parent 3aea91eb1e
commit 192b5c2ac7
4 changed files with 7 additions and 9 deletions

View file

@ -51,7 +51,7 @@ android {
} }
} }
lint { lint {
disable 'MissingTranslation', 'ImpliedQuantity' warning 'MissingTranslation', 'ImpliedQuantity', 'Instantiatable'
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8

View file

@ -13,7 +13,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" /> android:maxSdkVersion="29" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" />

View file

@ -191,7 +191,7 @@ abstract class AbsMusicServiceActivity : AbsBaseActivity(), IMusicServiceEventLi
override fun getPermissionsToRequest(): Array<String> { override fun getPermissionsToRequest(): Array<String> {
return mutableListOf(Manifest.permission.READ_EXTERNAL_STORAGE).apply { return mutableListOf(Manifest.permission.READ_EXTERNAL_STORAGE).apply {
if (!VersionUtils.hasQ()) { if (!VersionUtils.hasR()) {
add(Manifest.permission.WRITE_EXTERNAL_STORAGE) add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
} }
}.toTypedArray() }.toTypedArray()

View file

@ -754,11 +754,11 @@ class MusicService : MediaBrowserServiceCompat(),
this.position = position this.position = position
openCurrent { success -> openCurrent { success ->
completion(success) completion(success)
notifyChange(META_CHANGED)
notHandledMetaChangedForCurrentTrack = false
if (success) { if (success) {
prepareNextImpl() prepareNextImpl()
} }
notifyChange(META_CHANGED)
notHandledMetaChangedForCurrentTrack = false
} }
} }
@ -1088,11 +1088,9 @@ class MusicService : MediaBrowserServiceCompat(),
// We must call updateMediaSessionPlaybackState after the load of album art is completed // We must call updateMediaSessionPlaybackState after the load of album art is completed
// if we are loading it or it won't be updated in the notification // if we are loading it or it won't be updated in the notification
updateMediaSessionMetaData(::updateMediaSessionPlaybackState) updateMediaSessionMetaData(::updateMediaSessionPlaybackState)
savePosition()
savePositionInTrack()
serviceScope.launch(IO) { serviceScope.launch(IO) {
withContext(Main) {
savePosition()
savePositionInTrack()
}
val currentSong = currentSong val currentSong = currentSong
HistoryStore.getInstance(this@MusicService).addSongId(currentSong.id) HistoryStore.getInstance(this@MusicService).addSongId(currentSong.id)
if (songPlayCountHelper.shouldBumpPlayCount()) { if (songPlayCountHelper.shouldBumpPlayCount()) {