12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package shell
- func (d DeviceShell) putGlobal(key, value string) ([]byte, error) {
- return d.putSettings("global", key, value)
- }
- // func (d DeviceShell) putSecure(key, value string) ([]byte, error) {
- // return d.putSettings("secure", key, value)
- // }
- func (d DeviceShell) putSystem(key, value string) ([]byte, error) {
- return d.putSettings("system", key, value)
- }
- func (d DeviceShell) putSettings(namespace, key, value string) ([]byte, error) {
- return d.RunSync("settings", "put", namespace, key, value)
- }
- // ShowTouches enables touch pointer and touch coordinates showing
- func (d DeviceShell) ShowTouches() ([]byte, error) {
- var response []byte
- for _, val := range [...]string{"show_touches", "pointer_location"} {
- res, err := d.putSystem(val, "1")
- if err != nil {
- return res, err
- } else {
- response = append(response, res...)
- }
- }
- return response, nil
- }
- // DisableAnimations disables "transition_animation_scale", "window_animation_scale" and "animator_duration_scale"
- func (d DeviceShell) DisableAnimations() ([]byte, error) {
- var response []byte
- params := [...]string{"transition_animation_scale", "window_animation_scale", "animator_duration_scale"}
- for i := range params {
- res, err := d.putGlobal(params[i], "0.0")
- if err != nil {
- return res, err
- } else {
- response = append(response, res...)
- }
- }
- return response, nil
- }
|