Sentinel
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-thimble
- contains a class wrapper for Thimblesample
- a sample app for testing and developing
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
debugImplementation "com.infinum.sentinel:sentinel:1.1.6"
releaseImplementation "com.infinum.sentinel:sentinel-no-op:1.1.6"
KotlinDSL
debugImplementation("com.infinum.sentinel:sentinel:1.1.6")
releaseImplementation("com.infinum.sentinel:sentinel-no-op:1.1.6")
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:1.1.6"
debugImplementation "com.infinum.sentinel:tool-collar:1.1.6"
debugImplementation "com.infinum.sentinel:tool-dbinspector:1.1.6"
debugImplementation "com.infinum.sentinel:tool-leakcanary:1.1.6"
debugImplementation "com.infinum.sentinel:tool-appgallery:1.1.6"
debugImplementation "com.infinum.sentinel:tool-googleplay:1.1.6"
debugImplementation "com.infinum.sentinel:tool-thimble:1.1.6"
KotlinDSL
debugImplementation("com.infinum.sentinel:tool-chucker:1.1.6")
debugImplementation("com.infinum.sentinel:tool-collar:1.1.6")
debugImplementation("com.infinum.sentinel:tool-dbinspector:1.1.6")
debugImplementation("com.infinum.sentinel:tool-leakcanary:1.1.6")
debugImplementation("com.infinum.sentinel:tool-appgallery:1.1.6")
debugImplementation("com.infinum.sentinel:tool-googleplay:1.1.6")
debugImplementation("com.infinum.sentinel:tool-thimble:1.1.6")
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(),
ThimbleTool()
)
)
A set of tools should be provided as a watch parameter. This set of tools can be empty.
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 implemented
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 LeakCanaryThimbleTool
- a wrapper class that opens ThimbleAppGalleryTool
- 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 found
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 and Shake triggers 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.
Manual
- used for manually triggering UI with show()Shake
- default trigger to show UI, shake device to invokeForeground
- 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.
Plain
Markdown
JSON
XML
HTML
Requirements
This plugin has been written in Kotlin but works both inside Kotlin and Java projects. Minimum required API level to use Sentinel is 21 known as Android 5.0, Lollipop. Sentinel is built with and for AndroidX projects.
Contributing
Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license. 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.
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.