Android6.0 MTK 需求文档(二)

来源:互联网 发布:linux安装详解 编辑:程序博客网 时间:2024/06/06 06:44

一:相机中的右边的预览窗口查看图片后选择删除,屏幕界面下方会有一条横线(去除横线的办法)

packages/apps/Gallery2/src/com/android/gallery3d/data/FilterEmptyPromptSet.java)

diff --git a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java b/src/com/android/gallery3d/data/FilterEmptyPromptSet.javaindex ae053df..955a749 100644--- a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java+++ b/src/com/android/gallery3d/data/FilterEmptyPromptSet.java@@ -44,7 +44,7 @@ public class FilterEmptyPromptSet extends MediaSet implements ContentListener {         if (itemCount > 0) {             return itemCount;         } else {-            return 1;+            return 0;         }     }


二:计算器先按 "-"后在按其他计算符号都可以输入,正常第一个运算符只能输入"-"

packages/apps/Calculator/src/com/android/calculator2/CalculatorExpressionBuilder.java

diff --git a/src/com/android/calculator2/CalculatorExpressionBuilder.java b/src/com/android/calculator2/CalculatorExpressionBuilder.javaindex fc229f0..df85076 100755--- a/src/com/android/calculator2/CalculatorExpressionBuilder.java+++ b/src/com/android/calculator2/CalculatorExpressionBuilder.java@@ -19,6 +19,7 @@ package com.android.calculator2; import android.content.Context; import android.text.SpannableStringBuilder; import android.text.TextUtils;+import android.util.Log;  public class CalculatorExpressionBuilder extends SpannableStringBuilder { @@ -65,6 +66,16 @@ public class CalculatorExpressionBuilder extends SpannableStringBuilder {                         break;                     }+                    if (start > 0 && "-".indexOf(expr.charAt(start - 1)) != -1) {+                        appendExpr = "";+                        break;+                    }                     // don't allow multiple successive operators                     while (start > 0 && "+-*/".indexOf(expr.charAt(start - 1)) != -1) {                         --start;


三:虚拟按键请做成可以隐藏的功能

frameworks/

diff --git a/base/core/java/android/app/Activity.java b/base/core/java/android/app/Activity.javaindex f6ecec3..1696a5e 100644--- a/base/core/java/android/app/Activity.java+++ b/base/core/java/android/app/Activity.java@@ -117,7 +117,7 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List;-+import android.content.BroadcastReceiver; /**  * An activity is a single, focused thing that the user can do.  Almost all  * activities interact with the user, so the Activity class takes care of@@ -1742,6 +1742,20 @@ public class Activity extends ContextThemeWrapper     public void onConfigurationChanged(Configuration newConfig) {         if (DEBUG_LIFECYCLE) Slog.v(TAG, "onConfigurationChanged " + this + ": " + newConfig);         mCalled = true;+        Intent mIntent = new Intent("Configuration_orientation");+        if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){+            mIntent.putExtra("ori_status",1);+            Log.d("houcongxi","ori_status-------1111111111");+            this.sendBroadcast(mIntent);+        }else{+            mIntent.putExtra("ori_status",2);+            Log.d("houcongxi","ori_status-------2222222222");+            this.sendBroadcast(mIntent);+        }          mFragments.dispatchConfigurationChanged(newConfig); diff --git a/base/core/java/android/provider/Settings.java b/base/core/java/android/provider/Settings.javaindex 7222da6..daf099e 100644--- a/base/core/java/android/provider/Settings.java+++ b/base/core/java/android/provider/Settings.java@@ -1505,6 +1505,11 @@ public final class Settings {              // At one time in System, then Global, but now back in Secure             MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);+            MOVED_TO_SECURE.add(Secure.DEV_FORCE_SHOW_NAVBAR);         }          private static final HashSet<String> MOVED_TO_GLOBAL;@@ -4269,6 +4274,18 @@ public final class Settings {         @Deprecated         public static final String ANDROID_ID = Secure.ANDROID_ID; +        /**+         * Developer options - Navigation Bar show switch+         * @deprecated Use {@link android.provider.Settings.Secure#DEV_FORCE_SHOW_NAVBAR} instead+         * @hide+         */+        @Deprecated+        public static final String DEV_FORCE_SHOW_NAVBAR = Secure.DEV_FORCE_SHOW_NAVBAR;+         /**          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead          */@@ -5073,6 +5090,16 @@ public final class Settings {          */         public static final String ANDROID_ID = "android_id"; +        /**  +         * Developer options - Navigation Bar show switch+         * @hide+         */+        public static final String DEV_FORCE_SHOW_NAVBAR = "dev_force_show_navbar";+         /**          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead          */diff --git a/base/core/java/android/view/ViewRootImpl.java b/base/core/java/android/view/ViewRootImpl.javaindex 1ffc935..5c16de7 100644--- a/base/core/java/android/view/ViewRootImpl.java+++ b/base/core/java/android/view/ViewRootImpl.java@@ -111,6 +111,13 @@ import android.content.Intent; import com.android.featureoption.FeatureOption; +import android.content.IntentFilter;+import android.content.BroadcastReceiver;+ /**  * The top of a view hierarchy, implementing the needed protocol between View  * and the WindowManager.  This is for the most part an internal implementation@@ -454,12 +461,25 @@ public final class ViewRootImpl implements ViewParent,     private static final String DUMP_IMAGE_PTAH = "/data/dump/";     private static final String DATE_FORMAT_STRING = "yyyyMMdd_hhmmss";     private static final String DUMP_IMAGE_FORMAT = ".png";-+    private int screenWidth, screenHeight;+    private int ori;+    private int orl;     public ViewRootImpl(Context context, Display display) {         mContext = context;         mWindowSession = WindowManagerGlobal.getWindowSession();         mDisplay = display;         mBasePackageName = context.getBasePackageName();+        screenWidth=display.getWidth();+        screenHeight=display.getHeight();+        Log.d("houcongxi","screenWidth:"+screenWidth+"---,screenHeight:"+screenHeight);          mDisplayAdjustments = display.getDisplayAdjustments(); @@ -496,6 +516,17 @@ public final class ViewRootImpl implements ViewParent,         mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE);         loadSystemProperties();+        Configuration mCon=mContext.getResources().getConfiguration();+        orl= mCon.orientation;+        Log.d("houcongxi",orl+"+++++++++++++++++++++++");+        IntentFilter mOriIntentFilter = new IntentFilter();+        mOriIntentFilter.addAction("Configuration_orientation");+        mContext.registerReceiver(mOriBroadcastReceiver, mOriIntentFilter);+         /**          * M: increase instance count and check log property to determine          * whether to enable/disable log system. @{@@ -514,6 +545,20 @@ public final class ViewRootImpl implements ViewParent,         /** @} */     }+    private BroadcastReceiver mOriBroadcastReceiver = new BroadcastReceiver(){+       @Override+            public void onReceive(Context context, Intent intent) {+                String action = intent.getAction();+                if(action.equals("Configuration_orientation")){+                ori=intent.getIntExtra("ori_status",0);+                Log.d("houcongxi",ori+"ori++++++++++++++");+                }+            }+    };     public static void addFirstDrawHandler(Runnable callback) {         synchronized (sFirstDrawHandlers) {             if (!sFirstDrawComplete) {@@ -4744,7 +4789,15 @@ public final class ViewRootImpl implements ViewParent,             }             return FORWARD;         }-+        private float startY = 0;+        private float endY = 0;+        private float startX = 0;+        private float endX = 0;+    @@ -4761,12 +4814,34 @@ public final class ViewRootImpl implements ViewParent,             final MotionEvent event = (MotionEvent)q.mEvent;             mAttachInfo.mUnbufferedDispatchRequested = false;             boolean handled = mView.dispatchPointerEvent(event);+            int action = event.getAction(); +            switch (action & MotionEvent.ACTION_MASK) {+                case  MotionEvent.ACTION_DOWN:+                    startY = event.getY();+                    startX = event.getX();+                    break;+                case MotionEvent.ACTION_UP:+                    endY = event.getY();+                    endX = event.getX();+                    Intent mIntent = new Intent("forceAddNavigationBar");+                    if(startY - endY > 8&&(endY>screenHeight-460)&&(ori==1||orl==1)){+                        Log.d("houcongxi","Swipe up");+                        mContext.sendBroadcast(mIntent);+                    }else if(startX - endX > 8&&(endX>screenWidth-460&&(ori==2||orl==2))){+                        Log.d("houcongxi","swipe left");+                        mContext.sendBroadcast(mIntent);+                    } +                    break;+            }             if(FeatureOption.VANZO_FEATURE_GOLBAL_3FINGER_SCREENSHOT){-                int action = event.getAction();                 if(event.getPointerCount() > 3){                     mPointerCount = false;                     mThreeClick = true;diff --git a/base/packages/SettingsProvider/res/values/defaults.xml b/base/packages/SettingsProvider/res/values/defaults.xmlindex 5d7ea01..71f289f 100644--- a/base/packages/SettingsProvider/res/values/defaults.xml+++ b/base/packages/SettingsProvider/res/values/defaults.xml@@ -184,6 +184,9 @@          Override to disable immersive mode confirmation for certain packages. -->     <string name="def_immersive_mode_confirmations" translatable="false"></string> +    <!-- Defaults for Settings.System.DEV_FORCE_SHOW_NAVBAR. -->+    <integer name="def_force_disable_navkeys">0</integer>+     <!-- Default for Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE -->     <integer name="def_wifi_scan_always_available">0</integer> diff --git a/base/packages/SystemUI/res/layout/navigation_bar.xml b/base/packages/SystemUI/res/layout/navigation_bar.xmlindex c92ba45..d98d4f0 100644--- a/base/packages/SystemUI/res/layout/navigation_bar.xml+++ b/base/packages/SystemUI/res/layout/navigation_bar.xml@@ -43,7 +43,23 @@              <!-- navigation controls -->             <View-                android:layout_width="@dimen/navigation_side_padding"+                android:id="@+id/divider_view"+                android:layout_width="5dp"+                android:layout_height="match_parent"+                android:layout_weight="0"+                android:visibility="invisible"+                />+            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"+                android:layout_width="35dp"+                android:layout_height="match_parent"+                android:src="@drawable/ic_hide_navigationbar_x"+                android:layout_weight="0"+                android:scaleType="center"+                android:contentDescription="@string/accessibility_back"+                />++            <View+                android:layout_width="10dp"                 android:layout_height="match_parent"                 android:layout_weight="0"                 android:visibility="invisible"@@ -56,6 +72,7 @@                 android:layout_weight="0"                 android:scaleType="center"                 android:contentDescription="@string/accessibility_back"+                android:paddingRight="-20dp"                 />             <View                 android:layout_width="0dp"@@ -72,6 +89,7 @@                 android:layout_weight="0"                 android:scaleType="center"                 android:contentDescription="@string/accessibility_home"+                android:paddingRight="-20dp"                 />             <View                 android:layout_width="0dp"@@ -86,6 +104,7 @@                 android:layout_weight="0"                 android:scaleType="center"                 android:contentDescription="@string/accessibility_recent"+                android:paddingRight="-20dp"                 />             <FrameLayout                 android:layout_width="@dimen/navigation_side_padding"@@ -260,6 +279,21 @@                 android:contentDescription="@string/accessibility_back"                 />             <View+                android:layout_height="match_parent"+                android:layout_width="match_parent"+                android:layout_weight="1"+                android:visibility="invisible"+                />+            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"+                android:layout_height="@dimen/navigation_key_width"+                android:layout_width="match_parent"+                android:src="@drawable/ic_hide_navigationbar_y"+                android:scaleType="center"+                android:layout_weight="0"+                android:contentDescription="@string/accessibility_back"+                />+            <View+                android:id="@+id/divider_view"                 android:layout_height="@dimen/navigation_side_padding"                 android:layout_width="match_parent"                 android:layout_weight="0"diff --git a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.javaindex a0d07a0..24dcf14 100644--- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java+++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java@@ -68,6 +68,15 @@ import com.mediatek.multiwindow.MultiWindowProxy; import com.mediatek.systemui.ext.DefaultNavigationBarPlugin; import com.mediatek.systemui.ext.INavigationBarPlugin; import android.os.UserHandle;+import android.content.Intent;+import android.provider.Settings;+import android.content.BroadcastReceiver;+import android.os.SystemProperties;+import android.content.IntentFilter;   @@ -214,6 +223,13 @@ public class NavigationBarView extends LinearLayout {      public NavigationBarView(Context context, AttributeSet attrs) {         super(context, attrs);+         IntentFilter mAddIntentFilter = new IntentFilter();+         mAddIntentFilter.addAction("refresh_navigationbar_for_ic");+         mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);          mDisplay = ((WindowManager)context.getSystemService(                 Context.WINDOW_SERVICE)).getDefaultDisplay();@@ -544,6 +560,17 @@ public class NavigationBarView extends LinearLayout {         mCurrentView = mRotatedViews[Surface.ROTATION_0];          getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);+    if (SystemProperties.getBoolean("persist.sys.navigationbarstatus", true)) {+            getCollapseButton().setOnClickListener(mCollapseClickListener);+        } else {+            getCollapseButton().setVisibility(View.GONE);+            getDividerView().setVisibility(View.GONE);+        }          updateRTLOrder();     }@@ -565,6 +592,22 @@ public class NavigationBarView extends LinearLayout {          mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);+        if (SystemProperties.getBoolean("persist.sys.navigationbarstatus", true)) {+            //  if (getCollapseButton() != null) {+            getCollapseButton().setOnClickListener(mCollapseClickListener);+            //  }+        } else {+            //  if (getCollapseButton() != null) {+            getCollapseButton().setVisibility(View.GONE);+            getDividerView().setVisibility(View.GONE);+            //  } +        }+         // force the low profile & disabled states into compliance         mBarTransitions.init();         setDisabledFlags(mDisabledFlags, true /* force */);@@ -787,6 +830,53 @@ public class NavigationBarView extends LinearLayout {     public interface OnVerticalChangedListener {         void onVerticalChanged(boolean isVertical);     }+    public View getCollapseButton() {+        return mCurrentView.findViewById(R.id.collapse);+    }++    public View getDividerView() {+        return mCurrentView.findViewById(R.id.divider_view);+    }++    private final OnClickListener mCollapseClickListener = new OnClickListener() {+        @Override+            public void onClick(View view) {+                Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);+                Log.d("houcongxi","onclick:"+Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,-1));+                Intent mIntent = new Intent("removeNavigationBar");+                if (SystemProperties.getBoolean("persist.sys.navigationbarstatus", false)) {+                    mContext.sendBroadcast(mIntent);+                }+            }+    };+    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){+        @Override+            public void onReceive(Context context, Intent intent) {+                String action = intent.getAction();+                //让他消失,然后在出现的广播,动画以后做+                Intent mIntent = new Intent("removeNavigationBar");+                mContext.sendBroadcast(mIntent);+                new Handler().postDelayed(new Runnable(){+                        public void run() {+                        Intent nIntent = new Intent("forceAddNavigationBar");+                        mContext.sendBroadcast(nIntent);+                        }+                        }, 700);++                /*   if(getCollapseButton().getVisibility()==View.VISIBLE){+                     getCollapseButton().setVisibility(View.GONE);+                     getDividerView().setVisibility(View.GONE);+                     }else{+                     getCollapseButton().setOnClickListener(mCollapseClickListener);+                     getCollapseButton().setVisibility(View.VISIBLE);+                     getDividerView().setVisibility(View.VISIBLE);+                     }*/+            }+    };      /// M: add for multi window @{     private BroadcastReceiver mFloatWindowBroadcastReceiver = new BroadcastReceiver() {diff --git a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.javaindex 392b6b7..2113397 100644--- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java+++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java@@ -416,6 +416,43 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,      // ensure quick settings is disabled until the current user makes it through the setup wizard     private boolean mUserSetup = false;++    private void forceAddNavigationBar() {+        // If we have no Navbar view and we should have one, create it+        if (mNavigationBarView != null) {+            return;+        }+        removeNavigationBar();+        android.util.Log.e("houcongxi", "================="+mNavigationBarView);++        mNavigationBarView =+            (NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);++        mNavigationBarView.setDisabledFlags(mDisabled1);+        //mNavigationBarView.setDisabledFlags(mDisabled2);+        mNavigationBarView.setBar(this);+        mNavigationBarView.setBackgroundColor(0x00000000);+        //mNavigationBarView.invalidate();++        android.util.Log.e("houcongxi", "========222========"+mNavigationBarView);+        addNavigationBar();+        repositionNavigationBar();++    }+    private void removeNavigationBar() {+        if (mNavigationBarView == null) return;+        if (mNavigationBarView != null) {+            mWindowManager.removeViewImmediate(mNavigationBarView);+            mNavigationBarView = null;+        }++        //mWindowManager.removeView(mNavigationBarView);+        //mNavigationBarView = null;+    }     private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) {         @Override         public void onChange(boolean selfChange) {@@ -1123,6 +1160,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,         ThreadedRenderer.overrideProperty("ambientRatio", String.valueOf(1.5f));         mStatusBarPlmnPlugin.addPlmn((LinearLayout)mStatusBarView.                                      findViewById(R.id.status_bar_contents), mContext);+        IntentFilter mAddIntentFilter = new IntentFilter();+        mAddIntentFilter.addAction("removeNavigationBar");+        mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);++        IntentFilter mRemIntentFilter = new IntentFilter();+        mRemIntentFilter.addAction("forceAddNavigationBar");+        mContext.registerReceiver(mrBroadcastReceiver, mRemIntentFilter);          return mStatusBarView;     }@@ -4514,6 +4562,31 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,     }     /// M: Support "Operator plugin - Customize Carrier Label for PLMN". @} +    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){+        @Override+            public void onReceive(Context context, Intent intent) {+                String action = intent.getAction();+                int num=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,0);+                boolean visible=(num==1)?true:false;+                Log.d("houcongxi","===visible:"+visible);+                if(action.equals("removeNavigationBar")){+                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);+                    removeNavigationBar();+                }else if(action.equals("forceAddNavigationBar")&&!visible){+                    forceAddNavigationBar();+                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);++                    int num2=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,1);+                    boolean visible2=(num2==1)?true:false;+                    Log.d("houcongxi","-----visible2:"+visible2);+                }+            }+    };+// End of Vanzo:houcongxi+     /// M:add for multi window @{     public void registerMWProxyAgain()     {diff --git a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/base/services/core/java/com/android/server/policy/PhoneWindowManager.javaindex 65f9eb2..c848034 100644--- a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java+++ b/base/services/core/java/com/android/server/policy/PhoneWindowManager.java@@ -1859,8 +1859,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {         String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");         if ("1".equals(navBarOverride)) {             mHasNavigationBar = false;+            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);         } else if ("0".equals(navBarOverride)) {             mHasNavigationBar = true;+            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);         }          // For demo purposes, allow the rotation of the HDMI display to be controlled.

四:连上USB后,默认MTP模式

(frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java)

diff --git a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 4a7183a..06560bb 100644 --- a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -348,7 +348,7 @@ public class UsbDeviceManager {          // current USB state          private boolean mConnected;          private boolean mConfigured; -        private boolean mUsbDataUnlocked; +        private boolean mUsbDataUnlocked = true;          private String mCurrentFunctions;          private boolean mCurrentFunctionsApplied;          private UsbAccessory mCurrentAccessory; @@ -1134,7 +1134,7 @@ public class UsbDeviceManager {                      mUsbConfigured = mConfigured;                      if (!mConnected) {                          // When a disconnect occurs, relock access to sensitive user data -                        mUsbDataUnlocked = false; +                        //mUsbDataUnlocked = false;                     }                      updateUsbNotification();                     updateAdbNotification(); @@ -1143,7 +1143,7 @@ public class UsbDeviceManager {                         updateCurrentAccessory();                     } else if (!mConnected) {                         // restore defaults when USB is disconnected-                        setEnabledFunctions(null, false);+                        //setEnabledFunctions(null, false);                     }                     if (mBootCompleted) {                         updateUsbStateBroadcast();

五:时间格式作成dd/mm/yyyy

(frameworks/)

diff --git a/base/api/current.txt b/base/api/current.txtindex d7fdb2d..d23c46a 100644--- a/base/api/current.txt+++ b/base/api/current.txt@@ -32521,6 +32521,7 @@ package android.text.format {     method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);     method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);     method public static java.text.DateFormat getDateFormat(android.content.Context);+    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);     method public static char[] getDateFormatOrder(android.content.Context);     method public static java.text.DateFormat getLongDateFormat(android.content.Context);     method public static java.text.DateFormat getMediumDateFormat(android.content.Context);diff --git a/base/api/system-current.txt b/base/api/system-current.txtindex 3c88e59..193bd36 100644--- a/base/api/system-current.txt+++ b/base/api/system-current.txt@@ -34813,6 +34813,7 @@ package android.text.format {     method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);     method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);     method public static java.text.DateFormat getDateFormat(android.content.Context);+    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);     method public static char[] getDateFormatOrder(android.content.Context);     method public static java.text.DateFormat getLongDateFormat(android.content.Context);     method public static java.text.DateFormat getMediumDateFormat(android.content.Context);diff --git a/base/core/java/android/text/format/DateFormat.java b/base/core/java/android/text/format/DateFormat.javaindex 8d5555d..1555939 100755--- a/base/core/java/android/text/format/DateFormat.java+++ b/base/core/java/android/text/format/DateFormat.java@@ -292,7 +292,14 @@ public class DateFormat {      * @return the {@link java.text.DateFormat} object that properly formats the date.      */     public static java.text.DateFormat getDateFormat(Context context) {+/*+ * add choose date format         return java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);+ */+        String value = Settings.System.getString(context.getContentResolver(),+                Settings.System.DATE_FORMAT);+        return getDateFormatForSetting(context, value);     }      /**@@ -325,9 +332,16 @@ public class DateFormat {      * order returned here.      */     public static char[] getDateFormatOrder(Context context) {+/* + * add choose date format         return ICU.getDateFormatOrder(getDateFormatString());+ */+        return ICU.getDateFormatOrder(getDateFormatString(context));     } +/* + * add choose date format     private static String getDateFormatString() {         java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);         if (df instanceof SimpleDateFormat) {@@ -336,6 +350,13 @@ public class DateFormat {          throw new AssertionError("!(df instanceof SimpleDateFormat)");     }+ */+    private static String getDateFormatString(Context context) {+        String value = Settings.System.getString(context.getContentResolver(),+                Settings.System.DATE_FORMAT);+        return getDateFormatStringForSetting(context, value);+    }      /**      * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a@@ -636,4 +657,116 @@ public class DateFormat {     private static String zeroPad(int inValue, int inMinDigits) {         return String.format(Locale.getDefault(), "%0" + inMinDigits + "d", inValue);     }+/* + * TODO: replace this line with your comment+ */++    public static java.text.DateFormat getDateFormatForSetting(Context context, String value) {+        String format = getDateFormatStringForSetting(context, value);+        return new java.text.SimpleDateFormat(format);+    }++    private static String getDateFormatStringForSetting(Context context, String value) {+        String result = null;+        if (value != null) {+            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{+            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";+            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";+            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";+            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";++            int day = value.indexOf(dayValue);+            int month = value.indexOf(monthValue);+            int year = value.indexOf(yearValue);+            int week = value.indexOf(weekValue);++            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {+                String template = null;+                if (week < day) {+                    if (year < month && year < day) {+                        if (month < day) {+                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);+                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);+                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);+                        }+                    } else if (month < day) {+                        if (day < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);+                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);+                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);+                        }+                    } else {+                        if (month < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);+                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);+                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);+                        }+                    }+                } else {+                    if (year < month && year < day) {+                        if (month < day) {+                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);+                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);+                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);+                        }+                    } else if (month < day) {+                        if (day < year) {+                            template = context.getString(com.mediatek.internal.R.string.month_day_year_wday);+                            result = String.format(template, monthValue, dayValue, yearValue, weekValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.month_year_day_wday);+                            result = String.format(template, monthValue, yearValue, dayValue, weekValue);+                        }+                    } else {+                        if (month < year) {+                            template = context.getString(com.mediatek.internal.R.string.day_month_year_wday);+                            result = String.format(template, dayValue, monthValue, yearValue, weekValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.day_year_month_wday);+                            result = String.format(template, dayValue, yearValue, monthValue, weekValue);+                        }+                    }+                }++                return result;+                /// M: @}+        } else if (month >= 0 && day >= 0 && year >= 0) {+            String template = context.getString(com.android.internal.R.string.numeric_date_template);+            if (year < month && year < day) {+                if (month < day) {+                    result = String.format(template, yearValue, monthValue, dayValue);+                } else {+                    result = String.format(template, yearValue, dayValue, monthValue);+                }+            } else if (month < day) {+                if (day < year) {+                    result = String.format(template, monthValue, dayValue, yearValue);+                } else { // unlikely+                    result = String.format(template, monthValue, yearValue, dayValue);+                }+            } else { // date < month+                if (month < year) {+                    result = String.format(template, dayValue, monthValue, yearValue);+                } else { // unlikely+                    result = String.format(template, dayValue, yearValue, monthValue);+                }+            }++            return result;+        }+        }++        // The setting is not set; use the locale's default.+        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);+        return d.shortDateFormat4;+    } }diff --git a/base/core/res/res/values/donottranslate-cldr.xml b/base/core/res/res/values/donottranslate-cldr.xmlindex a8e2b2b..80db6e4 100755--- a/base/core/res/res/values/donottranslate-cldr.xml+++ b/base/core/res/res/values/donottranslate-cldr.xml@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">+    <string name="numeric_date_template">"%s/%s/%s"</string>     <string name="month_day_year">%B %-e, %Y</string>     <string name="time_of_day">%-l:%M:%S %p</string>     <string name="date_and_time">%b %-e, %Y, %-l:%M:%S %p</string>diff --git a/base/core/res/res/values/symbols.xml b/base/core/res/res/values/symbols.xmlindex e9faf09..50a869a 100644--- a/base/core/res/res/values/symbols.xml+++ b/base/core/res/res/values/symbols.xml@@ -2325,7 +2325,7 @@    <java-symbol type="string" name="global_action_reboot" />    <java-symbol type="string" name="reboot_confirm_question" />    <java-symbol type="string" name="reboot_confirm" />-+   <java-symbol type="string" name="numeric_date_template" /> <!-- Vanzo:tanglei on: Wed, 21 Jan 2015 11:47:03 +0800 -->   <!-- For Smart Wake -->diff --git a/base/packages/Keyguard/res/values/strings_custom.xml b/base/packages/Keyguard/res/values/strings_custom.xmlnew file mode 100755index 0000000..c688ae5--- /dev/null+++ b/base/packages/Keyguard/res/values/strings_custom.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">+    <string name="default_date_format"><xliff:g id="default_date_format">dd-MM-yyyy</xliff:g></string>+</resources>diff --git a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.javaindex 86244b8..6c22fea 100644--- a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java+++ b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java@@ -35,6 +35,12 @@ import android.widget.GridLayout; import android.widget.LinearLayout; import android.widget.TextClock; import android.widget.TextView;+/* + * add choose date format+ */+import android.provider.Settings;+import libcore.icu.LocaleData;  import com.android.internal.widget.LockPatternUtils; @@ -165,8 +171,17 @@ public class KeyguardStatusView extends GridLayout {     }      public void refreshTime() {+/* + * add choose date format         mDateView.setFormat24Hour(Patterns.dateView);         mDateView.setFormat12Hour(Patterns.dateView);+ */+        String dateFormat = getCustomDateFormatString(mContext);+        if (dateFormat == null || "".equals(dateFormat))+            dateFormat = getResources().getString(R.string.default_date_format);+        mDateView.setFormat24Hour(dateFormat);+        mDateView.setFormat12Hour(dateFormat);          if (bA1Support) {             mClockView.setFormat12Hour(Patterns.clockView12);@@ -286,4 +301,118 @@ public class KeyguardStatusView extends GridLayout {             cacheKey = key;         }     }++/* + * add choose date format+ * this part was ported from 82lp+*/+    private String getCustomDateFormatString(Context context) {+        String value = Settings.System.getString(context.getContentResolver(),+                Settings.System.DATE_FORMAT);+        return getDateFormatStringForSetting(context, value);+    }++    private String getDateFormatStringForSetting(Context context, String value) {+        String result = null;+        if (value != null) {+            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{+            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";+            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";+            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";+            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";++            int day = value.indexOf(dayValue);+            int month = value.indexOf(monthValue);+            int year = value.indexOf(yearValue);+            int week = value.indexOf(weekValue);++            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {+                String template = null;+                if (week < day) {+                    if (year < month && year < day) {+                        if (month < day) {+                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);+                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);+                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);+                        }+                    } else if (month < day) {+                        if (day < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);+                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);+                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);+                        }+                    } else {+                        if (month < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);+                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);+                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);+                        }+                    }+                } else {+                    if (year < month && year < day) {+                        if (month < day) {+                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);+                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);+                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);+                        }+                    } else if (month < day) {+                        if (day < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);+                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);+                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);+                        }+                    } else {+                        if (month < year) {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);+                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);+                        } else {+                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);+                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);+                        }+                    }+                }++                return result;+                /// M: @}+        } else if (month >= 0 && day >= 0 && year >= 0) {+            String template = context.getString(com.android.internal.R.string.numeric_date_template);+            if (year < month && year < day) {+                if (month < day) {+                    result = String.format(template, yearValue, monthValue, dayValue);+                } else {+                    result = String.format(template, yearValue, dayValue, monthValue);+                }+            } else if (month < day) {+                if (day < year) {+                    result = String.format(template, monthValue, dayValue, yearValue);+                } else { // unlikely+                    result = String.format(template, monthValue, yearValue, dayValue);+                }+            } else { // date < month+                if (month < year) {+                    result = String.format(template, dayValue, monthValue, yearValue);+                } else { // unlikely+                    result = String.format(template, dayValue, yearValue, monthValue);+                }+            }++            return result;+        }+        }++        // The setting is not set; use the locale's default.+        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);+        return d.shortDateFormat4;+    } }diff --git a/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.javaindex 186005c..d9eaabc 100644--- a/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java+++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java@@ -31,6 +31,11 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; +/* + */+import java.util.Calendar;+import android.text.format.DateFormat;+// End of Vanzo:songlixin public class DateView extends TextView {     private static final String TAG = "DateView"; @@ -98,6 +103,8 @@ public class DateView extends TextView {     }      protected void updateClock() {+/* + * porting jb2->kk #53983         if (mDateFormat == null) {             final Locale l = Locale.getDefault();             final String fmt = DateFormat.getBestDateTimePattern(l, mDatePattern);@@ -111,5 +118,10 @@ public class DateView extends TextView {             setText(text);             mLastText = text;         }+ */+        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(mContext);+        final Calendar now = Calendar.getInstance();+        setText(shortDateFormat.format(now.getTime()));     } }
packages/apps/Settings/

diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xmlindex 39d8743..f169374 100644--- a/res/xml/date_time_prefs.xml+++ b/res/xml/date_time_prefs.xml@@ -53,4 +53,12 @@         android:title="@string/date_time_24hour"         /> +<!--+add date format+-->+    <ListPreference+        android:key="date_format"+        android:title="@string/date_time_date_format"+        android:summary="dd/MM/yyyy"/> </PreferenceScreen>diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.javaindex 474f026..fed3f03 100644--- a/src/com/android/settings/DateTimeSettings.java+++ b/src/com/android/settings/DateTimeSettings.java@@ -81,6 +81,12 @@ public class DateTimeSettings extends SettingsPreferenceFragment     private SwitchPreference mAutoTimeZonePref;     private Preference mTimeZone;     private Preference mDatePref;+/*+ * add date format+ */+    private static final String KEY_DATE_FORMAT = "date_format";+    private ListPreference mDateFormat;      // /M: add for GPS time sync feature @{     private static final int DIALOG_GPS_CONFIRM = 2;@@ -151,8 +157,50 @@ public class DateTimeSettings extends SettingsPreferenceFragment         mTime24Pref = findPreference("24 hour");         mTimeZone = findPreference("timezone");         mDatePref = findPreference("date");+/*+ * add date format+        if (isFirstRun) {+            getPreferenceScreen().removePreference(mTime24Pref);+        }+ */+        mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);+        if (isFirstRun) {+            getPreferenceScreen().removePreference(mTime24Pref);+            getPreferenceScreen().removePreference(mDateFormat);+        }+        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);+        String [] formattedDates = new String[dateFormats.length];+        String currentFormat = getDateFormat();+        // Initialize if DATE_FORMAT is not set in the system settings+        // This can happen after a factory reset (or data wipe)+        if (currentFormat == null) {+            currentFormat = "";+        }++        // Prevents duplicated values on date format selector.+        mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 31, 13, 0, 0);++        for (int i = 0; i < formattedDates.length; i++) {+/*+ * TODO: replace this line with your comment+            String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime());+ */+            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());++            if (dateFormats[i].length() == 0) {+                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);+            } else {+                formattedDates[i] = formatted;+            }+        }++        mDateFormat.setEntries(formattedDates);+        mDateFormat.setEntryValues(R.array.date_format_values);+        mDateFormat.setValue(currentFormat);+ -        // /M: modify as MTK add GPS time Sync feature         boolean autoEnabled = autoTimeEnabled || autoTimeGpsEnabled;         mTimePref.setEnabled(!autoEnabled);         mDatePref.setEnabled(!autoEnabled);@@ -193,18 +241,51 @@ public class DateTimeSettings extends SettingsPreferenceFragment         // We use 13:00 so we can demonstrate the 12/24 hour options.         mDummyDate.set(now.get(Calendar.YEAR), 11, 31, 13, 0, 0);         Date dummyDate = mDummyDate.getTime();+/*+ * add date format+ */+        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);+        mDateFormat.setSummary(shortDateFormat.format(dummyDate));+         mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));         mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));         mTimeZone.setSummary(ZoneGetter.getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime()));         mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));     } +/*+ * add date format+ */+    private void updateDateFormatEntries() {+        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);+        String [] formattedDates = new String[dateFormats.length];+        for (int i = 0; i < formattedDates.length; i++) {+          //  String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime());+            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());+            if (dateFormats[i].length() == 0) {+                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);+            } else {+                formattedDates[i] = formatted;+            }+        }+        mDateFormat.setEntries(formattedDates);+    }++     @Override     public void onDateSet(DatePicker view, int year, int month, int day) {         final Activity activity = getActivity();         if (activity != null) {             setDate(activity, year, month, day);             updateTimeAndDateDisplay(activity);+/*+ * add date format+ */+            updateDateFormatEntries();+         }     } @@ -250,6 +331,17 @@ public class DateTimeSettings extends SettingsPreferenceFragment             Settings.Global.putInt(                     getContentResolver(), Settings.Global.AUTO_TIME_ZONE, autoZoneEnabled ? 1 : 0);             mTimeZone.setEnabled(!autoZoneEnabled);+/*+ * add date format+ */+        } else if (key.equals(KEY_DATE_FORMAT)) {+            String format = preferences.getString(key,getResources().getString(R.string.default_date_format));+            Settings.System.putString(getContentResolver(),Settings.System.DATE_FORMAT, format);+            updateTimeAndDateDisplay(getActivity());+            Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED);+            getActivity().sendBroadcast(timeChanged);+         }     } @@ -372,6 +464,14 @@ public class DateTimeSettings extends SettingsPreferenceFragment                 is24Hour? HOURS_24 : HOURS_12);     } +/*+ * add date format+ */+    private String getDateFormat() {+        return Settings.System.getString(getContentResolver(),Settings.System.DATE_FORMAT);+    }+     private boolean getAutoState(String name) {         try {             return Settings.Global.getInt(getContentResolver(), name) > 0;


