Merge "Fix bug #10624988 Incorrect mirroring of RAM and Internal Storage for Apps screens in Settings" into klp-dev

This commit is contained in:
Fabrice Di Meglio
2013-09-06 20:05:17 +00:00
committed by Android (Google) Code Review
4 changed files with 29 additions and 12 deletions

View File

@@ -50,6 +50,7 @@ import android.provider.Settings;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.text.BidiFormatter;
import android.text.format.Formatter;
import android.util.Log;
import android.view.LayoutInflater;
@@ -385,20 +386,21 @@ public class ManageApplications extends Fragment implements
return;
}
if (mTotalStorage > 0) {
BidiFormatter bidiFormatter = BidiFormatter.getInstance();
mColorBar.setRatios((mTotalStorage-mFreeStorage-mAppStorage)/(float)mTotalStorage,
mAppStorage/(float)mTotalStorage, mFreeStorage/(float)mTotalStorage);
long usedStorage = mTotalStorage - mFreeStorage;
if (mLastUsedStorage != usedStorage) {
mLastUsedStorage = usedStorage;
String sizeStr = Formatter.formatShortFileSize(
mOwner.getActivity(), usedStorage);
String sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(mOwner.getActivity(), usedStorage));
mUsedStorageText.setText(mOwner.getActivity().getResources().getString(
R.string.service_foreground_processes, sizeStr));
}
if (mLastFreeStorage != mFreeStorage) {
mLastFreeStorage = mFreeStorage;
String sizeStr = Formatter.formatShortFileSize(
mOwner.getActivity(), mFreeStorage);
String sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(mOwner.getActivity(), mFreeStorage));
mFreeStorageText.setText(mOwner.getActivity().getResources().getString(
R.string.service_background_processes, sizeStr));
}

View File

@@ -16,6 +16,7 @@
package com.android.settings.applications;
import android.text.BidiFormatter;
import com.android.internal.util.MemInfoReader;
import com.android.settings.R;
@@ -342,11 +343,14 @@ public class RunningProcessesView extends FrameLayout
mLastBackgroundProcessMemory = mState.mBackgroundProcessMemory;
mLastAvailMemory = availMem;
long freeMem = mLastAvailMemory + mLastBackgroundProcessMemory;
String sizeStr = Formatter.formatShortFileSize(getContext(), freeMem);
BidiFormatter bidiFormatter = BidiFormatter.getInstance();
String sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(getContext(), freeMem));
mBackgroundProcessText.setText(getResources().getString(
R.string.service_background_processes, sizeStr));
sizeStr = Formatter.formatShortFileSize(getContext(),
mMemInfoReader.getTotalSize() - freeMem);
sizeStr = bidiFormatter.unicodeWrap(
Formatter.formatShortFileSize(getContext(),
mMemInfoReader.getTotalSize() - freeMem));
mForegroundProcessText.setText(getResources().getString(
R.string.service_foreground_processes, sizeStr));
}