1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00
OpenSTF/res/app/control-panes/dashboard/apps/apps-controller.js
2015-08-31 17:04:46 +09:00

66 lines
1.7 KiB
JavaScript

// See https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml
module.exports = function ShellCtrl($scope) {
$scope.result = null
var run = function (command) {
// Force run activity
command += ' --activity-clear-top'
return $scope.control.shell(command)
.then(function (result) {
console.log(result)
})
}
// TODO: Move this to server side
// TODO: Android 2.x doesn't support openSetting(), account for that on the UI
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')
}
$scope.clear = function () {
$scope.command = ''
$scope.data = ''
$scope.result = null
}
}