Android 系统(157)---ODM 开发用户常见需求文档(八)


一:信号图标,3G改为H,G改为E

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java)

[java]  view plain  copy
  1.      static final MobileIconGroup THREE_G = new MobileIconGroup(  
  2. -            "3G",  
  3. +            "H",  
  4.              TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,  
  5.              TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,  
  6.              AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,  
  7. @@ -282,10 +282,10 @@ class TelephonyIcons {  
  8.              TelephonyIcons.TELEPHONY_NO_NETWORK,  
  9.              TelephonyIcons.QS_TELEPHONY_NO_NETWORK,  
  10.              AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],  
  11. -            R.string.accessibility_data_connection_3g,  
  12. -            TelephonyIcons.ICON_3G,  
  13. +            R.string.accessibility_data_connection_3_5g,  
  14. +            TelephonyIcons.ICON_H,  
  15.              true,  
  16. -            TelephonyIcons.QS_DATA_3G  
  17. +            TelephonyIcons.QS_DATA_H  
  18.              );  
  19.    
  20.      static final MobileIconGroup WFC = new MobileIconGroup(  
  21. @@ -343,7 +343,7 @@ class TelephonyIcons {  
  22.              );  
  23.    
  24.      static final MobileIconGroup G = new MobileIconGroup(  
  25. -            "G",  
  26. +            "E",  
  27.              TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,  
  28.              TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,  
  29.              AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,  
  30. @@ -351,10 +351,10 @@ class TelephonyIcons {  
  31.              TelephonyIcons.TELEPHONY_NO_NETWORK,  
  32.              TelephonyIcons.QS_TELEPHONY_NO_NETWORK,  
  33.              AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],  
  34. -            R.string.accessibility_data_connection_gprs,  
  35. -            TelephonyIcons.ICON_G,  
  36. +            R.string.accessibility_data_connection_edge,  
  37. +            TelephonyIcons.ICON_E,  
  38.              false,  
  39. -            TelephonyIcons.QS_DATA_G  
  40. +            TelephonyIcons.QS_DATA_E  
  41.              );  
  42.    
  43.      static final MobileIconGroup H = new MobileIconGroup(  

二:添加可选的网络 3G

services/Telephony/src/com/android/phone/MobileNetworkSettings.java)

[java]  view plain  copy
  1.                  mButtonEnabledNetworks.setSummary(R.string.network_3G);  
  2.                  break;  
  3.              case Phone.NT_MODE_WCDMA_ONLY:  
  4. +                mButtonEnabledNetworks.setValue(Integer.toString(Phone.NT_MODE_WCDMA_ONLY));  
  5. +                mButtonEnabledNetworks.setSummary(R.string.network_3G_only);  
  6. +                break;  
  7.              case Phone.NT_MODE_GSM_UMTS:  
  8.              case Phone.NT_MODE_WCDMA_PREF:  
  9.                  if (!mIsGlobalCdma) {  
services/Telephony/res/values/strings.xml

[html]  view plain  copy
  1. <span style="font-size:12px;"><resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  2.     <string name="network_3G">GSM/WCDMA (Auto)</string>  
  3.     <string name="network_3G_only">Only WCDMA</string>  
  4.     <string name="network_2G">Only GSM</string>  
  5.     <string-array name="enabled_networks_4g_choices" translatable="false">  
  6.         <item>@string/network_4G</item>  
  7.         <item>@string/network_3G</item>  
  8.         <item>@string/network_3G_only</item>  
  9.         <item>@string/network_2G</item>  
  10.     </string-array>  
  11.     <!-- 网络优先级 -->  
  12.     <string-array name="enabled_networks_values" translatable="false">  
  13.         <item>"9"</item>  
  14.         <item>"0"</item>  
  15.         <item>"2"</item>  
  16.         <item>"1"</item>  
  17.     </string-array>  
  18. </resources></span>  

三:语言列表中只保留English,Spanish,French,中文

(除了常规的宏里配置VANZO_PRODUCT_LOCALES=es_ES zh_CN fr_FR en_US,还需在frameworks/base/core/res/res/values/locale_config.xml 中删除不要的语言)


四:更改Google默认打开输入法

packages/inputmethods/

(LatinIME/java/Android.mk)

[html]  view plain  copy
  1. LOCAL_PACKAGE_NAME :LatinIME  
  2.    
  3. -LOCAL_CERTIFICATE :shared  
  4. +LOCAL_CERTIFICATE :platform  
  5.    
  6.  LOCAL_JNI_SHARED_LIBRARIES :libjni_latinime  
  7.    
  8. @@ -34,7 +34,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \  
  9.          android-common inputmethod-common android-support-v4 jsr305 latinime-common  
  10.    
  11.    
  12. -  
  13. +LOCAL_PRIVILEGED_MODULE :true  
  14.  # Do not compress dictionary files to mmap dict data runtime  
  15.  LOCAL_AAPT_FLAGS := -0 .dict  

(LatinIME/java/AndroidManifest.xml)

[html]  view plain  copy
  1.      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
  2.      <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />  
  3.      <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />  
  4. +    <uses-permission android:name="android.permission.WRITE_SETTINGS" />  
  5. +    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />  
  6.    
  7.      <application android:label="@string/english_ime_name"  
  8.              android:icon="@drawable/ic_launcher_keyboard"  
  9. @@ -164,6 +166,12 @@  
  10.              </intent-filter>  
  11.          </receiver>  
  12.    
  13. +        <receiver android:name="LatinImeRe" android:enabled="true">  
  14. +            <intent-filter>  
  15. +                <action android:name="android.intent.action.BOOT_COMPLETED" />  
  16. +            </intent-filter>  
  17. +        </receiver>  
  18. +  
  19.          <!-- Content providers -->  
  20.          <provider android:name="com.android.inputmethod.dictionarypack.DictionaryProvider"  
  21.                  android:grantUriPermissions="true"  

(LatinIME/java/src/com/android/inputmethod/latin/LatinImeRe.java)

[java]  view plain  copy
  1. +package com.android.inputmethod.latin;  
  2. +  
  3. +import android.content.BroadcastReceiver;  
  4. +import android.content.Context;  
  5. +import android.content.Intent;  
  6. +import android.content.SharedPreferences;  
  7. +import android.provider.Settings;  
  8. +import android.util.Log;  
  9. +import android.view.inputmethod.InputMethodInfo;  
  10. +import android.view.inputmethod.InputMethodManager;  
  11. +import android.view.inputmethod.InputMethodSubtype;  
  12. +  
  13. +import android.text.TextUtils;  
  14. +  
  15. +public class LatinImeRe extends BroadcastReceiver {  
  16. +  
  17. +    private static final String TAG = "LatinImeRe";  
  18. +  
  19. +    @Override  
  20. +        public void onReceive(Context context, Intent intent) {  
  21. +            // Set the default input language at the system boot completed.  
  22. +            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {  
  23. +                Log.w(TAG, "onReceive");  
  24. +                SharedPreferences sp = context.getSharedPreferences("default_input_language_config",  
  25. +                        Context.MODE_PRIVATE);  
  26. +                boolean hasSet = sp.getBoolean("has_set"false);  
  27. +  
  28. +                setDefaultSubtypes(context);  
  29. +                sp.edit().putBoolean("has_set"true).commit();  
  30. +            }  
  31. +        }  
  32. +    /** 
  33. +     * M: Set the default IME subtype. 
  34. +     */  
  35. +    private void setDefaultSubtypes(Context context) {  
  36. +        final String serviceName = "com.android.inputmethod.latin/.LatinIME";  
  37. +        final String currentPackageName = "com.android.inputmethod.latin";  
  38. +        final String enable = Settings.Secure.getString(context.getContentResolver(),  
  39. +                Settings.Secure.ENABLED_INPUT_METHODS);  
  40. +  
  41. +        Log.w(TAG, "setDefaultSubtypes() enable :" + enable);  
  42. +  
  43. +        final InputMethodManager imm = (InputMethodManager) context.getSystemService(  
  44. +                Context.INPUT_METHOD_SERVICE);  
  45. +        final StringBuilder builder = new StringBuilder();  
  46. +  
  47. +        // Get sub type hash code  
  48. +        for (InputMethodInfo info : imm.getInputMethodList()) {  
  49. +            if (currentPackageName.equals(info.getPackageName())) {  
  50. +                for (int i = 0; i < info.getSubtypeCount(); i++) {  
  51. +                    final InputMethodSubtype subtype = info.getSubtypeAt(i);  
  52. +                    final String locale = subtype.getLocale().toString();  
  53. +                    //winny  
  54. +                    Log.w(TAG, "subtype.getLocale().toString :" + locale);  
  55. +  
  56. +                    if (isDefaultLocale(locale)) {  
  57. +                        Log.i(TAG, "default enabled subtype locale = " + locale);  
  58. +                        builder.append(';');  
  59. +                        builder.append(subtype.hashCode());  
  60. +                    }  
  61. +                }  
  62. +  
  63. +                break;  
  64. +            }  
  65. +        }  
  66. +  
  67. +        Log.w(TAG, "after for loop :" + builder.toString());  
  68. +        // Insert the sub type  
  69. +        if (builder.length() > 0) {  
  70. +            final String subtype = builder.toString();  
  71. +            builder.setLength(0);  
  72. +  
  73. +            final int index = enable.indexOf(serviceName) + serviceName.length();  
  74. +            if (enable.length() > index) {  
  75. +                builder.append(enable.substring(0, index));  
  76. +                builder.append(subtype);  
  77. +                builder.append(enable.substring(index));  
  78. +            } else if (enable.length() == index) {  
  79. +                builder.append(enable);  
  80. +                builder.append(subtype);  
  81. +            } else {  
  82. +                return;  
  83. +            }  
  84. +        }  
  85. +  
  86. +        // Commit the result  
  87. +        android.provider.Settings.Secure.putString(context.getContentResolver(),  
  88. +                android.provider.Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());  
  89. +    }  
  90. +    /** 
  91. +     * M: Check if the current locale is default or not. 
  92. +     */  
  93. +    private boolean isDefaultLocale (String locale) {  
  94. +  
  95. +        String[] locales= new String[]{"es"};  
  96. +        //将默认的语言在此添加,注意写法与method.xml中的subtype语言保持一致,这里es是西班牙语的示例。  
  97. +        for (String s : locales) {  
  98. +            if (s.equals(locale)) {  
  99. +                return true;  
  100. +            }  
  101. +        }  
  102. +  
  103. +        return false;  
  104. +  
  105. +    }  
  106. +}  

五:收到短信时,手机无振动

vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/transaction/MessagingNotification.java)

[java]  view plain  copy
  1.              */  
  2.              /// M: comment if, change condition  
  3.              //if (vibrateAlways || vibrateSilent && nowSilent) {  
  4. -            if (notiProf.needVibrate()  
  5. -                    && audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {  
  6. +            if (notiProf.needVibrate()) {  
  7.                  defaults |= Notification.DEFAULT_VIBRATE;  
  8.              }  
  9.              /// @}  
  10. @@ -1471,6 +1470,11 @@ public class MessagingNotification {  
  11.                  }  
  12.              }  
  13.          }  
  14. +        PowerManager mPowerManager = (PowerManager) (context.getSystemService(Context.POWER_SERVICE));  
  15. +        PowerManager.WakeLock mWakeLock = null;  
  16. +        mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP  
  17. +                        | PowerManager.ON_AFTER_RELEASE, "MMS_wake_lock");  
  18. +        mWakeLock.acquire(5000);  
  19.    
  20.          nm.notify(NOTIFICATION_ID, notification);  
  21.          // add for OP  

