Schematize vold system properties

Properties accessed across partitions are now schematized and will
become APIs to make explicit interfaces among partitions.

Bug: 117924132
Test: m -j
Change-Id: I8e04f643197b6c8a60cc38c6979e41c5de3469f5
Merged-In: Iedfd3c1dda665006ea5410ee787c3ca447ac7db1
(cherry picked from commit c1246e6c36)
This commit is contained in:
Inseob Kim
2018-11-08 13:13:54 +09:00
committed by Colin Cross
parent 7c7dc29e8d
commit 0a91222c83
6 changed files with 14 additions and 8 deletions

View File

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

View File

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

View File

@@ -16,7 +16,7 @@
package com.android.systemui.statusbar.policy;
import android.os.SystemProperties;
import android.sysprop.VoldProperties;
/**
* Helper for determining whether the phone is decrypted yet.
@@ -26,7 +26,7 @@ public class EncryptionHelper {
public static final boolean IS_DATA_ENCRYPTED = 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);
}
}

View File

@@ -99,6 +99,7 @@ import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
import android.provider.MediaStore;
import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.text.TextUtils;
import android.text.format.DateUtils;
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
// the system locale out of the mount service.
if ("".equals(SystemProperties.get("vold.encrypt_progress"))) {
if ("".equals(VoldProperties.encrypt_progress().orElse(""))) {
copyLocaleFromMountService();
}
}

View File

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

View File

@@ -49,6 +49,7 @@ import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.storage.IStorageManager;
import android.sysprop.VoldProperties;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Slog;
@@ -626,7 +627,7 @@ public final class SystemServer {
traceEnd();
// 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)) {
Slog.w(TAG, "Detected encryption in progress - only parsing core apps");
mOnlyCore = true;