-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2a2c2a
commit 24f997a
Showing
22 changed files
with
774 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
agents/android/framework/src/main/java/org/ironman/framework/bean/os/File.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.ironman.framework.bean.os; | ||
|
||
public class File { | ||
public String name; | ||
public String path; | ||
public boolean isDirectory; | ||
public boolean readable; | ||
public boolean writable; | ||
public boolean executable; | ||
} |
2 changes: 1 addition & 1 deletion
2
...onman/framework/bean/process/Process.java → ...rg/ironman/framework/bean/os/Process.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
agents/android/framework/src/main/java/org/ironman/framework/bean/os/Service.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.ironman.framework.bean.os; | ||
|
||
import android.os.IBinder; | ||
|
||
import java.util.List; | ||
|
||
public class Service { | ||
public String name; | ||
public String desc; | ||
public IBinder binder; | ||
public Process owner; | ||
public List<Process> users; | ||
} |
52 changes: 52 additions & 0 deletions
52
agents/android/framework/src/main/java/org/ironman/framework/util/CommandUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.ironman.framework.util; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
public class CommandUtil { | ||
|
||
public static String execCommand(String... commands) throws IOException { | ||
Process proccess = null; | ||
BufferedReader stdout = null; | ||
BufferedReader stderr = null; | ||
|
||
try { | ||
proccess = Runtime.getRuntime().exec(commands); | ||
|
||
stdout = new BufferedReader(new InputStreamReader(proccess.getInputStream())); | ||
stderr = new BufferedReader(new InputStreamReader(proccess.getErrorStream())); | ||
|
||
String line; | ||
StringBuilder sb = new StringBuilder(); | ||
while ((line = stdout.readLine()) != null) { | ||
sb.append(line).append('\n'); | ||
} | ||
|
||
return sb.toString(); | ||
} finally { | ||
if (stdout != null) { | ||
try { | ||
stdout.close(); | ||
} catch (Exception e) { | ||
// ignore | ||
} | ||
} | ||
if (stderr != null) { | ||
try { | ||
stderr.close(); | ||
} catch (Exception e) { | ||
// ignore | ||
} | ||
} | ||
if (proccess != null) { | ||
try { | ||
proccess.destroy(); | ||
} catch (Exception e) { | ||
// ignore | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
agents/android/framework/src/main/java/org/ironman/framework/util/ProcessUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.