Merge "Support persist.sys.audit_safemode"
This commit is contained in:
@@ -96,6 +96,9 @@ public final class ShutdownThread extends Thread {
|
||||
// Indicates whether we are rebooting into safe mode
|
||||
public static final String REBOOT_SAFEMODE_PROPERTY = "persist.sys.safemode";
|
||||
|
||||
// Indicates whether we should stay in safe mode until ro.build.date.utc is newer than this
|
||||
public static final String AUDIT_SAFEMODE_PROPERTY = "persist.sys.audit_safemode";
|
||||
|
||||
// static instance of this thread
|
||||
private static final ShutdownThread sInstance = new ShutdownThread();
|
||||
|
||||
|
||||
@@ -305,6 +305,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
private static final String PROPERTY_EMULATOR_CIRCULAR = "ro.emulator.circular";
|
||||
|
||||
private static final String PROPERTY_BUILD_DATE_UTC = "ro.build.date.utc";
|
||||
|
||||
final private KeyguardDisableHandler mKeyguardDisableHandler;
|
||||
|
||||
final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
|
||||
@@ -7629,8 +7631,22 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|| volumeDownState > 0;
|
||||
try {
|
||||
if (SystemProperties.getInt(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, 0) != 0) {
|
||||
mSafeMode = true;
|
||||
SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, "");
|
||||
int auditSafeMode = SystemProperties.getInt(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, 0);
|
||||
|
||||
if (auditSafeMode == 0) {
|
||||
mSafeMode = true;
|
||||
SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, "");
|
||||
} else {
|
||||
// stay in safe mode until we have updated to a newer build
|
||||
int buildDate = SystemProperties.getInt(PROPERTY_BUILD_DATE_UTC, 0);
|
||||
|
||||
if (auditSafeMode >= buildDate) {
|
||||
mSafeMode = true;
|
||||
} else {
|
||||
SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, "");
|
||||
SystemProperties.set(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user