I.MX6 android 禁止低电量自动关机

/************************************************************************
 *                     I.MX6 android 禁止低电量自动关机
 * 说明:
 *     记录如何禁止Android低电量自动关机的功能。
 *
 *                                     2016-3-18 深圳 南山平山村 曾剑锋
 ***********************************************************************/

一、参考文章:
    android低电量处理流程
        http://www.2cto.com/kf/201211/172297.html

二、解决方法:
    cat frameworks/base/services/java/com/android/server/BatteryService.java
        public final class BatteryService extends Binder {
            ......
            private void shutdownIfNoPowerLocked() {
                // shut down gracefully if our battery is critically low and we are not powered.
                // wait until the system has booted before attempting to display the shutdown dialog.
                /*
                if (mBatteryLevel == 0 && !isPoweredLocked(BatteryManager.BATTERY_PLUGGED_ANY)) {
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            if (ActivityManagerNative.isSystemReady()) {
                                Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
                                intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
                                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                            }
                        }
                    });
                }
                */
            }
            ......
        }

 

上一篇:如何使用React Native制作圆形加载条


下一篇:HyperLedger Fabric 1.2 基础环境搭建(7)