diff options
-rw-r--r-- | app/build.gradle | 12 | ||||
-rw-r--r-- | app/src/main/AndroidManifest.xml | 18 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java | 2 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java | 7 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java | 15 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Constants.java | 17 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Util.java | 5 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/xml/authenticator.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/xml/changelog.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/xml/mostrecent_syncadapter.xml | 4 | ||||
-rw-r--r-- | app/src/main/res/xml/playlists_syncadapter.xml | 4 | ||||
-rw-r--r-- | app/src/main/res/xml/podcasts_syncadapter.xml | 4 | ||||
-rw-r--r-- | app/src/main/res/xml/searchable.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/xml/starred_syncadapter.xml | 4 |
15 files changed, 69 insertions, 34 deletions
diff --git a/app/build.gradle b/app/build.gradle index 1edbc5e2..d3030d40 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,12 +6,18 @@ android { defaultConfig { applicationId "github.daneren2005.dsub" minSdkVersion 15 - targetSdkVersion 26 - versionCode 203 - versionName '5.5.0' + targetSdkVersion 28 + versionCode 204 + versionName '5.5.1' setProperty("archivesBaseName", "DSub $versionName") resConfigs "de", "es", "fr", "hu", "nl", "pt-rPT", "ru", "sv" vectorDrawables.useSupportLibrary = true + resValue 'string', 'account_type.subsonic', applicationId + ".subsonic" + resValue 'string', 'provider.search', applicationId + ".provider.DSubSearchProvider" + resValue 'string', 'provider.playlist', applicationId + ".playlists.provider" + resValue 'string', 'provider.podcast', applicationId + ".podcasts.provider" + resValue 'string', 'provider.starred', applicationId + ".starred.provider" + resValue 'string', 'provider.recently_added', applicationId + ".mostrecent.provider" } buildTypes { release { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 52756534..0a211246 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,6 +24,7 @@ <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature android:name="android.hardware.bluetooth" android:required="false" /> @@ -39,7 +40,8 @@ android:backupAgent="github.daneren2005.dsub.util.SettingsBackupAgent" android:icon="@drawable/launch" android:theme="@style/Theme.DSub.Light" - android:largeHeap="true"> + android:largeHeap="true" + android:usesCleartextTraffic="true"> <uses-library android:name="android.test.runner" /> @@ -89,10 +91,10 @@ </intent-filter> </activity> - <service android:name=".service.DownloadService" + <service android:name="github.daneren2005.dsub.service.DownloadService" android:label="DSub Playback Service"/> - <service android:name=".service.AutoMediaBrowserService" + <service android:name="github.daneren2005.dsub.service.AutoMediaBrowserService" android:exported="true"> <intent-filter> @@ -214,24 +216,24 @@ </receiver> <provider android:name="github.daneren2005.dsub.provider.DSubSearchProvider" - android:authorities="github.daneren2005.dsub.provider.DSubSearchProvider"/> + android:authorities="@string/provider.search"/> <provider android:name="github.daneren2005.dsub.provider.PlaylistStubProvider" - android:authorities="github.daneren2005.dsub.playlists.provider" + android:authorities="@string/provider.playlist" android:label="@string/button_bar.playlists" android:exported="false" android:syncable="true"/> <provider android:name="github.daneren2005.dsub.provider.PodcastStubProvider" - android:authorities="github.daneren2005.dsub.podcasts.provider" + android:authorities="@string/provider.podcast" android:label="@string/button_bar.podcasts" android:exported="false" android:syncable="true"/> <provider android:name="github.daneren2005.dsub.provider.StarredStubProvider" - android:authorities="github.daneren2005.dsub.starred.provider" + android:authorities="@string/provider.starred" android:label="@string/main.albums_starred" android:exported="false" android:syncable="true"/> <provider android:name="github.daneren2005.dsub.provider.MostRecentStubProvider" - android:authorities="github.daneren2005.dsub.mostrecent.provider" + android:authorities="@string/provider.recently_added" android:label="@string/main.albums_newest" android:exported="false" android:syncable="true"/> diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index 5948064d..4d8dfb59 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -1248,7 +1248,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte PrintWriter printWriter = null; try { - PackageInfo packageInfo = context.getPackageManager().getPackageInfo("github.daneren2005.dsub", 0); + PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); file = new File(Environment.getExternalStorageDirectory(), "dsub-stacktrace.txt"); printWriter = new PrintWriter(file); printWriter.println("Android API level: " + Build.VERSION.SDK); diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java index 326cebb4..1789ad15 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java @@ -575,6 +575,12 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared serverSyncPreference.setSummary(R.string.settings_server_sync_summary); serverSyncPreference.setTitle(R.string.settings_server_sync); + final CheckBoxPreference serverAuthHeaderPreference = new CheckBoxPreference(context); + serverAuthHeaderPreference.setKey(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance); + serverAuthHeaderPreference.setChecked(Util.isAuthHeaderEnabled(context, instance)); + serverAuthHeaderPreference.setSummary(R.string.settings_server_authheaders_summary); + serverAuthHeaderPreference.setTitle(R.string.settings_server_authheaders); + final Preference serverOpenBrowser = new Preference(context); serverOpenBrowser.setKey(Constants.PREFERENCES_KEY_OPEN_BROWSER); serverOpenBrowser.setPersistent(false); @@ -649,6 +655,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared screen.addPreference(serverPasswordPreference); screen.addPreference(serverTagPreference); screen.addPreference(serverSyncPreference); + screen.addPreference(serverAuthHeaderPreference); screen.addPreference(serverTestConnectionPreference); screen.addPreference(serverOpenBrowser); screen.addPreference(serverRemoveServerPreference); diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java index 100224e8..8fdafc11 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java @@ -1911,11 +1911,16 @@ public class RESTMusicService implements MusicService { SharedPreferences prefs = Util.getPreferences(context); int instance = getInstance(context); - String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null); - String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null); - if (prefs.getBoolean(Constants.PREFERENCES_KEY_ENCRYPTED_PASSWORD + instance, false)) password = KeyStoreUtil.decrypt(password); - String encoded = Base64.encodeToString((username + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP);; - connection.setRequestProperty("Authorization", "Basic " + encoded); + boolean authHeader = prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance, true); + if(authHeader) { + String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null); + String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null); + if (prefs.getBoolean(Constants.PREFERENCES_KEY_ENCRYPTED_PASSWORD + instance, false)) { + password = KeyStoreUtil.decrypt(password); + } + String encoded = Base64.encodeToString((username + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP); + connection.setRequestProperty("Authorization", "Basic " + encoded); + } // Force the connection to initiate if(connection.getResponseCode() >= 500) { diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java index 933f531f..0ce58d73 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java @@ -18,6 +18,8 @@ */ package github.daneren2005.dsub.util; +import github.daneren2005.dsub.BuildConfig; + /** * @author Sindre Mehus * @version $Id$ @@ -85,6 +87,7 @@ public final class Constants { public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId"; public static final String PREFERENCES_KEY_USERNAME = "username"; public static final String PREFERENCES_KEY_PASSWORD = "password"; + public static final String PREFERENCES_KEY_SERVER_AUTHHEADER = "authHeader"; public static final String PREFERENCES_KEY_ENCRYPTED_PASSWORD = "encryptedPassword"; public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime"; public static final String PREFERENCES_KEY_THEME = "theme"; @@ -213,17 +216,17 @@ public final class Constants { public static final String FRAGMENT_POSITION = "fragmentPosition"; // Name of the preferences file. - public static final String PREFERENCES_FILE_NAME = "github.daneren2005.dsub_preferences"; - public static final String OFFLINE_SYNC_NAME = "github.daneren2005.dsub.offline"; + public static final String PREFERENCES_FILE_NAME = BuildConfig.APPLICATION_ID + "_preferences"; + public static final String OFFLINE_SYNC_NAME = BuildConfig.APPLICATION_ID + ".offline"; public static final String OFFLINE_SYNC_DEFAULT = "syncDefaults"; // Account prefs public static final String SYNC_ACCOUNT_NAME = "Subsonic Account"; - public static final String SYNC_ACCOUNT_TYPE = "subsonic.org"; - public static final String SYNC_ACCOUNT_PLAYLIST_AUTHORITY = "github.daneren2005.dsub.playlists.provider"; - public static final String SYNC_ACCOUNT_PODCAST_AUTHORITY = "github.daneren2005.dsub.podcasts.provider"; - public static final String SYNC_ACCOUNT_STARRED_AUTHORITY = "github.daneren2005.dsub.starred.provider"; - public static final String SYNC_ACCOUNT_MOST_RECENT_AUTHORITY = "github.daneren2005.dsub.mostrecent.provider"; + public static final String SYNC_ACCOUNT_TYPE = BuildConfig.APPLICATION_ID + ".subsonic"; + public static final String SYNC_ACCOUNT_PLAYLIST_AUTHORITY = BuildConfig.APPLICATION_ID + ".playlists.provider"; + public static final String SYNC_ACCOUNT_PODCAST_AUTHORITY = BuildConfig.APPLICATION_ID + ".podcasts.provider"; + public static final String SYNC_ACCOUNT_STARRED_AUTHORITY = BuildConfig.APPLICATION_ID + ".starred.provider"; + public static final String SYNC_ACCOUNT_MOST_RECENT_AUTHORITY = BuildConfig.APPLICATION_ID + ".mostrecent.provider"; public static final String TASKER_EXTRA_BUNDLE = "com.twofortyfouram.locale.intent.extra.BUNDLE"; diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java index b58a81e4..872e9561 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -460,6 +460,11 @@ public final class Util { return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_SYNC + instance, true); } + public static boolean isAuthHeaderEnabled(Context context, int instance) { + SharedPreferences prefs = getPreferences(context); + return prefs.getBoolean(Constants.PREFERENCES_KEY_SERVER_AUTHHEADER + instance, true); + } + public static String getParentFromEntry(Context context, MusicDirectory.Entry entry) { if(Util.isTagBrowsing(context)) { if(!entry.isDirectory()) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 17e96487..a3dd6af2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -284,6 +284,8 @@ <string name="settings.server_open_browser">Open in browser</string> <string name="settings.server_sync_summary">Whether or not syncing is enabled for this server</string> <string name="settings.server_sync">Sync Enabled</string> + <string name="settings.server_authheaders_summary">If this is enabled the request headers will include Authorization: Basic</string> + <string name="settings.server_authheaders">Authorization Basic headers</string> <string name="settings.cache_title">Music cache</string> <string name="settings.preload_wifi">Songs to preload (Wifi)</string> <string name="settings.preload_mobile">Songs to preload (Mobile)</string> diff --git a/app/src/main/res/xml/authenticator.xml b/app/src/main/res/xml/authenticator.xml index 3055240b..23e4621a 100644 --- a/app/src/main/res/xml/authenticator.xml +++ b/app/src/main/res/xml/authenticator.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" - android:accountType="subsonic.org" + android:accountType="@string/account_type.subsonic" android:icon="@drawable/launch" android:smallIcon="@drawable/launch" android:label="@string/common.appname"/>
\ No newline at end of file diff --git a/app/src/main/res/xml/changelog.xml b/app/src/main/res/xml/changelog.xml index e8654e6f..d7875dcd 100644 --- a/app/src/main/res/xml/changelog.xml +++ b/app/src/main/res/xml/changelog.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <changelog> + <release version="5.5.1 BETA" versioncode="204" releasedate="09/21/2020"> + <change>Update to Android 9 target level</change> + <change>Optionally use system default media style notification (on by default)</change> + <change>Fix not being able to use basic server auth with @ in network connection string</change> + </release> <release version="5.5.0" versioncode="203" releasedate="09/12/2020"> <change>Fix saving files being broken on Android 11+</change> <change>Upgrade to Android 8 target level again</change> diff --git a/app/src/main/res/xml/mostrecent_syncadapter.xml b/app/src/main/res/xml/mostrecent_syncadapter.xml index 0195edeb..a0172501 100644 --- a/app/src/main/res/xml/mostrecent_syncadapter.xml +++ b/app/src/main/res/xml/mostrecent_syncadapter.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" - android:contentAuthority="github.daneren2005.dsub.mostrecent.provider" - android:accountType="subsonic.org" + android:contentAuthority="@string/provider.recently_added" + android:accountType="@string/account_type.subsonic" android:userVisible="true" android:supportsUploading="false" android:allowParallelSyncs="false" diff --git a/app/src/main/res/xml/playlists_syncadapter.xml b/app/src/main/res/xml/playlists_syncadapter.xml index 6c56557b..1cea7a2d 100644 --- a/app/src/main/res/xml/playlists_syncadapter.xml +++ b/app/src/main/res/xml/playlists_syncadapter.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" - android:contentAuthority="github.daneren2005.dsub.playlists.provider" - android:accountType="subsonic.org" + android:contentAuthority="@string/provider.playlist" + android:accountType="@string/account_type.subsonic" android:userVisible="true" android:supportsUploading="false" android:allowParallelSyncs="false" diff --git a/app/src/main/res/xml/podcasts_syncadapter.xml b/app/src/main/res/xml/podcasts_syncadapter.xml index 52340ae4..c992fc96 100644 --- a/app/src/main/res/xml/podcasts_syncadapter.xml +++ b/app/src/main/res/xml/podcasts_syncadapter.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" - android:contentAuthority="github.daneren2005.dsub.podcasts.provider" - android:accountType="subsonic.org" + android:contentAuthority="@string/provider.podcast" + android:accountType="@string/account_type.subsonic" android:userVisible="true" android:supportsUploading="false" android:allowParallelSyncs="false" diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml index 35ff18f3..5967ae45 100644 --- a/app/src/main/res/xml/searchable.xml +++ b/app/src/main/res/xml/searchable.xml @@ -4,7 +4,7 @@ android:hint="@string/search.title" android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" android:voiceLanguageModel="web_search" - android:searchSuggestAuthority="github.daneren2005.dsub.provider.DSubSearchProvider" + android:searchSuggestAuthority="@string/provider.search" android:searchSuggestSelection=" unused" android:searchSuggestIntentAction="android.intent.action.VIEW"> </searchable>
\ No newline at end of file diff --git a/app/src/main/res/xml/starred_syncadapter.xml b/app/src/main/res/xml/starred_syncadapter.xml index d1d0e1e2..1d855057 100644 --- a/app/src/main/res/xml/starred_syncadapter.xml +++ b/app/src/main/res/xml/starred_syncadapter.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android" - android:contentAuthority="github.daneren2005.dsub.starred.provider" - android:accountType="subsonic.org" + android:contentAuthority="@string/provider.starred" + android:accountType="@string/account_type.subsonic" android:userVisible="true" android:supportsUploading="false" android:allowParallelSyncs="false" |