更改 MTK 设置 > 存储





diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index d3572a7..e8efbd1 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -3097,4 +3097,5 @@
     "Auriculares"
     "Periférico de entrada"
     "Bluetooth"
+    Information de ROM
 
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 85c9ffc..72153da 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -39,6 +39,8 @@
     "Habilitar conexión de datos"
     "Inhabilitar conexión de datos"
     "VoLTE administrada"
+    Disponible
+    Firmware
     "Potencia de la señal móvil del teléfono"
     "Ver libreta de direcciones de tarjeta SIM"
     "Ver números de marcación fija"
@@ -3099,4 +3101,5 @@
     "Auriculares"
     "Periférico de entrada"
     "Bluetooth"
+    Information de ROM
 
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index b3b47a2..9cd3dc9 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -34,6 +34,8 @@
     "Connexions"
     "Appareil"
     "Personnel"
+    Disponible
+    Firmware
     "Accès"
     "Système"
     "Activer la connexion des données"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 38bc124..4034e17 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,12 +24,16 @@
     Allow
     
     Deny
-
+    
+    ROM INFORMATION
+    "Total ROM"
+    Total RAM
     
     Close
     
     Switch
-
+    Available
+    Firmware
      
     
     Unknown
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 327c27c..81be252 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -659,7 +659,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
                     SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC)
                     == SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
             mLoader.setSummary(this, mContext.getString(auto ? R.string.display_summary_on
-                    : R.string.display_summary_off));
+                    : R.string.no_automatic_brightness_text));
         }
     }
 
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index ab2267b..e1ad609 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -24,6 +24,7 @@ import android.content.ActivityNotFoundException;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import java.text.DecimalFormat;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
@@ -91,10 +92,14 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
     private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";
 
     private static final int[] ITEMS_NO_SHOW_SHARED = new int[] {
+            R.string.storage_detail_available,
+            R.string.storage_detail_system,
             R.string.storage_detail_apps,
     };
 
     private static final int[] ITEMS_SHOW_SHARED = new int[] {
+            R.string.storage_detail_available,
+            R.string.storage_detail_system,
             R.string.storage_detail_apps,
             R.string.storage_detail_images,
             R.string.storage_detail_videos,
@@ -121,6 +126,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
     private int mItemPoolIndex;
 
     private Preference mExplore;
+    private Preference storage_detail_title_system;
+    private Preference storage_detail_total;
 
     private boolean mNeedsUpdate;
 
@@ -168,6 +175,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
         mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
 
         mExplore = buildAction(R.string.storage_menu_explore);
+        storage_detail_title_system = buildAction(R.string.storage_detail_title_system);
+        storage_detail_total  =  buildAction(R.string.storage_detail_total);
 
         mNeedsUpdate = true;
 
@@ -195,8 +204,9 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
         final PreferenceScreen screen = getPreferenceScreen();
 
         screen.removeAll();
-
         addPreference(screen, mSummary);
 
         List allUsers = mUserManager.getUsers();
         final int userCount = allUsers.size();
@@ -233,6 +243,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
         addItem(screen, R.string.storage_detail_cached, null, UserHandle.USER_NULL);
 
         if (showShared) {
+            addCategory2(screen);
             addPreference(screen, mExplore);
         }
 
@@ -241,12 +252,31 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
         final long freeBytes = file.getFreeSpace();
         final long usedBytes = totalBytes - freeBytes;
 
-        final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
-        mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
-                result.value, result.units));
-        mSummary.setSummary(getString(R.string.storage_volume_used,
-                Formatter.formatFileSize(context, totalBytes)));
-        mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
+        if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {
+            final long  systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);
+            final BytesResult systemresult = Formatter.formatBytes(getResources(), systemBytes, 0);
+            storage_detail_title_system.setSummary("1.0 GB");
+            storage_detail_total.setSummary("8.0 GB");
+            //全文中的result为2中的 4.99 GB
+            final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);
+            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+                        result.value, result.units));
+            mSummary.setSummary(getString(R.string.storage_volume_used,
+                        Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024))));
+            mSummary.setPercent((int) (((systemBytes+usedBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024)));
+
+        }else{
+            storage_detail_title_system.setSummary("1.0 GB");
+            storage_detail_total.setSummary("8.0 GB");
+            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
+            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+                        result.value, result.units));
+            mSummary.setSummary(getString(R.string.storage_volume_used,
+                        Formatter.formatFileSize(context, totalBytes)));
+            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
+        }
+
         mExt.updateCustomizedPrivateSettingsPlugin(screen, mVolume);
         mMeasure.forceMeasure();
         mNeedsUpdate = false;
