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
3975f951
Commit
3975f951
authored
Mar 04, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getABI()
parent
34a54dca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
4 deletions
+55
-4
src/com/github/shadowsocks/Shadowsocks.java
src/com/github/shadowsocks/Shadowsocks.java
+1
-0
src/com/github/shadowsocks/Utils.java
src/com/github/shadowsocks/Utils.java
+54
-4
No files found.
src/com/github/shadowsocks/Shadowsocks.java
View file @
3975f951
...
@@ -460,6 +460,7 @@ public class Shadowsocks extends PreferenceActivity implements
...
@@ -460,6 +460,7 @@ public class Shadowsocks extends PreferenceActivity implements
Utils
.
runRootCommand
(
sb
.
toString
());
Utils
.
runRootCommand
(
sb
.
toString
());
copyAssets
(
""
);
copyAssets
(
""
);
copyAssets
(
Utils
.
getABI
());
Utils
.
runCommand
(
"chmod 755 /data/data/com.github.shadowsocks/iptables\n"
Utils
.
runCommand
(
"chmod 755 /data/data/com.github.shadowsocks/iptables\n"
+
"chmod 755 /data/data/com.github.shadowsocks/redsocks\n"
+
"chmod 755 /data/data/com.github.shadowsocks/redsocks\n"
...
...
src/com/github/shadowsocks/Utils.java
View file @
3975f951
...
@@ -46,15 +46,17 @@ import android.graphics.drawable.Drawable;
...
@@ -46,15 +46,17 @@ import android.graphics.drawable.Drawable;
import
android.os.Environment
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.util.Log
;
import
java.io.File
;
import
java.io.*
;
import
java.io.FileDescriptor
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
Utils
{
public
class
Utils
{
public
final
static
String
TAG
=
"Shadowsocks"
;
public
final
static
String
TAG
=
"Shadowsocks"
;
public
final
static
String
ABI_PROP
=
"ro.product.cpu.abi"
;
public
final
static
String
ABI2_PROP
=
"ro.product.cpu.abi2"
;
public
final
static
String
ARM_ABI
=
"arm"
;
public
final
static
String
X86_ABI
=
"x86"
;
public
final
static
String
MIPS_ABI
=
"mips"
;
public
final
static
String
DEFAULT_SHELL
=
"/system/bin/sh"
;
public
final
static
String
DEFAULT_SHELL
=
"/system/bin/sh"
;
public
final
static
String
DEFAULT_ROOT
=
"/system/bin/su"
;
public
final
static
String
DEFAULT_ROOT
=
"/system/bin/su"
;
public
final
static
String
ALTERNATIVE_ROOT
=
"/system/xbin/su"
;
public
final
static
String
ALTERNATIVE_ROOT
=
"/system/xbin/su"
;
...
@@ -69,6 +71,54 @@ public class Utils {
...
@@ -69,6 +71,54 @@ public class Utils {
private
static
String
iptables
=
null
;
private
static
String
iptables
=
null
;
private
static
String
data_path
=
null
;
private
static
String
data_path
=
null
;
public
static
String
getABI
()
{
String
abi
=
getSystemProperty
(
ABI_PROP
);
String
abi2
=
getSystemProperty
(
ABI2_PROP
);
if
(
abi2
!=
null
)
{
if
(
abi2
.
toLowerCase
().
contains
(
ARM_ABI
))
{
return
ARM_ABI
;
}
else
if
(
abi2
.
toLowerCase
().
contains
(
X86_ABI
))
{
return
X86_ABI
;
}
}
else
if
(
abi
!=
null
)
{
if
(
abi
.
toLowerCase
().
contains
(
ARM_ABI
))
{
return
ARM_ABI
;
}
else
if
(
abi
.
toLowerCase
().
contains
(
X86_ABI
))
{
return
X86_ABI
;
}
}
return
ARM_ABI
;
}
/**
* Returns a SystemProperty
*
* @param propName The Property to retrieve
* @return The Property, or NULL if not found
*/
private
static
String
getSystemProperty
(
String
propName
)
{
String
line
;
BufferedReader
input
=
null
;
try
{
Process
p
=
Runtime
.
getRuntime
().
exec
(
"getprop "
+
propName
);
input
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()),
1024
);
line
=
input
.
readLine
();
input
.
close
();
}
catch
(
IOException
ex
)
{
Log
.
e
(
TAG
,
"Unable to read sysprop "
+
propName
,
ex
);
return
null
;
}
finally
{
if
(
input
!=
null
)
{
try
{
input
.
close
();
}
catch
(
IOException
e
)
{
Log
.
e
(
TAG
,
"Exception while closing InputStream"
,
e
);
}
}
}
return
line
;
}
private
static
void
checkIptables
()
{
private
static
void
checkIptables
()
{
if
(!
isRoot
())
{
if
(!
isRoot
())
{
...
...
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