본문 바로가기

개발 개발/Android

android reboot

http://source-android.frandroid.com/system/core/libcutils/android_reboot.c


특별히 셋팅하지 않는 이상 sync()와 remount_ro()를 수행한뒤 리부팅을 한다.

int android_reboot(int cmd, int flags, char *arg) { int ret; if (!(flags & ANDROID_RB_FLAG_NO_SYNC)) sync(); if (!(flags & ANDROID_RB_FLAG_NO_REMOUNT_RO)) remount_ro(); switch (cmd) { case ANDROID_RB_RESTART: ret = reboot(RB_AUTOBOOT); break; case ANDROID_RB_POWEROFF: ret = reboot(RB_POWER_OFF); break; case ANDROID_RB_RESTART2: ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, arg); break; default: ret = -1; } return ret; }