Revert "Revert "Schematize vold system properties""

This reverts commit 49e81e0eea.

Reason for revert: Fixed breakage

Change-Id: I414b753a218d9baf3d24530ff14df7644eb148e0
Merged-In: Id2a696c621015d46015d5de0e7aef987e9e01b54
This commit is contained in:
Inseob Kim
2018-12-10 07:05:20 +00:00
parent 49e81e0eea
commit 8346eb5ccc
2 changed files with 7 additions and 7 deletions

View File

@@ -33,11 +33,11 @@ import android.os.Message;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.storage.IStorageManager; import android.os.storage.IStorageManager;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.provider.Settings; import android.provider.Settings;
import android.sysprop.VoldProperties;
import android.telecom.TelecomManager; import android.telecom.TelecomManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.Editable; import android.text.Editable;
@@ -400,7 +400,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// If we are not encrypted or encrypting, get out quickly. // If we are not encrypted or encrypting, get out quickly.
final String state = SystemProperties.get("vold.decrypt"); final String state = VoldProperties.decrypt().orElse("");
if (!isDebugView() && ("".equals(state) || DECRYPT_STATE.equals(state))) { if (!isDebugView() && ("".equals(state) || DECRYPT_STATE.equals(state))) {
disableCryptKeeperComponent(this); disableCryptKeeperComponent(this);
// Typically CryptKeeper is launched as the home app. We didn't // Typically CryptKeeper is launched as the home app. We didn't
@@ -468,7 +468,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
return; return;
} }
final String progress = SystemProperties.get("vold.encrypt_progress"); final String progress = VoldProperties.encrypt_progress().orElse("");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) { if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress); setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit(); encryptionProgressInit();
@@ -636,7 +636,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} }
private void updateProgress() { private void updateProgress() {
final String state = SystemProperties.get("vold.encrypt_progress"); final String state = VoldProperties.encrypt_progress().orElse("");
if ("error_partially_encrypted".equals(state)) { if ("error_partially_encrypted".equals(state)) {
showFactoryReset(false); showFactoryReset(false);
@@ -657,8 +657,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// Now try to get status as time remaining and replace as appropriate // Now try to get status as time remaining and replace as appropriate
Log.v(TAG, "Encryption progress: " + progress); Log.v(TAG, "Encryption progress: " + progress);
try { try {
final String timeProperty = SystemProperties.get("vold.encrypt_time_remaining"); int time = VoldProperties.encrypt_time_remaining().get();
int time = Integer.parseInt(timeProperty);
if (time >= 0) { if (time >= 0) {
// Round up to multiple of 10 - this way display is less jerky // Round up to multiple of 10 - this way display is less jerky
time = (time + 9) / 10 * 10; time = (time + 9) / 10 * 10;

View File

@@ -39,6 +39,7 @@ import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.provider.Settings; import android.provider.Settings;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import android.sysprop.VoldProperties;
import android.telephony.euicc.EuiccManager; import android.telephony.euicc.EuiccManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -404,7 +405,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
} }
private boolean isExtStorageEncrypted() { private boolean isExtStorageEncrypted() {
String state = SystemProperties.get("vold.decrypt"); String state = VoldProperties.decrypt().orElse("");
return !"".equals(state); return !"".equals(state);
} }