Module: DroidAdbs::Settings

Defined in:
lib/droid_adbs/commons/settings.rb

Class Method Summary collapse

Class Method Details

.disable_always_finish_activitiesString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



5
6
7
# File 'lib/droid_adbs/commons/settings.rb', line 5

def disable_always_finish_activities
  `#{::DroidAdbs.shell} settings put global always_finish_activities 0`.strip
end

.enable_always_finish_activitiesString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



10
11
12
# File 'lib/droid_adbs/commons/settings.rb', line 10

def enable_always_finish_activities
  `#{::DroidAdbs.shell} settings put global always_finish_activities 1`.strip
end

.set_date_to(yyyymmdd, hhmmss) ⇒ String

Returns message from adb command.

Returns:

  • (String)

    message from adb command



64
65
66
67
# File 'lib/droid_adbs/commons/settings.rb', line 64

def set_date_to(yyyymmdd, hhmmss)
  turn_auto_time_off
  `#{::DroidAdbs.shell} date -s #{yyyymmdd}.#{hhmmss}`.strip
end

.turn_airplain_mode_offString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



23
24
25
26
27
# File 'lib/droid_adbs/commons/settings.rb', line 23

def turn_airplain_mode_off
  result1 = `#{::DroidAdbs.shell} settings put global airplane_mode_on 0`
  result2 = `#{::DroidAdbs.shell} am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false`.strip
  result1.concat result2
end

.turn_airplain_mode_onString

Network mode

Returns:

  • (String)

    message from adb command



16
17
18
19
20
# File 'lib/droid_adbs/commons/settings.rb', line 16

def turn_airplain_mode_on
  result1 = `#{::DroidAdbs.shell} settings put global airplane_mode_on 1`
  result2 = `#{::DroidAdbs.shell} am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true`.strip
  result1.concat result2
end

.turn_all_animation_offString

animation settings

Returns:

  • (String)

    message from adb command



71
72
73
74
75
76
# File 'lib/droid_adbs/commons/settings.rb', line 71

def turn_all_animation_off
  turn_all_animation_off_without_reboot
  intent_boot_completed
  puts "adopt settings..."
  false
end

.turn_all_animation_off_without_rebootString

animation settings

Returns:

  • (String)

    message from adb command



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/droid_adbs/commons/settings.rb', line 80

def turn_all_animation_off_without_reboot
  unless available_changing_animation?
    puts "the device is not over API Level 17"
    return true
  end

  if all_animation_off?
    puts "already all animation settings are off"
    return true
  end

  scale_off "window_animation_scale"
  scale_off "transition_animation_scale"
  scale_off "animator_duration_scale"
  false
end

.turn_all_animation_onString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



98
99
100
101
102
103
# File 'lib/droid_adbs/commons/settings.rb', line 98

def turn_all_animation_on
  turn_all_animation_on_without_reboot
  intent_boot_completed
  puts "adopt settings..."
  false
end

.turn_all_animation_on_without_rebootString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/droid_adbs/commons/settings.rb', line 106

def turn_all_animation_on_without_reboot
  unless available_changing_animation?
    puts "the device is not over API Level 17"
    return true
  end

  if all_animation_on?
    puts "already all animation settings are on"
    return true
  end

  scale_on "window_animation_scale"
  scale_on "transition_animation_scale"
  scale_on "animator_duration_scale"
  false
end

.turn_auto_time_offString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



59
60
61
# File 'lib/droid_adbs/commons/settings.rb', line 59

def turn_auto_time_off
  `#{::DroidAdbs.shell} settings put global auto_time 0`.strip
end

.turn_auto_time_onString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



54
55
56
# File 'lib/droid_adbs/commons/settings.rb', line 54

def turn_auto_time_on
  `#{::DroidAdbs.shell} settings put global auto_time 1`.strip
end

.turn_cpu_monitoring_offString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



49
50
51
# File 'lib/droid_adbs/commons/settings.rb', line 49

def turn_cpu_monitoring_off
  `#{::DroidAdbs.shell} settings put global show_processes 0`.strip
end

.turn_cpu_monitoring_onString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



44
45
46
# File 'lib/droid_adbs/commons/settings.rb', line 44

def turn_cpu_monitoring_on
  `#{::DroidAdbs.shell} settings put global show_processes 1`.strip
end

.turn_wifi_offString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



37
38
39
40
41
# File 'lib/droid_adbs/commons/settings.rb', line 37

def turn_wifi_off
  result1 = `#{::DroidAdbs.shell} settings put global wifi_on 0`
  result2 = `#{::DroidAdbs.shell} am broadcast -a android.intent.action.WIFI_ON --ez state false`.strip
  result1.concat result2
end

.turn_wifi_onString

Returns message from adb command.

Returns:

  • (String)

    message from adb command



30
31
32
33
34
# File 'lib/droid_adbs/commons/settings.rb', line 30

def turn_wifi_on
  result1 = `#{::DroidAdbs.shell} settings put global wifi_on 1`
  result2 = `#{::DroidAdbs.shell} am broadcast -a android.intent.action.WIFI_ON --ez state false`.strip
  result1.concat result2
end