/mirkerson/article/details/21861595
在我们mtk项目中:如何关闭快速开机功能?
①、在device/reallytek/项目配置rlk6737m_65_n/(rlk_projects\cxlite_h3713_a1\)
MTK_IPO_SUPPORT = no //在配置的宏一定要在**.mk文件中进行转化才能被上层直接使用
②、在device/reallytek/rlk6737m_65_n/中
ifeq ($(strip $(MTK_IPO_SUPPORT)), yes)
PRODUCT_PROPERTY_OVERRIDES += ro.mtk_ipo_support=1
endif
//以ro.开头表示系统配置文件,并且表示只能读,即放在这里让我们看一下,让我们知道。PRODUCT_PROPERTY_OVERRIDES是android的一种默认格式
③、在上层某一个java文件中的FeatureOption
类中调用MTK_IPO_SUPPORT
成员变量判断它的值,从而进一步做如下操作
在./packages/apps/Settings/src/com/android/settings/accessibility/: 中
FeatureOption.MTK_IPO_SUPPORT ==
false
首先查看Settings里控制开关
02
|
boolean ipoSettingEnabled = (getContentResolver(),
|
04
|
if (mIpoSetting!= null ){
|
08
|
boolean isChecked = ((CheckBoxPreference) preference).isChecked();
|
09
|
(getContentResolver(), .IPO_SETTING,
|
全局搜索 .IPO_SETTING ,发现在关机系统里调用了该状态(ShutdownThread.Java)
ShutdownThread 里的 checkShutdownFlow 方法
02
|
if (FeatureOption.MTK_IPO_SUPPORT == false || mReboot == true ) {
|
03
|
mShutdownFlow = NORMAL_SHUTDOWN_FLOW;
|
10
|
.IPO_SETTING, 1 ) == 1 ;
|
11
|
} catch (NullPointerException ex) {
|
12
|
mShutdownFlow = NORMAL_SHUTDOWN_FLOW;
|
15
|
if (isIPOEnabled == true ) {
|
18
|
mShutdownFlow = NORMAL_SHUTDOWN_FLOW;
|
20
|
mShutdownFlow = IPO_SHUTDOWN_FLOW;
|
22
|
mShutdownFlow = NORMAL_SHUTDOWN_FLOW;
|
以上函数如果正常进入快速关机模式
mShutdownFlow = IPO_SHUTDOWN_FLOW
关机流程会调用 (mContext, true);
ShutdownThread 里的 shutdown 方法
01
|
bConfirmForAnimation = confirm;
|
03
|
if (mDialog == null ) {
|
04
|
mDialog = new (context)
|
05
|
.setIcon(.ic_dialog_alert)
|
07
|
.setMessage(.shutdown_confirm)
|
08
|
.setPositiveButton(, new () {
|
09
|
public void onClick(DialogInterface dialog, int which) {
|
11
|
beginShutdownSequence(context);
|
12
|
if (mDialog != null ) {
|
17
|
.setNegativeButton(, new () {
|
18
|
public void onClick(DialogInterface dialog, int which) {
|
19
|
synchronized (sIsStartedGuard) {
|
22
|
if (mDialog != null ) {
|
30
|
.TYPE_KEYGUARD_DIALOG);
|
38
|
beginShutdownSequence(context);
|
ShutdownThread 里的 beginShutdownSequence 方法
1
|
if (mShutdownFlow == IPO_SHUTDOWN_FLOW) {
|
3
|
synchronized (mShutdownThreadSync) {
|
ShutdownThread 里的 run 方法
03
|
while (mShutdownFlow == IPO_SHUTDOWN_FLOW) {
|
07
|
if (mShutdownFlow != IPO_SHUTDOWN_FLOW) {
|
adb logcat -s “ShutdownThread”
01
|
--------- beginning of /dev/log/system
|
02
|
--------- beginning of /dev/log/main
|
03
|
D/ShutdownThread( 189 ): !!! Request to shutdown !!!
|
04
|
D/ShutdownThread( 189 ): Notifying thread to start radio shutdown
|
05
|
D/ShutdownThread( 189 ): PowerOff dialog doesn't exist. Create it first
|
06
|
D/ShutdownThread( 189 ): ShutdownThread exists already
|
07
|
D/ShutdownThread( 189 ): checkShutdownFlow: IPO_Support= true mReboot= false
|
08
|
D/ShutdownThread( 189 ): checkShutdownFlow: isIPOEnabled= true mShutdownFlow= 1
|
09
|
D/ShutdownThread( 189 ): shutdown acquire partial WakeLock 2
|
10
|
I/ShutdownThread( 189 ): Sending shutdown broadcast...
|
11
|
I/ShutdownThread( 189 ): Waiting for Bluetooth and Radio...
|
12
|
I/ShutdownThread( 189 ): Radio and Bluetooth shutdown complete.
|
13
|
I/ShutdownThread( 189 ): Shutting down MountService
|
14
|
W/ShutdownThread( 189 ): Result code 0 from
|
15
|
I/ShutdownThread( 189 ): Performing ipo low-level shutdown...
|
ShutdownManager 里的 saveStates 方法
ShutdownThread 里的 running 方法
ShutdownManager 里的 shutdown 方法
1
|
mPowerManager = (PowerManager)( "power" );
|
5
|
Intent intent = new Intent( "" );
|
adb logcat -s “ShutdownManager”
01
|
--------- beginning of /dev/log/system
|
02
|
--------- beginning of /dev/log/main
|
03
|
I/ShutdownManager( 189 ): btState: false
|
04
|
I/ShutdownManager( 189 ): saveStates: wifi: 0 , airplaneModeState: 0
|
05
|
V/ShutdownManager( 189 ): Current Wallpaper = null
|
06
|
V/ShutdownManager( 189 ): Current IME:
|
07
|
I/ShutdownManager( 189 ): accessibility is disabled
|
08
|
I/ShutdownManager( 189 ): killProcess (IME):
|
09
|
I/ShutdownManager( 189 ): forceStopPackage:
|
10
|
V/ShutdownManager( 189 ): process =
|
11
|
I/ShutdownManager( 189 ): forceStopPackage:
|
12
|
I/ShutdownManager( 189 ): forceStopPackage:
|
13
|
I/ShutdownManager( 189 ): forceStopPackage:
|
14
|
I/ShutdownManager( 189 ): forceStopPackage:
|
15
|
I/ShutdownManager( 189 ): forceStopPackage:
|
16
|
I/ShutdownManager( 189 ): forceStopPackage:
|
17
|
I/ShutdownManager( 189 ): forceStopPackage:
|
18
|
I/ShutdownManager( 189 ): forceStopPackage:
|
19
|
I/ShutdownManager( 189 ): forceStopPackage:
|
20
|
V/ShutdownManager( 189 ): uid-process =
|
21
|
I/ShutdownManager( 189 ): forceStopPackage:
|
22
|
I/ShutdownManager( 189 ): forceStopPackage:
|
23
|
V/ShutdownManager( 189 ): uid-process =
|
24
|
I/ShutdownManager( 189 ): forceStopPackage:
|
ActivityManagerPlus 接收到关机广播
adb logcat -s “ActivityManagerPlus”
1
|
--------- beginning of /dev/log/system
|
2
|
--------- beginning of /dev/log/main
|
3
|
I/ActivityManagerPlus( 189 ): Receive:
|
4
|
Intent { act=.ACTION_SHUTDOWN_IPO }
|
5
|
I/ActivityManagerPlus( 189 ): finished
|
6
|
I/ActivityManagerPlus( 189 ): Receive:
|
7
|
Intent { act= (has extras) }
|
8
|
I/ActivityManagerPlus( 189 ): createIPOWin
|
ActivityManagerPlus 里的 createIPOWin 方法 关机调用
01
|
Window win = (context);
|
09
|
WindowManagerImpl wm = (WindowManagerImpl)( "window" );
|
ActivityManagerPlus 里的 removeIPOWin 方法 开机调用
1
|
WindowManagerImpl wm = (WindowManagerImpl)( "window" );
|
底层实现
mediatek/source/external/ipod/