六:个别SIM卡在搜索网络的时候 4G/3G/2G 前面显示的是null

frameworks/opt/telephony/src/java/com/android/internal/telephony/RIL.java

[java]  view plain  copy
  1.                                      (mSimOperatorNumeric.equals(strings[i + 2]))) {  
  2.                                  String sCphsOns = null;  
  3.                                  sCphsOns = simRecord.getSIMCPHSOns();  
  4. -                                if (sCphsOns != null) {  
  5. +                                if (sCphsOns != null && !sCphsOns.equals("")) {  
  6.                                      strings[i + 0] = sCphsOns;  
  7.                                      Rlog.d(RILJ_LOG_TAG, "plmn name update to CPHS Ons: "  
  8.                                              + strings[i + 0]);  

七:去除信号图标 X

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java)

[java]  view plain  copy
  1.      static final int ICON_CARRIER_NETWORK_CHANGE =  
  2.              R.drawable.stat_sys_signal_carrier_network_change_animation;  
  3.    
  4. -    static final int ICON_DATA_DISABLED = R.drawable.stat_sys_data_disabled;  
  5. +    static final int ICON_DATA_DISABLED = -1;  
  6.    
  7.      static final int QS_ICON_LTE = R.drawable.ic_qs_signal_lte;  
  8.      static final int QS_ICON_3G = R.drawable.ic_qs_signal_3g;  
  9. @@ -256,7 +256,7 @@ class TelephonyIcons {  
  10.      static final int QS_ICON_CARRIER_NETWORK_CHANGE =  
  11.              R.drawable.ic_qs_signal_carrier_network_change_animation;  
  12.    
  13. -    static final int QS_ICON_DATA_DISABLED = R.drawable.ic_qs_data_disabled;  
  14. +    static final int QS_ICON_DATA_DISABLED = -1;  
  15.    
  16.      static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(  
  17.              "CARRIER_NETWORK_CHANGE",  
packages/apps/Settings/src/com/android/settings/dashboard/conditional/CellularDataCondition.java)

[java]  view plain  copy
  1.      @Override  
  2.      public Icon getIcon() {  
  3. -        return Icon.createWithResource(mManager.getContext(), R.drawable.ic_cellular_off);  
  4. +        return Icon.createWithResource(mManager.getContext(), -1);  
  5.      }  
  6.    
  7.      @Override  

八:拨打语音信箱时显示 @@@@@@@@@@@@@@

packages/apps/Dialer/InCallUI/src/com/android/incallui/ContactInfoCache.java)

[java]  view plain  copy
  1.                      // later determine whether to use the name or nameAlternative when presenting  
  2.                      displayName = info.name;  
  3.                      cce.nameAlternative = info.nameAlternative;  
  4. +                    if ( displayName !=null && displayName.equals("@@@@@@@@@@@@@@")) {  
  5. +                        displayName = context.getResources().getString(R.string.voicemail) ;  
  6. +                    }  
  7.                      displayNumber = number;  
  8.                      label = info.phoneLabel;  
  9.                      Log.d(TAG, "  ==>  name is present in CallerInfo: displayName '" + displayName  

九:sim卡1打开数据网络切换sim卡2,数据网络要跟随开打

packages/apps/Settings/src/com/android/settings/sim/SimDialogActivity.java)

[java]  view plain  copy
  1.          final SubscriptionManager subscriptionManager = SubscriptionManager.from(context);  
  2.          /// M: for plug-in, need to call before setDefaultDataSubId  
  3.          mSimManagementExt.setDataState(subId);  
  4. -        subscriptionManager.setDefaultDataSubId(subId);  
  5. +        TelephonyManager telephonyManager = TelephonyManager.from(context);  
  6. +        boolean enableBefore = telephonyManager.getDataEnabled();  
  7. +        int preSubId = subscriptionManager.getDefaultDataSubscriptionId();  
  8. +        Log.d(TAG, "data flag: " + enableBefore + ", subId: " + subId + ", preSubId: " + preSubId);  
  9. +        if (subscriptionManager.isValidSubscriptionId(subId) &&subId != preSubId) {  
  10. +            subscriptionManager.setDefaultDataSubId(subId);  
  11. +            if (enableBefore) {  
  12. +                telephonyManager.setDataEnabled(subId, true);  
  13. +                telephonyManager.setDataEnabled(preSubId, false);  
  14. +            }  
  15. +        }  
  16.          /// M: for plug-in, need to call after setDefaultDataSubId  
  17.          mSimManagementExt.setDataStateEnable(subId);  
  18.          /// M: for plug-in @{  

十:CARD 改为 SIM

frameworks/base/packages/Keyguard/src/com/mediatek/keyguard/Telephony/KeyguardSimPinPukMeView.java)

[java]  view plain  copy
  1.              ///   fetch the latest/updated active sub list.  
  2.              SubscriptionInfo info = mUpdateMonitor.getSubscriptionInfoForSubId(subId, forceReload);  
  3.              CharSequence displayName = info != null ? info.getDisplayName() : ""// don't crash  
  4. +            displayName = ((String) displayName).replace("CARD 1","SIM 1").replace("CARD 2","SIM 2");  
  5.              // M: add for ALPS02475558  
  6.              if (info == null) {  
  7. -                displayName = "CARD " + Integer.toString(mPhoneId + 1);  
  8. +                displayName = "SIM " + Integer.toString(mPhoneId + 1);  
  9.                  Log.d(TAG, "we set a displayname");  
  10.              }  
  11.              Log.d(TAG, "resetState() - subId = " + subId + ", displayName = " + displayName);  
packages/apps/Settings/src/com/android/settings/sim/SimDialogActivity.java)

