1. 程式人生 > >Android6.0 MTK 需求文件(二)

Android6.0 MTK 需求文件(二)

一:相機中的右邊的預覽視窗檢視圖片後選擇刪除,螢幕介面下方會有一條橫線(去除橫線的辦法)

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.java
index 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.java
index 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.java
index 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.java
index 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.java
index 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.xml
index 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.xml
index 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.java
index 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.java
index 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.java
index 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.

(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.txt
index 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.txt
index 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.java
index 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.xml
index 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.xml
index 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.xml
new file mode 100755
index 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.java
index 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.java
index 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.xml
index 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.java
index 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.java
index 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.java
index 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.java
index 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.java
index 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.java
index 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.java
index 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.java
index 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.java
new file mode 100644
index 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;