mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:33:30 +02:00
Adding new Settings shortcuts.
This commit is contained in:
@@ -1,31 +1,64 @@
|
||||
// See https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
|
||||
|
||||
module.exports = function ShellCtrl($scope, gettext) {
|
||||
// TODO: implement multiple devices
|
||||
// $scope.results = []
|
||||
$scope.result = null
|
||||
|
||||
$scope.referenceUrl = 'https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference'
|
||||
|
||||
$scope.run = function(command) {
|
||||
if (command === 'clear') {
|
||||
$scope.clear()
|
||||
return
|
||||
}
|
||||
|
||||
$scope.command = ''
|
||||
|
||||
var run = function (command) {
|
||||
// Force run activity
|
||||
command += ' --activity-clear-top'
|
||||
return $scope.control.shell(command)
|
||||
.progressed(function(result) {
|
||||
$scope.result = result
|
||||
$scope.data = result.data.join('')
|
||||
$scope.$digest()
|
||||
})
|
||||
.then(function(result) {
|
||||
$scope.result = result
|
||||
$scope.data = result.data.join('')
|
||||
$scope.$digest()
|
||||
.then(function (result) {
|
||||
console.log(result)
|
||||
})
|
||||
}
|
||||
|
||||
function openSetting(activity) {
|
||||
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings\$' + activity)
|
||||
}
|
||||
|
||||
$scope.openSettings = function () {
|
||||
run('am start -a android.intent.action.MAIN -n com.android.settings/.Settings')
|
||||
}
|
||||
|
||||
$scope.openWiFiSettings = function () {
|
||||
//openSetting('WifiSettingsActivity')
|
||||
run('am start -a android.settings.WIFI_SETTINGS')
|
||||
}
|
||||
|
||||
$scope.openLocaleSettings = function () {
|
||||
openSetting('LocalePickerActivity')
|
||||
}
|
||||
|
||||
$scope.openIMESettings = function () {
|
||||
openSetting('KeyboardLayoutPickerActivity')
|
||||
}
|
||||
|
||||
$scope.openDisplaySettings = function () {
|
||||
openSetting('DisplaySettingsActivity')
|
||||
}
|
||||
|
||||
$scope.openDeviceInfo = function () {
|
||||
openSetting('DeviceInfoSettingsActivity')
|
||||
}
|
||||
|
||||
$scope.openManageApps = function () {
|
||||
//openSetting('ManageApplicationsActivity')
|
||||
run('am start -a android.settings.APPLICATION_SETTINGS')
|
||||
}
|
||||
|
||||
$scope.openRunningApps = function () {
|
||||
openSetting('RunningServicesActivity')
|
||||
}
|
||||
|
||||
$scope.openDeveloperSettings = function () {
|
||||
openSetting('DevelopmentSettingsActivity')
|
||||
}
|
||||
|
||||
|
||||
//'am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity'
|
||||
//'am start -a android.intent.action.POWER_USAGE_SUMMARY'
|
||||
|
||||
|
||||
$scope.clear = function () {
|
||||
$scope.command = ''
|
||||
$scope.data = ''
|
||||
|
||||
Reference in New Issue
Block a user