[java]  view plain  copy
  1.                  mSimManagementExt.setCurrNetworkIcon(holder.icon, mDialogId, position);  
  2.                  holder.icon.setAlpha(OPACITY);  
  3.              } else {  
  4. -                holder.title.setText(sir.getDisplayName());  
  5. +                holder.title.setText((sir.getDisplayName().toString()).replace("CARD""SIM"));  
  6.                  holder.summary.setText(sir.getNumber());  
  7.                  holder.icon.setImageBitmap(sir.createIconBitmap(mContext));  
  8.                  /// M: when item numbers is over the screen, should set alpha 1.0f.  

十一:设置->设置PIN/密码锁成功后,再进入输入密码界面,无须输入密码直接点击确定,提示“设置已停止运行”

packages/apps/Settings/src/com/android/settings/ConfirmLockPassword.java)

[java]  view plain  copy
  1.              mPasswordEntryInputDisabler.setInputEnabled(false);  
  2.    
  3. -            final String pin = mPasswordEntry.getText().toString();  
  4. +            String pin = mPasswordEntry.getText().toString();  
  5. +            if (pin.equals("")){  
  6. +               pin = "0" ;  
  7. +            }  
  8.              final boolean verifyChallenge = getActivity().getIntent().getBooleanExtra(  
  9.                      ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);  
  10.              Intent intent = new Intent();  

十二:删除phone > 通话 > IP前缀... 这个选项

packages/services/Telephony/src/com/android/phone/CallFeaturesSetting.java)

[java]  view plain  copy
  1.      }  
  2.    
  3.      private void setIpFunction() {  
  4. +        PreferenceScreen press = getPreferenceScreen();  
  5.          Preference prefIp = getPreferenceScreen().findPreference(IP_PREFIX_KEY);  
  6.          Intent intent = new Intent(this, IpPrefixPreference.class);  
  7.          intent.putExtra(SubscriptionInfoHelper.SUB_ID_EXTRA, mSubscriptionInfoHelper.getSubId());  
  8.          if (prefIp != null) {  
  9.              prefIp.setIntent(intent);  
  10.          }  
  11. +        press.removePreference(prefIp);  
  12.      }  
  13.    
  14.      private BroadcastReceiver mReceiver = new BroadcastReceiver() {  

十三:浏览器默认搜索引擎更改

vendor/mediatek/proprietary/packages/apps/Browser/src/com/android/browser/preferences/SearchEngineSettings.java)

[java]  view plain  copy
  1.                  mEntries[i] = searchEngines.get(i).getLabel();  
  2.                  mEntryFavicon[i] = searchEngines.get(i).getFaviconUri();  
  3.                  if (mEntryValues[i].equals(searchEngineName)) {  
  4. -                    selectedItem = i;  
  5. +                    selectedItem = 1;  
  6.                  }  
  7.              }  

十四:更改fingerprint认证

build/tools/buildinfo.sh)

