Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
41405f91
Commit
41405f91
authored
May 14, 2020
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show more information on conflicting plugins
Because one of you feckers just cannot learn to be decent.
parent
93bce703
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
core/src/main/java/com/github/shadowsocks/plugin/PluginList.kt
...src/main/java/com/github/shadowsocks/plugin/PluginList.kt
+9
-1
core/src/main/java/com/github/shadowsocks/plugin/PluginManager.kt
.../main/java/com/github/shadowsocks/plugin/PluginManager.kt
+6
-0
No files found.
core/src/main/java/com/github/shadowsocks/plugin/PluginList.kt
View file @
41405f91
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks.plugin
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks.plugin
import
android.content.Intent
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.content.pm.PackageManager
import
android.widget.Toast
import
com.github.shadowsocks.Core.app
import
com.github.shadowsocks.Core.app
class
PluginList
:
ArrayList
<
Plugin
>()
{
class
PluginList
:
ArrayList
<
Plugin
>()
{
...
@@ -33,7 +34,14 @@ class PluginList : ArrayList<Plugin>() {
...
@@ -33,7 +34,14 @@ class PluginList : ArrayList<Plugin>() {
val
lookup
=
mutableMapOf
<
String
,
Plugin
>().
apply
{
val
lookup
=
mutableMapOf
<
String
,
Plugin
>().
apply
{
for
(
plugin
in
this
@PluginList
)
{
for
(
plugin
in
this
@PluginList
)
{
fun
check
(
old
:
Plugin
?)
=
check
(
old
==
null
||
old
===
plugin
)
fun
check
(
old
:
Plugin
?)
{
if
(
old
!=
null
&&
old
!==
plugin
)
{
val
packages
=
this
@PluginList
.
filter
{
it
.
id
==
plugin
.
id
}.
joinToString
{
it
.
packageName
}
val
message
=
"Conflicting plugins found from: $packages"
Toast
.
makeText
(
app
,
message
,
Toast
.
LENGTH_LONG
).
show
()
throw
IllegalStateException
(
message
)
}
}
check
(
put
(
plugin
.
id
,
plugin
))
check
(
put
(
plugin
.
id
,
plugin
))
for
(
alias
in
plugin
.
idAliases
)
check
(
put
(
alias
,
plugin
))
for
(
alias
in
plugin
.
idAliases
)
check
(
put
(
alias
,
plugin
))
}
}
...
...
core/src/main/java/com/github/shadowsocks/plugin/PluginManager.kt
View file @
41405f91
...
@@ -33,6 +33,7 @@ import android.net.Uri
...
@@ -33,6 +33,7 @@ import android.net.Uri
import
android.os.Build
import
android.os.Build
import
android.system.Os
import
android.system.Os
import
android.util.Base64
import
android.util.Base64
import
android.widget.Toast
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core.app
import
com.github.shadowsocks.Core.app
...
@@ -143,6 +144,11 @@ object PluginManager {
...
@@ -143,6 +144,11 @@ object PluginManager {
val
providers
=
app
.
packageManager
.
queryIntentContentProviders
(
val
providers
=
app
.
packageManager
.
queryIntentContentProviders
(
Intent
(
PluginContract
.
ACTION_NATIVE_PLUGIN
,
buildUri
(
configuration
.
selected
)),
flags
)
Intent
(
PluginContract
.
ACTION_NATIVE_PLUGIN
,
buildUri
(
configuration
.
selected
)),
flags
)
if
(
providers
.
isEmpty
())
return
null
if
(
providers
.
isEmpty
())
return
null
if
(
providers
.
size
>
1
)
{
Toast
.
makeText
(
app
,
"Conflicting plugins found from: ${providers.joinToString { it.providerInfo.packageName }}"
,
Toast
.
LENGTH_LONG
).
show
()
}
val
provider
=
providers
.
single
().
providerInfo
val
provider
=
providers
.
single
().
providerInfo
val
options
=
configuration
.
getOptions
{
provider
.
loadString
(
PluginContract
.
METADATA_KEY_DEFAULT_CONFIG
)
}
val
options
=
configuration
.
getOptions
{
provider
.
loadString
(
PluginContract
.
METADATA_KEY_DEFAULT_CONFIG
)
}
var
failure
:
Throwable
?
=
null
var
failure
:
Throwable
?
=
null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment