ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2012年4月16日 星期一

Android System Shutdown -- code trace

在 frameworks/base/core/java/com/android/internal/app 有一個 ShutdownThread.java

這邊有說明一下 shutdown process:
  1. http://kobablog.wordpress.com/2011/07/16/shutdown-sequence-of-android/
  2. http://hi.baidu.com/jsxhxcq/blog/item/0933ae618376f0e8f6365451.html

使用標準的 shutdown process的話,app 還可以收到 shutdown message:
http://stackoverflow.com/questions/5076410/how-to-know-device-is-power-off

copy 一下 回答的部份:
public static final String ACTION_SHUTDOWN Since: API Level 4 Broadcast Action: Device is shutting down. This is broadcast when the device is being shut down (completely turned off, not sleeping). Once the broadcast is complete, the final shutdown will proceed and all unsaved data lost. Apps will not normally need to handle this, since the foreground activity will be paused as well. This is a protected intent that can only be sent by the system. Constant Value: "android.intent.action.ACTION_SHUTDOWN" This would appear to be it? I just Googled your command and it was on the Standard Broadcast Actions list. :
ref: http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN

沒有留言:

標籤

網誌存檔