Skip to content

Commit

Permalink
Release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Nov 25, 2018
1 parent 9e1beac commit aa69f6d
Show file tree
Hide file tree
Showing 38 changed files with 174 additions and 612 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 2.1.0
## Bug fixes
- Fix a bug that could cause `new SuFile(parent, name)` to fail

## Behavior Changes
- When creating `SuFileInputStream`/`SuFileOutputStream`/`SuRandomAccessFile` with a character file, it will throw `FileNotFoundException` instead of failing silently. Character file I/O is not possible with shells, use `Shell.su("cat <chr_file>").exec().getOut()` instead.

## API Changes
- Add `boolean Shell.waitAndClose(long, TimeUnit)` and `void Shell.waitAndClose()`. You can now wait for all tasks to finish before closing the shell instance.
- Add `Shell.Config.setTimeout(long)`. Use it to set the maximum time for waiting a new shell construction. The default value is 20 seconds.
- Deprecate `ContainerApp`. libsu can now automatically inject root shells directly into Application contexts without any configuration, so `ContainerApp` is no longer needed. This class will be removed in the next update.

# 2.0.3

## Improvements
Expand Down
55 changes: 2 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,65 +29,14 @@ repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.topjohnwu:libsu:2.0.3'
implementation 'com.github.topjohnwu:libsu:2.1.0'
}
```

## Quick Tutorial

### Setup Container
If you don't extend `Application` in your app, directly use `ContainerApp` as application:
```xml
<!-- AndroidManifest.xml -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...>
<application
android:name="com.topjohnwu.superuser.ContainerApp"
...>
...
</application>
</manifest>
```

Or if you use your own `Application` class, extend `ContainerApp`:
```java
public class MyApplication extends ContainerApp {
@Override
public void onCreate() {
super.onCreate();

// You can configure Shell here
Shell.Config.setFlags(Shell.FLAG_REDIRECT_STDERR);
Shell.Config.verboseLogging(BuildConfig.DEBUG);

// Use libsu's internal BusyBox
BusyBox.setup(this);

/* Your other code */
...
}
}
```

Or if you cannot change you base class, here is a workaround:
```java
public class MyApplication extends CustomApplication {
// Create a new Container field to store the root shell
private Shell.Container container;
@Override
public void onCreate() {
super.onCreate();
// Assign the container with a pre-configured Container
container = Shell.Config.newContainer();

/* Configure shell and your other code */
...
}
}
```

### Shell Operations
Once you have the container setup, you can directly use the high level APIs: `Shell.su()`/`Shell.sh()`:
High level APIs: `Shell.su()`/`Shell.sh()`:

```java
// Run commands and get output immediately
Expand Down
5 changes: 2 additions & 3 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:56 EST 2018 -->
<title>All Classes (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand All @@ -14,7 +14,6 @@ <h1 class="bar">All&nbsp;Classes</h1>
<ul>
<li><a href="com/topjohnwu/superuser/BusyBox.html" title="class in com.topjohnwu.superuser" target="classFrame">BusyBox</a></li>
<li><a href="com/topjohnwu/superuser/CallbackList.html" title="class in com.topjohnwu.superuser" target="classFrame">CallbackList</a></li>
<li><a href="com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser" target="classFrame">ContainerApp</a></li>
<li><a href="com/topjohnwu/superuser/NoShellException.html" title="class in com.topjohnwu.superuser" target="classFrame">NoShellException</a></li>
<li><a href="com/topjohnwu/superuser/Shell.html" title="class in com.topjohnwu.superuser" target="classFrame">Shell</a></li>
<li><a href="com/topjohnwu/superuser/Shell.Config.html" title="class in com.topjohnwu.superuser" target="classFrame">Shell.Config</a></li>
Expand Down
5 changes: 2 additions & 3 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:56 EST 2018 -->
<title>All Classes (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand All @@ -14,7 +14,6 @@ <h1 class="bar">All&nbsp;Classes</h1>
<ul>
<li><a href="com/topjohnwu/superuser/BusyBox.html" title="class in com.topjohnwu.superuser">BusyBox</a></li>
<li><a href="com/topjohnwu/superuser/CallbackList.html" title="class in com.topjohnwu.superuser">CallbackList</a></li>
<li><a href="com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser">ContainerApp</a></li>
<li><a href="com/topjohnwu/superuser/NoShellException.html" title="class in com.topjohnwu.superuser">NoShellException</a></li>
<li><a href="com/topjohnwu/superuser/Shell.html" title="class in com.topjohnwu.superuser">Shell</a></li>
<li><a href="com/topjohnwu/superuser/Shell.Config.html" title="class in com.topjohnwu.superuser">Shell.Config</a></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/BusyBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>BusyBox (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
8 changes: 4 additions & 4 deletions docs/com/topjohnwu/superuser/CallbackList.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>CallbackList (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down Expand Up @@ -48,7 +48,7 @@
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/topjohnwu/superuser/BusyBox.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/topjohnwu/superuser/CallbackList.html" target="_top">Frames</a></li>
Expand Down Expand Up @@ -479,7 +479,7 @@ <h4>size</h4>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/topjohnwu/superuser/BusyBox.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/topjohnwu/superuser/CallbackList.html" target="_top">Frames</a></li>
Expand Down
405 changes: 0 additions & 405 deletions docs/com/topjohnwu/superuser/ContainerApp.html

This file was deleted.

8 changes: 4 additions & 4 deletions docs/com/topjohnwu/superuser/NoShellException.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>NoShellException (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down Expand Up @@ -41,7 +41,7 @@
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Prev&nbsp;Class</li>
<li><a href="../../../com/topjohnwu/superuser/Shell.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
Expand Down Expand Up @@ -180,7 +180,7 @@ <h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Prev&nbsp;Class</li>
<li><a href="../../../com/topjohnwu/superuser/Shell.html" title="class in com.topjohnwu.superuser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.Config.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Config (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
12 changes: 4 additions & 8 deletions docs/com/topjohnwu/superuser/Shell.Container.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Container (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down Expand Up @@ -98,20 +98,16 @@ <h2 title="Interface Shell.Container" class="title">Interface Shell.Container</h
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../com/topjohnwu/superuser/ContainerApp.html" title="class in com.topjohnwu.superuser">ContainerApp</a></dd>
</dl>
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../com/topjohnwu/superuser/Shell.html" title="class in com.topjohnwu.superuser">Shell</a></dd>
</dl>
<hr>
<br>
<pre>public static interface <span class="typeNameLabel">Shell.Container</span></pre>
<div class="block">The container to store the global <code>Shell</code> instance.
<div class="block">A container to store the global <code>Shell</code> instance.
<p>
In order to store a shell instance somewhere in a component of your app, the easiest way
is to create a new non-static <a href="../../../com/topjohnwu/superuser/Shell.Container.html" title="interface in com.topjohnwu.superuser"><code>Shell.Container</code></a> field in your class and assign the value with
is to create a new non-static <a href="../../../com/topjohnwu/superuser/Shell.Container.html" title="interface in com.topjohnwu.superuser"><code>Shell.Container</code></a> field in the class and assign it with
the object returned from <a href="../../../com/topjohnwu/superuser/Shell.Config.html#newContainer--"><code>Shell.Config.newContainer()</code></a>.
<p>
If you decide to go the more complicated route by implementing <a href="../../../com/topjohnwu/superuser/Shell.Container.html" title="interface in com.topjohnwu.superuser"><code>Shell.Container</code></a> in your
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.GetShellCallback.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.GetShellCallback (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.Initializer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Initializer (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.Job.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Job (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.Result.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Result (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.ResultCallback.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.ResultCallback (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/topjohnwu/superuser/Shell.Task.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 11 22:48:43 EST 2018 -->
<!-- Generated by javadoc (1.8.0_152-release) on Sun Nov 25 02:44:55 EST 2018 -->
<title>Shell.Task (libsu API)</title>
<meta name="date" content="2018-11-11">
<meta name="date" content="2018-11-25">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
Expand Down
Loading

0 comments on commit aa69f6d

Please sign in to comment.