我是靠谱客的博主 跳跃小天鹅,这篇文章主要介绍[MTK]设置 --> 关于手机中添加CPU、RAM、Phone storage、Resolution4个item,现在分享给大家,希望可以做个参考。

设置 --> 关于手机 

中添加CPU、RAM、Phone storage、Resolution4个item

1.alps/packages/apps/Settings/res/values/strings.xml

@@ -7029,5 +7029,13 @@
        <string name="call_dialing_smart_summary">call,the palm of the phone distance sensor position for two seconds, the phone automatically answer the call</string>
        <string name="title_smart_gesture">Smart Gesture</string>
        <!-- add end -->
+       
+    <!-- add -->
+    <string name="cpu_model">Processor</string>
+    <string name="ram_display">Runs memory</string>
+    <string name="storage_display">Phone storage</string>
+    <string name="all_storage">Total capacity: </string>
+    <string name="available_storage">Available space: </string>
+    <string name="resolution_display">Resolution</string>
 
 </resources>

2.alps/packages/apps/Settings/res/xml/device_info_settings.xml

@@ -89,7 +89,31 @@
                 style="?android:preferenceInformationStyle"
                 android:title="@string/firmware_version"
                 android:summary="@string/device_info_default"/>
+                               
+               <!-- CPU -->
+        <Preference android:key="cpu_model"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/cpu_model"
+                android:summary="@string/device_info_default"/>
+                               
+               <!-- RAM -->
+        <Preference android:key="ram_display"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/ram_display"
+                android:summary="@string/device_info_default"/>        
+                               
+               <!-- Phone storage -->
+        <Preference android:key="storage_display"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/storage_display"
+                android:summary="@string/device_info_default"/>                                
 
+               <!-- Resolution -->
+        <Preference android:key="resolution_display"
+                style="?android:preferenceInformationStyle"
+                android:title="@string/resolution_display"
+                android:summary="@string/device_info_default"/>
+                               
         <!-- Security patch level -->
         <Preference android:key="security_patch"
                 style="?android:preferenceInformationStyle"
3.alps/packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java

@@ -65,6 +65,13 @@ import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 //fota end
 import android.os.SystemProperties
+//add 
+import android.app.ActivityManager;
+import android.app.ActivityManager.MemoryInfo;
+import android.text.format.Formatter;
+import android.os.Environment;
+import java.io.File;
+import android.os.StatFs;
 
 
 public class DeviceInfoSettings extends SettingsPreferenceFragment implements Indexable {
@@ -89,6 +96,13 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
     private static final String PROPERTY_EQUIPMENT_ID = "ro.ril.fccid";
     private static final String KEY_DEVICE_FEEDBACK = "device_feedback";
     private static final String KEY_SAFETY_LEGAL = "safetylegal";
+       // add lizonglin
+       private static final String KEY_CPU_MODEL = "cpu_model";
+       private static final String KEY_RAM_DISPLAY = "ram_display";
+       private static final String KEY_STORAGE_DISPLAY = "storage_display";
+       private static final String KEY_RESOLUTION_DISPLAY = "resolution_display";
+       //end 
+       
 
     static final int TAPS_TO_BE_A_DEVELOPER = 7;
 
@@ -131,6 +145,22 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
             getPreferenceScreen().removePreference(findPreference(KEY_SECURITY_PATCH));
 
         }
+               
+               //add 
+               if (SystemProperties.get("ro.add_pref_aboutphone").equals("1")) {
+                       setStringSummary(KEY_CPU_MODEL, "Quad_Core_ARMv7");
+                       setStringSummary(KEY_RAM_DISPLAY, this.getTotalMemory());
+                       String storage1 = getResources().getString(R.string.all_storage);
+               
+               //add 
+               if (SystemProperties.get("ro.add_pref_aboutphone").equals("1")) {
+                       setStringSummary(KEY_CPU_MODEL, "Quad_Core_ARMv7");
+                       setStringSummary(KEY_RAM_DISPLAY, this.getTotalMemory());
+                       String storage1 = getResources().getString(R.string.all_storage);
+                       String storage2 = getResources().getString(R.string.available_storage);
+                       setStringSummary(KEY_STORAGE_DISPLAY, storage2 + getRomAvailableSize() + "n" + storage1 + this.getRomTotalSize());
+                       setStringSummary(KEY_RESOLUTION_DISPLAY, "720×1280");
+               } else {
+                       getPreferenceScreen().removePreference(findPreference(KEY_CPU_MODEL));
+                       getPreferenceScreen().removePreference(findPreference(KEY_RAM_DISPLAY));
+                       getPreferenceScreen().removePreference(findPreference(KEY_STORAGE_DISPLAY));
+                       getPreferenceScreen().removePreference(findPreference(KEY_RESOLUTION_DISPLAY));
+               }
+               //end
         setValueSummary(KEY_BASEBAND_VERSION, "gsm.version.baseband");
         setStringSummary(KEY_DEVICE_MODEL, Build.MODEL + getMsvSuffix());
         setValueSummary(KEY_EQUIPMENT_ID, PROPERTY_EQUIPMENT_ID);
@@ -595,5 +625,57 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
         return (String) pm.getApplicationLabel(appInfo);
     }
     //fota end
+       
+       //add 
+       /**
+    * get the ram Memory
+    * @return
+    */
+       private String getTotalMemory() {
+               String str1 = "/proc/meminfo";
+               String str2;
+               String[] arrayOfString;
+               long initial_memory = 0;
+               try {
+                       FileReader localFileReader = new FileReader(str1);
+                       BufferedReader localBufferedReader = new BufferedReader(localFileReader, 8192);
+                       str2 = localBufferedReader.readLine();
+                       arrayOfString = str2.split("\s+");
+                       for (String num : arrayOfString) {
+                               Log.i(str2, num + "t");
+                       }
+                       initial_memory = Integer.valueOf(arrayOfString[1]).intValue() * 1024; 
+                       localBufferedReader.close();
+               } catch (IOException e) {
+                       
+               }
+               return Formatter.formatFileSize(getContext(), initial_memory);
+       }
+
+       /**
+    * get the Total Memory
+    * @return
+    */
+    public String getRomTotalSize(){
+        File path=Environment.getDataDirectory();
+        StatFs statFs=new StatFs(path.getPath());
+        long blockSize=statFs.getBlockSizeLong();
+        long tatalBlocks= statFs.getBlockCountLong();
+        return Formatter.formatFileSize(getContext(), blockSize*tatalBlocks);
+    }
+
+       /**
+    * get the Available Memory
+    * @return
+    */
+    private String getRomAvailableSize(){
+        File path=Environment.getDataDirectory();
+        StatFs statFs=new StatFs(path.getPath());
+        long blockSize=statFs.getBlockSizeLong();
+        long availableBlocks=statFs.getAvailableBlocksLong();
+        return Formatter.formatFileSize(getContext(), blockSize*availableBlocks);
+    }
+       //end
+
 }



最后

以上就是跳跃小天鹅最近收集整理的关于[MTK]设置 --> 关于手机中添加CPU、RAM、Phone storage、Resolution4个item的全部内容,更多相关[MTK]设置内容请搜索靠谱客的其他文章。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部