diff options
author | Jeff Sharkey <jsharkey@google.com> | 2015-07-30 19:24:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-30 19:24:53 +0000 |
commit | bb9d6b906e564c9f685834bb7dcccfbe0aa87a29 (patch) | |
tree | c868f9da0f7be78dbd9f3b70f234f181dd5927aa | |
parent | eb372c93ee00fa9365206129136501497e6341c7 (diff) | |
parent | f99b424f3b147ed165a28d4124362f0e53cadf53 (diff) | |
download | packages_apps_Settings-bb9d6b906e564c9f685834bb7dcccfbe0aa87a29.zip packages_apps_Settings-bb9d6b906e564c9f685834bb7dcccfbe0aa87a29.tar.gz packages_apps_Settings-bb9d6b906e564c9f685834bb7dcccfbe0aa87a29.tar.bz2 |
Merge "Refresh after clearing, tweak warn threshold." into mnc-dev
3 files changed, 27 insertions, 12 deletions
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java index 58e050b..4f9b33b 100644 --- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java +++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java @@ -192,8 +192,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { for (int userIndex = 0; userIndex < userCount; ++userIndex) { final UserInfo userInfo = allUsers.get(userIndex); if (isProfileOf(mCurrentUser, userInfo)) { - PreferenceCategory details = addCategory(screen, - showHeaders ? userInfo.name : null); + final PreferenceGroup details = showHeaders ? + addCategory(screen, userInfo.name) : screen; addDetailItems(details, showShared, userInfo.id); ++addedUserCount; } @@ -201,7 +201,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { // Add rest of users if (userCount - addedUserCount > 0) { - PreferenceCategory otherUsers = addCategory(screen, + PreferenceGroup otherUsers = addCategory(screen, getText(R.string.storage_other_users)); for (int userIndex = 0; userIndex < userCount; ++userIndex) { final UserInfo userInfo = allUsers.get(userIndex); @@ -253,7 +253,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { return category; } - private void addDetailItems(PreferenceCategory category, boolean showShared, int userId) { + private void addDetailItems(PreferenceGroup category, boolean showShared, int userId) { final int[] itemsToAdd = (showShared ? ITEMS_SHOW_SHARED : ITEMS_NO_SHOW_SHARED); for (int i = 0; i < itemsToAdd.length; ++i) { addItem(category, itemsToAdd[i], null, userId); @@ -719,7 +719,12 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { public void onRemoveCompleted(final String packageName, final boolean succeeded) { synchronized (this) { if (--mRemaining == 0) { - mTarget.update(); + mTarget.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + mTarget.update(); + } + }); } } } diff --git a/src/com/android/settings/deviceinfo/StorageWizardBase.java b/src/com/android/settings/deviceinfo/StorageWizardBase.java index e508cd1..a32109c 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardBase.java +++ b/src/com/android/settings/deviceinfo/StorageWizardBase.java @@ -176,6 +176,10 @@ public abstract class StorageWizardBase extends Activity { } } + protected void setKeepScreenOn(boolean keepScreenOn) { + getSetupWizardLayout().setKeepScreenOn(keepScreenOn); + } + public void onNavigateNext() { throw new UnsupportedOperationException(); } diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java index a18bca3..1a5a70c 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java +++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java @@ -27,7 +27,6 @@ import android.content.Intent; import android.content.pm.IPackageMoveObserver; import android.os.AsyncTask; import android.os.Bundle; -import android.os.RemoteException; import android.os.storage.DiskInfo; import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; @@ -55,6 +54,7 @@ public class StorageWizardFormatProgress extends StorageWizardBase { return; } setContentView(R.layout.storage_wizard_progress); + setKeepScreenOn(true); mFormatPrivate = getIntent().getBooleanExtra( StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false); @@ -144,13 +144,19 @@ public class StorageWizardFormatProgress extends StorageWizardBase { return; } - final float pct = (float) mInternalBench / (float) mPrivateBench; - Log.d(TAG, "New volume is " + pct + "x the speed of internal"); + if (activity.mFormatPrivate) { + final float pct = (float) mInternalBench / (float) mPrivateBench; + Log.d(TAG, "New volume is " + pct + "x the speed of internal"); - // TODO: refine this warning threshold - if (mPrivateBench > 2000000000) { - final SlowWarningFragment dialog = new SlowWarningFragment(); - dialog.show(activity.getFragmentManager(), TAG_SLOW_WARNING); + // To help set user expectations around device performance, we + // warn if the adopted media is 0.25x the speed of internal + // storage or slower. + if (Float.isNaN(pct) || pct < 0.25) { + final SlowWarningFragment dialog = new SlowWarningFragment(); + dialog.show(activity.getFragmentManager(), TAG_SLOW_WARNING); + } else { + activity.onFormatFinished(); + } } else { activity.onFormatFinished(); } |