android-sentinel
Sentinel

Description
Sentinel is a simple one screen UI that provides standardised entry point for tools used in
development and QA alongside device, application and permissions data.
It's designed to be easily configured and expanded depending on needs and requirements of developers
and QA testers.
The project is organized in the following modules:
sentinel- contains a single screen UI that provides visual information about device, application, permissions and toolssentinel-no-op- contains stubs for easy release implementation of UI package and any Tools includedtool-chucker- contains a class wrapper for Chuckertool-collar- contains a class wrapper for Collartool-dbinspector- contains a class wrapper for DbInspectortool-leakcanary- contains a class wrapper for LeakCanarytool-appgallery- contains a class wrapper for Huawei AppGallerytool-googleplay- contains a class wrapper for Google Playtool-timber- contains a class wrapper for Timbertool-deeplinks- contains the Deep links tool, built with Jetpack Composetool-networkemulator-okhttp- contains a class wrapper for NetworkEmulatortool-networkemulator-okhttp-no-op- contains stubs for easy release implementation of the NetworkEmulator interceptortool-networkproxy-okhttp- contains a class wrapper for NetworkProxytool-networkproxy-okhttp-no-op- contains stubs for easy release implementation of the NetworkProxy wrappertool-showkase- contains a class wrapper for Showkasetool-showkase-no-op- contains stubs for easy release implementation of the Showkase wrappersample- a sample app for testing and developing
Table of contents
Requirements
This plugin has been written in Kotlin but works both inside Kotlin and Java projects. Minimum required API level to use Sentinel is 24. Sentinel is built with and for AndroidX projects.
Usage
To include Sentinel in your project, you have to add buildscript dependencies in your project
level build.gradle or build.gradle.kts:
Groovy
buildscript {
repositories {
mavenCentral()
}
}
KotlinDSL
buildscript {
repositories {
mavenCentral()
}
}
Then add the following dependencies in your app build.gradle or build.gradle.kts :
Groovy
def sentinelVersion = "2.0.0"
debugImplementation "com.infinum.sentinel:sentinel:$sentinelVersion"
releaseImplementation "com.infinum.sentinel:sentinel-no-op:$sentinelVersion"
KotlinDSL
val sentinelVersion = "2.0.0"
debugImplementation("com.infinum.sentinel:sentinel:$sentinelVersion")
releaseImplementation("com.infinum.sentinel:sentinel-no-op:$sentinelVersion")
Basic tools are provided inside the main package but depending on requirements you might want to add specific tools:
Groovy
debugImplementation "com.infinum.sentinel:tool-chucker:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-collar:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-dbinspector:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-leakcanary:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-appgallery:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-googleplay:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-timber:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-deeplinks:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-networkemulator-okhttp:$sentinelVersion"
releaseImplementation "com.infinum.sentinel:tool-networkemulator-okhttp-no-op:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-networkproxy-okhttp:$sentinelVersion"
releaseImplementation "com.infinum.sentinel:tool-networkproxy-okhttp-no-op:$sentinelVersion"
debugImplementation "com.infinum.sentinel:tool-showkase:$sentinelVersion"
releaseImplementation "com.infinum.sentinel:tool-showkase-no-op:$sentinelVersion"
KotlinDSL
debugImplementation("com.infinum.sentinel:tool-chucker:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-collar:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-dbinspector:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-leakcanary:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-appgallery:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-googleplay:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-timber:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-deeplinks:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-networkemulator-okhttp:$sentinelVersion")
releaseImplementation("com.infinum.sentinel:tool-networkemulator-okhttp-no-op:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-networkproxy-okhttp:$sentinelVersion")
releaseImplementation("com.infinum.sentinel:tool-networkproxy-okhttp-no-op:$sentinelVersion")
debugImplementation("com.infinum.sentinel:tool-showkase:$sentinelVersion")
releaseImplementation("com.infinum.sentinel:tool-showkase-no-op:$sentinelVersion")
Tool wrappers are stubbed in sentinel-no-op, but the libraries they wrap (Chucker, Collar, DbInspector,
LeakCanary, Timber) are only exposed in debug. If your shared code uses one of them directly, for example
ChuckerInterceptor or Timber.plant(), add that library yourself (or its own no-op artifact) for release builds.
Now you can sync your project.
Getting started
Create or inject an instance of Sentinel in your Application class and start watching for triggers:
Sentinel.watch(
setOf(
ChuckerTool(),
CollarTool(),
DbInspectorTool(),
LeakCanaryTool(),
AppGalleryTool(appId = "123456789"),
GooglePlayTool(),
TimberTool(allowedTags = listOf("EXAMPLE")),
CertificateTool(userCertificates = listOf()),
DeepLinkTool()
)
)
A set of tools should be provided as a watch parameter. This set of tools can be empty.
App Startup
Under the hood Sentinel is using App Startup library to initialize itself. If you are using App Startup library in your project, you might encounter errors related to Sentinel's initialization.
To avoid errors simply add dependency to Sentinel's initializer in your initializer:
class SentinelInitializer : Initializer<Unit> {
override fun create(context: Context) {
Sentinel.watch(
setOf(
ChuckerTool(),
DbInspectorTool(),
GooglePlayTool(),
TimberTool(),
),
)
}
override fun dependencies(): List<Class<out Initializer<*>?>?> = listOf(
com.infinum.sentinel.SentinelInitializer::class.java,
)
}
Tools
Sentinel provides several different levels of tools for a developer to implement.
Built in
AppInfoTool- opens Android OS Settings page of the application in which Sentinel was implementedCrashMonitorTool- monitors exceptions and ANR crashes of the application in which Sentinel was implementedBundleMonitorTool- monitors Bundle objects passed around the application mostly for size avoiding TransactionTooLarge exceptionsPreference Editor- by tapping any preference Sentinel opens a screen where you can edit current valueCertificateTool- opens a list of system and user provided X.509 certificates with details
Dependency wrappers
Depending of what you include as module dependencies, very specific tools are provided.
ChuckerTool- a wrapper class that opens ChuckerCollarTool- a wrapper class that opens CollarDbInspectorTool- a wrapper class that opens DbInspectorLeakCanaryTool- a wrapper class that opens LeakCanaryTimberTool- a wrapper class that opens Timber . Takes in an optional list of allowed tags for filtering logged messages per tag.AppGalleryTool- a wrapper class that opens Huawei AppGallery of a published application or a web page of the application if Huawei AppGallery is not foundGooglePlayTool- a wrapper class that opens Google Play of a published application or a web page of the application if Google Play is not foundNetworkEmulatorTool- a wrapper class that opens NetworkEmulator. Enables user to modify network conditions.NetworkProxyTool- a wrapper class that opens NetworkProxy. Lets the user alter the status code and body of API responses, or mock them, from inside the app. Requires the interceptor, see Network Proxy below.ShowkaseTool- a wrapper class that opens Showkase, Airbnb's Compose component browser. Requires additional setup, see Showkase below.DeepLinkTool- lists the deep links the application declares in its manifest, and lets you build, save and launch variants of them with your own query parameters. Requirestool-deeplinks, see Deep links below.
Network Proxy
Add the interceptor to your OkHttp client, after Chucker if you use it, so Chucker records what the app actually received:
OkHttpClient.Builder()
.addInterceptor(ChuckerInterceptor(context))
.addInterceptor(NetworkProxyInterceptor(context))
.build()
Rules match on method and path with * as a one-segment wildcard, and either modify the real response
or mock it without hitting the network. Because the interceptor runs inside the process after TLS, it works
with certificate pinning. tool-networkproxy-okhttp/README.md covers
the details.
Showkase
Unlike the other wrappers, Showkase needs build configuration in your project, because its annotation processor has to run over your own sources. The short version:
debugImplementation "com.infinum.sentinel:tool-showkase:$sentinelVersion"
releaseImplementation "com.infinum.sentinel:tool-showkase-no-op:$sentinelVersion"
debugImplementation "com.airbnb.android:showkase:1.0.5"
kspDebug "com.airbnb.android:showkase-processor:1.0.5"
Use a variant-scoped ksp configuration such as kspDebug, never the project-wide ksp
configuration: that one applies the processor to every variant, production included.
Register the tool with your app's @ShowkaseRoot module:
Sentinel.watch(
setOf(
ShowkaseTool(MyRootModule::class),
),
)
tool-showkase/README.md covers the full setup, flavored projects, minified builds and troubleshooting.
Source abstractions
If you want to implement a different tool other than already packaged with a predefined type and name, several are available.
NetworkTool- a wrapper interface with a name Network for any network interceptorsMemoryTool- a wrapper interface with a name Memory for any memory management toolsAnalyticsTool- a wrapper interface with a name Analytics for any analytics collectorsDatabaseTool- a wrapper interface with a name Database for any database viewersReportTool- a wrapper interface with a name Report for any crash reporting toolsBluetoothTool- a wrapper interface with a name Bluetooth for any Bluetooth loggersDistributionTool- a wrapper interface with a name Distribution for any release distribution channelsDesignTool- a wrapper interface with a name Design for any design utilities
Independent implementations
An interface is provided named Sentinel.Tool that requires implementation of a String resource for a name and a View.OnClickListener. An optional icon Drawable resource can be supplied. Implementing this interface enables any class to be provided as a tool in Sentinel.
interface Tool {
@DrawableRes
fun icon(): Int? = null
@StringRes
fun name(): Int
fun listener(): View.OnClickListener
}
Triggers
Sentinel observes several different trigger events, determining when to show up.
Manual trigger cannot be turned off but rest are configurable through Sentinel
settings except Foreground trigger when running on emulators. Trigger states will be persisted
between sessions.
Upon first run, all triggers are enabled.
Only way to override default trigger behaviour is to explicitly set them in you application manifest.
If declared, these will override any changes that user does on each application launch.
Accepted values are 0 and 1 to disable or enable a trigger.
Anything else will result in the same way like the metadata key isn't declared at all.
<application
android:name=".SampleApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
...
<meta-data
android:name="com.infinum.sentinel.trigger.shake"
android:value="1" />
<meta-data
android:name="com.infinum.sentinel.trigger.proximity"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.foreground"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.usb_connected"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.airplane_mode_on"
android:value="0" />
...
</application>
Manual- used for manually triggering UI with show()Shake- default trigger to show UI, shake device to invokeProximity- shows UI every time sensor detects near stateForeground- shows UI every time application goes into foregroundUSB connected- shows UI every time an USB cable is plugged inAirplane mode on- shows UI every time Airplane mode is turned on
Formatters
Data gathered and presented by Sentinel can be shared to any text compliant recipient applications. Sentinel provides a few simple text formatters for easy integrations into other systems. Plain formatter is selected by default, but selecting any other is persisted between sessions.
PlainMarkdownJSONXMLHTML
Crash monitor
Sentinel has a built in default uncaught exception handler and ANR observer. If switched on in
settings, it will notify both in a form of a notification. Note that from Android 13 you need to give permission
to the app to show notifications.
Once tapped on this notification, a screen with details is shown. A complete list of crashes is
persisted between sessions and available on demand.
Methods to react on these crashes in a graceful way are provided in Sentinel.
Sentinel.setExceptionHandler { _, exception ->
println("Exception happened: ${exception.message}")
exitProcess(exception.hashCode())
}
Sentinel.setAnrListener { exception ->
println("ANR happened: ${exception.message}")
exitProcess(exception.hashCode())
}
Bundle monitor
Sentinel monitors Bundle objects passed around the application mostly for size limit of 500kB,
thus avoiding TransactionTooLarge exceptions.
In settings there are options to notify inside a running session, toggle specific variants or set
the limit of Bundle size.
This monitor feature runs automatically for every Activity but if you wish to disable monitoring
for a specific screen, you can do so in the AndroidManifest.xml by adding a meta-data node.
<activity
android:name="com.example.ui.main.MainActivity"
android:exported="false">
<meta-data
android:name="@string/sentinel_infinum_monitored"
android:value="false" />
</activity>
Deep links
The Deep links tool lives in its own module. Add it to your debug build; the DeepLinkTool stub for release builds is
already in sentinel-no-op:
debugImplementation("com.infinum.sentinel:tool-deeplinks:$sentinelVersion")
If testers get another build type with sentinel, such as a qa or staging build from Firebase App Distribution,
add the tool to that build type too, for example with qaImplementation(...). Builds that use sentinel-no-op get
the stub, and the tool doesn't appear in them.
The tool is built with Jetpack Compose 1.12 and Material 3 1.4 (Compose BOM 2026.09.00) and Navigation 3 1.2, so
tool-deeplinks brings them into your debug build; sentinel doesn't. If your app also uses Compose, Gradle resolves
the higher of the two versions, so your debug build can run a newer Compose than your release build.
Sentinel reads the intent filters declared in the application's manifest and lists the deep links they accept (content and file schemes,
MIME-type filters and non-exported screens are left out), grouped by the screen that declares them. Add DeepLinkTool
to the watched tools:
DeepLinkTool(
exampleLinks = listOf(
DeepLinkTool.ExampleLink("myapp://product/123?ref=push", "Product 123")
)
)
Example links are optional. Use them for links with realistic IDs or parameters that the manifest can't describe. They are listed in an "Example links" section above the declared links.
For every link you can:
- create variants with your own query parameters, and fill in pattern links such as
/product/*. Variants are saved on the device. Pattern links (templates) can't be launched, copied or shared as they are: you launch, copy and share them through a variant that fills them in. - launch the link the way a tap in another app would ("Real tap"), or, for web links, directly into the application ("Open in this app"). Web links ask which one; other links open with Real tap.
A link whose screen lacks the
BROWSABLEcategory can't take a Real tap, so it opens in the application directly. The variant editor's Launch action saves the variant and launches it in one step. - see warnings for declarations that break real links, such as a missing
DEFAULTorBROWSABLEcategory, a link declared by two screens, or a disabled screen - open a breakdown of the link's parts, and copy or share it
- on Android 12 and later, see whether a web link's domain is verified, and open the system link settings
When you test with the tool:
- Every launch from the tool is a warm start, because the application is already running. To test a cold start, copy
the link, force-stop the application in Settings > Apps > (the application) > Force stop, or with
adb shell am force-stop <applicationId>, then open the link from another app, such as a notes or chat app. - Only one installed app can own a web link's domain or receive a custom scheme without a chooser. If a second build of the application is installed, for example a debug and a release build, links can open in that build instead.
- On Android 17 and later,
adb shell am start --debug-link -a android.intent.action.VIEW -d "<link>"shows how the system resolved a link, including Dynamic App Links rules that the tool can't read.
Contributing
We believe that the community can help us improve and build better a product. Please refer to our contributing guide to learn about the types of contributions we accept and the process for submitting them.
To ensure that our community remains respectful and professional, we defined a code of conduct that we expect all contributors to follow.
For easier developing a sample application with
proper implementations is provided. If you wish to add a new specific dependency wrapper tool,
create a new module and set it up like the ones already provided. Then create a pull request.
We appreciate your interest and look forward to your contributions.
License
Copyright 2020 Infinum
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Credits
Maintained and sponsored by Infinum.
