diff --git a/.gitmodules b/.gitmodules index e8fc0ec8..c14024db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,8 @@ url = https://android.googlesource.com/platform/external/pcre [submodule "mobile/src/main/jni/libsodium"] path = mobile/src/main/jni/libsodium - url = https://github.com/shadowsocks/libsodium.git + url = https://github.com/jedisct1/libsodium.git + branch = stable [submodule "mobile/src/main/jni/libev"] path = mobile/src/main/jni/libev url = https://github.com/shadowsocks/libev.git diff --git a/build.sbt b/build.sbt index bc8d1f61..bd13b300 100644 --- a/build.sbt +++ b/build.sbt @@ -18,7 +18,7 @@ lazy val commonSettings = Seq( typedResources := false ) -val supportLibsVersion = "25.1.0" +val supportLibsVersion = "25.1.1" lazy val root = Project(id = "shadowsocks-android", base = file(".")) .settings(commonSettings) .aggregate(plugin, mobile) diff --git a/mobile/src/main/jni/Android.mk b/mobile/src/main/jni/Android.mk index 45d3b96d..8f771c47 100755 --- a/mobile/src/main/jni/Android.mk +++ b/mobile/src/main/jni/Android.mk @@ -26,115 +26,32 @@ include $(CLEAR_VARS) SODIUM_SOURCE := \ crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \ - crypto_auth/crypto_auth.c \ - crypto_auth/hmacsha256/auth_hmacsha256_api.c \ - crypto_auth/hmacsha256/cp/hmac_hmacsha256.c \ - crypto_auth/hmacsha256/cp/verify_hmacsha256.c \ - crypto_auth/hmacsha512/auth_hmacsha512_api.c \ - crypto_auth/hmacsha512/cp/hmac_hmacsha512.c \ - crypto_auth/hmacsha512/cp/verify_hmacsha512.c \ - crypto_auth/hmacsha512256/auth_hmacsha512256_api.c \ - crypto_auth/hmacsha512256/cp/hmac_hmacsha512256.c \ - crypto_auth/hmacsha512256/cp/verify_hmacsha512256.c \ - crypto_box/crypto_box.c \ - crypto_box/crypto_box_easy.c \ - crypto_box/crypto_box_seal.c \ - crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c \ - crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c \ - crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c \ - crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c \ - crypto_box/curve25519xsalsa20poly1305/ref/keypair_curve25519xsalsa20poly1305.c \ - crypto_core/hsalsa20/ref2/core_hsalsa20.c \ - crypto_core/hsalsa20/core_hsalsa20_api.c \ crypto_core/salsa20/ref/core_salsa20.c \ - crypto_core/salsa20/core_salsa20_api.c \ - crypto_generichash/crypto_generichash.c \ - crypto_generichash/blake2/generichash_blake2_api.c \ - crypto_generichash/blake2/ref/blake2-impl.h \ - crypto_generichash/blake2/ref/blake2.h \ crypto_generichash/blake2/ref/blake2b-compress-ref.c \ - crypto_generichash/blake2/ref/blake2b-load-sse2.h \ - crypto_generichash/blake2/ref/blake2b-load-sse41.h \ crypto_generichash/blake2/ref/blake2b-ref.c \ - crypto_generichash/blake2/ref/blake2b-round.h \ crypto_generichash/blake2/ref/generichash_blake2b.c \ - crypto_hash/crypto_hash.c \ - crypto_hash/sha256/hash_sha256_api.c \ - crypto_hash/sha256/cp/hash_sha256.c \ - crypto_hash/sha512/hash_sha512_api.c \ - crypto_hash/sha512/cp/hash_sha512.c \ - crypto_onetimeauth/crypto_onetimeauth.c \ crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ - crypto_onetimeauth/poly1305/onetimeauth_poly1305.h \ - crypto_onetimeauth/poly1305/donna/poly1305_donna.h \ - crypto_onetimeauth/poly1305/donna/poly1305_donna32.h \ - crypto_onetimeauth/poly1305/donna/poly1305_donna64.h \ crypto_onetimeauth/poly1305/donna/poly1305_donna.c \ - crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \ - crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \ - crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \ - crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c \ - crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h \ - crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c \ - crypto_pwhash/scryptsalsa208sha256/sysendian.h \ - crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c \ - crypto_scalarmult/crypto_scalarmult.c \ + crypto_pwhash/crypto_pwhash.c \ + crypto_pwhash/argon2/argon2-core.c \ + crypto_pwhash/argon2/argon2.c \ + crypto_pwhash/argon2/argon2-encoding.c \ + crypto_pwhash/argon2/argon2-fill-block-ref.c \ + crypto_pwhash/argon2/blake2b-long.c \ + crypto_pwhash/argon2/pwhash_argon2i.c \ crypto_scalarmult/curve25519/scalarmult_curve25519.c \ - crypto_scalarmult/curve25519/scalarmult_curve25519.h \ - crypto_secretbox/crypto_secretbox.c \ - crypto_secretbox/crypto_secretbox_easy.c \ - crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305_api.c \ - crypto_shorthash/crypto_shorthash.c \ - crypto_shorthash/siphash24/shorthash_siphash24_api.c \ - crypto_shorthash/siphash24/ref/shorthash_siphash24.c \ - crypto_sign/crypto_sign.c \ - crypto_sign/ed25519/ref10/base.h \ - crypto_sign/ed25519/ref10/base2.h \ - crypto_sign/ed25519/sign_ed25519_api.c \ - crypto_sign/ed25519/ref10/keypair.c \ - crypto_sign/ed25519/ref10/open.c \ - crypto_sign/ed25519/ref10/obsolete.c \ - crypto_sign/ed25519/ref10/sign.c \ - crypto_stream/crypto_stream.c \ crypto_stream/chacha20/stream_chacha20.c \ - crypto_stream/chacha20/stream_chacha20.h \ - crypto_stream/chacha20/ref/stream_chacha20_ref.h \ crypto_stream/chacha20/ref/stream_chacha20_ref.c \ - crypto_stream/salsa20/stream_salsa20_api.c \ - crypto_stream/xsalsa20/stream_xsalsa20_api.c \ - crypto_stream/xsalsa20/ref/stream_xsalsa20.c \ - crypto_stream/xsalsa20/ref/xor_xsalsa20.c \ - crypto_verify/16/verify_16_api.c \ + crypto_stream/salsa20/ref/stream_salsa20_ref.c \ + crypto_stream/salsa20/ref/xor_salsa20_ref.c \ crypto_verify/16/ref/verify_16.c \ - crypto_verify/32/verify_32_api.c \ - crypto_verify/32/ref/verify_32.c \ - crypto_verify/64/verify_64_api.c \ - crypto_verify/64/ref/verify_64.c \ randombytes/randombytes.c \ + randombytes/sysrandom/randombytes_sysrandom.c \ sodium/core.c \ sodium/runtime.c \ sodium/utils.c \ sodium/version.c -SODIUM_SOURCE += \ - crypto_scalarmult/curve25519/ref10/x25519_ref10.c - -SODIUM_SOURCE += \ - crypto_pwhash/argon2/argon2-core.c \ - crypto_pwhash/argon2/argon2.c \ - crypto_pwhash/argon2/argon2-encoding.c \ - crypto_pwhash/argon2/blake2b-long.c \ - crypto_pwhash/argon2/argon2-fill-block-ref.c \ - crypto_pwhash/argon2/pwhash_argon2i.c \ - crypto_pwhash/argon2/argon2-fill-block-ssse3.c - -SODIUM_SOURCE += \ - crypto_stream/salsa20/ref/stream_salsa20_ref.c \ - crypto_stream/salsa20/ref/xor_salsa20_ref.c - -SODIUM_SOURCE += \ - randombytes/sysrandom/randombytes_sysrandom.c - LOCAL_MODULE := sodium LOCAL_CFLAGS += -O2 -I$(LOCAL_PATH)/libsodium/src/libsodium/include \ -I$(LOCAL_PATH)/include \ @@ -329,8 +246,10 @@ include $(BUILD_SHARED_EXECUTABLE) include $(CLEAR_VARS) -SHADOWSOCKS_SOURCES := local.c cache.c udprelay.c encrypt.c \ - utils.c netutils.c json.c jconf.c acl.c http.c tls.c rule.c \ +SHADOWSOCKS_SOURCES := local.c \ + cache.c udprelay.c utils.c netutils.c json.c jconf.c \ + acl.c http.c tls.c rule.c \ + crypto.c aead.c stream.c base64.c \ plugin.c \ android.c @@ -364,7 +283,11 @@ include $(BUILD_SHARED_EXECUTABLE) include $(CLEAR_VARS) -SHADOWSOCKS_SOURCES := tunnel.c cache.c udprelay.c encrypt.c utils.c netutils.c json.c jconf.c android.c plugin.c +SHADOWSOCKS_SOURCES := tunnel.c \ + cache.c udprelay.c utils.c netutils.c json.c jconf.c \ + crypto.c aead.c stream.c base64.c \ + plugin.c \ + android.c LOCAL_MODULE := ss-tunnel LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES)) diff --git a/mobile/src/main/jni/libsodium b/mobile/src/main/jni/libsodium index a81cea23..e160de24 160000 --- a/mobile/src/main/jni/libsodium +++ b/mobile/src/main/jni/libsodium @@ -1 +1 @@ -Subproject commit a81cea2366b9e814861a6f47e5bd460e06f19295 +Subproject commit e160de24fd146ab84b4eb397c7cffbf34775aa02 diff --git a/mobile/src/main/jni/shadowsocks-libev b/mobile/src/main/jni/shadowsocks-libev index 1c2b6170..f4b16416 160000 --- a/mobile/src/main/jni/shadowsocks-libev +++ b/mobile/src/main/jni/shadowsocks-libev @@ -1 +1 @@ -Subproject commit 1c2b6170b9ec5443d4a3e211425bc0d5f8e18119 +Subproject commit f4b1641636942bc44c96160afad9f023fb6dbf0e diff --git a/mobile/src/main/res/values/arrays.xml b/mobile/src/main/res/values/arrays.xml index 58e8ae88..b1bcba81 100644 --- a/mobile/src/main/res/values/arrays.xml +++ b/mobile/src/main/res/values/arrays.xml @@ -1,8 +1,6 @@ - TABLE - RC4 RC4-MD5 AES-128-CFB AES-192-CFB @@ -17,11 +15,14 @@ SALSA20 CHACHA20 CHACHA20-IETF + AES-128-GCM + AES-192-GCM + AES-256-GCM + CHACHA20-POLY1305 + CHACHA20-IETF-POLY1305 - table - rc4 rc4-md5 aes-128-cfb aes-192-cfb @@ -36,6 +37,11 @@ salsa20 chacha20 chacha20-ietf + aes-128-gcm + aes-192-gcm + aes-256-gcm + chacha20-poly1305 + chacha20-ietf-poly1305 diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index a8e902f9..17d2f7fe 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -36,8 +36,6 @@ IPv6 Route Redirect IPv6 traffic to remote - One-time Authentication - Enable one-time authentication Route All Bypass LAN @@ -62,7 +60,6 @@ Shadowsocks started. Invalid server name Failed to connect the remote server - WARNING: The current encryption method is unsafe WARNING: NAT mode has been deprecated since Android 5.0 NAT mode requires ROOT permission Switch to VPN mode diff --git a/mobile/src/main/res/xml/pref_profile.xml b/mobile/src/main/res/xml/pref_profile.xml index e2784a69..37d88686 100644 --- a/mobile/src/main/res/xml/pref_profile.xml +++ b/mobile/src/main/res/xml/pref_profile.xml @@ -37,10 +37,6 @@ android:entryValues="@array/enc_method_value" android:summary="%s" android:title="@string/enc_method"/> - diff --git a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala index 3b3d2ccb..5d5ec16d 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala @@ -183,9 +183,6 @@ trait BaseService extends Service { changeState(State.CONNECTING) - if (profile.isMethodUnsafe) - handler.post(() => Toast.makeText(this, R.string.method_unsafe, Toast.LENGTH_LONG).show()) - Utils.ThrowableFuture(try connect() catch { case _: NameNotResolvedException => stopRunner(stopService = true, getString(R.string.invalid_server)) case _: NullConnectionException => stopRunner(stopService = true, getString(R.string.reboot_required)) @@ -325,7 +322,6 @@ trait BaseService extends Service { .put("server_port", profile.remotePort) .put("password", profile.password) .put("method", profile.method) - if (profile.auth) config.put("auth", true) if (pluginPath != null) config .put("plugin", Commandline.toString(buildPluginCommandLine())) .put("plugin_opts", plugin.toString) diff --git a/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala b/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala index 90e6d4e0..155ddf28 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/database/DBHelper.scala @@ -77,9 +77,6 @@ class DBHelper(val context: Context) } else if (oldVersion < 19) { profileDao.executeRawNoArgs("UPDATE `profile` SET route = 'all' WHERE route IS NULL;") } - if (oldVersion < 10) { - profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN auth SMALLINT;") - } if (oldVersion < 11) { profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN ipv6 SMALLINT;") } @@ -89,9 +86,9 @@ class DBHelper(val context: Context) TableUtils.createTable(connectionSource, classOf[Profile]) profileDao.executeRawNoArgs( "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, proxyApps, bypass," + - " udpdns, auth, ipv6, individual) " + - "SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth," + - " ipv6, individual FROM `tmp`;") + " udpdns, ipv6, individual) " + + "SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, ipv6," + + " individual FROM `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("COMMIT;") } else if (oldVersion < 13) { @@ -127,10 +124,10 @@ class DBHelper(val context: Context) profileDao.executeRawNoArgs("ALTER TABLE `profile` RENAME TO `tmp`;") TableUtils.createTable(connectionSource, classOf[Profile]) profileDao.executeRawNoArgs( - "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, remoteDns, proxyApps," + - " bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, plugin) " + + "INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, remoteDns, " + + "proxyApps, bypass, udpdns, ipv6, individual, tx, rx, date, userOrder, plugin) " + "SELECT id, name, host, localPort, CASE WHEN kcp = 1 THEN kcpPort ELSE remotePort END, password, method, " + - "route, remoteDns, proxyApps, bypass, udpdns, auth, ipv6, individual, tx, rx, date, userOrder, " + + "route, remoteDns, proxyApps, bypass, udpdns, ipv6, individual, tx, rx, date, userOrder, " + "CASE WHEN kcp = 1 THEN 'kcptun ' || kcpcli ELSE NULL END FROM `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("COMMIT;") diff --git a/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala b/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala index 19ffe4d5..53581e85 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/database/Profile.scala @@ -20,13 +20,13 @@ package com.github.shadowsocks.database -import java.net.URLEncoder import java.util.Locale import android.content.SharedPreferences +import android.net.Uri import android.os.Binder -import android.text.TextUtils import android.util.Base64 +import com.github.shadowsocks.plugin.PluginConfiguration import com.github.shadowsocks.utils.Key import com.j256.ormlite.field.{DataType, DatabaseField} @@ -68,9 +68,6 @@ class Profile { @DatabaseField var udpdns: Boolean = _ - @DatabaseField - var auth: Boolean = _ - @DatabaseField var ipv6: Boolean = _ @@ -96,11 +93,19 @@ class Profile { def nameIsEmpty: Boolean = name == null || name.isEmpty def getName: String = if (nameIsEmpty) formattedAddress else name - override def toString: String = "ss://" + Base64.encodeToString("%s%s:%s@%s:%d".formatLocal(Locale.ENGLISH, - method, if (auth) "-auth" else "", password, host, remotePort).getBytes, Base64.NO_PADDING | Base64.NO_WRAP) + - (if (TextUtils.isEmpty(name)) "" else '#' + URLEncoder.encode(name, "utf-8")) - - def isMethodUnsafe: Boolean = "table".equalsIgnoreCase(method) || "rc4".equalsIgnoreCase(method) + def toUri: Uri = { + val builder = new Uri.Builder() + .scheme("ss") + .encodedAuthority("%s@%s:%d".formatLocal(Locale.ENGLISH, + Base64.encodeToString("%s:%s".formatLocal(Locale.ENGLISH, method, password).getBytes, + Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE), host, remotePort)) + val configuration = new PluginConfiguration(plugin) + if (configuration.selected.nonEmpty) + builder.appendQueryParameter(Key.plugin, configuration.selectedOptions.toString(false)) + if (!nameIsEmpty) builder.fragment(name) + builder.build() + } + override def toString: String = toUri.toString def serialize(editor: SharedPreferences.Editor): SharedPreferences.Editor = editor .putString(Key.name, name) @@ -114,7 +119,6 @@ class Profile { .putBoolean(Key.proxyApps, proxyApps) .putBoolean(Key.bypass, bypass) .putBoolean(Key.udpdns, udpdns) - .putBoolean(Key.auth, auth) .putBoolean(Key.ipv6, ipv6) .putString(Key.individual, individual) .putString(Key.plugin, plugin) @@ -132,7 +136,6 @@ class Profile { proxyApps = pref.getBoolean(Key.proxyApps, false) bypass = pref.getBoolean(Key.bypass, false) udpdns = pref.getBoolean(Key.udpdns, false) - auth = pref.getBoolean(Key.auth, false) ipv6 = pref.getBoolean(Key.ipv6, false) individual = pref.getString(Key.individual, null) plugin = pref.getString(Key.plugin, null) diff --git a/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala b/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala index 69034aba..d1d9fe21 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/utils/Constants.scala @@ -141,7 +141,6 @@ object Key { val proxyApps = "isProxyApps" val bypass = "isBypassApps" val udpdns = "isUdpDns" - val auth = "isAuth" val ipv6 = "isIpv6" val host = "proxy" diff --git a/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala b/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala index e9666fda..a571bad6 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/utils/Parser.scala @@ -20,32 +20,49 @@ package com.github.shadowsocks.utils -import java.net.URLDecoder - +import android.net.Uri import android.util.{Base64, Log} import com.github.shadowsocks.database.Profile object Parser { val TAG = "ShadowParser" - private val pattern = "(?i)ss://([A-Za-z0-9+-/=_]+)(#(.+))?".r - private val decodedPattern = "(?i)^((.+?)(-auth)??:(.*)@(.+?):(\\d+?))$".r + private val pattern = "(?i)^ss://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]$".r + private val userInfoPattern = "^(.+?):(.*)$".r + private val legacyPattern = "^((.+?):(.*)@(.+?):(\\d+?))$".r def findAll(data: CharSequence): Iterator[Profile] = - pattern.findAllMatchIn(if (data == null) "" else data).map(m => try - decodedPattern.findFirstMatchIn(new String(Base64.decode(m.group(1), Base64.NO_PADDING), "UTF-8")) match { - case Some(ss) => - val profile = new Profile - profile.method = ss.group(2).toLowerCase - if (ss.group(3) != null) profile.auth = true - profile.password = ss.group(4) - profile.host = ss.group(5) - profile.remotePort = ss.group(6).toInt - if (m.group(2) != null) profile.name = URLDecoder.decode(m.group(3), "utf-8") - profile - case _ => null - } catch { - case ex: Exception => - Log.e(TAG, "parser error: " + m.source, ex)// Ignore - null - }).filter(_ != null) + pattern.findAllMatchIn(if (data == null) "" else data).map(m => { + val uri = Uri.parse(m.matched) + uri.getUserInfo match { + case null => uri.getHost match { + case legacyPattern(_, method, password, host, port) => // legacy uri + val profile = new Profile + profile.method = method.toLowerCase + profile.password = password + profile.host = host + profile.remotePort = port.toInt + profile.plugin = uri.getQueryParameter(Key.plugin) + profile.name = uri.getFragment + profile + case _ => + Log.e(TAG, "Unrecognized URI: " + m.matched) + null + } + case userInfo => + new String(Base64.decode(userInfo, Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE)) match { + case userInfoPattern(method, password) => + val profile = new Profile + profile.method = method + profile.password = password + profile.host = uri.getHost + profile.remotePort = uri.getPort + profile.plugin = uri.getQueryParameter(Key.plugin) + profile.name = uri.getFragment + profile + case _ => + Log.e(TAG, "Unknown user info: " + m.matched) + null + } + } + }).filter(_ != null) } diff --git a/plugin/README.md b/plugin/README.md index 601744f4..f3a8df6c 100644 --- a/plugin/README.md +++ b/plugin/README.md @@ -88,7 +88,7 @@ Then add it to your manifest: ... + android:authorities="$FULLY_QUALIFIED_NAME_OF_YOUR_CONTENTPROVIDER"> diff --git a/plugin/build.sbt b/plugin/build.sbt index 4e648f36..c902a8b9 100644 --- a/plugin/build.sbt +++ b/plugin/build.sbt @@ -2,7 +2,7 @@ enablePlugins(AndroidLib) android.useSupportVectors name := "plugin" -version := "0.0.1" +version := "0.0.2-SNAPSHOT" pomExtra in Global := { https://github.com/shadowsocks/shadowsocks-android diff --git a/plugin/doc.md b/plugin/doc.md index 4caebaac..b652eea3 100644 --- a/plugin/doc.md +++ b/plugin/doc.md @@ -153,7 +153,7 @@ This corresponds to `com.github.shadowsocks.plugin.NativePluginProvider` in the ... + android:authorities="$FULLY_QUALIFIED_NAME_OF_YOUR_CONTENTPROVIDER"> diff --git a/plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.java b/plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.java index 7794b5d4..7aa436db 100644 --- a/plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.java +++ b/plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.java @@ -24,6 +24,14 @@ public final class PluginOptions extends HashMap { super(initialCapacity, loadFactor); } + // TODO: this method is not needed since API 24 + public String getOrDefault(Object key, String defaultValue) { + String v; + return (((v = get(key)) != null) || containsKey(key)) + ? v + : defaultValue; + } + private PluginOptions(String options, boolean parseId) { this(); if (TextUtils.isEmpty(options)) return; diff --git a/plugin/src/main/scala/com/github/shadowsocks/plugin/NativePluginProvider.scala b/plugin/src/main/scala/com/github/shadowsocks/plugin/NativePluginProvider.scala index 982c7f37..412ab0c1 100644 --- a/plugin/src/main/scala/com/github/shadowsocks/plugin/NativePluginProvider.scala +++ b/plugin/src/main/scala/com/github/shadowsocks/plugin/NativePluginProvider.scala @@ -15,7 +15,7 @@ import android.os.{Bundle, ParcelFileDescriptor} * <application> * ... * <provider android:name="com.github.shadowsocks.$PLUGIN_ID.BinaryProvider" - * android:authorities="com.github.shadowsocks.plugin.$PLUGIN_ID"> + * android:authorities="com.github.shadowsocks.plugin.$PLUGIN_ID.BinaryProvider"> * <intent-filter> * <category android:name="com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN" /> * </intent-filter>