[java]  view plain  copy
  1.  echo "# Do not try to parse description, fingerprint, or thumbprint"  
  2.  echo "ro.build.description=$PRIVATE_BUILD_DESC"  
  3. -echo "ro.build.fingerprint=$VANZO_INNER_CUSTOM_PRODUCT_BRAND/$VANZO_INNER_CUSTOM_PRODUCT_NAME/$VANZO_INNER_CUSTOM_PRODUCT_DEVICE:$PLATFORM_VERSION/$BUILD_ID/`date +%Y%m%d.%H%M%S`:$TARGET_BUILD_TYPE/release-keys"  
  4. -echo "ro.bootimage.build.fingerprint=$VANZO_INNER_CUSTOM_PRODUCT_BRAND/$VANZO_INNER_CUSTOM_PRODUCT_NAME/$VANZO_INNER_CUSTOM_PRODUCT_DEVICE:$PLATFORM_VERSION/$BUILD_ID/`date +%Y%m%d.%H%M%S`:$TARGET_BUILD_TYPE/release-keys"  
  5. +echo "ro.build.fingerprint=Azumi/Speed_Pro_55/Speed_Pro_55:7.0/NRD90M/20170401.113705:user/release-keys"  
  6. +echo "ro.bootimage.build.fingerprint=Azumi/Speed_Pro_55/Speed_Pro_55:7.0/NRD90M/20170401.113705:user/release-keys"  
  7.  if [ -n "$BUILD_THUMBPRINT" ] ; then  
  8.    echo "ro.build.thumbprint=$BUILD_THUMBPRINT"  
  9.  fi  

十五:文件管理中更改存储空间大小

vendor/mediatek/proprietary/packages/apps/FileManager/src/com/mediatek/filemanager/FileInfoAdapter.java)

[java]  view plain  copy
  1.                  LogUtils.d(TAG, "setSizeText, freeSpace = " + MountPointManager.getInstance().getMountPointFreeSpace(fileInfo.getFileAbsolutePath()) + ",totalSpace = "  
  2.                          + MountPointManager.getInstance().getMountPointTotalSpace(fileInfo.getFileAbsolutePath()));  
  3.    
  4. -                sb.append(mResources.getString(R.string.free_space)).append(" ");  
  5. -                sb.append(freeSpaceString).append(" \n");  
  6. -                sb.append(mResources.getString(R.string.total_space)).append(" ");  
  7. -                sb.append(totalSpaces).append(" ");  
  8. +                sb.append(mResources.getString(R.string.free_space)).append(" ");  
  9. +                sb.append(freeSpaceString).append(",  ");  
  10. +                String path = fileInfo.getFileAbsolutePath();  
  11. +                if (MountPointManager.getInstance().isInternalMountPath(path)) {  
  12. +                    String totalSpacesCustom = "16.0GB";  
  13. +                    sb.append(mResources.getString(R.string.total_space)).append(" ");  
  14. +                    sb.append(totalSpacesCustom).append(" ");  
  15. +                } else {  
  16. +                    sb.append(mResources.getString(R.string.total_space)).append(" ");  
  17. +                    sb.append(totalSpaces).append(" ");  
  18. +                }  
  19.                  textView.setText(sb.toString());  
  20.                  textView.setVisibility(View.VISIBLE);  
  21.              } else {  

十六:设置 > 存储    加入总空间/可用空间/系统空间

packages/apps/Settings/

(res/values-es/strings_storage.xml)

[html]  view plain  copy
  1. +<?xml version="1.0" encoding="UTF-8"?>  
  2. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  3. +    <string name="storage_detail_total">Memoria Total</string>  
  4. +    <string name="storage_detail_available">Memoria Disponible</string>  
  5. +    <string name="storage_detail_system">Memoria del Sistema</string>  
  6. +</resources>  

(res/values-zh-rCN/strings_storage.xml)

[html]  view plain  copy
  1. +<?xml version="1.0" encoding="UTF-8"?>  
  2. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  3. +    <string name="storage_detail_total">总空间</string>  
  4. +    <string name="storage_detail_available">可用</string>  
  5. +    <string name="storage_detail_system">系统</string>  
  6. +</resources>  

(res/values/strings_storage.xml)

[html]  view plain  copy
  1. +<?xml version="1.0" encoding="UTF-8"?>  
  2. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  3. +    <string name="storage_detail_total">Total Space</string>  
  4. +    <string name="storage_detail_available">Available</string>  
  5. +    <string name="storage_detail_system">System</string>  
  6. +</resources>  

(src/com/android/settings/deviceinfo/PrivateVolumeSettings.java)

[java]  view plain  copy
  1.      private static final String AUTHORITY_MEDIA = "com.android.providers.media.documents";  
  2.    
  3.      private static final int[] ITEMS_NO_SHOW_SHARED = new int[] {  
  4. +            R.string.storage_detail_total,  
  5. +            R.string.storage_detail_available,  
  6. +            R.string.storage_detail_system,  
  7.              R.string.storage_detail_apps,  
  8.      };  
  9.    
  10.      private static final int[] ITEMS_SHOW_SHARED = new int[] {  
  11. +            R.string.storage_detail_total,  
  12. +            R.string.storage_detail_available,  
  13. +            R.string.storage_detail_system,  
  14.              R.string.storage_detail_apps,  
  15.              R.string.storage_detail_images,  
  16.              R.string.storage_detail_videos,  
  17. @@ -241,12 +247,24 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  18.          final long freeBytes = file.getFreeSpace();  
  19.          final long usedBytes = totalBytes - freeBytes;  
  20.    
  21. -        final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  22. -        mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  23. -                result.value, result.units));  
  24. -        mSummary.setSummary(getString(R.string.storage_volume_used,  
  25. -                Formatter.formatFileSize(context, totalBytes)));  
  26. -        mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  27. +        if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {  
  28. +            final long  systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes);  
  29. +            final BytesResult systemresult = Formatter.formatBytes(getResources(), systemBytes, 0);  
  30. +            final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);  
  31. +            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  32. +                        result.value, result.units));  
  33. +            mSummary.setSummary(getString(R.string.storage_volume_used,  
  34. +                        Formatter.formatFileSize(context, (long) (16.0 * 1024 * 1024 * 1024))));  
  35. +            mSummary.setPercent((int) (((systemBytes+usedBytes) * 100) / (float) (16.0 * 1024 * 1024 * 1024)));  
  36. +  
  37. +        }else{  
  38. +            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  39. +            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  40. +                        result.value, result.units));  
  41. +            mSummary.setSummary(getString(R.string.storage_volume_used,  
  42. +                        Formatter.formatFileSize(context, totalBytes)));  
  43. +            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  44. +        }  
  45.          mExt.updateCustomizedPrivateSettingsPlugin(screen, mVolume);  
  46.          mMeasure.forceMeasure();  
  47.          mNeedsUpdate = false;  
  48. @@ -276,6 +294,13 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  49.      private void addDetailItems(PreferenceGroup category, boolean showShared, int userId) {  
  50.          final int[] itemsToAdd = (showShared ? ITEMS_SHOW_SHARED : ITEMS_NO_SHOW_SHARED);  
  51.          for (int i = 0; i < itemsToAdd.length; ++i) {  
  52. +            if (!VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {  
  53. +                if (itemsToAdd[i] == R.string.storage_detail_total  
  54. +                        || itemsToAdd[i] == R.string.storage_detail_available  
  55. +                        || itemsToAdd[i] == R.string.storage_detail_system) {  
  56. +                    continue;  
  57. +                }  
  58. +            }  
  59.              addItem(category, itemsToAdd[i], null, userId);  
  60.          }  
  61.      }  
  62. @@ -295,7 +320,20 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  63.              item.setTitle(titleRes);  
  64.              item.setKey(Integer.toString(titleRes));  
  65.          }  
  66. -        item.setSummary(R.string.memory_calculating_size);  
  67. +        final Context context = getActivity();  
  68. +        final File file = mVolume.getPath();  
  69. +        final long totalBytes = file.getTotalSpace();  
  70. +        final long freeBytes = file.getFreeSpace();  
  71. +        final long usedBytes = totalBytes - freeBytes;  
  72. +        if (titleRes == R.string.storage_detail_total) {  
  73. +            item.setSummary("16.00 GB");  
  74. +        } else if (titleRes == R.string.storage_detail_available){  
  75. +            item.setSummary(Formatter.formatFileSize(context, freeBytes));  
  76. +        } else if (titleRes == R.string.storage_detail_system) {  
  77. +            item.setSummary(Formatter.formatFileSize(context, (long)(16.0 * 1024 * 1024 * 1024) - totalBytes));  
  78. +        } else {  
  79. +            item.setSummary(R.string.memory_calculating_size);  
  80. +        }  
  81.          item.userHandle = userId;  
  82.          addPreference(group, item);  
  83.          ++mItemPoolIndex;  

