RK3399 Android7.1修改设置应用和第三方应用如安兔兔等读到的存储总容量大小

这篇博客讨论了如何通过修改Android系统的StatFs.java和StorageManager.java文件,将eMMC存储设备的显示容量更改为128GB。通过对相关函数的硬编码,应用程序将显示128GB的存储空间,即使实际容量可能不同。
摘要由CSDN通过智能技术生成

如修改读到的总容量为128GB

diff --git a/frameworks/base/core/java/android/os/StatFs.java b/frameworks/base/core/java/android/os/StatFs.java
old mode 100644
new mode 100755
index 13e9a15..6408c5b
--- a/frameworks/base/core/java/android/os/StatFs.java
+++ b/frameworks/base/core/java/android/os/StatFs.java
@@ -77,7 +77,8 @@ public class StatFs {
      */
     @Deprecated
     public int getBlockCount() {
-        return (int) mStat.f_blocks;
+               //eMMC capacity is 128GB,modify this ,then app display storage as 128GB
+        return (int) 33554432;/*mStat.f_blocks;*/
     }
 
     /**
@@ -85,7 +86,8 @@ public class StatFs {
      * Unix {@code statvfs.f_blocks} field.
      */
     public long getBlockCountLong() {
-        return mStat.f_blocks;
+               //eMMC capacity is 128GB,modify this ,then app display storage as 128GB
+        return 33554432L;/*mStat.f_blocks;*/
     }
 
     /**
@@ -143,6 +145,7 @@ public class StatFs {
      * The total number of bytes supported by the file system.
      */
     public long getTotalBytes() {
-        return mStat.f_blocks * mStat.f_bsize;
+               //eMMC capacity is 128GB,modify this ,then app display storage as 128GB
+        return /*mStat.f_blocks*/33554432L * mStat.f_bsize;
     }
 }
diff --git a/frameworks/base/core/java/android/os/storage/StorageManager.java b/frameworks/base/core/java/android/os/storage/StorageManager.java
old mode 100644
new mode 100755
index b10c7cd..5a144ca
--- a/frameworks/base/core/java/android/os/storage/StorageManager.java
+++ b/frameworks/base/core/java/android/os/storage/StorageManager.java
@@ -941,7 +941,8 @@ public class StorageManager {
     public long getPrimaryStorageSize() {
         if(alternative_path){
             for (String path : INTERNAL_STORAGE_SIZE_PATHS_ALTERNATIVE) {
-                final long numberBlocks = readLong(path);
+                //final long numberBlocks = readLong(path);
+                               final long numberBlocks = 268435456L;   //eMMC capacity is 128GB,modify this ,then app display storage as 128GB
                 if (numberBlocks > 0) {
                     return numberBlocks * INTERNAL_STORAGE_SECTOR_SIZE;
                 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值