Helper application to test android applications. This application handle some settings via adb broadcast. So, you can handle some settings via adb broadcast.
Some features are similar to https://github.com/linkedin/test-butler published by LinkedIn.
- Remove particular account from AccountManager via
adb
broadcast.- You can remove application local data via
adb shell am clear your.package.name
. - But if your application support account manager, the command can't remove the data.
- You can remove application local data via
- Change language/country setting via some adb commands
- Change animation scale
- Clear data
-
- Git clone this repository, build and install this apk into your target device.
- run the apk once
$ adb shell am start -n com.kazucocoa.droidtesthelper/.MainActivity
-
- Execute the following command. ( Should replace
your.target.account.type
to fit your application. )
$ adb shell am broadcast -a 'DroidTestHelper' --es ACCOUNT_TYPE your.target.account.type
- Managing account only for API level 22 and lower.
- If you clone this repository and build apk with the same signature for your test target apk, you can manage the account without permissions.
- Execute the following command. ( Should replace
-
- Execute the following command to allow permission.
$ adb shell pm grant com.kazucocoa.droidtesthelper android.permission.CHANGE_CONFIGURATION
-
- Set
ja_JP
$ adb shell am broadcast -a 'DroidTestHelper' --es LANG ja --es COUNTRY JP
- Set
- https://developer.android.com/reference/java/util/Locale.html
- http://stackoverflow.com/questions/7973023/what-is-the-list-of-supported-languages-locales-on-android
-
- Execute the following command to allow permission.
$ adb shell pm grant com.kazucocoa.droidtesthelper android.permission.SET_ANIMATION_SCALE
$ adb shell pm grant com.kazucocoa.droidtesthelper android.permission.WRITE_SECURE_SETTINGS
-
- enable/disable animation scale 1.0f
- enable
$ adb shell am broadcast -a 'DroidTestHelper' --ez ANIMATION true
- disable
$ adb shell am broadcast -a 'DroidTestHelper' --ez ANIMATION false
-
- clear data (Requires API level 21+)
$ adb shell am broadcast -a 'DroidTestHelper' --es CLEAR_DATA com.example
- HandleAccountHelper
- HandleAnimations
- HandleLocale
- HandlePermission
- HandleClearData
dependencies {
compile 'com.github.KazuCocoa:DroidTestHelper:0.3.0'
}
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<!-- to grant permission -->
<uses-permission android:name="android.permission.GRANT_REVOKE_PERMISSIONS"/>
<uses-permission
android:name="android.permission.MANAGE_ACCOUNTS"
android:maxSdkVersion="22" />
A package com.kazucocoa.droidtesthelper
is example to use com.kazucocoa.droidtesthelperlib
.
-
Android P has
Restrictions on non-SDK interfaces
feature. -
java.lang.NoSuchMethodException: setAnimationScales [class [F]
happen when we callsetAnimationScales
in animation handler -
To available the interface, we need below adb commands
adb shell settings put global hidden_api_policy_pre_p_apps 1 adb shell settings put global hidden_api_policy_p_apps 1
-
To disable again, we need below adb commands
adb shell settings delete global hidden_api_policy_pre_p_apps adb shell settings delete global hidden_api_policy_p_apps
I will add additional feature if I need.
MIT