android13 常规问题修改

1.修改默认的电池容量

--- a/vendor/vendor/mediatek/proprietary/packages/overlay/vendor/FrameworkResOverlay/power/res/xml/power_profile.xml
+++ b/vendor/vendor/mediatek/proprietary/packages/overlay/vendor/FrameworkResOverlay/power/res/xml/power_profile.xml
@@ -131,7 +131,7 @@
   </array>
 
   <!-- This is the battery capacity in mAh (measured at nominal voltage) -->
-  <item name="battery.capacity">1000</item>
+  <item name="battery.capacity">6000</item>

2.修改开机logo 的路径

    修改:     vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/wxga/wxga_kernel.bmp
    修改:     vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/wxga/wxga_uboot.bmp

3.简单修改 内存的作假

--- a/vendor/kernel-4.19/fs/proc/meminfo.c
+++ b/vendor/kernel-4.19/fs/proc/meminfo.c
@@ -21,6 +21,8 @@
 #include <asm/pgtable.h>
 #include "internal.h"
 
+#define CONFIG_KERNEL_FAKE_EXTRA_MEM_MB 7600
+
 void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
 {
 }
@@ -56,7 +58,14 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
        available = si_mem_available();
        sreclaimable = global_node_page_state(NR_SLAB_RECLAIMABLE);
        sunreclaim = global_node_page_state(NR_SLAB_UNRECLAIMABLE);
-
+//add by dhy.. for fake mem..
+#ifdef CONFIG_KERNEL_FAKE_EXTRA_MEM_MB
+       if(current->cred->uid.val > 10000){
+               available *= ((CONFIG_KERNEL_FAKE_EXTRA_MEM_MB * 1000) >> (PAGE_SHIFT - 10)) / i.totalram;
+               i.freeram *= ((CONFIG_KERNEL_FAKE_EXTRA_MEM_MB * 1000) >> (PAGE_SHIFT - 10)) / i.totalram;
+               i.totalram = ((CONFIG_KERNEL_FAKE_EXTRA_MEM_MB * 1000) >> (PAGE_SHIFT - 10));
+       }
+#endif
        show_val_kb(m, "MemTotal:       ", i.totalram);
        show_val_kb(m, "MemFree:        ", i.freeram);
        show_val_kb(m, "MemAvailable:   ", available);
diff --git a/vendor/kernel-4.19/kernel/sys.c b/vendor/kernel-4.19/kernel/sys.c
index 1058821d3da..87cddc470f1 100644
--- a/vendor/kernel-4.19/kernel/sys.c
+++ b/vendor/kernel-4.19/kernel/sys.c
@@ -133,6 +133,8 @@
 # define GET_TAGGED_ADDR_CTRL()                (-EINVAL)
 #endif
 
+#define CONFIG_KERNEL_FAKE_EXTRA_MEM_MB 7600
+
 /*
  * this is where the system-wide overflow UID and GID are defined, for
  * architectures that now have 32-bit UID/GID but didn't in the past
@@ -2731,7 +2733,13 @@ static int do_sysinfo(struct sysinfo *info)
         * with 2.2.x, and also retains compatibility with earlier 2.4.x
         * kernels...
         */
-
+//add by dhy ..for fake mem
+#ifdef CONFIG_KERNEL_FAKE_EXTRA_MEM_MB
+       if(current->cred->uid.val > 10000){
+               info->freeram *= ((CONFIG_KERNEL_FAKE_EXTRA_MEM_MB * 1000) >> (PAGE_SHIFT - 10)) / info->totalram; 
+               info->totalram = ((CONFIG_KERNEL_FAKE_EXTRA_MEM_MB * 1000) >> (PAGE_SHIFT - 10));
+       }
+#endif
        info->mem_unit = 1;
        info->totalram <<= bitcount;
        info->freeram <<= bitcount;

