Skip to content

Commit

Permalink
meta: remove access_network_state perm [OxygenCobalt#22]
Browse files Browse the repository at this point in the history
ExoPlayer's online functionality will cause the library to request the
ACCESS_NETWORK_STATE permission. We don't need this since we use
ExoPlayer for local playback only. For simplicity [and to remove a
weird suspicious permission, we just disable it]
  • Loading branch information
OxygenCobalt committed Jul 2, 2021
1 parent 7b5e817 commit f1f2fcf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.oxycblt.auxio">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Workaround for ExoPlayer's online functionality requiring unnecessary permissions -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove"/>

<queries />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.oxycblt.auxio.playback.state.PlaybackStateManager

/**
* Nightmarish class that coordinates communication between [MediaSessionCompat], [Player],
* and [PlaybackStateManager]
* and [PlaybackStateManager].
*/
class PlaybackSessionConnector(
private val context: Context,
Expand Down Expand Up @@ -106,6 +106,9 @@ class PlaybackSessionConnector(
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, song.album.name)
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, song.duration)

// Load the cover asynchronously. This is the entire reason I don't use a plain
// MediaSessionConnector, which AFAIK makes it impossible to load this the way I do
// without a bunch of stupid race conditions.
loadBitmap(context, song) { bitmap ->
builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap)
mediaSession.setMetadata(builder.build())
Expand Down
4 changes: 2 additions & 2 deletions info/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Contains all the detail UIs for some data types in Auxio. All detail user interf

#### `.library`

The UI and adapters for the library view in Auxio, `LibraryViewModel` handles the sorting and which data to display in the fragment, while `LibraryFragment` and `LibraryAdapter` display the data.
The UI and adapters for the library view in Auxio, `LibraryViewModel` handles the sorting and which data to display in the fragment, while `LibraryFragment` and `LibraryAdapter` displays the data.

#### `.music`

Expand Down Expand Up @@ -166,7 +166,7 @@ PlaybackStateManager───────────────────┘

`PlaybackStateManager` is the shared object that contains the master copy of the playback state, doing all operations on it. This object should ***NEVER*** be used in a UI, as it does not sanitize input and can cause major problems if a Volatile UI interacts with it. It's callback system is also prone to memory leaks if not cleared when done. `PlaybackViewModel` should be used instead, as it exposes stable data and safe functions that UIs can use to interact with the playback state.

`PlaybackService`'s job is to use the playback state to manage the ExoPlayer instance and notification and also modify the state depending on system events, such as when a button is pressed on a headset. It should **never** be bound to, mostly because there is no need given that `PlaybackViewModel` exposes the same data in a much safer fashion.
`PlaybackService`'s job is to use the playback state to manage the ExoPlayer instance and notification and also modify the state depending on system events, such as when a button is pressed on a headset. It should **never** be bound to, mostly because there is no need given that `PlaybackViewModel` exposes the same data in a much safer fashion. `PlaybackService` also controls the `PlaybackSessionConnector` and `AudioReactor` classes, which manage the `MediaSession` and `AudioFocus` state respectively.

#### `.recycler`

Expand Down
7 changes: 4 additions & 3 deletions info/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ Auxio is local music player for android that I built for myself, primarily. Its

## Where can I download Auxio?

Currently, its available on the [IzzyOnDroid F-Droid repository](https://apt.izzysoft.de/fdroid/). I still want to make some changes and get feedback before I submit it to the mainline F-Droid repository, but it will arrive there eventually.
Auxio is available on the [F-Droid](https://f-droid.org/en/packages/org.oxycblt.auxio/) repository.

## Can I translate Auxio to my native language?

See the [Translations](https://github.com/OxygenCobalt/Auxio/issues/3) issue for guidance on how to create translations and submit them to the project. Any contributions are appreciated.
See the [Translations](https://github.com/OxygenCobalt/Auxio/issues/3) issue for guidance on how to create translations and submit them to the project. Any contributions are appreciated and
tend to always be accepted.

## How can I contribute/report issues?

Open an [Issue](https://github.com/OxygenCobalt/Auxio/issues) or a [Pull Request](https://github.com/OxygenCobalt/Auxio/pulls), please note the [Contribution Guidelines](../.github/CONTRIBUTING.md) and [Accepted Additions](ADDITIONS.md) however.

## Why ExoPlayer?

ExoPlayer is far more flexible than the native MediaPlayer API, which allows Auxio to have consistent behavior across devices & OEMs, along with allowing Auxio to be extended to music sources outside of local files. You can read more about the benefits (and drawbacks) of ExoPlayer [Here](https://exoplayer.dev/pros-and-cons.html).
ExoPlayer is far more flexible than the native MediaPlayer API, which allows consistent behavior across devices & OEMs amd the ability to be extended to music sources outside of local files. You can read more about the benefits (and drawbacks) of ExoPlayer [Here](https://exoplayer.dev/pros-and-cons.html).

## Why cant I have a custom accent?

Expand Down

0 comments on commit f1f2fcf

Please sign in to comment.