@@ -273,9 +303,38 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
         return category;
     }
 
+    private PreferenceCategory addCategory2(PreferenceGroup group) {
+        PreferenceCategory category;
+        if (mHeaderPoolIndex < mHeaderPreferencePool.size()) {
+            category = mHeaderPreferencePool.get(mHeaderPoolIndex);
+        } else {
+            category = new PreferenceCategory(getPrefContext(), null,
+                    com.android.internal.R.attr.preferenceCategoryStyle);
+            mHeaderPreferencePool.add(category);
+        }
+        category.setTitle(R.string.storage_detail_title);
+        category.removeAll();
+        addPreference2(group, category,-1);
+        addPreference(category, storage_detail_total);
+        addPreference(category, storage_detail_title_system);
+        ++mHeaderPoolIndex;
+        return category;
+    }
+
+    private void addPreference2(PreferenceGroup group, Preference pref,int order) {
+        pref.setOrder(order);
+        group.addPreference(pref);
+    }
+
     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) {
+            if (!VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {
+                if (itemsToAdd[i] == R.string.storage_detail_available
+                        || itemsToAdd[i] == R.string.storage_detail_system) {
+                    continue;
+                }
+            }
             addItem(category, itemsToAdd[i], null, userId);
         }
     }
@@ -295,7 +354,18 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
             item.setTitle(titleRes);
             item.setKey(Integer.toString(titleRes));
         }
-        item.setSummary(R.string.memory_calculating_size);
+        final Context context = getActivity();
+        final File file = mVolume.getPath();
+        final long totalBytes = file.getTotalSpace();
+        final long freeBytes = file.getFreeSpace();
+        final long usedBytes = totalBytes - freeBytes;
+        if (titleRes == R.string.storage_detail_available){
+            item.setSummary(Formatter.formatFileSize(context, freeBytes));
+        } else if (titleRes == R.string.storage_detail_system) {
+            item.setSummary(Formatter.formatFileSize(context, (long)(8.0 * 1024 * 1024 * 1024) - totalBytes));
+        } else {
+            item.setSummary(R.string.memory_calculating_size);
+        }
         item.userHandle = userId;
         addPreference(group, item);
         ++mItemPoolIndex;
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index b341b70..68e3cf9 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -167,12 +167,22 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
             final long freeBytes = file.getFreeSpace();
             final long usedBytes = totalBytes - freeBytes;
 
-            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
-            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
-                    result.value, result.units));
-            mSummary.setSummary(getString(R.string.storage_volume_used,
-                    Formatter.formatFileSize(context, totalBytes)));
-            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));
+            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {
+                final long  systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);
+                final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);
+                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+                            result.value, result.units));
+                mSummary.setSummary(getString(R.string.storage_volume_used,
+                            Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024)))+"---");
+                mSummary.setPercent((int) (((usedBytes+systemBytes) * 100) / (float)(8.0 * 1024 * 1024 * 1024)));
+            }else{
+                final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
+                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+                            result.value, result.units));
+                mSummary.setSummary(getString(R.string.storage_volume_used,
+                            Formatter.formatFileSize(context, totalBytes)));
+                mSummary.setPercent((int) ((usedBytes * 100) / 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 40d28d7..ebb6912 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -74,7 +74,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
     private static final String TAG_VOLUME_UNMOUNTED = "volume_unmounted";
     private static final String TAG_DISK_INIT = "disk_init";
     private static boolean sHasOpened;
-
     static final int COLOR_PUBLIC = Color.parseColor("#ff9e9e9e");
     static final int COLOR_WARNING = Color.parseColor("#fff4511e");
 
@@ -87,10 +86,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
     };
 
     private StorageManager mStorageManager;
-
     private PreferenceCategory mInternalCategory;
     private PreferenceCategory mExternalCategory;
-
     private StorageSummaryPreference mInternalSummary;
 
     private StorageSettingsExts mCustomizationCategory;
@@ -120,7 +117,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
 
         mInternalCategory = (PreferenceCategory) findPreference("storage_internal");
         mExternalCategory = (PreferenceCategory) findPreference("storage_external");
-
         mInternalSummary = new StorageSummaryPreference(getPrefContext());
 
         setHasOptionsMenu(true);
@@ -177,6 +173,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
         int privateCount = 0;
         long privateUsedBytes = 0;
         long privateTotalBytes = 0;
+        long  systemBytes = 0;
 
         final List volumes = mStorageManager.getVolumes();
         Collections.sort(volumes, VolumeInfo.getDescriptionComparator());
@@ -190,6 +187,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
                     final File path = vol.getPath();
                     privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();
                     privateTotalBytes += path.getTotalSpace();
+                    if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())){
+                        systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - path.getTotalSpace());
+                    }
                 }
             } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
                 mExternalCategory.addPreference(
@@ -229,11 +229,13 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
             }
         }
 