六:客户服务(“长按3”)必须拨打* 611

(packages/apps/Dialer/src/com/android/dialer/dialpad/DialpadFragment.java)

diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.javaindex 82be25b..ddd6e0d 100644--- a/src/com/android/dialer/dialpad/DialpadFragment.java+++ b/src/com/android/dialer/dialpad/DialpadFragment.java@@ -863,6 +863,8 @@ public class DialpadFragment extends Fragment         // Long-pressing zero button will enter '+' instead.         final DialpadKeyButton zero = (DialpadKeyButton) fragmentView.findViewById(R.id.zero);         zero.setOnLongClickListener(this);+        final DialpadKeyButton three = (DialpadKeyButton) fragmentView.findViewById(R.id.three);+        three.setOnLongClickListener(this);     }      @Override@@ -1334,6 +1336,15 @@ public class DialpadFragment extends Fragment                 mDigits.setCursorVisible(true);                 return false;             }+            case R.id.three: {+                Intent intent=new Intent();+                intent.setAction("android.intent.action.CALL");+                intent.setData(Uri.parse("tel:*611"));+                startActivity(intent);+                clearDialpad();+                return true;++            }         }         return false;     }

七:短信收件人界面输入611应该识别为紧急号码(内置联系人)

这种方式拨号中的快速拨号和联系人中的收藏界面没有