(src/com/android/settings/deviceinfo/PublicVolumeSettings.java)

[java]  view plain  copy
  1.              final long freeBytes = file.getFreeSpace();  
  2.              final long usedBytes = totalBytes - freeBytes;  
  3.    
  4. -            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  5. -            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  6. -                    result.value, result.units));  
  7. -            mSummary.setSummary(getString(R.string.storage_volume_used,  
  8. -                    Formatter.formatFileSize(context, totalBytes)));  
  9. -            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  10. +            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {  
  11. +                final long  systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes);  
  12. +                final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);  
  13. +                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  14. +                            result.value, result.units));  
  15. +                mSummary.setSummary(getString(R.string.storage_volume_used,  
  16. +                            Formatter.formatFileSize(context, (long) (16.0 * 1024 * 1024 * 1024)))+"---");  
  17. +                mSummary.setPercent((int) (((usedBytes+systemBytes) * 100) / (float)(16.0 * 1024 * 1024 * 1024)));  
  18. +            }else{  
  19. +                final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  20. +                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  21. +                            result.value, result.units));  
  22. +                mSummary.setSummary(getString(R.string.storage_volume_used,  
  23. +                            Formatter.formatFileSize(context, totalBytes)));  
  24. +                mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  25. +            }  
  26.          }  
  27.    
  28.          if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {  
(src/com/android/settings/deviceinfo/StorageSettings.java)

[java]  view plain  copy
  1.          int privateCount = 0;  
  2.          long privateUsedBytes = 0;  
  3.          long privateTotalBytes = 0;  
  4. +        long  systemBytes = 0;  
  5.    
  6.          final List<VolumeInfo> volumes = mStorageManager.getVolumes();  
  7.          Collections.sort(volumes, VolumeInfo.getDescriptionComparator());  
  8. @@ -190,6 +191,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  9.                      final File path = vol.getPath();  
  10.                      privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();  
  11.                      privateTotalBytes += path.getTotalSpace();  
  12. +                    if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())){  
  13. +                        systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - path.getTotalSpace());  
  14. +                    }  
  15.                  }  
  16.              } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {  
  17.                  mExternalCategory.addPreference(  
  18. @@ -229,11 +233,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  19.              }  
  20.          }  
  21.    
  22. -        final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);  
  23. -        mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  24. -                result.value, result.units));  
  25. -        mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,  
  26. -                Formatter.formatFileSize(context, privateTotalBytes)));  
  27. +        final BytesResult result = Formatter.formatBytes(getResources(),systemBytes+privateUsedBytes, 0);  
  28. +            mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  29. +                        result.value, result.units));  
  30. +            mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,  
  31. +                        Formatter.formatFileSize(context, privateTotalBytes+systemBytes)));  
  32.          mExt.updateCustomizedStorageSettingsPlugin(mInternalCategory);  
  33.          if (mInternalCategory.getPreferenceCount() > 0) {  
  34.              getPreferenceScreen().addPreference(mInternalCategory);  
  35. @@ -514,6 +516,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  36.               final List<VolumeInfo> volumes = storageManager.getVolumes();  
  37.               long privateUsedBytes = 0;  
  38.               long privateTotalBytes = 0;  
  39. +             long systemBytes = 0;  
  40. +  
  41.               for (VolumeInfo info : volumes) {  
  42.                   if (info.getType() != VolumeInfo.TYPE_PUBLIC  
  43.                           && info.getType() != VolumeInfo.TYPE_PRIVATE) {  
  44. @@ -528,7 +532,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  45.                 if (path == null) {  
  46.                     continue;  
  47.                 }  
  48. +               if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(info.getId())){  
  49. +                   systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - path.getTotalSpace());  
  50. +               }  
  51.                 privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();  
  52.                 privateTotalBytes += path.getTotalSpace();  
  53.              }  
  54.              mLoader.setSummary(this, mContext.getString(R.string.storage_summary,  
  55. -                    Formatter.formatFileSize(mContext, privateUsedBytes),  
  56. -                    Formatter.formatFileSize(mContext, privateTotalBytes)));  
  57. +                    Formatter.formatFileSize(mContext, systemBytes+privateUsedBytes),  
  58. +                    Formatter.formatFileSize(mContext, systemBytes+privateTotalBytes)));  
  59.          }  
  60.      }  

(src/com/android/settings/deviceinfo/StorageVolumePreference.java)

