Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
majora-adr
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
majora
majora-adr
Commits
b1fdd507
Commit
b1fdd507
authored
Sep 12, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show clientId
parent
f448a33a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
4 deletions
+13
-4
MainActivity.java
app/src/main/java/com/virjar/majora/adr/MainActivity.java
+4
-3
Shell.java
app/src/main/java/com/virjar/majora/adr/Shell.java
+2
-0
TheApp.java
app/src/main/java/com/virjar/majora/adr/TheApp.java
+6
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-1
No files found.
app/src/main/java/com/virjar/majora/adr/MainActivity.java
View file @
b1fdd507
package
com
.
virjar
.
majora
.
adr
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
com.hjq.permissions.OnPermissionCallback
;
import
com.hjq.permissions.Permission
;
...
...
@@ -23,6 +23,9 @@ public class MainActivity extends Activity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
TextView
textView
=
findViewById
(
R
.
id
.
clientId
);
textView
.
setText
(
ClientIdentifier
.
id
());
Button
btn
=
findViewById
(
R
.
id
.
goSetting
);
...
...
@@ -41,8 +44,6 @@ public class MainActivity extends Activity {
* 设置一个应用外悬浮窗,因为安卓10之后对后台启动activity具有限制
* https://developer.android.com/guide/components/activities/background-starts
* <p>
* {@link TheApp#checkFloatPermission(Context) 需要授予悬浮窗权限} (Context)},
* {@link TheApp#canBackgroundStart(Context) 或者miui等在设置中给予后台启动Activity权限}
*/
private
void
showRatelFloatWindow
()
{
XXPermissions
.
with
(
this
)
...
...
app/src/main/java/com/virjar/majora/adr/Shell.java
View file @
b1fdd507
...
...
@@ -12,6 +12,7 @@ public class Shell {
public
static
void
executeCmd
(
String
cmd
)
{
try
{
MajoraLogger
.
getLogger
().
info
(
"execute cmd: "
+
cmd
);
Process
process
=
Runtime
.
getRuntime
().
exec
(
"su"
);
OutputStream
outputStream
=
process
.
getOutputStream
();
outputStream
.
write
(
cmd
.
getBytes
());
...
...
@@ -36,6 +37,7 @@ public class Shell {
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
String
line
;
while
((
line
=
bufferedReader
.
readLine
())
!=
null
)
{
MajoraLogger
.
getLogger
().
info
(
line
);
stringBuffer
.
append
(
line
).
append
(
"\n"
);
}
bufferedReader
.
close
();
...
...
app/src/main/java/com/virjar/majora/adr/TheApp.java
View file @
b1fdd507
...
...
@@ -26,6 +26,12 @@ public class TheApp extends Application {
public
void
onCreate
()
{
super
.
onCreate
();
theApp
=
this
;
new
Thread
(
"makeSu"
)
{
@Override
public
void
run
()
{
Shell
.
executeCmd
(
"pwd"
);
}
}.
start
();
KeepAliveService
.
startService
(
this
);
if
(!
checkFloatPermission
(
this
))
{
...
...
app/src/main/res/layout/activity_main.xml
View file @
b1fdd507
...
...
@@ -20,7 +20,7 @@
<TextView
android:id=
"@+id/
indexTextView
"
android:id=
"@+id/
clientId
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"MajoraApp"
...
...
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