Android7.0 MTK 需求文档(一)

本文档介绍了在Android 7.0系统中针对MTK平台进行的一些定制需求,包括信号图标更新、3G网络选项添加、默认输入法更改、数据网络切换行为调整、界面文字修改等,涉及多个系统组件和应用程序的改动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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

     static final MobileIconGroup THREE_G = new MobileIconGroup(
-            "3G",
+            "H",
             TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
             TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
@@ -282,10 +282,10 @@ class TelephonyIcons {
             TelephonyIcons.TELEPHONY_NO_NETWORK,
             TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
-            R.string.accessibility_data_connection_3g,
-            TelephonyIcons.ICON_3G,
+            R.string.accessibility_data_connection_3_5g,
+            TelephonyIcons.ICON_H,
             true,
-            TelephonyIcons.QS_DATA_3G
+            TelephonyIcons.QS_DATA_H
             );
 
     static final MobileIconGroup WFC = new MobileIconGroup(
@@ -343,7 +343,7 @@ class TelephonyIcons {
             );
 
     static final MobileIconGroup G = new MobileIconGroup(
-            "G",
+            "E",
             TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH,
             TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
@@ -351,10 +351,10 @@ class TelephonyIcons {
             TelephonyIcons.TELEPHONY_NO_NETWORK,
             TelephonyIcons.QS_TELEPHONY_NO_NETWORK,
             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
-            R.string.accessibility_data_connection_gprs,
-            TelephonyIcons.ICON_G,
+            R.string.accessibility_data_connection_edge,
+            TelephonyIcons.ICON_E,
             false,
-            TelephonyIcons.QS_DATA_G
+            TelephonyIcons.QS_DATA_E
             );
 
     static final MobileIconGroup H = new MobileIconGroup(

二:添加可选的网络 3G

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

                 mButtonEnabledNetworks.setSummary(R.string.network_3G);
                 break;
             case Phone.NT_MODE_WCDMA_ONLY:
+                mButtonEnabledNetworks.setValue(Integer.toString(Phone.NT_MODE_WCDMA_ONLY));
+                mButtonEnabledNetworks.setSummary(R.string.network_3G_only);
+                break;
             case Phone.NT_MODE_GSM_UMTS:
             case Phone.NT_MODE_WCDMA_PREF:
                 if (!mIsGlobalCdma) {
services/Telephony/res/values/strings.xml

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="network_3G">GSM/WCDMA (Auto)</string>
    <string name="network_3G_only">Only WCDMA</string>
    <string name="network_2G">Only GSM</string>
    <string-array name="enabled_networks_4g_choices" translatable="false">
        <item>@string/network_4G</item>
        <item>@string/network_3G</item>
        <item>@string/network_3G_only</item>
        <item>@string/network_2G</item>
    </string-array>
    <!-- 网络优先级 -->
    <string-array name="enabled_networks_values" translatable="false">
        <item>"9"</item>
        <item>"0"</item>
        <item>"2"</item>
        <item>"1"</item>
    </string-array>
</resources>

三:语言列表中只保留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)

LOCAL_PACKAGE_NAME := LatinIME
 
-LOCAL_CERTIFICATE := shared
+LOCAL_CERTIFICATE := platform
 
 LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime
 
@@ -34,7 +34,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
         android-common inputmethod-common android-support-v4 jsr305 latinime-common
 
 
-
+LOCAL_PRIVILEGED_MODULE := true
 # Do not compress dictionary files to mmap dict data runtime
 LOCAL_AAPT_FLAGS := -0 .dict

(LatinIME/java/AndroidManifest.xml)

     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
     <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
 
     <application android:label="@string/english_ime_name"
             android:icon="@drawable/ic_launcher_keyboard"
@@ -164,6 +166,12 @@
             </intent-filter>
         </receiver>
 
+        <receiver android:name="LatinImeRe" android:enabled="true">
+            <intent-filter>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+            </intent-filter>
+        </receiver>
+
         <!-- Content providers -->
         <provider android:name="com.android.inputmethod.dictionarypack.DictionaryProvider"
                 android:grantUriPermissions="true"

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

+package com.android.inputmethod.latin;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.view.inputmethod.InputMethodSubtype;
+
+import android.text.TextUtils;
+
+public class LatinImeRe extends BroadcastReceiver {
+
+    private static final String TAG = "LatinImeRe";
+
+    @Override
+        public void onReceive(Context context, Intent intent) {
+            // Set the default input language at the system boot completed.
+            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
+                Log.w(TAG, "onReceive");
+                SharedPreferences sp = context.getSharedPreferences("default_input_language_config",
+                        Context.MODE_PRIVATE);
+                boolean hasSet = sp.getBoolean("has_set", false);
+
+                setDefaultSubtypes(context);
+                sp.edit().putBoolean("has_set", true).commit();
+            }
+        }
+    /**
+     * M: Set the default IME subtype.
+     */
+    private void setDefaultSubtypes(Context context) {
+        final String serviceName = "com.android.inputmethod.latin/.LatinIME";
+        final String currentPackageName = "com.android.inputmethod.latin";
+        final String enable = Settings.Secure.getString(context.getContentResolver(),
+                Settings.Secure.ENABLED_INPUT_METHODS);
+
+        Log.w(TAG, "setDefaultSubtypes() enable :" + enable);
+
+        final InputMethodManager imm = (InputMethodManager) context.getSystemService(
+                Context.INPUT_METHOD_SERVICE);
+        final StringBuilder builder = new StringBuilder();
+
+        // Get sub type hash code
+        for (InputMethodInfo info : imm.getInputMethodList()) {
+            if (currentPackageName.equals(info.getPackageName())) {
+                for (int i = 0; i < info.getSubtypeCount(); i++) {
+                    final InputMethodSubtype subtype = info.getSubtypeAt(i);
+                    final String locale = subtype.getLocale().toString();
+                    //winny
+                    Log.w(TAG, "subtype.getLocale().toString :" + locale);
+
+                    if (isDefaultLocale(locale)) {
+                        Log.i(TAG, "default enabled subtype locale = " + locale);
+                        builder.append(';');
+                        builder.append(subtype.hashCode());
+                    }
+                }
+
+                break;
+            }
+        }
+
+        Log.w(TAG, "after for loop :" + builder.toString());
+        // Insert the sub type
+        if (builder.length() > 0) {
+            final String subtype = builder.toString();
+            builder.setLength(0);
+
+            final int index = enable.indexOf(serviceName) + serviceName.length();
+            if (enable.length() > index) {
+                builder.append(enable.substring(0, index));
+                builder.append(subtype);
+                builder.append(enable.substring(index));
+            } else if (enable.length() == index) {
+                builder.append(enable);
+                builder.append(subtype);
+            } else {
+                return;
+            }
+        }
+
+        // Commit the result
+        android.provider.Settings.Secure.putString(context.getContentResolver(),
+                android.provider.Settings.Secure.ENABLED_INPUT_METHODS, builder.toString());
+    }
+    /**
+     * M: Check if the current locale is default or not.
+     */
+    private boolean isDefaultLocale (String locale) {
+
+        String[] locales= new String[]{"es"};
+        //将默认的语言在此添加,注意写法与method.xml中的subtype语言保持一致,这里es是西班牙语的示例。
+        for (String s : locales) {
+            if (s.equals(locale)) {
+                return true;
+            }
+        }
+
+        return false;
+
+    }
+}

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

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

             */
             /// M: comment if, change condition
             //if (vibrateAlways || vibrateSilent && nowSilent) {
-            if (notiProf.needVibrate()
-                    && audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {
+            if (notiProf.needVibrate()) {
                 defaults |= Notification.DEFAULT_VIBRATE;
             }
             /// @}
@@ -1471,6 +1470,11 @@ public class MessagingNotification {
                 }
             }
         }
+        PowerManager mPowerManager = (PowerManager) (context.getSystemService(Context.POWER_SERVICE));
+        PowerManager.WakeLock mWakeLock = null;
+        mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
+                        | PowerManager.ON_AFTER_RELEASE, "MMS_wake_lock");
+        mWakeLock.acquire(5000);
 
         nm.notify(NOTIFICATION_ID, notification);
         // add for OP
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值