--- a/system/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/system/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -6400,6 +6400,23 @@ public class ActivityManagerService extends IActivityManager.Stub
     @Override
     public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) {
         mProcessList.getMemoryInfo(outInfo);
+               //add by dhy for fake meminfo..
+               boolean needFake = false;
+               final int callingUid = Binder.getCallingUid();
+               String packages[] = mContext.getPackageManager().getPackagesForUid(callingUid);
+        if (packages != null && packages.length > 0) { // Ephemeral apps cannot share uid
+            needFake = "com.android.settings".equals(packages[0]) || "com.kte.testmode".equals(packages[0]);
+        }
+               //android.util.Log.e("DHYCO","uid:"+Binder.getCallingUid()+",,needFake="+needFake+",,availMem:"+outInfo.availMem+",,totalMem:"+outInfo.totalMem+",,,packages="+Arrays.toString(packages));
+               if(callingUid > android.os.Process.FIRST_APPLICATION_UID || needFake){
+                       long total = SystemProperties.getInt("ro.config.fake_mem", 0) * 1024 * 1024l;
+                       if(total > outInfo.totalMem){
+                               float scale = total / outInfo.totalMem;
+                               outInfo.availMem = (long)(scale * outInfo.availMem);
+                               outInfo.totalMem = total;
+                       }
+               }
+               //end...


--- a/system/device/mediatek/system/common/system.prop
+++ b/system/device/mediatek/system/common/system.prop
@@ -64,7 +64,7 @@ sys.ipo.disable=1
 
 # identity
 Build.BRAND=MTK
-
+ro.config.fake_mem=7600
 # Disable iorapd
 ro.iorapd.enable=false


--- a/system/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/applications/ProcStatsData.java
+++ b/system/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/applications/ProcStatsData.java
@@ -362,7 +362,9 @@ public class ProcStatsData {
     public static class MemInfo {
         public double realUsedRam;
         public double realFreeRam;
-        public double realTotalRam;
+        public double realTotalRam;            
+               //add by dhy for fake mem..
+               long fake_total = android.os.SystemProperties.getInt("ro.config.fake_mem", 0) * 1024 * 1024l;
         long baseCacheRam;
 
         double[] mMemStateWeights = new double[ProcessStats.STATE_COUNT];
@@ -381,7 +383,10 @@ public class ProcStatsData {
                 long memTotalTime) {
             this.memTotalTime = memTotalTime;
             calculateWeightInfo(context, totalMem, memTotalTime);
-
+                       //add by dhy for fake mem..
+                       boolean fakeUse = fake_total > realTotalRam;
+                       if(fakeUse) realTotalRam = fake_total;
+                       //end 
             double usedRam = (usedWeight * 1024) / memTotalTime;
             double freeRam = (freeWeight * 1024) / memTotalTime;
             totalRam = usedRam + freeRam;

4.为测试模式 添加 距感测试功能

Author: azhuo <rd009@kingtop-group.com>
Date:   Sat Apr 13 09:32:07 2024 +0800

    azhuo modify 测试模式 的距感测试功能

 vendor/device/mediatek/vendor/common/init.sensor_1_0.rc                                                                 |   5 +
 vendor/device/mediatek/vendor/common/init.sensor_2_0.rc                                                                 |   5 +-
 vendor/vendor/mediatek/proprietary/packages/apps/SensorHub/AndroidManifest.xml                                          |  14 +++
 vendor/vendor/mediatek/proprietary/packages/apps/SensorHub/res/layout/kte_sensor_ps_calibration.xml                     |  86 ++++++++++++++++
 vendor/vendor/mediatek/proprietary/packages/apps/SensorHub/res/values-zh-rCN/strings.xml                                |  24 +++++
 vendor/vendor/mediatek/proprietary/packages/apps/SensorHub/res/values/strings.xml                                       |   7 ++
 vendor/vendor/mediatek/proprietary/packages/apps/SensorHub/src/com/mediatek/sensorhub/sensor/KtePSensorCalibration.java
diff --git a/vendor/device/mediatek/vendor/common/init.sensor_1_0.rc b/vendor/device/mediatek/vendor/common/init.sensor_1_0.rc
index 33e30151a5b..66332af7b15 100755
--- a/vendor/device/mediatek/vendor/common/init.sensor_1_0.rc
+++ b/vendor/device/mediatek/vendor/common/init.sensor_1_0.rc
@@ -206,3 +206,8 @@ on post-fs-data
     chown system system /sys/class/sensor/m_bio_misc/biodelay
     chown system system /sys/class/sensor/m_bio_misc/biobatch
     chown system system /sys/class/sensor/m_bio_misc/bioflush
+
+   #KTE romtool:ro.kte.psensor.calibration start
+    chmod 0777 /dev/hf_manager
+    chown system system /dev/hf_manager
+    chmod 0777 /dev/als_ps
diff --git a/vendor/device/mediatek/vendor/common/init.sensor_2_0.rc b/vendor/device/mediatek/vendor/common/init.sensor_2_0.rc
index 0c506565852..6c9d0bdeb82 100644
--- a/vendor/device/mediatek/vendor/common/init.sensor_2_0.rc
+++ b/vendor/device/mediatek/vendor/common/init.sensor_2_0.rc
@@ -1,7 +1,8 @@
 # MTK platform .rc configure
 on post-fs-data
     # calibration
-    mkdir /data/vendor/sensor 0774 system system
+    mkdir /data/vendor/sensor 0777 system system
     # Sensor
-    chmod 0660 /dev/hf_manager
+    #KTE romtool:ro.kte.psensor.calibration start
+    chmod 0777 /dev/hf_manager
     chown system system /dev/hf_manager

修改sensor 的权限 ,刚开始 添加上面的功能 ,抓log 发现hal 层的硬件库 没有权限打开 alps_ps 的权限 相关log信息 如下

HWMLIB: get_psensor_data: open als_ps fail (Permission denied)

5.修改mtklog 默认的存储路径

相关修改文件 以及路径

     device/mediatek/system/common/mtklog/mtklog-config-basic-eng.prop
     device/mediatek/system/common/mtklog/mtklog-config-basic-user.prop
     device/mediatek/system/common/mtklog/mtklog-config-bsp-eng.prop
     device/mediatek/system/common/mtklog/mtklog-config-bsp-user.prop

--- a/system/device/mediatek/system/common/mtklog/mtklog-config-basic-eng.prop
+++ b/system/device/mediatek/system/common/mtklog/mtklog-config-basic-eng.prop
@@ -1,5 +1,5 @@
 # mtk log path can be set as system_data or device_storage or portable_storage
-mtklog_path = system_data
+mtklog_path = device_storage
 com.mediatek.log.mobile.customer = MTK_Internal
 com.mediatek.log.mobile.AllMode = true
 
@@ -11,6 +11,7 @@ com.mediatek.log.gpshost.enabled = true
 com.mediatek.log.bthost.enabled = true
 
 com.mediatek.log.mobile.maxsize = 1000
+com.mediatek.log.mobile.totalmaxsize = 1000
 com.mediatek.log.modem.maxsize = 2000
 com.mediatek.log.net.maxsize =600
 com.mediatek.log.connsysfw.maxsize = 2000

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值