(packages/apps/Contacts/)

diff --git a/src/com/android/contacts/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/editor/AggregationSuggestionEngine.javaindex bc3f7dc..3122cb1 100644--- a/src/com/android/contacts/editor/AggregationSuggestionEngine.java+++ b/src/com/android/contacts/editor/AggregationSuggestionEngine.java@@ -328,6 +328,7 @@ public class AggregationSuggestionEngine extends HandlerThread {             }             sb.append(')');             /// M: Change feature, remove SIM/USIM contact on join popup window.+            sb.append(" AND " + Contacts.IS_SDN_CONTACT + "!=-2");             sb.append(" AND " + Contacts.INDICATE_PHONE_SIM + "=-1");             sb.toString(); diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.javaindex 96feceb..da8f44b 100644--- a/src/com/android/contacts/list/JoinContactListAdapter.java+++ b/src/com/android/contacts/list/JoinContactListAdapter.java@@ -107,8 +107,8 @@ public class JoinContactListAdapter extends ContactListAdapter {         loader.setUri(allContactsUri);         /** M: Change Feature for ALPS00108644.          * Descriptions: remove SIM/USIM contacts when do edit join. */-        loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");-+      //  loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");+         loader.setSelection(Contacts._ID + "!=?"+" AND " + Contacts.INDICATE_PHONE_SIM + "=-1" + " AND " + Contacts.IS_SDN_CONTACT + "!=-2");         loader.setSelectionArgs(new String[]{ String.valueOf(mTargetContactId) });         if (getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY) {             loader.setSortOrder(Contacts.SORT_KEY_PRIMARY);diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.javaindex 760de5d..cf42d49 100644--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java@@ -2665,8 +2665,9 @@ public class QuickContactActivity extends ContactsActivity implements SensorEven      * Returns true if it is possible to edit the current contact.      */     private boolean isContactEditable() {-        return mContactData != null && !mContactData.isDirectoryEntry() &&-            !mContactData.isSdnContacts();+ //       return mContactData != null && !mContactData.isDirectoryEntry() &&+ //           !mContactData.isSdnContacts();+       return mContactData != null && !mContactData.isDirectoryEntry() && !mContactData.isSdnContacts() && !mContactData.isInternationDialNumber() && !mContactData.isReadOnlyContact() ;      }      /**diff --git a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.javaindex 08aa2a7..60cf1d9 100644--- a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java+++ b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java@@ -246,6 +246,9 @@ public class MultiBasePickerAdapter extends DefaultContactListAdapter {         if (!mShowSdnNumber) {             selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");         }+        if (!showReadOnlyContact ) {+            selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");+        }         loader.setSelection(selection.toString());     } diff --git a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.javaindex 7f0035a..921df88 100644--- a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java+++ b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java@@ -310,4 +310,8 @@ public class MultiDeletionPickerFragment extends MultiBasePickerFragment {     public boolean isShowSdnNumber() {         return false;     }++    protected boolean isInstanceOfContactsMultiDeletionFragment(){+        return true ;+    } }diff --git a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.javaindex ea58d2a..8192c68 100644--- a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java+++ b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java@@ -93,6 +93,7 @@ public class BootCmpReceiver extends BroadcastReceiver {                 if (!isPhbReady()) {                     processBootComplete(context);                 }+                presetServiceNumber(context);             }         } else if (action.equals(TelephonyIntents.ACTION_PHB_STATE_CHANGED)                 || action.equals(Intent.ACTION_BOOT_COMPLETED)) {@@ -181,6 +182,10 @@ public class BootCmpReceiver extends BroadcastReceiver {             SIMServiceUtils.SERVICE_WORK_REMOVE);     } +    private void presetServiceNumber(Context context) {+        startSimService(context, -1, SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS);+    }+     public void resfreshAllSimContacts(Context context) {         Log.i(TAG, "resfreshSimContacts");         startSimService(context, SIMServiceUtils.SERVICE_FORCE_REMOVE_SUB_ID,diff --git a/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.javanew file mode 100644index 0000000..33aedf6--- /dev/null+++ b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java@@ -0,0 +1,116 @@+package com.mediatek.contacts.simservice;++import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;+import android.content.Context;+import android.content.Intent;+import android.content.ContentProviderOperation;+import android.content.ContentValues;+import android.content.OperationApplicationException;+import android.database.Cursor;+import android.net.Uri;+import android.provider.ContactsContract;+import android.provider.ContactsContract.CommonDataKinds.Email; //for usim+import android.provider.ContactsContract.CommonDataKinds.GroupMembership;+import android.provider.ContactsContract.CommonDataKinds.Phone;+import android.provider.ContactsContract.CommonDataKinds.StructuredName;+import android.provider.ContactsContract.Data;+import android.provider.ContactsContract.Groups;+import android.provider.ContactsContract.RawContacts;+import com.android.contacts.common.model.account.AccountType;+import android.os.RemoteException;+import java.util.ArrayList;+import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;+import com.mediatek.contacts.simservice.SIMServiceUtils;+import com.mediatek.contacts.simservice.SIMServiceUtils.ServiceWorkData;+import com.mediatek.contacts.simcontact.SimCardUtils;+import com.mediatek.contacts.util.Log;+import android.provider.ContactsContract.PhoneLookup;+++public class PresetContactsImportProcessor extends SIMProcessorBase {++   private static final String TAG = "PresetContactsImportProcessor";+   private static boolean sIsRunningNumberCheck = false;+   private static final int INSERT_PRESET_NUMBER_COUNT = 2;         //预置联系人的个数+   private static final String INSERT_PRESET_NAME[]   = {"Número de emergencia","Atención al cliente"}; //各预置联系人的姓名 +   private static final String INSERT_PRESET_NUMBER[] = {"611","*611"};   //各预置联系人的号码+   private int mSlotId;+   private Context mContext;+   public PresetContactsImportProcessor(Context context, int slotId, Intent intent, ProcessorCompleteListener listener) {+         super(intent, listener);+              mContext = context;+              mSlotId = slotId;+       }+      @Override+   public int getType() {+        return SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS;+   }+   @Override+   public void doWork() {+       if (isCancelled()) {+       Log.d(TAG, "[doWork]cancel import preset contacts work. Thread id=" + Thread.currentThread().getId());+       return;+   }+      importDefaultReadonlyContact();+   }++   private void importDefaultReadonlyContact(){+           Log.i(TAG, "isRunningNumberCheck before: " + sIsRunningNumberCheck);+           if (sIsRunningNumberCheck) {+              return;+            }+           sIsRunningNumberCheck = true;+           for(int i = 0;i < INSERT_PRESET_NUMBER_COUNT; i++) {+            Log.i(TAG, "isRunningNumberCheck after: " + sIsRunningNumberCheck);+            Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(INSERT_PRESET_NUMBER[i]));+            Log.i(TAG, "getContactInfoByPhoneNumbers(), uri = " + uri);+            Cursor contactCursor = mContext.getContentResolver().query(uri, +            new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup.PHOTO_ID}, null, null, null);+            try {+            if (contactCursor != null && contactCursor.getCount() > 0) {+                      return;+            } else {+             final ArrayList operationList = new ArrayList();+            ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);+            ContentValues contactvalues = new ContentValues();+            contactvalues.put(RawContacts.ACCOUNT_NAME, AccountType.ACCOUNT_NAME_LOCAL_PHONE);+            contactvalues.put(RawContacts.ACCOUNT_TYPE, AccountType.ACCOUNT_TYPE_LOCAL_PHONE);+            contactvalues.put(RawContacts.INDICATE_PHONE_SIM, ContactsContract.RawContacts.INDICATE_PHONE);+            contactvalues.put(RawContacts.IS_SDN_CONTACT, 1);+            builder.withValues(contactvalues);+            builder.withValue(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_DISABLED);+            operationList.add(builder.build());+            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);+            builder.withValueBackReference(Phone.RAW_CONTACT_ID, 0);+            builder.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);+            builder.withValue(Phone.TYPE, Phone.TYPE_MOBILE);+            builder.withValue(Phone.NUMBER, INSERT_PRESET_NUMBER[i]);+            builder.withValue(Data.IS_PRIMARY, 1);+            operationList.add(builder.build());+            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);+            builder.withValueBackReference(StructuredName.RAW_CONTACT_ID, 0);+            builder.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);+            builder.withValue(StructuredName.DISPLAY_NAME, INSERT_PRESET_NAME[i]);+            operationList.add(builder.build());+            try {+                mContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operationList);+            } catch (RemoteException e) {+                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));+            } catch (OperationApplicationException e) {+                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));+            }+            }+            } finally {+            // when this service start,but the contactsprovider has not been started yet.+            // the contactCursor perhaps null, but not always.(first load will weekup the provider)+            // so add null block to avoid nullpointerexception+            if (contactCursor != null) {+                contactCursor.close();+            }+         } //END for+        Log.i(TAG, "isRunningNumberCheck insert: " + sIsRunningNumberCheck);+        sIsRunningNumberCheck = false;+      }+    }+}+diff --git a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java b/src/com/mediatek/contacts/simservice/SIMProcessorManager.javaindex 9b15494..fbab034 100644--- a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java+++ b/src/com/mediatek/contacts/simservice/SIMProcessorManager.java@@ -44,7 +44,7 @@ import com.android.contacts.common.vcard.ProcessorBase;  import com.mediatek.contacts.simservice.SIMServiceUtils.SIMProcessorState; import com.mediatek.contacts.util.Log;-+import com.mediatek.contacts.simcontact.SlotUtils; import java.util.concurrent.ConcurrentHashMap;  public class SIMProcessorManager implements SIMProcessorState {@@ -166,6 +166,7 @@ public class SIMProcessorManager implements SIMProcessorState {         Log.d(TAG, "[createProcessor] create new processor for subId: " + subId + ", workType: "                 + workType);         SIMProcessorBase processor = null;+        int slotId = SlotUtils.getNonSlotId();          if (workType == SIMServiceUtils.SERVICE_WORK_IMPORT) {             processor = new SIMImportProcessor(context, subId, intent, listener);@@ -175,6 +176,8 @@ public class SIMProcessorManager implements SIMProcessorState {             processor = new SIMEditProcessor(context, subId, intent, listener);         } else if (workType == SIMServiceUtils.SERVICE_WORK_DELETE) {             processor = new SIMDeleteProcessor(context, subId, intent, listener);+        } else if(workType == SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS){+            processor = new PresetContactsImportProcessor(context, slotId, intent, listener);         }          return processor;

