Merge "Import translations. DO NOT MERGE"
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 826c20b..49142d7 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -35,7 +35,7 @@
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.telecom.TelecomManager;
@@ -182,7 +182,7 @@
@Override
protected Integer doInBackground(String... params) {
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
try {
return service.decryptStorage(params[0]);
} catch (Exception e) {
@@ -253,7 +253,7 @@
} else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try {
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
@@ -289,7 +289,7 @@
@Override
protected Boolean doInBackground(Void... params) {
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
try {
Log.d(TAG, "Validating encryption state.");
state = service.getEncryptionState();
@@ -483,7 +483,7 @@
@Override
public Void doInBackground(Void... v) {
try {
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
@@ -865,10 +865,10 @@
|| imm.getEnabledInputMethodSubtypeList(null, false).size() > 1;
}
- private IMountService getMountService() {
+ private IStorageManager getStorageManager() {
final IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
}
return null;
}
diff --git a/src/com/android/settings/CryptKeeperConfirm.java b/src/com/android/settings/CryptKeeperConfirm.java
index 87189c8..e12ebe0 100644
--- a/src/com/android/settings/CryptKeeperConfirm.java
+++ b/src/com/android/settings/CryptKeeperConfirm.java
@@ -25,7 +25,7 @@
import android.os.IBinder;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.provider.Settings;
import android.util.Log;
import android.view.LayoutInflater;
@@ -83,10 +83,10 @@
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
Bundle args = getIntent().getExtras();
- mountService.encryptStorage(args.getInt("type", -1), args.getString("password"));
+ storageManager.encryptStorage(args.getInt("type", -1), args.getString("password"));
} catch (Exception e) {
Log.e("CryptKeeper", "Error while encrypting...", e);
}
@@ -140,8 +140,8 @@
// 2. The system locale.
try {
IBinder service = ServiceManager.getService("mount");
- IMountService mountService = IMountService.Stub.asInterface(service);
- mountService.setField("SystemLocale", Locale.getDefault().toLanguageTag());
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
+ storageManager.setField("SystemLocale", Locale.getDefault().toLanguageTag());
} catch (Exception e) {
Log.e(TAG, "Error storing locale for decryption UI", e);
}
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 02d2e7a..dd9a7fe 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -54,7 +54,7 @@
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.service.persistentdata.PersistentDataBlockManager;
@@ -489,8 +489,8 @@
try {
IBinder service = ServiceManager.getService("mount");
- IMountService mountService = IMountService.Stub.asInterface(service);
- if (!mountService.isConvertibleToFBE()) {
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
+ if (!storageManager.isConvertibleToFBE()) {
removePreference(KEY_CONVERT_FBE);
} else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
convertFbePreference.setEnabled(false);
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index e57231e..b0685cf 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -269,7 +269,7 @@
result.value, result.units));
mSummary.setSummary(getString(R.string.storage_volume_used,
Formatter.formatFileSize(context, mTotalSize)));
- mSummary.setPercent((int) ((usedBytes * 100) / mTotalSize));
+ mSummary.setPercent(usedBytes, mTotalSize);
mMeasure.forceMeasure();
mNeedsUpdate = false;
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index fccd440..ca0348c 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -166,7 +166,7 @@
result.value, result.units));
mSummary.setSummary(getString(R.string.storage_volume_used,
Formatter.formatFileSize(context, totalBytes)));
- mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
+ mSummary.setPercent(usedBytes, totalBytes);
}
if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index c537661..5ee3983 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -152,7 +152,7 @@
}
}
- private void refresh() {
+ private synchronized void refresh() {
final Context context = getPrefContext();
getPreferenceScreen().removeAll();
diff --git a/src/com/android/settings/deviceinfo/StorageSummaryPreference.java b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
index e1cf774..f97f049 100644
--- a/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
+++ b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
@@ -20,6 +20,7 @@
import android.graphics.Color;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
+import android.util.MathUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -36,8 +37,9 @@
setEnabled(false);
}
- public void setPercent(int percent) {
- mPercent = percent;
+ public void setPercent(long usedBytes, long totalBytes) {
+ mPercent = MathUtils.constrain((int) ((usedBytes * 100) / totalBytes),
+ (usedBytes > 0) ? 1 : 0, 100);
}
@Override
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
index a102eda..d9e42df 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
@@ -77,7 +77,7 @@
public void onNavigateNext() {
int moveId;
- // We only expect exceptions from MountService#setPrimaryStorageUuid
+ // We only expect exceptions from StorageManagerService#setPrimaryStorageUuid
try {
moveId = getPackageManager().movePrimaryStorage(mVolume);
} catch (IllegalArgumentException e) {