[java]  view plain  copy
  1.              final long freeBytes = path.getFreeSpace();  
  2.              final long totalBytes = path.getTotalSpace();  
  3.              final long usedBytes = totalBytes - freeBytes;  
  4. +            final long systemBytes = (long) ((16.0 * 1024 * 1024 * 1024) - totalBytes);  
  5.    
  6.              final String used = Formatter.formatFileSize(context, usedBytes);  
  7. +            final String usedSystem = Formatter.formatFileSize(context, usedBytes+systemBytes);  
  8.              final String total = Formatter.formatFileSize(context, totalBytes);  
  9.              setSummary(context.getString(R.string.storage_volume_summary, used, total));  
  10.              if (totalBytes > 0) {  
  11.                  mUsedPercent = (int) ((usedBytes * 100) / totalBytes);  
  12.              }  
  13.    
  14. +            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {  
  15. +                setSummary(context.getString(R.string.storage_volume_summary, usedSystem, "16.0 GB"));  
  16. +                if (totalBytes != 0) {  
  17. +                    mUsedPercent = (int) (((usedBytes+systemBytes) * 100) / (float) (16.0 * 1024 * 1024 * 1024));  
  18. +                }  
  19. +            } else {  
  20. +                setSummary(context.getString(R.string.storage_volume_summary, used, total));  
  21. +                if (totalBytes != 0) {  
  22. +                    mUsedPercent = (int) ((usedBytes * 100) / totalBytes);  
  23. +                }  
  24. +            }  
  25. +  
  26.              if (freeBytes < mStorageManager.getStorageLowBytes(path)) {  
  27.                  mColor = StorageSettings.COLOR_WARNING;  
  28.                  icon = context.getDrawable(R.drawable.ic_warning_24dp);  


十七:设置 > 存储      顶部加入显示 ROM/RAM

(packages/apps/Settings/)

(res/values/strings.xml)

[html]  view plain  copy
  1. +    <string name="storage_detail_title">ROM INFORMATION</string>  
  2. +    <string name="storage_detail_total">"Total ROM"</string>  
  3. +    <string name="storage_detail_system">Total RAM</string>  
(src/com/android/settings/deviceinfo/PrivateVolumeSettings.java)

[java]  view plain  copy
  1.  import android.content.Context;  
  2.  import android.content.DialogInterface;  
  3.  import android.content.Intent;  
  4. +import java.text.DecimalFormat;  
  5.  import android.content.pm.IPackageDataObserver;  
  6.  import android.content.pm.PackageInfo;  
  7.  import android.content.pm.PackageManager;  
  8. @@ -121,6 +122,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  9.      private int mItemPoolIndex;  
  10.    
  11.      private Preference mExplore;  
  12. +    private Preference storage_detail_system;  
  13. +    private Preference storage_detail_total;  
  14.    
  15.      private boolean mNeedsUpdate;  
  16.    
  17. @@ -168,6 +171,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  18.          mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());  
  19.    
  20.          mExplore = buildAction(R.string.storage_menu_explore);  
  21. +        storage_detail_system = buildAction(R.string.storage_detail_system);  
  22. +        storage_detail_total  =  buildAction(R.string.storage_detail_total);  
  23.    
  24.          mNeedsUpdate = true;  
  25.    
  26. @@ -195,8 +200,9 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  27.          final PreferenceScreen screen = getPreferenceScreen();  
  28.    
  29.          screen.removeAll();  
  30.          addPreference(screen, mSummary);  
  31.    
  32.          List<UserInfo> allUsers = mUserManager.getUsers();  
  33.          final int userCount = allUsers.size();  
  34. @@ -233,6 +239,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  35.          addItem(screen, R.string.storage_detail_cached, null, UserHandle.USER_NULL);  
  36.    
  37.          if (showShared) {  
  38. +            addCategory2(screen);  
  39.              addPreference(screen, mExplore);  
  40.          }  
  41.    
  42. @@ -241,12 +248,29 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {  
  43.          final long freeBytes = file.getFreeSpace();  
  44.          final long usedBytes = totalBytes - freeBytes;  
  45.    
  46. -        final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  47. -        mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  48. -                result.value, result.units));  
  49. -        mSummary.setSummary(getString(R.string.storage_volume_used,  
  50. -                Formatter.formatFileSize(context, totalBytes)));  
  51. -        mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  52. +        if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {    
  53. +            final long  systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);  
  54. +            final BytesResult systemresult = Formatter.formatBytes(getResources(), systemBytes, 0);  
  55. +            storage_detail_system.setSummary("1.0 GB");  
  56. +            storage_detail_total.setSummary("8.0 GB");  
  57. +  
  58. +            final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);  
  59. +            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  60. +                        result.value, result.units));  
  61. +            mSummary.setSummary(getString(R.string.storage_volume_used,  
  62. +                        Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024))));  
  63. +            mSummary.setPercent((int) (((systemBytes+usedBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024)));  
  64. +  
  65. +        }else{  
[java]  view plain  copy
  1. +            storage_detail_system.setSummary("1.0 GB");  
  2. +            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,6 +297,29 @@ 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_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) {
 
  
(src/com/android/settings/deviceinfo/PublicVolumeSettings.java)

[java]  view plain  copy
  1.              final long freeBytes = file.getFreeSpace();  
  2.              final long usedBytes = totalBytes - freeBytes;  
  3.    
  4. -            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);  
  5. -            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  6. -                    result.value, result.units));  
  7. -            mSummary.setSummary(getString(R.string.storage_volume_used,  
  8. -                    Formatter.formatFileSize(context, totalBytes)));  
  9. -            mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));  
  10. +            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(mVolume.getId())) {    
  11. +                final long  systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);    
  12. +                final BytesResult result = Formatter.formatBytes(getResources(), systemBytes+usedBytes, 0);    
  13. +                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),    
  14. +                            result.value, result.units));    
  15. +                mSummary.setSummary(getString(R.string.storage_volume_used,    
  16. +                            Formatter.formatFileSize(context, (long) (8.0 * 1024 * 1024 * 1024)))+"---");    
  17. +                mSummary.setPercent((int) (((usedBytes+systemBytes) * 100) / (float)(8.0 * 1024 * 1024 * 1024)));    
  18. +            }else{    
  19. +                final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);    
  20. +                mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),    
  21. +                            result.value, result.units));    
  22. +                mSummary.setSummary(getString(R.string.storage_volume_used,    
  23. +                            Formatter.formatFileSize(context, totalBytes)));    
  24. +                mSummary.setPercent((int) ((usedBytes * 100) / totalBytes));    
  25. +            }  
  26.          }  
  27.    
  28.          if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {  
(src/com/android/settings/deviceinfo/StorageSettings.java)

[java]  view plain  copy
  1.          int privateCount = 0;  
  2.          long privateUsedBytes = 0;  
  3.          long privateTotalBytes = 0;  
  4. +        long  systemBytes = 0;  
  5.    
  6.          final List<VolumeInfo> volumes = mStorageManager.getVolumes();  
  7.          Collections.sort(volumes, VolumeInfo.getDescriptionComparator());  
  8. @@ -190,6 +191,9 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  9.                      final File path = vol.getPath();  
  10.                      privateUsedBytes += path.getTotalSpace() - path.getFreeSpace();  
  11.                      privateTotalBytes += path.getTotalSpace();  
  12. +                    if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.getId())){    
  13. +                        systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - path.getTotalSpace());    
  14. +                    }  
  15.                  }  
  16.              } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {  
  17.                  mExternalCategory.addPreference(  
  18. @@ -229,11 +233,14 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index  
  19.              }  
  20.          }  
  21.    
  22. -        final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);  
  23. -        mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  24. -                result.value, result.units));  
  25. -        mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,  
  26. -                Formatter.formatFileSize(context, privateTotalBytes)));  
  27. +        final BytesResult result = Formatter.formatBytes(getResources(),systemBytes+privateUsedBytes, 0);  
  28. +            mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),  
  29. +                        result.value, result.units));    
  30. +            mInternalSummary.setSummary(getString(R.string.storage_volume_used_total,  
  31. +                        Formatter.formatFileSize(context, privateTotalBytes+systemBytes)));  
  32.          mExt.updateCustomizedStorageSettingsPlugin(mInternalCategory);  
  33.          if (mInternalCategory.getPreferenceCount() > 0) {  
  34.              getPreferenceScreen().addPreference(mInternalCategory);  

(src/com/android/settings/deviceinfo/StorageVolumePreference.java)

[java]  view plain  copy
  1.              final long freeBytes = path.getFreeSpace();  
  2.              final long totalBytes = path.getTotalSpace();  
  3.              final long usedBytes = totalBytes - freeBytes;  
  4. +            final long systemBytes = (long) ((8.0 * 1024 * 1024 * 1024) - totalBytes);  
  5.    
  6.              final String used = Formatter.formatFileSize(context, usedBytes);  
  7. +            final String usedSystem = Formatter.formatFileSize(context, usedBytes+systemBytes);  
  8.              final String total = Formatter.formatFileSize(context, totalBytes);  
  9.              setSummary(context.getString(R.string.storage_volume_summary, used, total));  
  10. +            /*setSummary(context.getString(R.string.storage_volume_summary, used, total));              
  11.              if (totalBytes > 0) { 
  12.                  mUsedPercent = (int) ((usedBytes * 100) / totalBytes); 
  13. +            }*/  
  14. +            if(VolumeInfo.ID_PRIVATE_INTERNAL.equals(volume.getId())) {    
  15. +                setSummary(context.getString(R.string.storage_volume_summary, usedSystem, "8.0 GB"));    
  16. +                if (totalBytes != 0) {    
  17. +                    mUsedPercent = (int) (((usedBytes+systemBytes) * 100) / (float) (8.0 * 1024 * 1024 * 1024));    
  18. +                }    
  19. +            } else {    
  20. +                setSummary(context.getString(R.string.storage_volume_summary, used, total));    
  21. +                if (totalBytes != 0) {    
  22. +                    mUsedPercent = (int) ((usedBytes * 100) / totalBytes);    
  23. +                }    
  24.               }  
  25.   
  26.              if (freeBytes < mStorageManager.getStorageLowBytes(path)) {  
  27.                  mColor = StorageSettings.COLOR_WARNING;  
  28.                  icon = context.getDrawable(R.drawable.ic_warning_24dp);  

十八:sim卡应用里删除 toast

(mediatek/proprietary/packages/apps/Stk/src/com/android/stk/StkAppService.java)

[java]  view plain  copy
  1.                  if (mStkContext[slotId].mMainCmd == null) {  
  2.                      CatLog.w(LOG_TAG, "mMainCmd is null");  
  3.                      // nothing todo when no SET UP MENU command didn't arrive.  
  4. +/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:39 +0800 
  5.                      mToast = Toast.makeText(mContext.getApplicationContext(), 
  6.                              R.string.main_menu_not_initialized, Toast.LENGTH_LONG); 
  7.                      mToast.setGravity(Gravity.BOTTOM, 0, 0); 
  8.                      mToast.show(); 
  9. + */  
  10. +// End of Vanzo:tanglei  
  11.                      StkAppService.mIsLauncherAcceptInput = true;  
  12.  //                    //Workaround for the toast is not canceled sometimes.  
  13.  //                    Message msg1 = mServiceHandler.obtainMessage(OP_CANCEL_TOAST_MSG);  
  14. @@ -915,10 +918,13 @@ public class StkAppService extends Service implements Runnable {  
  15.  */  
  16.    
  17.                  if (mStkContext[slotId].mAvailable != STK_AVAIL_AVAILABLE) {  
  18. +/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:50 +0800 
  19.                      mToast = Toast.makeText(mContext.getApplicationContext(), 
  20.                              R.string.lable_not_available, Toast.LENGTH_LONG); 
  21.                      mToast.setGravity(Gravity.BOTTOM, 0, 0); 
  22.                      mToast.show(); 
  23. + */  
  24. +// End of Vanzo:tanglei  
  25.                      StkAppService.mIsLauncherAcceptInput = true;  
  26.  //                    //Workaround for the toast is not canceled sometimes.  
  27.  //                    Message msg1 = mServiceHandler.obtainMessage(OP_CANCEL_TOAST_MSG);  
  28. @@ -3386,6 +3392,7 @@ public class StkAppService extends Service implements Runnable {  
  29.              }  
  30.          }  
  31.    
  32. +/* Vanzo:tanglei on: Tue, 18 Apr 2017 15:43:13 +0800 
  33.          mToast = toast; 
  34.          mToast.setView(v); 
  35.          mToast.setDuration(Toast.LENGTH_LONG); 
  36. @@ -3396,6 +3403,8 @@ public class StkAppService extends Service implements Runnable { 
  37.          msg1.arg1 = OP_CANCEL_TOAST_MSG; 
  38.          msg1.arg2 = slotId; 
  39.          mServiceHandler.sendMessageDelayed(msg1, DELAY_TO_CANCEL_TOAST_TIMEOUT); 
  40. + */  
  41. +// End of Vanzo:tanglei  
  42.      }  
  43.    
  44.      private void launchEventMessage(int slotId) {  

十九:语音邮件通知无法移除

frameworks/base/telephony/java/android/telephony/CarrierConfigManager.java)

[java]  view plain  copy
  1.          sDefaults.putBoolean(KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL, true);  
  2.          sDefaults.putBoolean(KEY_USE_HFA_FOR_PROVISIONING_BOOL, false);  
  3.          sDefaults.putBoolean(KEY_USE_OTASP_FOR_PROVISIONING_BOOL, false);  
  4. -        sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, false);  
  5. +        sDefaults.putBoolean(KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL, true);  
  6.          sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false);  
  7.          sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false);  
  8.          sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0);  

