OSDN Git Service

Revert "Revert "Schematize vold system properties""
authorInseob Kim <inseob@google.com>
Mon, 10 Dec 2018 07:06:25 +0000 (07:06 +0000)
committerInseob Kim <inseob@google.com>
Tue, 11 Dec 2018 00:23:07 +0000 (00:23 +0000)
This reverts commit 2473b08b07ccd58978d4b0271dc22a770b9b8605.

Reason for revert: Fixed build breakage
sysprop_cpp and sysprop_java directly have been linking against
libprotobuf-cpp-full and do not set proto.type field, which could
cause ASAN error due to linking against both libproto version of full
and lite.

Change-Id: I96eb47444d7b6f6b5fef092efc1514fcdd6f33b6
Merged-In: I8e04f643197b6c8a60cc38c6979e41c5de3469f5

Android.bp
core/java/android/os/storage/StorageManager.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/EncryptionHelper.java
services/core/java/com/android/server/StorageManagerService.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/java/com/android/server/SystemServer.java
services/usb/java/com/android/server/usb/UsbDebuggingManager.java
services/usb/java/com/android/server/usb/UsbDeviceManager.java

index 170e22e..6a22693 100644 (file)
@@ -619,6 +619,8 @@ java_defaults {
         "core/java/com/android/server/DropboxLogTags.logtags",
         "core/java/org/chromium/arc/EventLogTags.logtags",
 
+        ":platform-properties",
+
         ":framework-statslog-gen",
     ],
 
index d072d02..6b59279 100644 (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);
     }
 
index 639e50c..9c099f9 100644 (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);
     }
 }
index d11a74f..0571100 100644 (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();
         }
     }
index fa9c58e..974caae 100644 (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;
@@ -7970,8 +7971,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(
index 439f313..f3ac1a8 100644 (file)
@@ -48,6 +48,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;
@@ -625,7 +626,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;
index 3b08505..4239099 100644 (file)
@@ -34,10 +34,10 @@ import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 import android.os.SystemClock;
-import android.os.SystemProperties;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.service.usb.UsbDebuggingManagerProto;
+import android.sysprop.VoldProperties;
 import android.util.Base64;
 import android.util.Slog;
 
@@ -263,7 +263,7 @@ public class UsbDebuggingManager {
 
                 case MESSAGE_ADB_CONFIRM: {
                     if ("trigger_restart_min_framework".equals(
-                            SystemProperties.get("vold.decrypt"))) {
+                            VoldProperties.decrypt().orElse(""))) {
                         Slog.d(TAG, "Deferring adb confirmation until after vold decrypt");
                         if (mThread != null) {
                             mThread.sendResponse("NO");
index 4da7285..aa93c6b 100644 (file)
@@ -69,6 +69,7 @@ import android.os.storage.StorageVolume;
 import android.provider.Settings;
 import android.service.usb.UsbDeviceManagerProto;
 import android.service.usb.UsbHandlerProto;
+import android.sysprop.VoldProperties;
 import android.util.Pair;
 import android.util.Slog;
 
@@ -285,7 +286,7 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
         mControlFds.put(UsbManager.FUNCTION_PTP, ptpFd);
 
         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) {
             mDebuggingManager = new UsbDebuggingManager(context);
         }