(packages/apps/ContactsCommon/)

diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.javaindex a9afb32..b690dbc 100644--- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java+++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java@@ -83,6 +83,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {      */     private boolean mProfileExists; +    public boolean showReadOnlyContact = true;+     /**      * The root view of the fragment that this adapter is associated with.      */@@ -847,4 +849,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {     public TreeSet<Long> getSelectedContactIds() {         return mSelectedContactIds;     }++    public void setShowReadOnlyContact(boolean canDelete) {+        showReadOnlyContact = canDelete;+    } }diff --git a/src/com/android/contacts/common/list/ContactEntryListFragment.java b/src/com/android/contacts/common/list/ContactEntryListFragment.javaindex 7cc4aaa..d15fbd8 100644--- a/src/com/android/contacts/common/list/ContactEntryListFragment.java+++ b/src/com/android/contacts/common/list/ContactEntryListFragment.java@@ -358,6 +358,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter             mAdapter.setShowSdnNumber(isShowSdnNumber());              Log.d(TAG, "[onCreateLoader] loader: " + loader + ",id:" + id);+            mAdapter.setShowReadOnlyContact(isInstanceOfContactsMultiDeletionFragment() ? false : true);             mAdapter.configureLoader(loader, directoryId);             return loader;         }@@ -972,4 +973,8 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter     public boolean isShowSdnNumber() {         return true;     }++    protected boolean isInstanceOfContactsMultiDeletionFragment(){+        return false ;+    } }diff --git a/src/com/android/contacts/common/model/Contact.java b/src/com/android/contacts/common/model/Contact.javaindex 9d8f3f3..e39b361 100644--- a/src/com/android/contacts/common/model/Contact.java+++ b/src/com/android/contacts/common/model/Contact.java@@ -628,5 +628,9 @@ public class Contact {         return mId;     } +    public boolean isReadOnlyContact() {+        return mIsSdnContact == -2;+    }+     /** M: The previous lines are provided and maintained by Mediatek Inc. @} */ }diff --git a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java b/src/com/mediatek/contacts/simservice/SIMServiceUtils.javaindex 1f46812..f319503 100644--- a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java+++ b/src/com/mediatek/contacts/simservice/SIMServiceUtils.java@@ -69,6 +69,7 @@ public class SIMServiceUtils {     public static final int SERVICE_WORK_REMOVE = 2;     public static final int SERVICE_WORK_EDIT = 3;     public static final int SERVICE_WORK_DELETE = 4;+    public static final int SERVICE_WORK_IMPORT_PRESET_CONTACTS = 5;     public static final int SERVICE_WORK_UNKNOWN = -1;     public static final int SERVICE_IDLE = 0;     public static final int SERVICE_FORCE_REMOVE_SUB_ID = -20;diff --git a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java b/src/com/mediatek/contacts/util/ContactsCommonListUtils.javaindex 5213c21..a0ec917 100644--- a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java+++ b/src/com/mediatek/contacts/util/ContactsCommonListUtils.java@@ -161,6 +161,7 @@ public class ContactsCommonListUtils {          selection.append(Contacts.INDICATE_PHONE_SIM + "= ?");         selectionArgs.add("-1");+        selection.append(" AND " + RawContacts.IS_SDN_CONTACT + " > -2");          loader.setSelection(selection.toString());         loader.setSelectionArgs(selectionArgs.toArray(new String[0]));


这种方式拨号中的快速拨号和联系人中的收藏界面里有

packages/apps/Contacts/

diff --git a/AndroidManifest.xml b/AndroidManifest.xmlindex 6c73cc4..3180671 100644--- a/AndroidManifest.xml+++ b/AndroidManifest.xml@@ -615,6 +615,11 @@ add block mms item                 <category android:name="android.intent.category.DEFAULT" />             </intent-filter>         </activity>+       <receiver android:name=".AddContactsReceiver">+            <intent-filter>+                <action android:name="android.intent.action.BOOT_COMPLETED"/>+            </intent-filter>+       </receiver>          <service             android:name="com.mediatek.contacts.list.service.MultiChoiceService"diff --git a/src/com/android/contacts/AddContactsReceiver.java b/src/com/android/contacts/AddContactsReceiver.javanew file mode 100644index 0000000..524619e--- /dev/null+++ b/src/com/android/contacts/AddContactsReceiver.java@@ -0,0 +1,78 @@+package com.android.contacts;++import java.util.ArrayList;+import android.graphics.Bitmap;+import android.content.BroadcastReceiver;+import android.content.ContentProviderOperation;+import android.content.ContentResolver;+import android.content.ContentValues;+import android.content.Context;+import android.content.Intent;+import android.content.OperationApplicationException;+import android.os.RemoteException;+import android.provider.ContactsContract;+import android.provider.Settings;+import android.provider.ContactsContract.Data;+import android.provider.ContactsContract.RawContacts;+import android.provider.ContactsContract.CommonDataKinds.Phone;+import android.provider.ContactsContract.CommonDataKinds.Photo; +import android.net.Uri;+import android.provider.ContactsContract.CommonDataKinds.Email;+import android.provider.ContactsContract.CommonDataKinds.StructuredName;+import android.content.ContentUris;+import android.graphics.BitmapFactory;+import java.io.ByteArrayOutputStream;+import com.android.contacts.common.model.account.AccountType;+import android.provider.ContactsContract.Contacts;++public class AddContactsReceiver extends BroadcastReceiver {+    private static final String TAG = "AddContactsReceiver";++    @Override+    public void onReceive(Context context, Intent intent) {+        if (Settings.System.getInt(context.getContentResolver(), "add_other_contacts", 0) == 0) {+            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {+                boolean result = insert("Contact Center", "9242",1,context);+                Settings.System.putInt(context.getContentResolver(), "add_other_contacts", 1);+            }+        }+    }++    public boolean insert(String given_name, String mobile_number,int Starred,Context context) {+        try {+            ContentValues values = new ContentValues();+            Uri rawContactUri = context.getContentResolver().insert(+                    RawContacts.CONTENT_URI, values);+            long rawContactId = ContentUris.parseId(rawContactUri);+            if (given_name != "") {+                values.clear();+                values.put(Data.RAW_CONTACT_ID, rawContactId);+                values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);+                values.put(StructuredName.GIVEN_NAME, given_name);+                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI,+                        values);+            }+            if (mobile_number != "") {+                values.clear();+                values.put(Data.RAW_CONTACT_ID, rawContactId);+                values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);+                values.put(Phone.NUMBER, mobile_number);+                values.put(Phone.TYPE, Phone.TYPE_MOBILE);+                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI, values);+            }+            values.clear();+            values.put(ContactsContract.Contacts.STARRED, Starred);+            context.getContentResolver().update(ContactsContract.Contacts.CONTENT_URI,values,ContactsContract.Contacts._ID + " = ? ", new String[]{rawContactId + ""});+        }+        catch (Exception e) {+            return false;+        }+        return true;+    }+++}



