diff options
author | Vishal Bhoj <vishal.bhoj@linaro.org> | 2013-03-28 04:32:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@betelgeuse.canonical.com> | 2013-03-28 04:32:59 +0000 |
commit | 3844224c90dad44c000e4858a696e6e7cddca448 (patch) | |
tree | 4ef4909cb3dd2e79f647d2afc7512c1ba4b643cc | |
parent | 23516ee8daa36853ecd6fe6445aec140b0533bb3 (diff) | |
parent | 96a998ab66847179dbb19ba2c589a1de3fa0e6c8 (diff) |
Merge "disablesuspend.sh: add source for waiting home screen" into linaro-jb
-rwxr-xr-x | disablesuspend.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/disablesuspend.sh b/disablesuspend.sh index 0bc54ca..c39336a 100755 --- a/disablesuspend.sh +++ b/disablesuspend.sh @@ -6,7 +6,26 @@ # are licensed under the Apache License, Version 2.0. # You may obtain a copy of this license at # http://www.apache.org/licenses/LICENSE-2.0 +wait_home_screen(){ + timeout=0 + while(true) + do + echo "Waiting for Homescreen ..." + if logcat -d | grep -i "Displayed com.android.launcher/com.android.launcher2.Launcher:" ; then + echo "Home screen should be displayed!" + return 0 + fi + timeout=$((timeout+1)) + if [ $timeout = 30 ]; then + echo "Failed to wait the home screen displayed!" + return 1 + fi + sleep 60 + done +} +disable_suspend(){ + echo "Now disable the suspend feature..." stay_awake="delete from system where name='stay_on_while_plugged_in'; insert into system (name, value) values ('stay_on_while_plugged_in','3');" screen_sleep="delete from system where name='screen_off_timeout'; insert into system (name, value) values ('screen_off_timeout','-1');" lockscreen="delete from secure where name='lockscreen.disabled'; insert into secure (name, value) values ('lockscreen.disabled','1');" @@ -15,3 +34,13 @@ sqlite3 /data/data/com.android.providers.settings/databases/settings.db "${lockscreen}" ##set lock screen to none input keyevent 82 ##unlock the home screen svc power stayon true ##disable the suspend + echo "The suspend feature is disabled." +} + +if [ "X${1}" == "X--no-wait" ]; then + : +else + wait_home_screen || exit 1 +fi + +disable_suspend |