Loading core/java/android/app/AlarmManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ public class AlarmManager { * Alarm time in {@link System#currentTimeMillis System.currentTimeMillis()} * (wall clock time in UTC), which will wake up the device when * it goes off. And it will power on the devices when it shuts down. * Set as 5 to make it be compatible with android_alarm_type. */ public static final int RTC_POWEROFF_WAKEUP = 4; public static final int RTC_POWEROFF_WAKEUP = 5; /** * Broadcast Action: Sent after the value returned by Loading core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -2743,6 +2743,15 @@ public final class Settings { private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator; /** * Setting to show if system is in power off alarm mode. 1 = true, 0 = false * @hide */ public static final String POWER_OFF_ALARM_MODE = "power_off_alarm_mode"; /** Validator for POWER_OFF_ALARM_MODE */ private static final Validator POWER_OFF_ALARM_MODE_VALIDATOR = sBooleanValidator; /** * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This * feature converts two spaces to a "." and space. Loading Loading @@ -3355,6 +3364,7 @@ public final class Settings { PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); PUBLIC_SETTINGS.add(POWER_OFF_ALARM_MODE); } /** Loading Loading @@ -3480,6 +3490,7 @@ public final class Settings { VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); VALIDATORS.put(POWER_OFF_ALARM_MODE, POWER_OFF_ALARM_MODE_VALIDATOR); } /** Loading services/core/java/com/android/server/am/ActivityManagerService.java +20 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,11 @@ public final class ActivityManagerService extends ActivityManagerNative private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY; private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND; private static final String ACTION_POWER_OFF_ALARM = "org.codeaurora.alarm.action.POWER_OFF_ALARM"; private static final String POWER_OFF_ALARM = "powerOffAlarm"; /** Control over CPU and battery monitoring */ // write battery stats every 30 minutes. static final long BATTERY_STATS_TIME = 30 * 60 * 1000; Loading Loading @@ -3484,6 +3489,15 @@ public final class ActivityManagerService extends ActivityManagerNative return true; } /** * If system is power off alarm boot mode, we need to start alarm UI. */ void startAlarmActivityLocked() { Intent intent = new Intent(ACTION_POWER_OFF_ALARM); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); mContext.startActivityAsUser(intent, UserHandle.CURRENT); } private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) { ActivityInfo ai = null; ComponentName comp = intent.getComponent(); Loading Loading @@ -11870,6 +11884,12 @@ public final class ActivityManagerService extends ActivityManagerNative mBooting = true; startHomeActivityLocked(mCurrentUserId, "systemReady"); // start the power off alarm by boot mode boolean isAlarmBoot = SystemProperties.getBoolean("ro.alarm_boot", false); if (isAlarmBoot) { startAlarmActivityLocked(); } try { if (AppGlobals.getPackageManager().hasSystemUidErrors()) { Slog.e(TAG, "UIDs on the system are inconsistent, you need to wipe your" Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -2662,6 +2662,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " canceled=" + canceled); } // If the boot mode is power off alarm, we should not dispatch the several physical keys // in power off alarm UI to avoid pausing power off alarm UI. int isPowerOffAlarmMode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_OFF_ALARM_MODE, 0); if (DEBUG_INPUT) { Log.d(TAG, "intercept Dispatching isPowerOffAlarmMode = " + isPowerOffAlarmMode); } if (isPowerOffAlarmMode == 1 && (keyCode == KeyEvent.KEYCODE_HOME || keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU)) { return -1; // ignore the physical key here } // If we think we might have a volume down & power key chord on the way // but we're not sure, then tell the dispatcher to wait a little while and // try again later before dispatching. Loading services/core/jni/com_android_server_AlarmManagerService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ static const clockid_t android_alarm_to_clockid[N_ANDROID_TIMERFDS] = { CLOCK_BOOTTIME_ALARM, CLOCK_BOOTTIME, CLOCK_MONOTONIC, CLOCK_POWEROFF_ALARM, CLOCK_REALTIME, }; /* to match the legacy alarm driver implementation, we need an extra Loading Loading
core/java/android/app/AlarmManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ public class AlarmManager { * Alarm time in {@link System#currentTimeMillis System.currentTimeMillis()} * (wall clock time in UTC), which will wake up the device when * it goes off. And it will power on the devices when it shuts down. * Set as 5 to make it be compatible with android_alarm_type. */ public static final int RTC_POWEROFF_WAKEUP = 4; public static final int RTC_POWEROFF_WAKEUP = 5; /** * Broadcast Action: Sent after the value returned by Loading
core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -2743,6 +2743,15 @@ public final class Settings { private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator; /** * Setting to show if system is in power off alarm mode. 1 = true, 0 = false * @hide */ public static final String POWER_OFF_ALARM_MODE = "power_off_alarm_mode"; /** Validator for POWER_OFF_ALARM_MODE */ private static final Validator POWER_OFF_ALARM_MODE_VALIDATOR = sBooleanValidator; /** * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This * feature converts two spaces to a "." and space. Loading Loading @@ -3355,6 +3364,7 @@ public final class Settings { PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED); PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED); PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS); PUBLIC_SETTINGS.add(POWER_OFF_ALARM_MODE); } /** Loading Loading @@ -3480,6 +3490,7 @@ public final class Settings { VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); VALIDATORS.put(POWER_OFF_ALARM_MODE, POWER_OFF_ALARM_MODE_VALIDATOR); } /** Loading
services/core/java/com/android/server/am/ActivityManagerService.java +20 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,11 @@ public final class ActivityManagerService extends ActivityManagerNative private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY; private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND; private static final String ACTION_POWER_OFF_ALARM = "org.codeaurora.alarm.action.POWER_OFF_ALARM"; private static final String POWER_OFF_ALARM = "powerOffAlarm"; /** Control over CPU and battery monitoring */ // write battery stats every 30 minutes. static final long BATTERY_STATS_TIME = 30 * 60 * 1000; Loading Loading @@ -3484,6 +3489,15 @@ public final class ActivityManagerService extends ActivityManagerNative return true; } /** * If system is power off alarm boot mode, we need to start alarm UI. */ void startAlarmActivityLocked() { Intent intent = new Intent(ACTION_POWER_OFF_ALARM); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); mContext.startActivityAsUser(intent, UserHandle.CURRENT); } private ActivityInfo resolveActivityInfo(Intent intent, int flags, int userId) { ActivityInfo ai = null; ComponentName comp = intent.getComponent(); Loading Loading @@ -11870,6 +11884,12 @@ public final class ActivityManagerService extends ActivityManagerNative mBooting = true; startHomeActivityLocked(mCurrentUserId, "systemReady"); // start the power off alarm by boot mode boolean isAlarmBoot = SystemProperties.getBoolean("ro.alarm_boot", false); if (isAlarmBoot) { startAlarmActivityLocked(); } try { if (AppGlobals.getPackageManager().hasSystemUidErrors()) { Slog.e(TAG, "UIDs on the system are inconsistent, you need to wipe your" Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -2662,6 +2662,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " canceled=" + canceled); } // If the boot mode is power off alarm, we should not dispatch the several physical keys // in power off alarm UI to avoid pausing power off alarm UI. int isPowerOffAlarmMode = Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_OFF_ALARM_MODE, 0); if (DEBUG_INPUT) { Log.d(TAG, "intercept Dispatching isPowerOffAlarmMode = " + isPowerOffAlarmMode); } if (isPowerOffAlarmMode == 1 && (keyCode == KeyEvent.KEYCODE_HOME || keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU)) { return -1; // ignore the physical key here } // If we think we might have a volume down & power key chord on the way // but we're not sure, then tell the dispatcher to wait a little while and // try again later before dispatching. Loading
services/core/jni/com_android_server_AlarmManagerService.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ static const clockid_t android_alarm_to_clockid[N_ANDROID_TIMERFDS] = { CLOCK_BOOTTIME_ALARM, CLOCK_BOOTTIME, CLOCK_MONOTONIC, CLOCK_POWEROFF_ALARM, CLOCK_REALTIME, }; /* to match the legacy alarm driver implementation, we need an extra Loading