Support persist.sys.audit_safemode
Don't leave safe more if persist.sys.audit_safemode is set, unless the current build date is newer than the specified value. This allows us to keep the device in safe mode across reboots until an OTA has been applied or user data is wiped. Bug: 26902605 Change-Id: I781c3059ea8d4fb2f0c923e4488b1932d69678d3
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