二十:壁纸做过不滑动后(宽X2),锁屏解锁时会闪半张壁纸

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java)

[java]  view plain  copy
  1.          }  
  2.          boolean allowWhenShade = false;  
  3.          if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) {  
  4. -            Bitmap lockWallpaper = mLockscreenWallpaper.getBitmap();  
  5. +            Bitmap lockWallpaper;  
  6. +            Bitmap PreLockWallpaper = mLockscreenWallpaper.getBitmap();  
  7. +            if(PreLockWallpaper != null) {  
  8. +                int width = PreLockWallpaper.getWidth();  
  9. +                int height = PreLockWallpaper.getHeight();  
  10. +                if (width > height) {  
  11. +                    lockWallpaper = Bitmap.createBitmap(PreLockWallpaper,width/4,0,width/2,height);  
  12. +                } else {  
  13. +                    lockWallpaper = PreLockWallpaper;  
  14. +                }  
  15. +            } else {  
  16. +                lockWallpaper = PreLockWallpaper;  
  17. +            }  
  18.              if (lockWallpaper != null) {  
  19.                  artworkDrawable = new LockscreenWallpaper.WallpaperDrawable(  
  20.                          mBackdropBack.getResources(), lockWallpaper);  

二十一:删除投射功能(下拉状态栏及设置里的)

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java)

[java]  view plain  copy
  1.          else if (tileSpec.equals("rotation")) return new RotationLockTile(this);  
  2.          else if (tileSpec.equals("flashlight")) return new FlashlightTile(this);  
  3.          else if (tileSpec.equals("location")) return new LocationTile(this);  
  4. -        else if (tileSpec.equals("cast")) return new CastTile(this);  
  5. +        else if (tileSpec.equals("cast")) return null;  
  6.          else if (tileSpec.equals("hotspot")) return new HotspotTile(this);  
  7.  /* Vanzo:houcongxi on: Tue, 24 May 2016 18:18:29 +0800  
  8.   * add superscreenshot  

packages/apps/Settings/res/xml/sound_settings.xml

[html]  view plain  copy
  1.                  android:fragment="com.android.settings.notification.OtherSoundSettings" />  
  2.    
  3.          <!-- Cast -->  
  4. -        <PreferenceScreen  
  5. +        <!--<PreferenceScreen  
  6.                  android:key="wifi_display"  
  7.                  android:title="@string/wifi_display_settings_title"  
  8. -                android:fragment="com.android.settings.wfd.WifiDisplaySettings" />  
  9. +                android:fragment="com.android.settings.wfd.WifiDisplaySettings" />-->  
  10.    
  11.          <!-- M: Sound Enhancement -->  
  12.          <PreferenceScreen  

二十二:拍照人脸美化会生成两张照片

vendor/mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/mode/facebeauty/FaceBeautyMode.java)

[java]  view plain  copy
  1. if (!mIFeatureConfig.isVfbEnable()) {  
  2.                  mIFileSaver.init(FILE_TYPE.JPEG, 0null, -1);  
  3.                  long time = System.currentTimeMillis();  
  4. -                mIFileSaver.savePhotoFile(data, null, time, mIModuleCtrl.getLocation(), 0,  
  5. -                        mFileSavedListener);  
  6. +                // mIFileSaver.savePhotoFile(data, null, time, mIModuleCtrl.getLocation(), 0,  
  7. +                //        mFileSavedListener);  
  8.              }  
  9.          }  
  10.      }  

二十三:做CE认证必须要有自动接听功能,现在我们的进入工程模式没有自动接听功能,请安排增加上

vendor/mediatek/proprietary/packages/apps/EngineerMode/src/com/mediatek/engineermode/PrefsFragment.java)

[java]  view plain  copy
  1.          if (  !( isTestSim()  
  2.             || FeatureSupport.isEngLoad() || FeatureSupport.isUserDebugLoad()  
  3.               || ChipSupport.isFeatureSupported(ChipSupport.MTK_USERLOAD_SUPPORT) ) ) {  
  4. -            removePreference(screen, "auto_answer");  
  5.              Log.d("@M_" + TAG, "it is not an test sim card!");  
  6.          }else{  
  7.              Log.d("@M_" + TAG, "it is an test sim card or debug load");  
  8. @@ -299,7 +298,6 @@ public class PrefsFragment extends PreferenceFragment {  
  9.          }  
  10.    
  11.          if (FeatureSupport.isSupported(FeatureSupport.FK_BSP_PACKAGE)) {  
  12. -            removePreference(screen, "auto_answer");  
  13.          }  
  14.    
  15.          if (ChipSupport.isFeatureSupported(ChipSupport.MTK_FM_SUPPORT)) {  
  16. @@ -344,7 +342,6 @@ public class PrefsFragment extends PreferenceFragment {  
  17.          }  
  18.    
  19.          if (!isVoiceCapable() || isWifiOnly()) {  
  20. -            removePreference(screen, "auto_answer");  
  21.              removePreference(screen, "repeat_call_test");  
  22.          }  

二十四:在现在在没有插入耳机的情况也能进入FM测试项进行,且进入FM测试项没有出现提示:请插入耳机

vendor/mediatek/proprietary/packages/apps/FMRadio/src/com/android/fmradio/TestFM.java)

[java]  view plain  copy
  1.  import android.view.View;  
  2.  import android.view.View.OnClickListener;  
  3.  import android.widget.Button;  
  4. -  
  5. +import android.widget.Toast;  
  6.  import com.android.fmradio.FmService.ServiceBinder;  
  7.    
  8.  import java.io.IOException;  
  9. @@ -49,6 +49,8 @@ public class TestFM extends Activity implements OnClickListener {  
  10.    
  11.      private boolean mIsSearch = false;  
  12.    
  13. +    private AudioManager audoManager;   
  14. +  
  15.      private Handler mHandler = new Handler() {  
  16.          @Override  
  17.          public void handleMessage(Message msg) {  
  18. @@ -66,6 +68,13 @@ public class TestFM extends Activity implements OnClickListener {  
  19.          mSuccess = (Button) findViewById(R.id.success);  
  20.          mFail = (Button) findViewById(R.id.fail);  
  21.          mSearch = (Button) findViewById(R.id.search);  
  22. +        audoManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);  
  23. +        boolean isHeadsetOn = audoManager.isWiredHeadsetOn();  
  24. +        if (!isHeadsetOn){  
  25. +            Toast.makeText(this,  
  26. +                    R.string.fm_no_headset_text,  
  27. +                    Toast.LENGTH_SHORT).show();  
  28. +        }  
  29.          mSuccess.setOnClickListener(this);  
  30.          mSuccess.setEnabled(false);  
  31.          mFail.setOnClickListener(this);  
  32. @@ -73,7 +82,9 @@ public class TestFM extends Activity implements OnClickListener {  
  33.              @Override  
  34.              public void onClick(View v) {  
  35.                  if (!mIsSearch) {  
  36. +                   if(isHeadsetOn){  
  37.                      mSuccess.setEnabled(true);  
  38. +                    }  
  39.                      mIsSearch = true;  
  40.                      new Thread() {  
  41.                          public void run() {  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值