Skip to content

Commit 63560a7

Browse files
author
Josh Guilfoyle
committed
Initial commit
0 parents  commit 63560a7

File tree

130 files changed

+9379
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+9379
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gradle
2+
/local.properties
3+
/.idea
4+
*.iml
5+
.DS_Store
6+
/build

CONTRIBUTING.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing to Stetho
2+
We want to make contributing to this project as easy and transparent as
3+
possible.
4+
5+
## Our Development Process
6+
We work directly in the github project and provide versioned releases
7+
appropriate for major milestones and minor bug fixes or improvements. GitHub
8+
is used directly for issues and pull requests and the developers actively
9+
respond to requests.
10+
11+
## Pull Requests
12+
We actively welcome your pull requests.
13+
1. Fork the repo and create your branch from `master`.
14+
2. If you've added code that should be tested, add tests
15+
3. If you've changed APIs, update the documentation.
16+
4. Ensure the test suite passes.
17+
5. Make sure your code lints.
18+
6. If you haven't already, complete the Contributor License Agreement ("CLA").
19+
20+
## Contributor License Agreement ("CLA")
21+
In order to accept your pull request, we need you to submit a CLA. You only need
22+
to do this once to work on any of Facebook's open source projects.
23+
24+
Complete your CLA here: <https://code.facebook.com/cla>
25+
26+
## Issues
27+
We use GitHub issues to track public bugs. Please ensure your description is
28+
clear and has sufficient instructions to be able to reproduce the issue.
29+
30+
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
31+
disclosure of security bugs. In those cases, please go through the process
32+
outlined on that page and do not file a public issue.
33+
34+
## Coding Style
35+
* 2 spaces for indentation rather than tabs
36+
* Line wrapping indents 4 spaces
37+
* 100 character line length
38+
* One parameter per line when line wrapping is required
39+
* Use the `m` member variable prefix for private fields
40+
* Opening braces to appear on the same line as code
41+
42+
## License
43+
By contributing to Stetho, you agree that your contributions will be licensed
44+
under its BSD license.

LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
BSD License
2+
3+
For Stetho software
4+
5+
Copyright (c) 2015, Facebook, Inc. All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
* Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
* Neither the name Facebook nor the names of its contributors may be used to
18+
endorse or promote products derived from this software without specific
19+
prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PATENTS

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Additional Grant of Patent Rights
2+
3+
"Software" means the Stetho software distributed by Facebook, Inc.
4+
5+
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive,
6+
irrevocable (subject to the termination provision below) license under any
7+
rights in any patent claims owned by Facebook, to make, have made, use, sell,
8+
offer to sell, import, and otherwise transfer the Software. For avoidance of
9+
doubt, no license is granted under Facebook’s rights in any patent claims that
10+
are infringed by (i) modifications to the Software made by you or a third party,
11+
or (ii) the Software in combination with any software or other technology
12+
provided by you or a third party.
13+
14+
The license granted hereunder will terminate, automatically and without notice,
15+
for anyone that makes any claim (including by filing any lawsuit, assertion or
16+
other action) alleging (a) direct, indirect, or contributory infringement or
17+
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or
18+
affiliates, whether or not such claim is related to the Software, (ii) by any
19+
party if such claim arises in whole or in part from any software, product or
20+
service of Facebook or any of its subsidiaries or affiliates, whether or not
21+
such claim is related to the Software, or (iii) by any party relating to the
22+
Software; or (b) that any right in any patent claim of Facebook is invalid or
23+
unenforceable.

