我是靠谱客的博主 光亮雪糕,最近开发中收集的这篇文章主要介绍改设置里存储的flash总容量为固定值,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

设置——存储——总容量,内存的总容量和Flash的总容量在这里是一行代码统一控制的。

 

niming@ubuntu:/home/user/workspace2/niming/a23-v1.0/android/packages/apps/Settings$ git diff
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
old mode 100644
new mode 100755
index 4e5bd63..0337d17
--- a/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreferenceCategory.java
@@ -320,7 +320,8 @@ public class StorageVolumePreferenceCategory extends PreferenceCategory {
         if (!showDetails) return;
 
         // Count caches as available space, since system manages them
-        mItemTotal.setSummary(formatSize(details.totalSize));
+//        mItemTotal.setSummary(formatSize(details.totalSize));
+        mItemTotal.setSummary("7.95GB");
         mItemAvailable.setSummary(formatSize(details.availSize));
 
         mUsageBarPreference.clear();

        如果修改上面的代码的话,2个总容量都修改了。    若只修改flash总容量,以下是正确的修改方案:

 

niming@ubuntu:/home/user/workspace2/niming/a23-v1.0/android/packages/apps/Settings$ git diff  src/com/android/settings/deviceinfo/StorageMeasurement.java
diff --git a/src/com/android/settings/deviceinfo/StorageMeasurement.java b/src/com/android/settings/deviceinfo/StorageMeasurement.java
old mode 100644
new mode 100755
index c72f64c..0bb98a7
--- a/src/com/android/settings/deviceinfo/StorageMeasurement.java
+++ b/src/com/android/settings/deviceinfo/StorageMeasurement.java
@@ -420,6 +420,15 @@ public class StorageMeasurement {
                     final long[] stats = imcs.getFileSystemStats(path);
                     mTotalSize = stats[0];
                     mAvailSize = stats[1];
+                                       final long FakeTotal = (long) (7.95 * 1024 * 1024 * 1024);
+                                       final long FakeAvail = (long) (7.45 * 1024 * 1024 * 1024);
+                                       if ("/mnt/sdcard".equals(path)) {
+                                               mAvailSize = FakeAvail - (mTotalSize - mAvailSize);
+                                               mTotalSize = FakeTotal;
+                                       } else {
+                                               mTotalSize = stats[0];
+                                               mAvailSize = stats[1];
+                                       }
                }
             } catch (Exception e) {
                 Log.w(TAG, "Problem in container service", e);

          以下是正确修改后的效果图:

 

 

最后

以上就是光亮雪糕为你收集整理的改设置里存储的flash总容量为固定值的全部内容,希望文章能够帮你解决改设置里存储的flash总容量为固定值所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(78)

评论列表共有 0 条评论

立即
投稿
返回
顶部