八:创建邮箱时有个提示,不能使用,请开启权限。手机应该能创建邮箱账户

(frameworks/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java)

diff --git a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.javaindex d3dd7a0..288c583 100644--- a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java+++ b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java@@ -119,6 +119,16 @@ final class DefaultPermissionGrantPolicy {         STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);     } +    private static final Set<String> EMAIL_PERMISSIONS = new ArraySet<>();+    static {+        EMAIL_PERMISSIONS.add(Manifest.permission.READ_CALENDAR);+        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_CALENDAR);+        EMAIL_PERMISSIONS.add(Manifest.permission.READ_PHONE_STATE);+        EMAIL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);+        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);+        EMAIL_PERMISSIONS.add("com.android.email.permission.READ_ATTACHMENT");+    }+     private final PackageManagerService mService;      private PackagesProvider mImePackagesProvider;@@ -338,6 +348,15 @@ final class DefaultPermissionGrantPolicy {                 grantRuntimePermissionsLPw(certInstallerPackage, STORAGE_PERMISSIONS, true, userId);             } +            //exchange+            PackageParser.Package exchangePackage = getSystemPackageLPr("com.android.exchange");+            if (exchangePackage != null) {+                grantRuntimePermissionsLPw(exchangePackage, CONTACTS_PERMISSIONS, userId);+                grantRuntimePermissionsLPw(exchangePackage, EMAIL_PERMISSIONS, userId);+                grantRuntimePermissionsLPw(exchangePackage,STORAGE_PERMISSIONS, userId);+                grantRuntimePermissionsLPw(exchangePackage,PHONE_PERMISSIONS,userId);+            }+             // Dialer             if (dialerAppPackageNames == null) {                 Intent dialerIntent = new Intent(Intent.ACTION_DIAL);

九:SPN应该从SIM卡读取

frameworks/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java


diff --git a/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java b/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/              DefaultCarrierTextExt.java   index d4ba14b..c325f5d 100755   --- a/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java   +++ b/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java   @@ -17,7 +17,7 @@ public class DefaultCarrierTextExt implements ICarrierTextExt {            }             if (carrierText != null) {  -            return carrierText.toString().toUpperCase();  +            return carrierText.toString();           }           return null;       }

十:能呼叫短号码,而不是提示ussd code

(frameworks/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java)

diff --git a/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.javaindex 621aab7..cafaccb 100644--- a/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java+++ b/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java@@ -765,12 +765,12 @@ public final class GsmMmiCode extends Handler implements MmiCode {     static private boolean isShortCodeUSSD(String dialString, GSMPhone phone) {         if (dialString != null && dialString.length() <= MAX_LENGTH_SHORT_CODE) {             if (phone.isInCall()) {-                return true;+                return false;             }              if (dialString.length() != MAX_LENGTH_SHORT_CODE ||                     dialString.charAt(0) != '1') {-                return true;+                return false;             }         }         return false;



十一:语音信箱,+ 50377019995一个虚拟机访问长号

(packages/apps/Dialer/src/com/android/dialer/dialpad/DialpadFragment.java)

diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.javaindex 82be25b..9b72f31 100644--- a/src/com/android/dialer/dialpad/DialpadFragment.java+++ b/src/com/android/dialer/dialpad/DialpadFragment.java@@ -1446,7 +1446,42 @@ public class DialpadFragment extends Fragment                 return;             }-+            String IMSI = android.os.SystemProperties.get("gsm.sim.operator.imsi");+            if(IMSI != null && !(IMSI.isEmpty())){+                if (IMSI.startsWith("70604") || IMSI.startsWith("706040")|| IMSI.startsWith("722010")||IMSI.startsWith("72207")||IMSI.startsWith("722070")||IMSI.startsWith("73002")||IMSI.startsWith("73007") || IMSI.startsWith("732123") || IMSI.startsWith("71204") || IMSI.startsWith("74000")){+                    if(number !=null &&number.equals("+503 7701 9995")){+                        List<PhoneAccountHandle> subscriptionAccountHandles =+                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());+                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(+                                getTelecomManager().getDefaultOutgoingPhoneAccount(+                                    PhoneAccount.SCHEME_VOICEMAIL));+                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1+                            && !hasUserSelectedDefault;+                        if (needsAccountDisambiguation || isVoicemailAvailable()) {+                            callVoicemail();+                            return;+                        }+                    }+                } else if (IMSI.startsWith("21407") || IMSI.startsWith("70403") || IMSI.startsWith("33403")||IMSI.startsWith("334030")||IMSI.startsWith("71030")||IMSI.startsWith("710300") || IMSI.startsWith("71402")|| IMSI.startsWith("714020") || IMSI.startsWith("71606") || IMSI.startsWith("74807") || IMSI.startsWith("73404"))                {+                    if(number !=null &&number.equals("+503 7701 9995")){+                        List<PhoneAccountHandle> subscriptionAccountHandles =+                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());+                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(+                                getTelecomManager().getDefaultOutgoingPhoneAccount(+                                    PhoneAccount.SCHEME_VOICEMAIL));+                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1+                            && !hasUserSelectedDefault;+                        if (needsAccountDisambiguation || isVoicemailAvailable()) {+                            callVoicemail();+                            return;+                        }+                    }+                }+            }             // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated             // test equipment.             // TODO: clean it up.


十二:指定语言的电子邮箱签名

(packages/apps/Email/)

diff --git a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.javaindex d6acdaf..a2cda2d 100755--- a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java+++ b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java@@ -78,6 +78,8 @@ import android.widget.ScrollView; import android.widget.MultiAutoCompleteTextView; import android.widget.TextView; import android.widget.Toast;+import android.preference.EditTextPreference;+import java.util.Locale;  import com.android.common.Rfc822Validator; import com.android.common.contacts.DataUsageStatUpdater;@@ -1116,6 +1118,16 @@ public class ComposeActivity extends ActionBarActivity             DataCollectUtils.clearRecordedList();         }         /** @} */+        if(mSignature.equals("Send from my Andy 5E3 of Movistar") || mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") +                || mSignature.equals("Sent from my Andy 5E3")){+            if(mBodyView.getText().toString().contains("Send from my Andy 5E3 of Movistar") || mBodyView.getText().toString().contains("Enviado desde mi Andy 5E3 de Movistar") || mBodyView.getText().toString().contains("Sent from my Andy 5E3")){+                if(Locale.getDefault().getLanguage().equals("es")) {+                    mBodyView.setText(mBodyView.getText().toString());+                } else {+                    mBodyView.setText(mBodyView.getText().toString());+                }+            }+        }     }      @Override@@ -1890,6 +1902,21 @@ public class ComposeActivity extends ActionBarActivity                             message.bodyHtml.length());                 }             }+            if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")+                    || mSignature.equals("Sent from my Andy 5E3")){+                if(body.equals("Enviado desde mi Andy 5E3 de Movistar") || body.equals("Send from my Andy 5E3 of Movistar") +                        || body.equals("Sent from my Andy 5E3")){+                    if(Locale.getDefault().getLanguage().equals("en")){+                        mBodyView.setText("Send from my Andy 5E3 of Movistar");+                    } else if(Locale.getDefault().getLanguage().equals("es")){+                        mBodyView.setText("Enviado desde mi Andy 5E3 de Movistar");+                    } else {+                        mBodyView.setText("Sent from my Andy 5E3");+                    }+                }+            } else{+                mBodyView.setText(body);+            }             new HtmlToSpannedTask().execute(body);         } else {             final String body = message.bodyText;@@ -4229,6 +4256,18 @@ public class ComposeActivity extends ActionBarActivity             mSignature = newSignature;             if (!TextUtils.isEmpty(mSignature)) {                 // Appending a signature does not count as changing text.+                if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")+                        || mSignature.equals("Sent from my Andy 5E3")){+                    if(Locale.getDefault().getLanguage().equals("es")){+                        mSignature =  "Enviado desde mi Andy 5E3 de Movistar";+                    }else if(Locale.getDefault().getLanguage().equals("en")){+                        mSignature = "Send from my Andy 5E3 of Movistar";+                    }else{+                        mSignature = "Sent from my Andy 5E3";+                    }+                } else {+                    mSignature = newSignature;+                }                 mBodyView.removeTextChangedListener(this);                 mBodyView.append(convertToPrintableSignature(mSignature));                 mBodyView.addTextChangedListener(this);diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.javaindex e3671b3..7d7ab07 100755--- a/emailcommon/src/com/android/emailcommon/provider/Account.java+++ b/emailcommon/src/com/android/emailcommon/provider/Account.java@@ -44,6 +44,7 @@ import org.json.JSONException; import org.json.JSONObject;  import java.util.ArrayList;+import java.util.Locale;  public final class Account extends EmailContent implements Parcelable {     public static final String TABLE_NAME = "Account";@@ -144,6 +145,7 @@ public final class Account extends EmailContent implements Parcelable {     public String mProtocolVersion;     public String mSecuritySyncKey;     public String mSignature;+    public String CUSTOM_SIGNATURE = "Sent from my Andy 5E3";     public long mPolicyKey;     public long mPingDuration; @@ -211,6 +213,13 @@ public final class Account extends EmailContent implements Parcelable {         mSyncInterval = -1;         mSyncLookback = -1;         mFlags = 0;+        if(Locale.getDefault().getLanguage().equals("en")){+            mSignature = "Send from my Andy 5E3 of Movistar";+        } else if(Locale.getDefault().getLanguage().equals("es")){+            mSignature = "Enviado desde mi Andy 5E3 de Movistar";+        } else{+            mSignature = CUSTOM_SIGNATURE;+        }     }      public static Account restoreAccountWithId(Context context, long id) {@@ -285,7 +294,14 @@ public final class Account extends EmailContent implements Parcelable {         mRingtoneUri = cursor.getString(CONTENT_RINGTONE_URI_COLUMN);         mProtocolVersion = cursor.getString(CONTENT_PROTOCOL_VERSION_COLUMN);         mSecuritySyncKey = cursor.getString(CONTENT_SECURITY_SYNC_KEY_COLUMN);-        mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);+        //mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);+        if(Locale.getDefault().getLanguage().equals("en")){+            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";+        }else if(Locale.getDefault().getLanguage().equals("es")){+            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";+        }else{+            mSignature = CUSTOM_SIGNATURE;+        }         mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY_COLUMN);         mPingDuration = cursor.getLong(CONTENT_PING_DURATION_COLUMN);     }@@ -957,6 +973,13 @@ public final class Account extends EmailContent implements Parcelable {         mProtocolVersion = in.readString();         /* mNewMessageCount = */ in.readInt();         mSecuritySyncKey = in.readString();+        if(Locale.getDefault().getLanguage().equals("en")){+            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";+        }else if(Locale.getDefault().getLanguage().equals("es")){+            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";+        }else{+            mSignature = CUSTOM_SIGNATURE;+        }         mSignature = in.readString();         mPolicyKey = in.readLong(); diff --git a/src/com/android/email/activity/setup/AccountFinalizeFragment.java b/src/com/android/email/activity/setup/AccountFinalizeFragment.javaindex f2b9cde..bdfecf9 100755--- a/src/com/android/email/activity/setup/AccountFinalizeFragment.java+++ b/src/com/android/email/activity/setup/AccountFinalizeFragment.java@@ -127,13 +127,6 @@ public class AccountFinalizeFragment extends Fragment {         public Boolean loadInBackground() {             // Update the account in the database             final ContentValues cv = new ContentValues();-            if (!FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE.equals("")) {-                cv.put(EmailContent.AccountColumns.SIGNATURE, FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE);-            }             cv.put(EmailContent.AccountColumns.DISPLAY_NAME, mAccount.getDisplayName());             cv.put(EmailContent.AccountColumns.SENDER_NAME, mAccount.getSenderName());             mAccount.update(getContext(), cv);


十三:菜单>设置>显示> wallpappers,删除附件图中标示的选项“SherlockNews”
(packages/apps/Launcher3/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java)

diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.javaindex f46da53..bca9b0a 100755--- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java+++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java@@ -35,6 +35,7 @@ import com.android.launcher3.util.Thunk;  import java.util.ArrayList; import java.util.List;  public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ListAdapter {     private final LayoutInflater mInflater;@@ -78,6 +79,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements         final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];         for (int i = 0; i < imagePickerActivities.size(); i++) {             ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;             imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);         } @@ -88,6 +90,8 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements             final String itemPackageName = itemComponentName.getPackageName();             // Exclude anything from our own package, and the old Launcher,             // and live wallpaper picker+            if("com.sherlock.news".equals(itemPackageName))continue;             if (itemPackageName.equals(context.getPackageName()) ||                     itemPackageName.equals("com.android.launcher") ||                     itemPackageName.equals("com.android.wallpaper.livepicker")) {

(packages/apps/Settings/src/com/android/settings/WallpaperTypeSettings.java)

diff --git a/src/com/android/settings/WallpaperTypeSettings.java b/src/com/android/settings/WallpaperTypeSettings.javaindex 9046bfb..af3d8c8 100644--- a/src/com/android/settings/WallpaperTypeSettings.java+++ b/src/com/android/settings/WallpaperTypeSettings.java@@ -31,6 +31,7 @@ import com.android.settings.search.SearchIndexableRaw;  import java.util.ArrayList; import java.util.List;  public class WallpaperTypeSettings extends SettingsPreferenceFragment implements Indexable { @@ -67,9 +68,11 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements             Intent prefIntent = new Intent(intent);             prefIntent.setComponent(new ComponentName(                     info.activityInfo.packageName, info.activityInfo.name));             pref.setIntent(prefIntent);             CharSequence label = info.loadLabel(pm);             if (label == null) label = info.activityInfo.packageName;+            if("com.sherlock.news".equals(info.activityInfo.packageName))continue;             pref.setTitle(label);             parent.addPreference(pref);         }


十四:语言切换时,系统显示语言变化太慢

(packages/apps/Launcher3/)

diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.javaindex aca2402..6974ee9 100755--- a/src/com/android/launcher3/IconCache.java+++ b/src/com/android/launcher3/IconCache.java@@ -588,6 +588,9 @@ public class IconCache {                 entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);             }         }+        if (info != null) {+           entry.title = info.getLabel();+        }         return entry;     } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.javaindex c90677d..62d6531 100755--- a/src/com/android/launcher3/LauncherModel.java+++ b/src/com/android/launcher3/LauncherModel.java@@ -3754,9 +3754,13 @@ public class LauncherModel extends BroadcastReceiver             info.setIcon(icon == null ? mIconCache.getDefaultIcon(user) : icon);         } -        // from the db-        if (TextUtils.isEmpty(info.title) && c != null) {-            info.title =  Utilities.trim(c.getString(titleIndex));+        //// from the db+        //if (TextUtils.isEmpty(info.title) && c != null) {+        //    info.title =  Utilities.trim(c.getString(titleIndex));+        //}+        // from PMS.+        if (lai != null) {+            info.title = lai.getLabel();         }          // fall back to the class name of the activity