README.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Stetho
2+
Stetho is a sophisticated debug bridge for Android applications. When enabled,
3+
developers have access to the Chrome Developer Tools feature natively part of
4+
the Chrome desktop browser. Developers can also choose to enable the optional
5+
`dumpapp` tool which offers a powerful command-line interface to application
6+
internals.
7+
8+
## Features
9+
10+
### WebKit Inspector
11+
WebKit Inspector is the internal name of the Chrome Developer Tools feature.
12+
It is implemented using a client/server protocol which the Stetho software
13+
provides for your application. Once your application is integrated, simply
14+
navigate to `chrome://inspect` and click "Inspect" to get started!
15+
16+
![Inspector Discovery Screenshot](https://github.com/facebook/stetho/raw/master/docs/images/inspector-discovery.png)
17+
18+
#### Network inspection
19+
Network inspection is possible with the full spectrum of Chrome Developer Tools features, including image preview, JSON response helpers, and even exporting traces to the HAR format.
20+
21+
![Inspector Network Screenshot](https://github.com/facebook/stetho/raw/master/docs/images/inspector-network.png)
22+
23+
#### Database inspection
24+
SQLite databases can be visualized and interactively explored with full read/write capabilities.
25+
26+
![Inspector WebSQL Screenshot](https://github.com/facebook/stetho/raw/master/docs/images/inspector-sqlite.png)
27+
28+
### dumpapp
29+
Dumpapp extends beyond the Inspector UI features shown above to provide a much
30+
more extensible, command-line interface to application components. A default
31+
set of plugins is provided, but the real power of dumpapp is the ability to
32+
easily create your own!
33+
34+
![dumpapp prefs Screenshot](https://github.com/facebook/stetho/raw/master/docs/images/dumpapp-prefs.png)
35+
36+
## Integration
37+
Integrating with Stetho is intended to be seamless and straightforward for
38+
most existing Android applications. There is a simple initialization step
39+
which occurs in your `Application` class:
40+
41+
```java
42+
public class MyApplication extends Application {
43+
public void onCreate() {
44+
super.onCreate();
45+
Stetho.initialize(
46+
Stetho.newInitializerBuilder(this)
47+
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
48+
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
49+
.build());
50+
}
51+
}
52+
```
53+
54+
This brings up most of the default configuration but does not enable some
55+
additional hooks (most notably, network inspection). See below for specific
56+
details on individual subsystems.
57+
58+
### Enable network inspection
59+
If you are using the popular [OkHttp](http://https://github.com/square/okio)
60+
library at the 2.2.x+ release, you can use the
61+
[Interceptors](https://github.com/square/okhttp/wiki/Interceptors) system to
62+
automatically hook into your existing stack. This is currently the simplest
63+
and most straightforward way to enable network inspection:
64+
65+
```java
66+
OkHttpClient client = new OkHttpClient();
67+
client.networkInterceptors().add(new StethoInterceptor());
68+
```
69+
70+
If you are using any of other network stack options, you will need to manually
71+
provide data to the `NetworkEventReporter` interface. The general pattern for implementing this is:
72+
73+
```java
74+
NetworkEventReporter reporter = NetworkEventReporterImpl.get();
75+
// Important to check if it is enabled first so as not to add overhead to
76+
// the common case that is not under scrutiny.
77+
if (reporter.isEnabled()) {
78+
reporter.requestWillBeSent(new MyInspectorRequest(request));
79+
}
80+
```
81+
82+
See the `stetho-sample` project for more details.
83+
84+
### Custom dumpapp plugins
85+
Custom plugins are the preferred means of extending the `dumpapp` system and
86+
can be added easily during configuration. Simply replace your configuration
87+
step as such:
88+
89+
```java
90+
Stetho.initialize(Stetho.newInitializerBuilder(context)
91+
.enableDumpapp(new MyDumperPluginsProvider(context))
92+
.build())
93+
94+
private static class MyDumperPluginsProvider implements DumperPluginsProvider {
95+
...
96+
97+
public Iterable<DumperPlugin> get() {
98+
ArrayList<DumperPlugin> plugins = new ArrayList<DumperPlugin>();
99+
for (DumperPlugin defaultPlugin : Stetho.defaultDumperPluginsProvider(mContext).get()) {
100+
plugins.add(defaultPlugin);
101+
}
102+
plugins.add(new MyDumperPlugin());
103+
return plugins;
104+
}
105+
}
106+
```
107+
108+
See the `stetho-sample` project for more details.
109+
110+
## Improve Stetho!
111+
See the CONTRIBUTING.md file for how to help out.
112+
113+
## License
114+
Stetho is BSD-licensed. We also provide an additional patent grant.

build.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:1.0.0'
7+
classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
8+
}
9+
}
10+
11+
allprojects {
12+
repositories {
13+
jcenter()
14+
}
15+
}

docs/images/dumpapp-prefs.png

66.2 KB
Loading

docs/images/inspector-discovery.png

50.7 KB
Loading

docs/images/inspector-network.png

112 KB
Loading

docs/images/inspector-sqlite.png

94 KB
Loading

gradle/wrapper/gradle-wrapper.jar

49.8 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Wed Jan 28 14:53:04 PST 2015
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip

0 commit comments

Comments
 (0)