-        final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);
-        mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
-                result.value, result.units));
-        mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,
-                Formatter.formatFileSize(context, privateTotalBytes)));
+        final BytesResult result = Formatter.formatBytes(getResources(),systemBytes+privateUsedBytes, 0);
+            mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
+                        result.value, result.units));
+            mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,
+                        Formatter.formatFileSize(context, privateTotalBytes+systemBytes)));
+
+
         mExt.updateCustomizedStorageSettingsPlugin(mInternalCategory);
         if (mInternalCategory.getPreferenceCount() > 0) {
             getPreferenceScreen().addPreference(mInternalCategory);
@@ -514,6 +516,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
             final List volumes = storageManager.getVolumes();
             long privateUsedBytes = 0;
             long privateTotalBytes = 0;
+            long systemBytes = 0;
+
             for (VolumeInfo info : volumes) {
                 if (info.getType() != VolumeInfo.TYPE_PUBLIC
                         && info.getType() != VolumeInfo.TYPE_PRIVATE) {
@@ -523,12 +527,15 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
                 if (path == null) {
                     continue;
                 }
+                if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(info.getId())){
+                    systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - path.getTotalSpace());
+                }
                 privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();
                 privateTotalBytes += path.getTotalSpace();
             }
             mLoader.setSummary(this, mContext.getString(R.string.storage_summary,
-                    Formatter.formatFileSize(mContext, privateUsedBytes),
-                    Formatter.formatFileSize(mContext, privateTotalBytes)));
                     //图1中,红框中的第一个数值
+                    Formatter.formatFileSize(mContext, systemBytes+privateUsedBytes),
                     //图1中,红框中的第二个数值
+                    Formatter.formatFileSize(mContext, systemBytes+privateTotalBytes)));
         }
     }
 
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index 4abeb07..1534feb 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -71,12 +71,26 @@ public class StorageVolumePreference extends Preference {
             final long freeBytes = path.getFreeSpace();
             final long totalBytes = path.getTotalSpace();
             final long usedBytes = totalBytes - freeBytes;
+            final long systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);
 
             final String used = Formatter.formatFileSize(context, usedBytes);
+            final String usedSystem = Formatter.formatFileSize(context, usedBytes+systemBytes);
             final String total = Formatter.formatFileSize(context, totalBytes);
-            setSummary(context.getString(R.string.storage_volume_summary, used, total));
+            /*setSummary(context.getString(R.string.storage_volume_summary, used, total));
             if (totalBytes > 0) {
                 mUsedPercent = (int) ((usedBytes * 100) / totalBytes);
+            }*/
+
+            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {
+                setSummary(context.getString(R.string.storage_volume_summary, usedSystem, "8.0 GB"));
+                if (totalBytes != 0) {
+                    mUsedPercent = (int) (((usedBytes+systemBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024));
+                }
+            } else {
+                setSummary(context.getString(R.string.storage_volume_summary, used, total));
+                if (totalBytes != 0) {
+                    mUsedPercent = (int) ((usedBytes * 100) / totalBytes);
+                }
             }
 
             if (freeBytes < mStorageManager.getStorageLowBytes(path)) {

你可能感兴趣的:(MTK)