十五:

主菜单>消息>设置>一般>小区广播设置,

小区广播接收
小区广播警报
信道:所有的观测值:50,919,921和4370欧洲标准CMAS

(packages/providers/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java

diff --git a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.javaindex 3d7ac48..c32acf5 100755--- a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java+++ b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java@@ -134,8 +134,10 @@ public class CbProvider extends ContentProvider {             // break;         case URL_CHANNEL:             qb.setTables(CbDatabaseHelper.CHANNEL_TABLE);+            if (selection == null || !selection.contains("sub_id")) {             qb.appendWhere("(sub_id = " + SmsProvider.getSubIdFromUri(url)                     + ")");+            }             break;         case URL_CONVERSATION:             // qb.setTables(CbDatabaseHelper.CONVERSATION_TABLE);

(vendor/)

diff --git a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xmlindex 1e224e1..c70aa39 100755--- a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml+++ b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml@@ -534,6 +534,12 @@ add for MClock update sms database             <intent-filter>                 <action android:name="android.provider.Telephony.SMS_CB_RECEIVED" />             </intent-filter>+            <intent-filter>+                <action android:name="android.intent.action.SIM_STATE_CHANGED" />+            </intent-filter>         </receiver>          <!-- Catch-all receiver for broadcasts that don't have associated security -->diff --git a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.javaindex 7415026..816a1f5 100755--- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java+++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java@@ -64,6 +64,8 @@ import com.android.mms.MmsApp; import com.android.mms.util.MmsLog; import com.mediatek.mms.util.PermissionCheckUtil; +import com.android.internal.telephony.TelephonyIntents;+ /**  * M:  * Handle incoming SMSes.  Just dispatches the work off to a Service.@@ -98,7 +100,14 @@ public class CBMessageReceiver extends BroadcastReceiver {                         + intent.getAction() + ", result = " + getResultCode());          intent.setClass(context, CBMessageReceiverService.class);+/*         intent.putExtra("result", getResultCode());+ */+        android.util.Log.d(" CBMessageReceiver ", " CBMessageReceiver.onReceiveWithPrivilege 97 ");+        if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {+            intent.putExtra("result", getResultCode());+        }         beginStartingService(context, intent);     } diff --git a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.javaindex 35b3133..aea9c3a 100755--- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java+++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java@@ -81,6 +81,18 @@ import com.mediatek.mms.ext.IOpCBMessageReceiverServiceExt; import com.mediatek.opmsg.util.OpMessageUtils;  import android.telephony.SubscriptionManager;+import android.provider.Telephony;+import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;+import android.content.ContentValues;+import android.database.Cursor;+import android.util.Log;+import com.android.internal.telephony.IccCardConstants;+import com.android.internal.telephony.TelephonyIntents;+import android.telephony.SmsManager;+import android.provider.Telephony.Sms.Intents;  /**  * M:@@ -97,6 +109,19 @@ public class CBMessageReceiverService extends Service {      private static final Uri MESSAGE_URI = Telephony.SmsCb.CONTENT_URI;     private static final int DEFAULT_SUB_ID = 1;+    private static final int MESSAGE_SET_STATE = 33;+    private static final int MESSAGE_SET_CONFIG = 32;+    private static final String KEYID = "_id";+    private static final String NAME = "name";+    private static final String NUMBER = "number";+    private static final String ENABLE = "enable";+    private static final String SUBID = "sub_id";+    private static final Uri CHANNEL_URI = Uri.parse("content://cb/channel");+    private static final int EVENT_RETRY_ADD_CHANNEL_TIME_OUT = 101;+    private static boolean isAddingDefaultChannel = false;      public Handler mToastHandler = new Handler() {         @Override@@ -159,6 +184,7 @@ public class CBMessageReceiverService extends Service {         public void handleMessage(Message msg) {             int serviceId = msg.arg1;             Intent intent = (Intent) msg.obj;+            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 185 serviceId="+serviceId+" msg.what="+msg.what+" intent="+intent); // modify by mtk_debug 2015-3-19;             if (intent != null) {                 String action = intent.getAction();                 // NEED Replace with CB ACTION@@ -166,12 +192,266 @@ public class CBMessageReceiverService extends Service {                     handleCBMessageReceived(intent);                 }             }++            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 162 "); // modify by mtk_debug 2015-3-05;+            if(TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())){+                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage receiver a ACTION_SIM_STATE_CHANGED 164 "); // modify by mtk_debug 2015-3-05;+                synchronized(this){+                    handleSIMStateChangedReceived(intent);+                }+            }             // NOTE: We MUST not call stopSelf() directly, since we need to             // make sure the wake lock acquired by AlertReceiver is released.-            CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId);+            if(!isAddingDefaultChannel){+                CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId);+            }         }     } +    private void handleSIMStateChangedReceived(Intent intent) {+        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 191 "); // modify by mtk_debug 2015-3-05;+        int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID);+        String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);+        // boolean stateExtra = intent.getBooleanExtra("ready",false);+        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 214 stateExtra="+stateExtra); +        if(IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)){+            // if(stateExtra){+            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",919))+            {+                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");+                isAddingDefaultChannel=false;+            }else{+                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02;+                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/+                { +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");+                    addCustomChanneltoList(subId,"CL-Alerta Local",919);+                    isAddingDefaultChannel=false;++                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释+                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关++                }else{++                    Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;+                    //add retry+                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {+                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);+                        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;+                        mServiceHandler.sendMessageDelayed(msg, 2000);+                        isAddingDefaultChannel=true;+                    }+++                }++            }+            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",50))+            {+                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");+                isAddingDefaultChannel=false;+            }else{+                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //      modify by mtk_debug 2015-3-02;+                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/+                {+                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");+                    addCustomChanneltoList(subId,"CL-Alerta Local",50);+                    isAddingDefaultChannel=false;++                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释+                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关++                }else{++                    Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;+                    //add retry+                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {+                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);+                        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;+                        mServiceHandler.sendMessageDelayed(msg, 2000);+                        isAddingDefaultChannel=true;+                    }+++                }++            }+            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",921))+            {+                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");+                isAddingDefaultChannel=false;+            }else{+                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //  modify by mtk_debug 2015-3-02;+                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/+                {+                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");+                    addCustomChanneltoList(subId,"CL-Alerta Local",921);+                    isAddingDefaultChannel=false;++                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释+                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关++                }else{+ +                    Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;+                    //add retry+                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {+                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);+                        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;+                        mServiceHandler.sendMessageDelayed(msg, 2000);+                        isAddingDefaultChannel=true;+                    }+++                }++            }+            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",4370))+            {+                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");+                isAddingDefaultChannel=false;+            }else{+                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02;+                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/+                { +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");+                    addCustomChanneltoList(subId,"CL-Alerta Local",4370);+                    isAddingDefaultChannel=false;++                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释+                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关++                }else{++                    Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;+                    //add retry+                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {+                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);+                        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;+                        mServiceHandler.sendMessageDelayed(msg, 2000);+                        isAddingDefaultChannel=true;+                    }+++                }++            }++        }++    }++    private void addCustomChanneltoList(int mSubId,String channelName,int channelNum){+        Log.d(TAG, "addCustomChanneltoList: mSubId=" + mSubId+                + ", channelName= " + channelName + ", channelNum= " + channelNum);++        SmsBroadcastConfigInfo[] objectList = new SmsBroadcastConfigInfo[1];+        objectList[0] = new SmsBroadcastConfigInfo(channelNum,channelNum, -1, -1, true);++        Log.d(TAG, "addCustomChanneltoList: setCellBroadcastSmsConfig");+        //SmsManagerEx.getDefault().setCellBroadcastSmsConfig(objectList, objectList, mSimId);+        boolean isSetConfigSuccess = SmsManager.getSmsManagerForSubscriptionId(mSubId).setCellBroadcastSmsConfig(objectList, objectList);+        if(isSetConfigSuccess){+            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.addCustomChanneltoList set channel " +channelNum +" success 784 "); // modify by mtk_debug 2015-3-05;+            addChannelToDatabase(mSubId,channelName,channelNum);+        }else{+            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.addCustomChanneltoList set channel "+ channelNum +" failed 786 "); // modify by mtk_debug 2015-3-05;+        }+++        Log.d(TAG, " CBMessageReceiverService addCustomChanneltoList: function end");+    }++++    private boolean addChannelToDatabase(int mSubId,String channelName,int channelNum){+            // ClearChannel();+        Log.d(TAG, "addChannelToDatabase: mSubId=" + mSubId+                + ", channelName= " + channelName + ", channelNum= " + channelNum);+        String[] projection = new String[] { NUMBER, SUBID};+        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")"; +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";+        Cursor cursornum = null;+        Cursor cursorid = null;++        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,+                projection,+                NUMBER + " = ? AND " ++                SUBID + " = ?",+                new String[] {String.valueOf(channelNum), String.valueOf(mSubId)},+                null);+        Log.d(TAG, "addChannelToDatabase: cursor.getCount"+cursorzz.getCount());+        if(cursorzz.getCount() == 0){//if ((cursornum.getCount() == 0)&&(cursorid.getCount() == 0)){ +            Log.d(" CBMessageReceiverService ", " SmsReceiverService.addChannelToDatabase add mSubId=" + mSubId+                    + ", channelName= " + channelName + ", channelNum= " + channelNum +"to database"); // modify by mtk_debug 2015-3-05;+            ContentValues values = new ContentValues();+            values.put(NAME,channelName);+            values.put(NUMBER, channelNum);+            values.put(ENABLE, true);   //请注意:如果贵司希望预置的频道默认为disable状态,把true改成false即可+            values.put(SUBID, mSubId);+            try {+                //if(mSimId==PhoneConstants.SUB1){+                this.getContentResolver().insert(CHANNEL_URI, values);+                //}else if(mSimId==PhoneConstants.SUB2){+                // this.getContentResolver().insert(CHANNEL_URI1, values);+                //}+            } catch (Exception e){+                Log.d(" CBMessageReceiverService ", " SmsReceiverService.addChannelToDatabase exception 828 "); // modify by mtk_debug 2015-3-05;+                //cursornum.close();+                //cursorid.close();+                cursorzz.close();+                return false;+            }+            //cursornum.close();+            // cursorid.close();+            cursorzz.close();+            return true;+        }+        else{+            //cursornum.close();+            //cursorid.close();+            cursorzz.close();+            return false;+        }++    } +++    private boolean queryIfChannelInDatabase(int mSubId,String channelName,int channelNum){++        Log.d(TAG, "queryIfChannelInDatabase: mSubId=" + mSubId+                + ", channelName= " + channelName + ", channelNum= " + channelNum);+        String[] projection = new String[] { NUMBER, SUBID};+        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")"; +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";+        Cursor cursornum = null;+        Cursor cursorid = null;++        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,+                projection,+                NUMBER + " = ? AND " ++                SUBID + " = ?",+                new String[] {String.valueOf(channelNum),String.valueOf(mSubId)},+                null);++        if(cursorzz != null&&cursorzz.getCount() > 0){+            //if ((cursornum.getCount() != 0)&&(cursorid.getCount() != 0)){+            Log.d(TAG, "queryIfChannelInDatabase: cursor.getCount"+cursorzz.getCount());+            cursorzz.close();+            return true;+++        }else{+            cursorzz.close();+            Log.d(TAG, "queryIfChannelInDatabase: return false");+            return false;+        }++    }+// End of Vanzo:tanglei+     private void handleCBMessageReceived(Intent intent) {         // TODO need replace with cb message.         Bundle extras = intent.getExtras();diff --git a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.javaindex c17f2b0..d784299 100755--- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java+++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java@@ -218,6 +218,9 @@ public class CellBroadcastSettings extends TimeConsumingPreferenceActivity             } else {                 channel.setSummary(R.string.disable);             }+            if (title.equals("CL-Alerta Local(919)") || title.equals("CL-Alerta Local(50)") || title.equals("CL-Alerta Local(921)") || title.equals("CL-Alerta Local(4370)")) {+                channel.setEnabled(false);+            }              channel.setOnPreferenceClickListener(new OnPreferenceClickListener() {                 public boolean onPreferenceClick(Preference arg0) {




十六:首选网络类型,加入3G
(packages/services/Telephony/src/com/android/phone/MobileNetworkSettings.java)

diff --git a/Telephony/src/com/android/phone/MobileNetworkSettings.java b/Telephony/src/com/android/phone/MobileNetworkSettings.javaindex d1dbc6f..4a30ffa 100644--- a/Telephony/src/com/android/phone/MobileNetworkSettings.java+++ b/Telephony/src/com/android/phone/MobileNetworkSettings.java@@ -962,6 +962,7 @@ public class MobileNetworkSettings extends PreferenceActivity implements                 switch (buttonNetworkMode) {                     case Phone.NT_MODE_WCDMA_PREF:                     case Phone.NT_MODE_GSM_ONLY:+                    case Phone.NT_MODE_WCDMA_ONLY:                     case Phone.NT_MODE_LTE_GSM_WCDMA:                     case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:                     case Phone.NT_MODE_CDMA:@@ -1193,6 +1194,9 @@ public class MobileNetworkSettings extends PreferenceActivity implements         // @}         switch (NetworkMode) {             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) {


十七:掉指示灯功能

(vanzo/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java)

diff --git a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java+index 9440315..d0fad5c 100755--- a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java+++ b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java@@ -56,7 +56,7 @@ public class FactoryMode extends Activity implements OnItemClickListener {      private TextView mMotherBoardResult; -    public static boolean mHavePsensor = true;+    public static boolean mHavePsensor = false;      public static boolean mHaveMsensor = true;

十八:日历的排版从左往右,从周一开始

(vendor/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml)

diff --git a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xmlindex a0d1577..0b17327 100644--- a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml+++ b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml@@ -26,7 +26,7 @@             android:title="@string/preferences_show_week_num_title" />         <ListPreference             android:key="preferences_week_start_day"-            android:defaultValue="@string/preferences_week_start_day_default"+            android:defaultValue="2"             android:title="@string/preferences_week_start_day_title"             android:entries="@array/preferences_week_start_day_labels"             android:entryValues="@array/preferences_week_start_day_values"


十九:消息,编码按照7-bit方式,如果重音或特殊字符,设备应该允许160个字符/短信。

(vendor/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java)
diff --git a/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java b/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.javaindex 15dba17..5199a39 100644--- a/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java+++ b/mediatek/proprietary/packages/apps/Mms/src/com/android/mms/ui/ComposeMessageActivity.java@@ -1046,11 +1046,9 @@ public class ComposeMessageActivity extends Activity         */         int[] params = null; -        int encodingType = SmsMessage.ENCODING_UNKNOWN;+        int encodingType = SmsMessage.ENCODING_7BIT; -        encodingType = mOpComposeExt.getSmsEncodingType(encodingType, ComposeMessageActivity.this);--        params = SmsMessage.calculateLength(text, false, encodingType);+        params = SmsMessage.calculateLength(text, true, encodingType);             /* SmsMessage.calculateLength returns an int[4] with:              *   int[0] being the number of SMS's required,              *   int[1] the number of code units used,
(frameworks/base/telephony/java/com/android/internal/telephony/GsmAlphabet.java)
diff --git a/base/telephony/java/com/android/internal/telephony/GsmAlphabet.java b/base/telephony/java/com/android/internal/telephony/GsmAlphabet.javaindex 794456c..69665c6 100644--- a/base/telephony/java/com/android/internal/telephony/GsmAlphabet.java+++ b/base/telephony/java/com/android/internal/telephony/GsmAlphabet.java@@ -311,7 +311,7 @@ public class GsmAlphabet {         int headerBits = (header.length + 1) * 8;         int headerSeptets = (headerBits + 6) / 7; -        byte[] ret = stringToGsm7BitPacked(data, headerSeptets, true, languageTable,+        byte[] ret = stringToGsm7BitPacked(data, headerSeptets, false, languageTable,                 languageShiftTable);          // Paste in the header@@ -1509,5 +1509,29 @@ public class GsmAlphabet {                 }             }         }+/********MTK add*************/+//Add the customer character conversion table+        SparseIntArray defaultCharToGsm = sCharsToGsmTables[0];+        defaultCharToGsm.put('\u00c0', 0x41);// À > A+        defaultCharToGsm.put('\u00c1', 0x41);// Á > A+        defaultCharToGsm.put('\u00e0', 0x61);// à > a+        defaultCharToGsm.put('\u00e1', 0x61);// á > a+        defaultCharToGsm.put('\u00c8', 0x45);// È > E+        defaultCharToGsm.put('\u00e8', 0x45);// è > e+        defaultCharToGsm.put('\u00cc', 0x49);// Ì > I+        defaultCharToGsm.put('\u00cd', 0x49);// Í > I+        defaultCharToGsm.put('\u00cf', 0x49);// Ï > I+        defaultCharToGsm.put('\u00ec', 0x69);// ì > i+        defaultCharToGsm.put('\u00ed', 0x69);// í > i+        defaultCharToGsm.put('\u00ef', 0x69);// ï > i+        defaultCharToGsm.put('\u00d2', 0x4f);// Ò > O+        defaultCharToGsm.put('\u00d3', 0x4f);// Ó > O+        defaultCharToGsm.put('\u00f2', 0x6f);// ò > o+        defaultCharToGsm.put('\u00f3', 0x6f);// ò > o+        defaultCharToGsm.put('\u00d9', 0x55);// Ù > U+        defaultCharToGsm.put('\u00da', 0x55);// Ú > U+        defaultCharToGsm.put('\u00f9', 0x75);// ù > u+        defaultCharToGsm.put('\u00fa', 0x75);// ú > u+        defaultCharToGsm.put('\u00e7', 0x09);// ç > Ç     } }




1 0
原创粉丝点击