Merge "Revert "Revert "Schematize vold system properties"""

This commit is contained in:
Treehugger Robot
2018-12-11 11:04:01 +00:00
committed by Gerrit Code Review
8 changed files with 18 additions and 11 deletions

View File

@@ -621,6 +621,8 @@ java_defaults {
"core/java/com/android/server/DropboxLogTags.logtags", "core/java/com/android/server/DropboxLogTags.logtags",
"core/java/org/chromium/arc/EventLogTags.logtags", "core/java/org/chromium/arc/EventLogTags.logtags",
":platform-properties",
":framework-statslog-gen", ":framework-statslog-gen",
], ],

View File

@@ -52,6 +52,7 @@ import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException; import android.os.ServiceManager.ServiceNotFoundException;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.provider.Settings; import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.system.ErrnoException; import android.system.ErrnoException;
import android.system.Os; import android.system.Os;
import android.system.OsConstants; import android.system.OsConstants;
@@ -1465,7 +1466,7 @@ public class StorageManager {
* framework, so no service needs to check for changes during their lifespan * framework, so no service needs to check for changes during their lifespan
*/ */
public static boolean isBlockEncrypting() { public static boolean isBlockEncrypting() {
final String state = SystemProperties.get("vold.encrypt_progress", ""); final String state = VoldProperties.encrypt_progress().orElse("");
return !"".equalsIgnoreCase(state); return !"".equalsIgnoreCase(state);
} }
@@ -1481,7 +1482,7 @@ public class StorageManager {
* framework, so no service needs to check for changes during their lifespan * framework, so no service needs to check for changes during their lifespan
*/ */
public static boolean inCryptKeeperBounce() { public static boolean inCryptKeeperBounce() {
final String status = SystemProperties.get("vold.decrypt"); final String status = VoldProperties.decrypt().orElse("");
return "trigger_restart_min_framework".equals(status); return "trigger_restart_min_framework".equals(status);
} }

View File

@@ -16,7 +16,7 @@
package com.android.systemui.statusbar.policy; package com.android.systemui.statusbar.policy;
import android.os.SystemProperties; import android.sysprop.VoldProperties;
/** /**
* Helper for determining whether the phone is decrypted yet. * Helper for determining whether the phone is decrypted yet.
@@ -26,7 +26,7 @@ public class EncryptionHelper {
public static final boolean IS_DATA_ENCRYPTED = isDataEncrypted(); public static final boolean IS_DATA_ENCRYPTED = isDataEncrypted();
private static boolean isDataEncrypted() { private static boolean isDataEncrypted() {
String voldState = SystemProperties.get("vold.decrypt"); String voldState = VoldProperties.decrypt().orElse("");
return "1".equals(voldState) || "trigger_restart_min_framework".equals(voldState); return "1".equals(voldState) || "trigger_restart_min_framework".equals(voldState);
} }
} }

View File

@@ -99,6 +99,7 @@ import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord; import android.os.storage.VolumeRecord;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.ArrayMap; import android.util.ArrayMap;
@@ -973,7 +974,7 @@ class StorageManagerService extends IStorageManager.Stub
// On an encrypted device we can't see system properties yet, so pull // On an encrypted device we can't see system properties yet, so pull
// the system locale out of the mount service. // the system locale out of the mount service.
if ("".equals(SystemProperties.get("vold.encrypt_progress"))) { if ("".equals(VoldProperties.encrypt_progress().orElse(""))) {
copyLocaleFromMountService(); copyLocaleFromMountService();
} }
} }

View File

@@ -364,6 +364,7 @@ import android.provider.Downloads;
import android.provider.Settings; import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession; import android.service.voice.IVoiceInteractionSession;
import android.service.voice.VoiceInteractionManagerInternal; import android.service.voice.VoiceInteractionManagerInternal;
import android.sysprop.VoldProperties;
import android.telecom.TelecomManager; import android.telecom.TelecomManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
@@ -7958,8 +7959,8 @@ public class ActivityManagerService extends IActivityManager.Stub
SystemProperties.set("sys.boot_completed", "1"); SystemProperties.set("sys.boot_completed", "1");
// And trigger dev.bootcomplete if we are not showing encryption progress // And trigger dev.bootcomplete if we are not showing encryption progress
if (!"trigger_restart_min_framework".equals(SystemProperties.get("vold.decrypt")) if (!"trigger_restart_min_framework".equals(VoldProperties.decrypt().orElse(""))
|| "".equals(SystemProperties.get("vold.encrypt_progress"))) { || "".equals(VoldProperties.encrypt_progress().orElse(""))){
SystemProperties.set("dev.bootcomplete", "1"); SystemProperties.set("dev.bootcomplete", "1");
} }
mUserController.sendBootCompleted( mUserController.sendBootCompleted(

View File

@@ -48,6 +48,7 @@ import android.os.SystemProperties;
import android.os.Trace; import android.os.Trace;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.IStorageManager; import android.os.storage.IStorageManager;
import android.sysprop.VoldProperties;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.EventLog; import android.util.EventLog;
import android.util.Slog; import android.util.Slog;
@@ -625,7 +626,7 @@ public final class SystemServer {
traceEnd(); traceEnd();
// Only run "core" apps if we're encrypting the device. // Only run "core" apps if we're encrypting the device.
String cryptState = SystemProperties.get("vold.decrypt"); String cryptState = VoldProperties.decrypt().orElse("");
if (ENCRYPTING_STATE.equals(cryptState)) { if (ENCRYPTING_STATE.equals(cryptState)) {
Slog.w(TAG, "Detected encryption in progress - only parsing core apps"); Slog.w(TAG, "Detected encryption in progress - only parsing core apps");
mOnlyCore = true; mOnlyCore = true;

View File

@@ -34,10 +34,10 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.service.usb.UsbDebuggingManagerProto; import android.service.usb.UsbDebuggingManagerProto;
import android.sysprop.VoldProperties;
import android.util.Base64; import android.util.Base64;
import android.util.Slog; import android.util.Slog;
@@ -263,7 +263,7 @@ public class UsbDebuggingManager {
case MESSAGE_ADB_CONFIRM: { case MESSAGE_ADB_CONFIRM: {
if ("trigger_restart_min_framework".equals( if ("trigger_restart_min_framework".equals(
SystemProperties.get("vold.decrypt"))) { VoldProperties.decrypt().orElse(""))) {
Slog.d(TAG, "Deferring adb confirmation until after vold decrypt"); Slog.d(TAG, "Deferring adb confirmation until after vold decrypt");
if (mThread != null) { if (mThread != null) {
mThread.sendResponse("NO"); mThread.sendResponse("NO");

View File

@@ -69,6 +69,7 @@ import android.os.storage.StorageVolume;
import android.provider.Settings; import android.provider.Settings;
import android.service.usb.UsbDeviceManagerProto; import android.service.usb.UsbDeviceManagerProto;
import android.service.usb.UsbHandlerProto; import android.service.usb.UsbHandlerProto;
import android.sysprop.VoldProperties;
import android.util.Pair; import android.util.Pair;
import android.util.Slog; import android.util.Slog;
@@ -285,7 +286,7 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
mControlFds.put(UsbManager.FUNCTION_PTP, ptpFd); mControlFds.put(UsbManager.FUNCTION_PTP, ptpFd);
boolean secureAdbEnabled = SystemProperties.getBoolean("ro.adb.secure", false); boolean secureAdbEnabled = SystemProperties.getBoolean("ro.adb.secure", false);
boolean dataEncrypted = "1".equals(SystemProperties.get("vold.decrypt")); boolean dataEncrypted = "1".equals(VoldProperties.decrypt().orElse(""));
if (secureAdbEnabled && !dataEncrypted) { if (secureAdbEnabled && !dataEncrypted) {
mDebuggingManager = new UsbDebuggingManager(context); mDebuggingManager = new UsbDebuggingManager(context);
} }