Android 系统 (128)---ODM 开发用户常见需求文档(二) Android6.0 MTK 需求文档(二)

Android6.0 MTK 需求文档(二)

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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java b/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  2. index ae053df..955a749 100644  
  3. --- a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  4. +++ b/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  5. @@ -44,7 +44,7 @@ public class FilterEmptyPromptSet extends MediaSet implements ContentListener {  
  6.          if (itemCount > 0) {  
  7.              return itemCount;  
  8.          } else {  
  9. -            return 1;  
  10. +            return 0;  
  11.          }  
  12.      }  


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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/calculator2/CalculatorExpressionBuilder.java b/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  2. index fc229f0..df85076 100755  
  3. --- a/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  4. +++ b/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  5. @@ -19,6 +19,7 @@ package com.android.calculator2;  
  6.  import android.content.Context;  
  7.  import android.text.SpannableStringBuilder;  
  8.  import android.text.TextUtils;  
  9. +import android.util.Log;  
  10.    
  11.  public class CalculatorExpressionBuilder extends SpannableStringBuilder {  
  12.    
  13. @@ -65,6 +66,16 @@ public class CalculatorExpressionBuilder extends SpannableStringBuilder {  
  14.                          break;  
  15.                      }  
  16. +                    if (start > 0 && "-".indexOf(expr.charAt(start - 1)) != -1) {  
  17. +                        appendExpr = "";  
  18. +                        break;  
  19. +                    }  
  20.   
  21.                      // don't allow multiple successive operators  
  22.                      while (start > 0 && "+-*/".indexOf(expr.charAt(start - 1)) != -1) {  
  23.                          --start;  


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

frameworks/

[java]  view plain  copy
  1. diff --git a/base/core/java/android/app/Activity.java b/base/core/java/android/app/Activity.java  
  2. index f6ecec3..1696a5e 100644  
  3. --- a/base/core/java/android/app/Activity.java  
  4. +++ b/base/core/java/android/app/Activity.java  
  5. @@ -117,7 +117,7 @@ import java.lang.annotation.RetentionPolicy;  
  6.  import java.util.ArrayList;  
  7.  import java.util.HashMap;  
  8.  import java.util.List;  
  9. -  
  10. +import android.content.BroadcastReceiver;  
  11.  /** 
  12.   * An activity is a single, focused thing that the user can do.  Almost all 
  13.   * activities interact with the user, so the Activity class takes care of 
  14. @@ -1742,6 +1742,20 @@ public class Activity extends ContextThemeWrapper 
  15.      public void onConfigurationChanged(Configuration newConfig) { 
  16.          if (DEBUG_LIFECYCLE) Slog.v(TAG, "onConfigurationChanged " + this + ": " + newConfig); 
  17.          mCalled = true; 
  18. +        Intent mIntent = new Intent("Configuration_orientation"); 
  19.  
  20. +        if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){ 
  21. +            mIntent.putExtra("ori_status",1); 
  22. +            Log.d("houcongxi","ori_status-------1111111111"); 
  23. +            this.sendBroadcast(mIntent); 
  24. +        }else{ 
  25. +            mIntent.putExtra("ori_status",2); 
  26. +            Log.d("houcongxi","ori_status-------2222222222"); 
  27. +            this.sendBroadcast(mIntent); 
  28. +        } 
  29.   
  30.          mFragments.dispatchConfigurationChanged(newConfig); 
  31.   
  32. diff --git a/base/core/java/android/provider/Settings.java b/base/core/java/android/provider/Settings.java 
  33. index 7222da6..daf099e 100644 
  34. --- a/base/core/java/android/provider/Settings.java 
  35. +++ b/base/core/java/android/provider/Settings.java 
  36. @@ -1505,6 +1505,11 @@ public final class Settings { 
  37.   
  38.              // At one time in System, then Global, but now back in Secure 
  39.              MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); 
  40. +            MOVED_TO_SECURE.add(Secure.DEV_FORCE_SHOW_NAVBAR); 
  41.          } 
  42.   
  43.          private static final HashSet<String> MOVED_TO_GLOBAL; 
  44. @@ -4269,6 +4274,18 @@ public final class Settings { 
  45.          @Deprecated 
  46.          public static final String ANDROID_ID = Secure.ANDROID_ID; 
  47.   
  48. +        /** 
  49. +         * Developer options - Navigation Bar show switch 
  50. +         * @deprecated Use {@link android.provider.Settings.Secure#DEV_FORCE_SHOW_NAVBAR} instead 
  51. +         * @hide 
  52. +         */  
  53. +        @Deprecated  
  54. +        public static final String DEV_FORCE_SHOW_NAVBAR = Secure.DEV_FORCE_SHOW_NAVBAR;  
  55. +  
  56.          /** 
  57.           * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 
  58.           */  
  59. @@ -5073,6 +5090,16 @@ public final class Settings {  
  60.           */  
  61.          public static final String ANDROID_ID = "android_id";  
  62.    
  63. +        /**   
  64. +         * Developer options - Navigation Bar show switch 
  65. +         * @hide 
  66. +         */  
  67. +        public static final String DEV_FORCE_SHOW_NAVBAR = "dev_force_show_navbar";  
  68. +  
  69.          /** 
  70.           * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 
  71.           */  
  72. diff --git a/base/core/java/android/view/ViewRootImpl.java b/base/core/java/android/view/ViewRootImpl.java  
  73. index 1ffc935..5c16de7 100644  
  74. --- a/base/core/java/android/view/ViewRootImpl.java  
  75. +++ b/base/core/java/android/view/ViewRootImpl.java  
  76. @@ -111,6 +111,13 @@ import android.content.Intent;  
  77.  import com.android.featureoption.FeatureOption;  
  78.    
  79. +import android.content.IntentFilter;  
  80. +import android.content.BroadcastReceiver;  
  81. +  
  82.  /** 
  83.   * The top of a view hierarchy, implementing the needed protocol between View 
  84.   * and the WindowManager.  This is for the most part an internal implementation 
  85. @@ -454,12 +461,25 @@ public final class ViewRootImpl implements ViewParent, 
  86.      private static final String DUMP_IMAGE_PTAH = "/data/dump/"; 
  87.      private static final String DATE_FORMAT_STRING = "yyyyMMdd_hhmmss"; 
  88.      private static final String DUMP_IMAGE_FORMAT = ".png"; 
  89. - 
  90. +    private int screenWidth, screenHeight; 
  91. +    private int ori; 
  92. +    private int orl; 
  93.      public ViewRootImpl(Context context, Display display) { 
  94.          mContext = context; 
  95.          mWindowSession = WindowManagerGlobal.getWindowSession(); 
  96.          mDisplay = display; 
  97.          mBasePackageName = context.getBasePackageName(); 
  98. +        screenWidth=display.getWidth(); 
  99. +        screenHeight=display.getHeight(); 
  100. +        Log.d("houcongxi","screenWidth:"+screenWidth+"---,screenHeight:"+screenHeight); 
  101.   
  102.          mDisplayAdjustments = display.getDisplayAdjustments(); 
  103.   
  104. @@ -496,6 +516,17 @@ public final class ViewRootImpl implements ViewParent, 
  105.          mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); 
  106.          loadSystemProperties(); 
  107. +        Configuration mCon=mContext.getResources().getConfiguration(); 
  108. +        orl= mCon.orientation; 
  109. +        Log.d("houcongxi",orl+"+++++++++++++++++++++++"); 
  110. +        IntentFilter mOriIntentFilter = new IntentFilter(); 
  111. +        mOriIntentFilter.addAction("Configuration_orientation"); 
  112. +        mContext.registerReceiver(mOriBroadcastReceiver, mOriIntentFilter); 
  113. + 
  114.          /** 
  115.           * M: increase instance count and check log property to determine 
  116.           * whether to enable/disable log system. @{ 
  117. @@ -514,6 +545,20 @@ public final class ViewRootImpl implements ViewParent, 
  118.          /** @} */  
  119.      }  
  120. +    private BroadcastReceiver mOriBroadcastReceiver = new BroadcastReceiver(){  
  121. +       @Override  
  122. +            public void onReceive(Context context, Intent intent) {  
  123. +                String action = intent.getAction();  
  124. +                if(action.equals("Configuration_orientation")){  
  125. +                ori=intent.getIntExtra("ori_status",0);  
  126. +                Log.d("houcongxi",ori+"ori++++++++++++++");  
  127. +                }  
  128. +            }  
  129. +    };  
  130.      public static void addFirstDrawHandler(Runnable callback) {  
  131.          synchronized (sFirstDrawHandlers) {  
  132.              if (!sFirstDrawComplete) {  
  133. @@ -4744,7 +4789,15 @@ public final class ViewRootImpl implements ViewParent,  
  134.              }  
  135.              return FORWARD;  
  136.          }  
  137. -  
  138. +        private float startY = 0;  
  139. +        private float endY = 0;  
  140. +        private float startX = 0;  
  141. +        private float endX = 0;  
  142. +      
  143. @@ -4761,12 +4814,34 @@ public final class ViewRootImpl implements ViewParent,  
  144.              final MotionEvent event = (MotionEvent)q.mEvent;  
  145.              mAttachInfo.mUnbufferedDispatchRequested = false;  
  146.              boolean handled = mView.dispatchPointerEvent(event);  
  147. +            int action = event.getAction();  
  148.    
  149. +            switch (action & MotionEvent.ACTION_MASK) {  
  150. +                case  MotionEvent.ACTION_DOWN:  
  151. +                    startY = event.getY();  
  152. +                    startX = event.getX();  
  153. +                    break;  
  154. +                case MotionEvent.ACTION_UP:  
  155. +                    endY = event.getY();  
  156. +                    endX = event.getX();  
  157. +                    Intent mIntent = new Intent("forceAddNavigationBar");  
  158. +                    if(startY - endY > 8&&(endY>screenHeight-460)&&(ori==1||orl==1)){  
  159. +                        Log.d("houcongxi","Swipe up");  
  160. +                        mContext.sendBroadcast(mIntent);  
  161. +                    }else if(startX - endX > 8&&(endX>screenWidth-460&&(ori==2||orl==2))){  
  162. +                        Log.d("houcongxi","swipe left");  
  163. +                        mContext.sendBroadcast(mIntent);  
  164. +                    }   
  165. +                    break;  
  166. +            }  
  167.              if(FeatureOption.VANZO_FEATURE_GOLBAL_3FINGER_SCREENSHOT){  
  168. -                int action = event.getAction();  
  169.                  if(event.getPointerCount() > 3){  
  170.                      mPointerCount = false;  
  171.                      mThreeClick = true;  
  172. diff --git a/base/packages/SettingsProvider/res/values/defaults.xml b/base/packages/SettingsProvider/res/values/defaults.xml  
  173. index 5d7ea01..71f289f 100644  
  174. --- a/base/packages/SettingsProvider/res/values/defaults.xml  
  175. +++ b/base/packages/SettingsProvider/res/values/defaults.xml  
  176. @@ -184,6 +184,9 @@  
  177.           Override to disable immersive mode confirmation for certain packages. -->  
  178.      <string name="def_immersive_mode_confirmations" translatable="false"></string>  
  179.    
  180. +    <!-- Defaults for Settings.System.DEV_FORCE_SHOW_NAVBAR. -->  
  181. +    <integer name="def_force_disable_navkeys">0</integer>  
  182. +  
  183.      <!-- Default for Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE -->  
  184.      <integer name="def_wifi_scan_always_available">0</integer>  
  185.    
  186. diff --git a/base/packages/SystemUI/res/layout/navigation_bar.xml b/base/packages/SystemUI/res/layout/navigation_bar.xml  
  187. index c92ba45..d98d4f0 100644  
  188. --- a/base/packages/SystemUI/res/layout/navigation_bar.xml  
  189. +++ b/base/packages/SystemUI/res/layout/navigation_bar.xml  
  190. @@ -43,7 +43,23 @@  
  191.    
  192.              <!-- navigation controls -->  
  193.              <View  
  194. -                android:layout_width="@dimen/navigation_side_padding"  
  195. +                android:id="@+id/divider_view"  
  196. +                android:layout_width="5dp"  
  197. +                android:layout_height="match_parent"  
  198. +                android:layout_weight="0"  
  199. +                android:visibility="invisible"  
  200. +                />  
  201. +            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"  
  202. +                android:layout_width="35dp"  
  203. +                android:layout_height="match_parent"  
  204. +                android:src="@drawable/ic_hide_navigationbar_x"  
  205. +                android:layout_weight="0"  
  206. +                android:scaleType="center"  
  207. +                android:contentDescription="@string/accessibility_back"  
  208. +                />  
  209. +  
  210. +            <View  
  211. +                android:layout_width="10dp"  
  212.                  android:layout_height="match_parent"  
  213.                  android:layout_weight="0"  
  214.                  android:visibility="invisible"  
  215. @@ -56,6 +72,7 @@  
  216.                  android:layout_weight="0"  
  217.                  android:scaleType="center"  
  218.                  android:contentDescription="@string/accessibility_back"  
  219. +                android:paddingRight="-20dp"  
  220.                  />  
  221.              <View  
  222.                  android:layout_width="0dp"  
  223. @@ -72,6 +89,7 @@  
  224.                  android:layout_weight="0"  
  225.                  android:scaleType="center"  
  226.                  android:contentDescription="@string/accessibility_home"  
  227. +                android:paddingRight="-20dp"  
  228.                  />  
  229.              <View  
  230.                  android:layout_width="0dp"  
  231. @@ -86,6 +104,7 @@  
  232.                  android:layout_weight="0"  
  233.                  android:scaleType="center"  
  234.                  android:contentDescription="@string/accessibility_recent"  
  235. +                android:paddingRight="-20dp"  
  236.                  />  
  237.              <FrameLayout  
  238.                  android:layout_width="@dimen/navigation_side_padding"  
  239. @@ -260,6 +279,21 @@  
  240.                  android:contentDescription="@string/accessibility_back"  
  241.                  />  
  242.              <View  
  243. +                android:layout_height="match_parent"  
  244. +                android:layout_width="match_parent"  
  245. +                android:layout_weight="1"  
  246. +                android:visibility="invisible"  
  247. +                />  
  248. +            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"  
  249. +                android:layout_height="@dimen/navigation_key_width"  
  250. +                android:layout_width="match_parent"  
  251. +                android:src="@drawable/ic_hide_navigationbar_y"  
  252. +                android:scaleType="center"  
  253. +                android:layout_weight="0"  
  254. +                android:contentDescription="@string/accessibility_back"  
  255. +                />  
  256. +            <View  
  257. +                android:id="@+id/divider_view"  
  258.                  android:layout_height="@dimen/navigation_side_padding"  
  259.                  android:layout_width="match_parent"  
  260.                  android:layout_weight="0"  
  261. 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  
  262. index a0d07a0..24dcf14 100644  
  263. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java  
  264. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java  
  265. @@ -68,6 +68,15 @@ import com.mediatek.multiwindow.MultiWindowProxy;  
  266.  import com.mediatek.systemui.ext.DefaultNavigationBarPlugin;  
  267.  import com.mediatek.systemui.ext.INavigationBarPlugin;  
  268.  import android.os.UserHandle;  
  269. +import android.content.Intent;  
  270. +import android.provider.Settings;  
  271. +import android.content.BroadcastReceiver;  
  272. +import android.os.SystemProperties;  
  273. +import android.content.IntentFilter;  
  274.    
  275.    
  276.    
  277. @@ -214,6 +223,13 @@ public class NavigationBarView extends LinearLayout {  
  278.    
  279.      public NavigationBarView(Context context, AttributeSet attrs) {  
  280.          super(context, attrs);  
  281. +         IntentFilter mAddIntentFilter = new IntentFilter();  
  282. +         mAddIntentFilter.addAction("refresh_navigationbar_for_ic");  
  283. +         mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);  
  284.    
  285.          mDisplay = ((WindowManager)context.getSystemService(  
  286.                  Context.WINDOW_SERVICE)).getDefaultDisplay();  
  287. @@ -544,6 +560,17 @@ public class NavigationBarView extends LinearLayout {  
  288.          mCurrentView = mRotatedViews[Surface.ROTATION_0];  
  289.    
  290.          getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);  
  291. +    if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"true)) {  
  292. +            getCollapseButton().setOnClickListener(mCollapseClickListener);  
  293. +        } else {  
  294. +            getCollapseButton().setVisibility(View.GONE);  
  295. +            getDividerView().setVisibility(View.GONE);  
  296. +        }  
  297.    
  298.          updateRTLOrder();  
  299.      }  
  300. @@ -565,6 +592,22 @@ public class NavigationBarView extends LinearLayout {  
  301.    
  302.          mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);  
  303. +        if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"true)) {  
  304. +            //  if (getCollapseButton() != null) {  
  305. +            getCollapseButton().setOnClickListener(mCollapseClickListener);  
  306. +            //  }  
  307. +        } else {  
  308. +            //  if (getCollapseButton() != null) {  
  309. +            getCollapseButton().setVisibility(View.GONE);  
  310. +            getDividerView().setVisibility(View.GONE);  
  311. +            //  }   
  312. +        }  
  313. +  
  314.          // force the low profile & disabled states into compliance  
  315.          mBarTransitions.init();  
  316.          setDisabledFlags(mDisabledFlags, true /* force */);  
  317. @@ -787,6 +830,53 @@ public class NavigationBarView extends LinearLayout {  
  318.      public interface OnVerticalChangedListener {  
  319.          void onVerticalChanged(boolean isVertical);  
  320.      }  
  321. +    public View getCollapseButton() {  
  322. +        return mCurrentView.findViewById(R.id.collapse);  
  323. +    }  
  324. +  
  325. +    public View getDividerView() {  
  326. +        return mCurrentView.findViewById(R.id.divider_view);  
  327. +    }  
  328. +  
  329. +    private final OnClickListener mCollapseClickListener = new OnClickListener() {  
  330. +        @Override  
  331. +            public void onClick(View view) {  
  332. +                Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  333. +                Log.d("houcongxi","onclick:"+Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,-1));  
  334. +                Intent mIntent = new Intent("removeNavigationBar");  
  335. +                if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"false)) {  
  336. +                    mContext.sendBroadcast(mIntent);  
  337. +                }  
  338. +            }  
  339. +    };  
  340. +    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){  
  341. +        @Override  
  342. +            public void onReceive(Context context, Intent intent) {  
  343. +                String action = intent.getAction();  
  344. +                //让他消失,然后在出现的广播,动画以后做  
  345. +                Intent mIntent = new Intent("removeNavigationBar");  
  346. +                mContext.sendBroadcast(mIntent);  
  347. +                new Handler().postDelayed(new Runnable(){  
  348. +                        public void run() {  
  349. +                        Intent nIntent = new Intent("forceAddNavigationBar");  
  350. +                        mContext.sendBroadcast(nIntent);  
  351. +                        }  
  352. +                        }, 700);  
  353. +  
  354. +                /*   if(getCollapseButton().getVisibility()==View.VISIBLE){ 
  355. +                     getCollapseButton().setVisibility(View.GONE); 
  356. +                     getDividerView().setVisibility(View.GONE); 
  357. +                     }else{ 
  358. +                     getCollapseButton().setOnClickListener(mCollapseClickListener); 
  359. +                     getCollapseButton().setVisibility(View.VISIBLE); 
  360. +                     getDividerView().setVisibility(View.VISIBLE); 
  361. +                     }*/  
  362. +            }  
  363. +    };  
  364.    
  365.      /// M: add for multi window @{  
  366.      private BroadcastReceiver mFloatWindowBroadcastReceiver = new BroadcastReceiver() {  
  367. 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  
  368. index 392b6b7..2113397 100644  
  369. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java  
  370. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java  
  371. @@ -416,6 +416,43 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  372.    
  373.      // ensure quick settings is disabled until the current user makes it through the setup wizard  
  374.      private boolean mUserSetup = false;  
  375. +  
  376. +    private void forceAddNavigationBar() {  
  377. +        // If we have no Navbar view and we should have one, create it  
  378. +        if (mNavigationBarView != null) {  
  379. +            return;  
  380. +        }  
  381. +        removeNavigationBar();  
  382. +        android.util.Log.e("houcongxi""================="+mNavigationBarView);  
  383. +  
  384. +        mNavigationBarView =  
  385. +            (NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);  
  386. +  
  387. +        mNavigationBarView.setDisabledFlags(mDisabled1);  
  388. +        //mNavigationBarView.setDisabledFlags(mDisabled2);  
  389. +        mNavigationBarView.setBar(this);  
  390. +        mNavigationBarView.setBackgroundColor(0x00000000);  
  391. +        //mNavigationBarView.invalidate();  
  392. +  
  393. +        android.util.Log.e("houcongxi""========222========"+mNavigationBarView);  
  394. +        addNavigationBar();  
  395. +        repositionNavigationBar();  
  396. +  
  397. +    }  
  398. +    private void removeNavigationBar() {  
  399. +        if (mNavigationBarView == nullreturn;  
  400. +        if (mNavigationBarView != null) {  
  401. +            mWindowManager.removeViewImmediate(mNavigationBarView);  
  402. +            mNavigationBarView = null;  
  403. +        }  
  404. +  
  405. +        //mWindowManager.removeView(mNavigationBarView);  
  406. +        //mNavigationBarView = null;  
  407. +    }  
  408.      private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) {  
  409.          @Override  
  410.          public void onChange(boolean selfChange) {  
  411. @@ -1123,6 +1160,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  412.          ThreadedRenderer.overrideProperty("ambientRatio", String.valueOf(1.5f));  
  413.          mStatusBarPlmnPlugin.addPlmn((LinearLayout)mStatusBarView.  
  414.                                       findViewById(R.id.status_bar_contents), mContext);  
  415. +        IntentFilter mAddIntentFilter = new IntentFilter();  
  416. +        mAddIntentFilter.addAction("removeNavigationBar");  
  417. +        mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);  
  418. +  
  419. +        IntentFilter mRemIntentFilter = new IntentFilter();  
  420. +        mRemIntentFilter.addAction("forceAddNavigationBar");  
  421. +        mContext.registerReceiver(mrBroadcastReceiver, mRemIntentFilter);  
  422.    
  423.          return mStatusBarView;  
  424.      }  
  425. @@ -4514,6 +4562,31 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  426.      }  
  427.      /// M: Support "Operator plugin - Customize Carrier Label for PLMN". @}  
  428.    
  429. +    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){  
  430. +        @Override  
  431. +            public void onReceive(Context context, Intent intent) {  
  432. +                String action = intent.getAction();  
  433. +                int num=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,0);  
  434. +                boolean visible=(num==1)?true:false;  
  435. +                Log.d("houcongxi","===visible:"+visible);  
  436. +                if(action.equals("removeNavigationBar")){  
  437. +                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  438. +                    removeNavigationBar();  
  439. +                }else if(action.equals("forceAddNavigationBar")&&!visible){  
  440. +                    forceAddNavigationBar();  
  441. +                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);  
  442. +  
  443. +                    int num2=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,1);  
  444. +                    boolean visible2=(num2==1)?true:false;  
  445. +                    Log.d("houcongxi","-----visible2:"+visible2);  
  446. +                }  
  447. +            }  
  448. +    };  
  449. +// End of Vanzo:houcongxi  
  450. +  
  451.      /// M:add for multi window @{  
  452.      public void registerMWProxyAgain()  
  453.      {  
  454. diff --git a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  455. index 65f9eb2..c848034 100644  
  456. --- a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  457. +++ b/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  458. @@ -1859,8 +1859,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {  
  459.          String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");  
  460.          if ("1".equals(navBarOverride)) {  
  461.              mHasNavigationBar = false;  
  462. +            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  463.          } else if ("0".equals(navBarOverride)) {  
  464.              mHasNavigationBar = true;  
  465. +            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);  
  466.          }  
  467.    
  468.          // 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)

[java]  view plain  copy
  1. diff --git a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  2.  index 4a7183a..06560bb 100644  
  3.  --- a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  4.  +++ b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  5.  @@ -348,7 +348,7 @@ public class UsbDeviceManager {  
  6.           // current USB state  
  7.           private boolean mConnected;  
  8.           private boolean mConfigured;  
  9.  -        private boolean mUsbDataUnlocked;  
  10.  +        private boolean mUsbDataUnlocked = true;  
  11.           private String mCurrentFunctions;  
  12.           private boolean mCurrentFunctionsApplied;  
  13.           private UsbAccessory mCurrentAccessory;  
  14.  @@ -1134,7 +1134,7 @@ public class UsbDeviceManager {  
  15.                       mUsbConfigured = mConfigured;  
  16.                       if (!mConnected) {  
  17.                           // When a disconnect occurs, relock access to sensitive user data  
  18.  -                        mUsbDataUnlocked = false;  
  19.  +                        //mUsbDataUnlocked = false;  
  20.                      }  
  21.                       updateUsbNotification();  
  22.                      updateAdbNotification();  
  23.  @@ -1143,7 +1143,7 @@ public class UsbDeviceManager {  
  24.                          updateCurrentAccessory();  
  25.                      } else if (!mConnected) {  
  26.                          // restore defaults when USB is disconnected  
  27. -                        setEnabledFunctions(nullfalse);  
  28. +                        //setEnabledFunctions(null, false);  
  29.                      }  
  30.                      if (mBootCompleted) {  
  31.                          updateUsbStateBroadcast();  

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

(frameworks/)

[java]  view plain  copy
  1. diff --git a/base/api/current.txt b/base/api/current.txt  
  2. index d7fdb2d..d23c46a 100644  
  3. --- a/base/api/current.txt  
  4. +++ b/base/api/current.txt  
  5. @@ -32521,6 +32521,7 @@ package android.text.format {  
  6.      method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);  
  7.      method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);  
  8.      method public static java.text.DateFormat getDateFormat(android.content.Context);  
  9. +    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);  
  10.      method public static char[] getDateFormatOrder(android.content.Context);  
  11.      method public static java.text.DateFormat getLongDateFormat(android.content.Context);  
  12.      method public static java.text.DateFormat getMediumDateFormat(android.content.Context);  
  13. diff --git a/base/api/system-current.txt b/base/api/system-current.txt  
  14. index 3c88e59..193bd36 100644  
  15. --- a/base/api/system-current.txt  
  16. +++ b/base/api/system-current.txt  
  17. @@ -34813,6 +34813,7 @@ package android.text.format {  
  18.      method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);  
  19.      method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);  
  20.      method public static java.text.DateFormat getDateFormat(android.content.Context);  
  21. +    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);  
  22.      method public static char[] getDateFormatOrder(android.content.Context);  
  23.      method public static java.text.DateFormat getLongDateFormat(android.content.Context);  
  24.      method public static java.text.DateFormat getMediumDateFormat(android.content.Context);  
  25. diff --git a/base/core/java/android/text/format/DateFormat.java b/base/core/java/android/text/format/DateFormat.java  
  26. index 8d5555d..1555939 100755  
  27. --- a/base/core/java/android/text/format/DateFormat.java  
  28. +++ b/base/core/java/android/text/format/DateFormat.java  
  29. @@ -292,7 +292,14 @@ public class DateFormat {  
  30.       * @return the {@link java.text.DateFormat} object that properly formats the date.  
  31.       */  
  32.      public static java.text.DateFormat getDateFormat(Context context) {  
  33. +/* 
  34. + * add choose date format 
  35.          return java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); 
  36. + */  
  37. +        String value = Settings.System.getString(context.getContentResolver(),  
  38. +                Settings.System.DATE_FORMAT);  
  39. +        return getDateFormatForSetting(context, value);  
  40.      }  
  41.    
  42.      /** 
  43. @@ -325,9 +332,16 @@ public class DateFormat { 
  44.       * order returned here. 
  45.       */  
  46.      public static char[] getDateFormatOrder(Context context) {  
  47. +/*  
  48. + * add choose date format 
  49.          return ICU.getDateFormatOrder(getDateFormatString()); 
  50. + */  
  51. +        return ICU.getDateFormatOrder(getDateFormatString(context));  
  52.      }  
  53.    
  54. +/*  
  55. + * add choose date format 
  56.      private static String getDateFormatString() { 
  57.          java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); 
  58.          if (df instanceof SimpleDateFormat) { 
  59. @@ -336,6 +350,13 @@ public class DateFormat { 
  60.   
  61.          throw new AssertionError("!(df instanceof SimpleDateFormat)"); 
  62.      } 
  63. + */  
  64. +    private static String getDateFormatString(Context context) {  
  65. +        String value = Settings.System.getString(context.getContentResolver(),  
  66. +                Settings.System.DATE_FORMAT);  
  67. +        return getDateFormatStringForSetting(context, value);  
  68. +    }  
  69.    
  70.      /** 
  71.       * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a 
  72. @@ -636,4 +657,116 @@ public class DateFormat { 
  73.      private static String zeroPad(int inValue, int inMinDigits) { 
  74.          return String.format(Locale.getDefault(), "%0" + inMinDigits + "d", inValue); 
  75.      } 
  76. +/*  
  77. + * TODO: replace this line with your comment 
  78. + */  
  79. +  
  80. +    public static java.text.DateFormat getDateFormatForSetting(Context context, String value) {  
  81. +        String format = getDateFormatStringForSetting(context, value);  
  82. +        return new java.text.SimpleDateFormat(format);  
  83. +    }  
  84. +  
  85. +    private static String getDateFormatStringForSetting(Context context, String value) {  
  86. +        String result = null;  
  87. +        if (value != null) {  
  88. +            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{  
  89. +            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";  
  90. +            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";  
  91. +            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";  
  92. +            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";  
  93. +  
  94. +            int day = value.indexOf(dayValue);  
  95. +            int month = value.indexOf(monthValue);  
  96. +            int year = value.indexOf(yearValue);  
  97. +            int week = value.indexOf(weekValue);  
  98. +  
  99. +            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {  
  100. +                String template = null;  
  101. +                if (week < day) {  
  102. +                    if (year < month && year < day) {  
  103. +                        if (month < day) {  
  104. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);  
  105. +                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);  
  106. +                        } else {  
  107. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);  
  108. +                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);  
  109. +                        }  
  110. +                    } else if (month < day) {  
  111. +                        if (day < year) {  
  112. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  113. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  114. +                        } else {  
  115. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  116. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  117. +                        }  
  118. +                    } else {  
  119. +                        if (month < year) {  
  120. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  121. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  122. +                        } else {  
  123. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  124. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  125. +                        }  
  126. +                    }  
  127. +                } else {  
  128. +                    if (year < month && year < day) {  
  129. +                        if (month < day) {  
  130. +                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);  
  131. +                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);  
  132. +                        } else {  
  133. +                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);  
  134. +                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);  
  135. +                        }  
  136. +                    } else if (month < day) {  
  137. +                        if (day < year) {  
  138. +                            template = context.getString(com.mediatek.internal.R.string.month_day_year_wday);  
  139. +                            result = String.format(template, monthValue, dayValue, yearValue, weekValue);  
  140. +                        } else {  
  141. +                            template = context.getString(com.mediatek.internal.R.string.month_year_day_wday);  
  142. +                            result = String.format(template, monthValue, yearValue, dayValue, weekValue);  
  143. +                        }  
  144. +                    } else {  
  145. +                        if (month < year) {  
  146. +                            template = context.getString(com.mediatek.internal.R.string.day_month_year_wday);  
  147. +                            result = String.format(template, dayValue, monthValue, yearValue, weekValue);  
  148. +                        } else {  
  149. +                            template = context.getString(com.mediatek.internal.R.string.day_year_month_wday);  
  150. +                            result = String.format(template, dayValue, yearValue, monthValue, weekValue);  
  151. +                        }  
  152. +                    }  
  153. +                }  
  154. +  
  155. +                return result;  
  156. +                /// M: @}  
  157. +        } else if (month >= 0 && day >= 0 && year >= 0) {  
  158. +            String template = context.getString(com.android.internal.R.string.numeric_date_template);  
  159. +            if (year < month && year < day) {  
  160. +                if (month < day) {  
  161. +                    result = String.format(template, yearValue, monthValue, dayValue);  
  162. +                } else {  
  163. +                    result = String.format(template, yearValue, dayValue, monthValue);  
  164. +                }  
  165. +            } else if (month < day) {  
  166. +                if (day < year) {  
  167. +                    result = String.format(template, monthValue, dayValue, yearValue);  
  168. +                } else { // unlikely  
  169. +                    result = String.format(template, monthValue, yearValue, dayValue);  
  170. +                }  
  171. +            } else { // date < month  
  172. +                if (month < year) {  
  173. +                    result = String.format(template, dayValue, monthValue, yearValue);  
  174. +                } else { // unlikely  
  175. +                    result = String.format(template, dayValue, yearValue, monthValue);  
  176. +                }  
  177. +            }  
  178. +  
  179. +            return result;  
  180. +        }  
  181. +        }  
  182. +  
  183. +        // The setting is not set; use the locale's default.  
  184. +        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);  
  185. +        return d.shortDateFormat4;  
  186. +    }  
  187.  }  
  188. diff --git a/base/core/res/res/values/donottranslate-cldr.xml b/base/core/res/res/values/donottranslate-cldr.xml  
  189. index a8e2b2b..80db6e4 100755  
  190. --- a/base/core/res/res/values/donottranslate-cldr.xml  
  191. +++ b/base/core/res/res/values/donottranslate-cldr.xml  
  192. @@ -1,6 +1,7 @@  
  193.  <?xml version="1.0" encoding="UTF-8"?>  
  194.  <resources xmlns:android="http://schemas.android.com/apk/res/android"  
  195.      xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  196. +    <string name="numeric_date_template">"%s/%s/%s"</string>  
  197.      <string name="month_day_year">%B %-e, %Y</string>  
  198.      <string name="time_of_day">%-l:%M:%S %p</string>  
  199.      <string name="date_and_time">%b %-e, %Y, %-l:%M:%S %p</string>  
  200. diff --git a/base/core/res/res/values/symbols.xml b/base/core/res/res/values/symbols.xml  
  201. index e9faf09..50a869a 100644  
  202. --- a/base/core/res/res/values/symbols.xml  
  203. +++ b/base/core/res/res/values/symbols.xml  
  204. @@ -2325,7 +2325,7 @@  
  205.     <java-symbol type="string" name="global_action_reboot" />  
  206.     <java-symbol type="string" name="reboot_confirm_question" />  
  207.     <java-symbol type="string" name="reboot_confirm" />  
  208. -  
  209. +   <java-symbol type="string" name="numeric_date_template" />  
  210.  <!-- Vanzo:tanglei on: Wed, 21 Jan 2015 11:47:03 +0800  
  211.  -->  
  212.    <!-- For Smart Wake -->  
  213. diff --git a/base/packages/Keyguard/res/values/strings_custom.xml b/base/packages/Keyguard/res/values/strings_custom.xml  
  214. new file mode 100755  
  215. index 0000000..c688ae5  
  216. --- /dev/null  
  217. +++ b/base/packages/Keyguard/res/values/strings_custom.xml  
  218. @@ -0,0 +1,4 @@  
  219. +<?xml version="1.0" encoding="utf-8"?>  
  220. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  221. +    <string name="default_date_format"><xliff:g id="default_date_format">dd-MM-yyyy</xliff:g></string>  
  222. +</resources>  
  223. diff --git a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  224. index 86244b8..6c22fea 100644  
  225. --- a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  226. +++ b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  227. @@ -35,6 +35,12 @@ import android.widget.GridLayout;  
  228.  import android.widget.LinearLayout;  
  229.  import android.widget.TextClock;  
  230.  import android.widget.TextView;  
  231. +/*  
  232. + * add choose date format 
  233. + */  
  234. +import android.provider.Settings;  
  235. +import libcore.icu.LocaleData;  
  236.    
  237.  import com.android.internal.widget.LockPatternUtils;  
  238.    
  239. @@ -165,8 +171,17 @@ public class KeyguardStatusView extends GridLayout {  
  240.      }  
  241.    
  242.      public void refreshTime() {  
  243. +/*  
  244. + * add choose date format 
  245.          mDateView.setFormat24Hour(Patterns.dateView); 
  246.          mDateView.setFormat12Hour(Patterns.dateView); 
  247. + */  
  248. +        String dateFormat = getCustomDateFormatString(mContext);  
  249. +        if (dateFormat == null || "".equals(dateFormat))  
  250. +            dateFormat = getResources().getString(R.string.default_date_format);  
  251. +        mDateView.setFormat24Hour(dateFormat);  
  252. +        mDateView.setFormat12Hour(dateFormat);  
  253.    
  254.          if (bA1Support) {  
  255.              mClockView.setFormat12Hour(Patterns.clockView12);  
  256. @@ -286,4 +301,118 @@ public class KeyguardStatusView extends GridLayout {  
  257.              cacheKey = key;  
  258.          }  
  259.      }  
  260. +  
  261. +/*  
  262. + * add choose date format 
  263. + * this part was ported from 82lp 
  264. +*/  
  265. +    private String getCustomDateFormatString(Context context) {  
  266. +        String value = Settings.System.getString(context.getContentResolver(),  
  267. +                Settings.System.DATE_FORMAT);  
  268. +        return getDateFormatStringForSetting(context, value);  
  269. +    }  
  270. +  
  271. +    private String getDateFormatStringForSetting(Context context, String value) {  
  272. +        String result = null;  
  273. +        if (value != null) {  
  274. +            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{  
  275. +            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";  
  276. +            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";  
  277. +            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";  
  278. +            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";  
  279. +  
  280. +            int day = value.indexOf(dayValue);  
  281. +            int month = value.indexOf(monthValue);  
  282. +            int year = value.indexOf(yearValue);  
  283. +            int week = value.indexOf(weekValue);  
  284. +  
  285. +            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {  
  286. +                String template = null;  
  287. +                if (week < day) {  
  288. +                    if (year < month && year < day) {  
  289. +                        if (month < day) {  
  290. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);  
  291. +                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);  
  292. +                        } else {  
  293. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);  
  294. +                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);  
  295. +                        }  
  296. +                    } else if (month < day) {  
  297. +                        if (day < year) {  
  298. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  299. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  300. +                        } else {  
  301. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  302. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  303. +                        }  
  304. +                    } else {  
  305. +                        if (month < year) {  
  306. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  307. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  308. +                        } else {  
  309. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  310. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  311. +                        }  
  312. +                    }  
  313. +                } else {  
  314. +                    if (year < month && year < day) {  
  315. +                        if (month < day) {  
  316. +                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);  
  317. +                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);  
  318. +                        } else {  
  319. +                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);  
  320. +                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);  
  321. +                        }  
  322. +                    } else if (month < day) {  
  323. +                        if (day < year) {  
  324. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  325. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  326. +                        } else {  
  327. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  328. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  329. +                        }  
  330. +                    } else {  
  331. +                        if (month < year) {  
  332. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  333. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  334. +                        } else {  
  335. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  336. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  337. +                        }  
  338. +                    }  
  339. +                }  
  340. +  
  341. +                return result;  
  342. +                /// M: @}  
  343. +        } else if (month >= 0 && day >= 0 && year >= 0) {  
  344. +            String template = context.getString(com.android.internal.R.string.numeric_date_template);  
  345. +            if (year < month && year < day) {  
  346. +                if (month < day) {  
  347. +                    result = String.format(template, yearValue, monthValue, dayValue);  
  348. +                } else {  
  349. +                    result = String.format(template, yearValue, dayValue, monthValue);  
  350. +                }  
  351. +            } else if (month < day) {  
  352. +                if (day < year) {  
  353. +                    result = String.format(template, monthValue, dayValue, yearValue);  
  354. +                } else { // unlikely  
  355. +                    result = String.format(template, monthValue, yearValue, dayValue);  
  356. +                }  
  357. +            } else { // date < month  
  358. +                if (month < year) {  
  359. +                    result = String.format(template, dayValue, monthValue, yearValue);  
  360. +                } else { // unlikely  
  361. +                    result = String.format(template, dayValue, yearValue, monthValue);  
  362. +                }  
  363. +            }  
  364. +  
  365. +            return result;  
  366. +        }  
  367. +        }  
  368. +  
  369. +        // The setting is not set; use the locale's default.  
  370. +        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);  
  371. +        return d.shortDateFormat4;  
  372. +    }  
  373.  }  
  374. 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  
  375. index 186005c..d9eaabc 100644  
  376. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java  
  377. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java  
  378. @@ -31,6 +31,11 @@ import java.text.SimpleDateFormat;  
  379.  import java.util.Date;  
  380.  import java.util.Locale;  
  381.    
  382. +/*  
  383. + */  
  384. +import java.util.Calendar;  
  385. +import android.text.format.DateFormat;  
  386. +// End of Vanzo:songlixin  
  387.  public class DateView extends TextView {  
  388.      private static final String TAG = "DateView";  
  389.    
  390. @@ -98,6 +103,8 @@ public class DateView extends TextView {  
  391.      }  
  392.    
  393.      protected void updateClock() {  
  394. +/*  
  395. + * porting jb2->kk #53983 
  396.          if (mDateFormat == null) { 
  397.              final Locale l = Locale.getDefault(); 
  398.              final String fmt = DateFormat.getBestDateTimePattern(l, mDatePattern); 
  399. @@ -111,5 +118,10 @@ public class DateView extends TextView { 
  400.              setText(text); 
  401.              mLastText = text; 
  402.          } 
  403. + */  
  404. +        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(mContext);  
  405. +        final Calendar now = Calendar.getInstance();  
  406. +        setText(shortDateFormat.format(now.getTime()));  
  407.      }  
  408.  }  
packages/apps/Settings/

[java]  view plain  copy
  1. diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml  
  2. index 39d8743..f169374 100644  
  3. --- a/res/xml/date_time_prefs.xml  
  4. +++ b/res/xml/date_time_prefs.xml  
  5. @@ -53,4 +53,12 @@  
  6.          android:title="@string/date_time_24hour"  
  7.          />  
  8.    
  9. +<!--  
  10. +add date format  
  11. +-->  
  12. +    <ListPreference  
  13. +        android:key="date_format"  
  14. +        android:title="@string/date_time_date_format"  
  15. +        android:summary="dd/MM/yyyy"/>  
  16.  </PreferenceScreen>  
  17. diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java  
  18. index 474f026..fed3f03 100644  
  19. --- a/src/com/android/settings/DateTimeSettings.java  
  20. +++ b/src/com/android/settings/DateTimeSettings.java  
  21. @@ -81,6 +81,12 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  22.      private SwitchPreference mAutoTimeZonePref;  
  23.      private Preference mTimeZone;  
  24.      private Preference mDatePref;  
  25. +/* 
  26. + * add date format 
  27. + */  
  28. +    private static final String KEY_DATE_FORMAT = "date_format";  
  29. +    private ListPreference mDateFormat;  
  30.    
  31.      // /M: add for GPS time sync feature @{  
  32.      private static final int DIALOG_GPS_CONFIRM = 2;  
  33. @@ -151,8 +157,50 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  34.          mTime24Pref = findPreference("24 hour");  
  35.          mTimeZone = findPreference("timezone");  
  36.          mDatePref = findPreference("date");  
  37. +/* 
  38. + * add date format 
  39. +        if (isFirstRun) { 
  40. +            getPreferenceScreen().removePreference(mTime24Pref); 
  41. +        } 
  42. + */  
  43. +        mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);  
  44. +        if (isFirstRun) {  
  45. +            getPreferenceScreen().removePreference(mTime24Pref);  
  46. +            getPreferenceScreen().removePreference(mDateFormat);  
  47. +        }  
  48. +        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);  
  49. +        String [] formattedDates = new String[dateFormats.length];  
  50. +        String currentFormat = getDateFormat();  
  51. +        // Initialize if DATE_FORMAT is not set in the system settings  
  52. +        // This can happen after a factory reset (or data wipe)  
  53. +        if (currentFormat == null) {  
  54. +            currentFormat = "";  
  55. +        }  
  56. +  
  57. +        // Prevents duplicated values on date format selector.  
  58. +        mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 311300);  
  59. +  
  60. +        for (int i = 0; i < formattedDates.length; i++) {  
  61. +/* 
  62. + * TODO: replace this line with your comment 
  63. +            String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime()); 
  64. + */  
  65. +            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());  
  66. +  
  67. +            if (dateFormats[i].length() == 0) {  
  68. +                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);  
  69. +            } else {  
  70. +                formattedDates[i] = formatted;  
  71. +            }  
  72. +        }  
  73. +  
  74. +        mDateFormat.setEntries(formattedDates);  
  75. +        mDateFormat.setEntryValues(R.array.date_format_values);  
  76. +        mDateFormat.setValue(currentFormat);  
  77. +  
  78.    
  79. -        // /M: modify as MTK add GPS time Sync feature  
  80.          boolean autoEnabled = autoTimeEnabled || autoTimeGpsEnabled;  
  81.          mTimePref.setEnabled(!autoEnabled);  
  82.          mDatePref.setEnabled(!autoEnabled);  
  83. @@ -193,18 +241,51 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  84.          // We use 13:00 so we can demonstrate the 12/24 hour options.  
  85.          mDummyDate.set(now.get(Calendar.YEAR), 11311300);  
  86.          Date dummyDate = mDummyDate.getTime();  
  87. +/* 
  88. + * add date format 
  89. + */  
  90. +        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);  
  91. +        mDateFormat.setSummary(shortDateFormat.format(dummyDate));  
  92. +  
  93.          mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));  
  94.          mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));  
  95.          mTimeZone.setSummary(ZoneGetter.getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime()));  
  96.          mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));  
  97.      }  
  98.    
  99. +/* 
  100. + * add date format 
  101. + */  
  102. +    private void updateDateFormatEntries() {  
  103. +        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);  
  104. +        String [] formattedDates = new String[dateFormats.length];  
  105. +        for (int i = 0; i < formattedDates.length; i++) {  
  106. +          //  String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime());  
  107. +            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());  
  108. +            if (dateFormats[i].length() == 0) {  
  109. +                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);  
  110. +            } else {  
  111. +                formattedDates[i] = formatted;  
  112. +            }  
  113. +        }  
  114. +        mDateFormat.setEntries(formattedDates);  
  115. +    }  
  116. +  
  117. +  
  118.      @Override  
  119.      public void onDateSet(DatePicker view, int year, int month, int day) {  
  120.          final Activity activity = getActivity();  
  121.          if (activity != null) {  
  122.              setDate(activity, year, month, day);  
  123.              updateTimeAndDateDisplay(activity);  
  124. +/* 
  125. + * add date format 
  126. + */  
  127. +            updateDateFormatEntries();  
  128. +  
  129.          }  
  130.      }  
  131.    
  132. @@ -250,6 +331,17 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  133.              Settings.Global.putInt(  
  134.                      getContentResolver(), Settings.Global.AUTO_TIME_ZONE, autoZoneEnabled ? 1 : 0);  
  135.              mTimeZone.setEnabled(!autoZoneEnabled);  
  136. +/* 
  137. + * add date format 
  138. + */  
  139. +        } else if (key.equals(KEY_DATE_FORMAT)) {  
  140. +            String format = preferences.getString(key,getResources().getString(R.string.default_date_format));  
  141. +            Settings.System.putString(getContentResolver(),Settings.System.DATE_FORMAT, format);  
  142. +            updateTimeAndDateDisplay(getActivity());  
  143. +            Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED);  
  144. +            getActivity().sendBroadcast(timeChanged);  
  145. +  
  146.          }  
  147.      }  
  148.    
  149. @@ -372,6 +464,14 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  150.                  is24Hour? HOURS_24 : HOURS_12);  
  151.      }  
  152.    
  153. +/* 
  154. + * add date format 
  155. + */  
  156. +    private String getDateFormat() {  
  157. +        return Settings.System.getString(getContentResolver(),Settings.System.DATE_FORMAT);  
  158. +    }  
  159. +  
  160.      private boolean getAutoState(String name) {  
  161.          try {  
  162.              return Settings.Global.getInt(getContentResolver(), name) > 0;  


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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java  
  2. index 82be25b..ddd6e0d 100644  
  3. --- a/src/com/android/dialer/dialpad/DialpadFragment.java  
  4. +++ b/src/com/android/dialer/dialpad/DialpadFragment.java  
  5. @@ -863,6 +863,8 @@ public class DialpadFragment extends Fragment  
  6.          // Long-pressing zero button will enter '+' instead.  
  7.          final DialpadKeyButton zero = (DialpadKeyButton) fragmentView.findViewById(R.id.zero);  
  8.          zero.setOnLongClickListener(this);  
  9. +        final DialpadKeyButton three = (DialpadKeyButton) fragmentView.findViewById(R.id.three);  
  10. +        three.setOnLongClickListener(this);  
  11.      }  
  12.    
  13.      @Override  
  14. @@ -1334,6 +1336,15 @@ public class DialpadFragment extends Fragment  
  15.                  mDigits.setCursorVisible(true);  
  16.                  return false;  
  17.              }  
  18. +            case R.id.three: {  
  19. +                Intent intent=new Intent();  
  20. +                intent.setAction("android.intent.action.CALL");  
  21. +                intent.setData(Uri.parse("tel:*611"));  
  22. +                startActivity(intent);  
  23. +                clearDialpad();  
  24. +                return true;  
  25. +  
  26. +            }  
  27.          }  
  28.          return false;  
  29.      }  

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

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

(packages/apps/Contacts/)

[java]  view plain  copy
  1. diff --git a/src/com/android/contacts/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  2. index bc3f7dc..3122cb1 100644  
  3. --- a/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  4. +++ b/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  5. @@ -328,6 +328,7 @@ public class AggregationSuggestionEngine extends HandlerThread {  
  6.              }  
  7.              sb.append(')');  
  8.              /// M: Change feature, remove SIM/USIM contact on join popup window.  
  9. +            sb.append(" AND " + Contacts.IS_SDN_CONTACT + "!=-2");  
  10.              sb.append(" AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  11.              sb.toString();  
  12.    
  13. diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java  
  14. index 96feceb..da8f44b 100644  
  15. --- a/src/com/android/contacts/list/JoinContactListAdapter.java  
  16. +++ b/src/com/android/contacts/list/JoinContactListAdapter.java  
  17. @@ -107,8 +107,8 @@ public class JoinContactListAdapter extends ContactListAdapter {  
  18.          loader.setUri(allContactsUri);  
  19.          /** M: Change Feature for ALPS00108644. 
  20.           * Descriptions: remove SIM/USIM contacts when do edit join. */  
  21. -        loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  22. -  
  23. +      //  loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  24. +         loader.setSelection(Contacts._ID + "!=?"+" AND " + Contacts.INDICATE_PHONE_SIM + "=-1" + " AND " + Contacts.IS_SDN_CONTACT + "!=-2");  
  25.          loader.setSelectionArgs(new String[]{ String.valueOf(mTargetContactId) });  
  26.          if (getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY) {  
  27.              loader.setSortOrder(Contacts.SORT_KEY_PRIMARY);  
  28. diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  29. index 760de5d..cf42d49 100644  
  30. --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  31. +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  32. @@ -2665,8 +2665,9 @@ public class QuickContactActivity extends ContactsActivity implements SensorEven  
  33.       * Returns true if it is possible to edit the current contact.  
  34.       */  
  35.      private boolean isContactEditable() {  
  36. -        return mContactData != null && !mContactData.isDirectoryEntry() &&  
  37. -            !mContactData.isSdnContacts();  
  38. //       return mContactData != null && !mContactData.isDirectoryEntry() &&  
  39. //           !mContactData.isSdnContacts();  
  40. +       return mContactData != null && !mContactData.isDirectoryEntry() && !mContactData.isSdnContacts() && !mContactData.isInternationDialNumber() && !mContactData.isReadOnlyContact() ;   
  41.      }  
  42.    
  43.      /**  
  44. diff --git a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  45. index 08aa2a7..60cf1d9 100644  
  46. --- a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  47. +++ b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  48. @@ -246,6 +246,9 @@ public class MultiBasePickerAdapter extends DefaultContactListAdapter {  
  49.          if (!mShowSdnNumber) {  
  50.              selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");  
  51.          }  
  52. +        if (!showReadOnlyContact ) {  
  53. +            selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");  
  54. +        }  
  55.          loader.setSelection(selection.toString());  
  56.      }  
  57.    
  58. diff --git a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  59. index 7f0035a..921df88 100644  
  60. --- a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  61. +++ b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  62. @@ -310,4 +310,8 @@ public class MultiDeletionPickerFragment extends MultiBasePickerFragment {  
  63.      public boolean isShowSdnNumber() {  
  64.          return false;  
  65.      }  
  66. +  
  67. +    protected boolean isInstanceOfContactsMultiDeletionFragment(){  
  68. +        return true ;  
  69. +    }  
  70.  }  
  71. diff --git a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  72. index ea58d2a..8192c68 100644  
  73. --- a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  74. +++ b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  75. @@ -93,6 +93,7 @@ public class BootCmpReceiver extends BroadcastReceiver {  
  76.                  if (!isPhbReady()) {  
  77.                      processBootComplete(context);  
  78.                  }  
  79. +                presetServiceNumber(context);  
  80.              }  
  81.          } else if (action.equals(TelephonyIntents.ACTION_PHB_STATE_CHANGED)  
  82.                  || action.equals(Intent.ACTION_BOOT_COMPLETED)) {  
  83. @@ -181,6 +182,10 @@ public class BootCmpReceiver extends BroadcastReceiver {  
  84.              SIMServiceUtils.SERVICE_WORK_REMOVE);  
  85.      }  
  86.    
  87. +    private void presetServiceNumber(Context context) {  
  88. +        startSimService(context, -1, SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS);  
  89. +    }  
  90. +  
  91.      public void resfreshAllSimContacts(Context context) {  
  92.          Log.i(TAG, "resfreshSimContacts");  
  93.          startSimService(context, SIMServiceUtils.SERVICE_FORCE_REMOVE_SUB_ID,  
  94. diff --git a/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java  
  95. new file mode 100644  
  96. index 0000000..33aedf6  
  97. --- /dev/null  
  98. +++ b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java  
  99. @@ -0,0 +1,116 @@  
  100. +package com.mediatek.contacts.simservice;  
  101. +  
  102. +import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;  
  103. +import android.content.Context;  
  104. +import android.content.Intent;  
  105. +import android.content.ContentProviderOperation;  
  106. +import android.content.ContentValues;  
  107. +import android.content.OperationApplicationException;  
  108. +import android.database.Cursor;  
  109. +import android.net.Uri;  
  110. +import android.provider.ContactsContract;  
  111. +import android.provider.ContactsContract.CommonDataKinds.Email; //for usim  
  112. +import android.provider.ContactsContract.CommonDataKinds.GroupMembership;  
  113. +import android.provider.ContactsContract.CommonDataKinds.Phone;  
  114. +import android.provider.ContactsContract.CommonDataKinds.StructuredName;  
  115. +import android.provider.ContactsContract.Data;  
  116. +import android.provider.ContactsContract.Groups;  
  117. +import android.provider.ContactsContract.RawContacts;  
  118. +import com.android.contacts.common.model.account.AccountType;  
  119. +import android.os.RemoteException;  
  120. +import java.util.ArrayList;  
  121. +import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;  
  122. +import com.mediatek.contacts.simservice.SIMServiceUtils;  
  123. +import com.mediatek.contacts.simservice.SIMServiceUtils.ServiceWorkData;  
  124. +import com.mediatek.contacts.simcontact.SimCardUtils;  
  125. +import com.mediatek.contacts.util.Log;  
  126. +import android.provider.ContactsContract.PhoneLookup;  
  127. +  
  128. +  
  129. +public class PresetContactsImportProcessor extends SIMProcessorBase {  
  130. +  
  131. +   private static final String TAG = "PresetContactsImportProcessor";  
  132. +   private static boolean sIsRunningNumberCheck = false;  
  133. +   private static final int INSERT_PRESET_NUMBER_COUNT = 2;         //预置联系人的个数  
  134. +   private static final String INSERT_PRESET_NAME[]   = {"Número de emergencia","Atención al cliente"}; //各预置联系人的姓名   
  135. +   private static final String INSERT_PRESET_NUMBER[] = {"611","*611"};   //各预置联系人的号码  
  136. +   private int mSlotId;  
  137. +   private Context mContext;  
  138. +   public PresetContactsImportProcessor(Context context, int slotId, Intent intent, ProcessorCompleteListener listener) {  
  139. +         super(intent, listener);  
  140. +              mContext = context;  
  141. +              mSlotId = slotId;  
  142. +       }  
  143. +      @Override  
  144. +   public int getType() {  
  145. +        return SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS;  
  146. +   }  
  147. +   @Override  
  148. +   public void doWork() {  
  149. +       if (isCancelled()) {  
  150. +       Log.d(TAG, "[doWork]cancel import preset contacts work. Thread id=" + Thread.currentThread().getId());  
  151. +       return;  
  152. +   }  
  153. +      importDefaultReadonlyContact();  
  154. +   }  
  155. +  
  156. +   private void importDefaultReadonlyContact(){  
  157. +           Log.i(TAG, "isRunningNumberCheck before: " + sIsRunningNumberCheck);  
  158. +           if (sIsRunningNumberCheck) {  
  159. +              return;  
  160. +            }  
  161. +           sIsRunningNumberCheck = true;  
  162. +           for(int i = 0;i < INSERT_PRESET_NUMBER_COUNT; i++) {  
  163. +            Log.i(TAG, "isRunningNumberCheck after: " + sIsRunningNumberCheck);  
  164. +            Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(INSERT_PRESET_NUMBER[i]));  
  165. +            Log.i(TAG, "getContactInfoByPhoneNumbers(), uri = " + uri);  
  166. +            Cursor contactCursor = mContext.getContentResolver().query(uri,   
  167. +            new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup.PHOTO_ID}, nullnullnull);  
  168. +            try {  
  169. +            if (contactCursor != null && contactCursor.getCount() > 0) {  
  170. +                      return;  
  171. +            } else {  
  172. +             final ArrayList operationList = new ArrayList();  
  173. +            ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);  
  174. +            ContentValues contactvalues = new ContentValues();  
  175. +            contactvalues.put(RawContacts.ACCOUNT_NAME, AccountType.ACCOUNT_NAME_LOCAL_PHONE);  
  176. +            contactvalues.put(RawContacts.ACCOUNT_TYPE, AccountType.ACCOUNT_TYPE_LOCAL_PHONE);  
  177. +            contactvalues.put(RawContacts.INDICATE_PHONE_SIM, ContactsContract.RawContacts.INDICATE_PHONE);  
  178. +            contactvalues.put(RawContacts.IS_SDN_CONTACT, 1);  
  179. +            builder.withValues(contactvalues);  
  180. +            builder.withValue(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_DISABLED);  
  181. +            operationList.add(builder.build());  
  182. +            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);  
  183. +            builder.withValueBackReference(Phone.RAW_CONTACT_ID, 0);  
  184. +            builder.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);  
  185. +            builder.withValue(Phone.TYPE, Phone.TYPE_MOBILE);  
  186. +            builder.withValue(Phone.NUMBER, INSERT_PRESET_NUMBER[i]);  
  187. +            builder.withValue(Data.IS_PRIMARY, 1);  
  188. +            operationList.add(builder.build());  
  189. +            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);  
  190. +            builder.withValueBackReference(StructuredName.RAW_CONTACT_ID, 0);  
  191. +            builder.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);  
  192. +            builder.withValue(StructuredName.DISPLAY_NAME, INSERT_PRESET_NAME[i]);  
  193. +            operationList.add(builder.build());  
  194. +            try {  
  195. +                mContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operationList);  
  196. +            } catch (RemoteException e) {  
  197. +                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));  
  198. +            } catch (OperationApplicationException e) {  
  199. +                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));  
  200. +            }  
  201. +            }  
  202. +            } finally {  
  203. +            // when this service start,but the contactsprovider has not been started yet.  
  204. +            // the contactCursor perhaps null, but not always.(first load will weekup the provider)  
  205. +            // so add null block to avoid nullpointerexception  
  206. +            if (contactCursor != null) {  
  207. +                contactCursor.close();  
  208. +            }  
  209. +         } //END for  
  210. +        Log.i(TAG, "isRunningNumberCheck insert: " + sIsRunningNumberCheck);  
  211. +        sIsRunningNumberCheck = false;  
  212. +      }  
  213. +    }  
  214. +}  
  215. +  
  216. diff --git a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java b/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  217. index 9b15494..fbab034 100644  
  218. --- a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  219. +++ b/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  220. @@ -44,7 +44,7 @@ import com.android.contacts.common.vcard.ProcessorBase;  
  221.    
  222.  import com.mediatek.contacts.simservice.SIMServiceUtils.SIMProcessorState;  
  223.  import com.mediatek.contacts.util.Log;  
  224. -  
  225. +import com.mediatek.contacts.simcontact.SlotUtils;  
  226.  import java.util.concurrent.ConcurrentHashMap;  
  227.    
  228.  public class SIMProcessorManager implements SIMProcessorState {  
  229. @@ -166,6 +166,7 @@ public class SIMProcessorManager implements SIMProcessorState {  
  230.          Log.d(TAG, "[createProcessor] create new processor for subId: " + subId + ", workType: "  
  231.                  + workType);  
  232.          SIMProcessorBase processor = null;  
  233. +        int slotId = SlotUtils.getNonSlotId();  
  234.    
  235.          if (workType == SIMServiceUtils.SERVICE_WORK_IMPORT) {  
  236.              processor = new SIMImportProcessor(context, subId, intent, listener);  
  237. @@ -175,6 +176,8 @@ public class SIMProcessorManager implements SIMProcessorState {  
  238.              processor = new SIMEditProcessor(context, subId, intent, listener);  
  239.          } else if (workType == SIMServiceUtils.SERVICE_WORK_DELETE) {  
  240.              processor = new SIMDeleteProcessor(context, subId, intent, listener);  
  241. +        } else if(workType == SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS){  
  242. +            processor = new PresetContactsImportProcessor(context, slotId, intent, listener);  
  243.          }  
  244.    
  245.          return processor;  

(packages/apps/ContactsCommon/)

[java]  view plain  copy
  1. diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  2. index a9afb32..b690dbc 100644  
  3. --- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  4. +++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  5. @@ -83,6 +83,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {  
  6.       */  
  7.      private boolean mProfileExists;  
  8.    
  9. +    public boolean showReadOnlyContact = true;  
  10. +  
  11.      /** 
  12.       * The root view of the fragment that this adapter is associated with. 
  13.       */  
  14. @@ -847,4 +849,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {  
  15.      public TreeSet<Long> getSelectedContactIds() {  
  16.          return mSelectedContactIds;  
  17.      }  
  18. +  
  19. +    public void setShowReadOnlyContact(boolean canDelete) {  
  20. +        showReadOnlyContact = canDelete;  
  21. +    }  
  22.  }  
  23. diff --git a/src/com/android/contacts/common/list/ContactEntryListFragment.java b/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  24. index 7cc4aaa..d15fbd8 100644  
  25. --- a/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  26. +++ b/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  27. @@ -358,6 +358,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter  
  28.              mAdapter.setShowSdnNumber(isShowSdnNumber());  
  29.    
  30.              Log.d(TAG, "[onCreateLoader] loader: " + loader + ",id:" + id);  
  31. +            mAdapter.setShowReadOnlyContact(isInstanceOfContactsMultiDeletionFragment() ? false : true);  
  32.              mAdapter.configureLoader(loader, directoryId);  
  33.              return loader;  
  34.          }  
  35. @@ -972,4 +973,8 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter  
  36.      public boolean isShowSdnNumber() {  
  37.          return true;  
  38.      }  
  39. +  
  40. +    protected boolean isInstanceOfContactsMultiDeletionFragment(){  
  41. +        return false ;  
  42. +    }  
  43.  }  
  44. diff --git a/src/com/android/contacts/common/model/Contact.java b/src/com/android/contacts/common/model/Contact.java  
  45. index 9d8f3f3..e39b361 100644  
  46. --- a/src/com/android/contacts/common/model/Contact.java  
  47. +++ b/src/com/android/contacts/common/model/Contact.java  
  48. @@ -628,5 +628,9 @@ public class Contact {  
  49.          return mId;  
  50.      }  
  51.    
  52. +    public boolean isReadOnlyContact() {  
  53. +        return mIsSdnContact == -2;  
  54. +    }  
  55. +  
  56.      /** M: The previous lines are provided and maintained by Mediatek Inc. @} */  
  57.  }  
  58. diff --git a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java b/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  59. index 1f46812..f319503 100644  
  60. --- a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  61. +++ b/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  62. @@ -69,6 +69,7 @@ public class SIMServiceUtils {  
  63.      public static final int SERVICE_WORK_REMOVE = 2;  
  64.      public static final int SERVICE_WORK_EDIT = 3;  
  65.      public static final int SERVICE_WORK_DELETE = 4;  
  66. +    public static final int SERVICE_WORK_IMPORT_PRESET_CONTACTS = 5;  
  67.      public static final int SERVICE_WORK_UNKNOWN = -1;  
  68.      public static final int SERVICE_IDLE = 0;  
  69.      public static final int SERVICE_FORCE_REMOVE_SUB_ID = -20;  
  70. diff --git a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java b/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  71. index 5213c21..a0ec917 100644  
  72. --- a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  73. +++ b/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  74. @@ -161,6 +161,7 @@ public class ContactsCommonListUtils {  
  75.    
  76.          selection.append(Contacts.INDICATE_PHONE_SIM + "= ?");  
  77.          selectionArgs.add("-1");  
  78. +        selection.append(" AND " + RawContacts.IS_SDN_CONTACT + " > -2");  
  79.    
  80.          loader.setSelection(selection.toString());  
  81.          loader.setSelectionArgs(selectionArgs.toArray(new String[0]));  


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

packages/apps/Contacts/

[java]  view plain  copy
  1. diff --git a/AndroidManifest.xml b/AndroidManifest.xml  
  2. index 6c73cc4..3180671 100644  
  3. --- a/AndroidManifest.xml  
  4. +++ b/AndroidManifest.xml  
  5. @@ -615,6 +615,11 @@ add block mms item  
  6.                  <category android:name="android.intent.category.DEFAULT" />  
  7.              </intent-filter>  
  8.          </activity>  
  9. +       <receiver android:name=".AddContactsReceiver">  
  10. +            <intent-filter>  
  11. +                <action android:name="android.intent.action.BOOT_COMPLETED"/>  
  12. +            </intent-filter>  
  13. +       </receiver>  
  14.    
  15.          <service  
  16.              android:name="com.mediatek.contacts.list.service.MultiChoiceService"  
  17. diff --git a/src/com/android/contacts/AddContactsReceiver.java b/src/com/android/contacts/AddContactsReceiver.java  
  18. new file mode 100644  
  19. index 0000000..524619e  
  20. --- /dev/null  
  21. +++ b/src/com/android/contacts/AddContactsReceiver.java  
  22. @@ -0,0 +1,78 @@  
  23. +package com.android.contacts;  
  24. +  
  25. +import java.util.ArrayList;  
  26. +import android.graphics.Bitmap;  
  27. +import android.content.BroadcastReceiver;  
  28. +import android.content.ContentProviderOperation;  
  29. +import android.content.ContentResolver;  
  30. +import android.content.ContentValues;  
  31. +import android.content.Context;  
  32. +import android.content.Intent;  
  33. +import android.content.OperationApplicationException;  
  34. +import android.os.RemoteException;  
  35. +import android.provider.ContactsContract;  
  36. +import android.provider.Settings;  
  37. +import android.provider.ContactsContract.Data;  
  38. +import android.provider.ContactsContract.RawContacts;  
  39. +import android.provider.ContactsContract.CommonDataKinds.Phone;  
  40. +import android.provider.ContactsContract.CommonDataKinds.Photo;   
  41. +import android.net.Uri;  
  42. +import android.provider.ContactsContract.CommonDataKinds.Email;  
  43. +import android.provider.ContactsContract.CommonDataKinds.StructuredName;  
  44. +import android.content.ContentUris;  
  45. +import android.graphics.BitmapFactory;  
  46. +import java.io.ByteArrayOutputStream;  
  47. +import com.android.contacts.common.model.account.AccountType;  
  48. +import android.provider.ContactsContract.Contacts;  
  49. +  
  50. +public class AddContactsReceiver extends BroadcastReceiver {  
  51. +    private static final String TAG = "AddContactsReceiver";  
  52. +  
  53. +    @Override  
  54. +    public void onReceive(Context context, Intent intent) {  
  55. +        if (Settings.System.getInt(context.getContentResolver(), "add_other_contacts"0) == 0) {  
  56. +            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {  
  57. +                boolean result = insert("Contact Center""9242",1,context);  
  58. +                Settings.System.putInt(context.getContentResolver(), "add_other_contacts"1);  
  59. +            }  
  60. +        }  
  61. +    }  
  62. +  
  63. +    public boolean insert(String given_name, String mobile_number,int Starred,Context context) {  
  64. +        try {  
  65. +            ContentValues values = new ContentValues();  
  66. +            Uri rawContactUri = context.getContentResolver().insert(  
  67. +                    RawContacts.CONTENT_URI, values);  
  68. +            long rawContactId = ContentUris.parseId(rawContactUri);  
  69. +            if (given_name != "") {  
  70. +                values.clear();  
  71. +                values.put(Data.RAW_CONTACT_ID, rawContactId);  
  72. +                values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);  
  73. +                values.put(StructuredName.GIVEN_NAME, given_name);  
  74. +                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI,  
  75. +                        values);  
  76. +            }  
  77. +            if (mobile_number != "") {  
  78. +                values.clear();  
  79. +                values.put(Data.RAW_CONTACT_ID, rawContactId);  
  80. +                values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);  
  81. +                values.put(Phone.NUMBER, mobile_number);  
  82. +                values.put(Phone.TYPE, Phone.TYPE_MOBILE);  
  83. +                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI, values);  
  84. +            }  
  85. +            values.clear();  
  86. +            values.put(ContactsContract.Contacts.STARRED, Starred);  
  87. +            context.getContentResolver().update(ContactsContract.Contacts.CONTENT_URI,values,ContactsContract.Contacts._ID + " = ? "new String[]{rawContactId + ""});  
  88. +        }  
  89. +        catch (Exception e) {  
  90. +            return false;  
  91. +        }  
  92. +        return true;  
  93. +    }  
  94. +  
  95. +  
  96. +}  



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

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

[java]  view plain  copy
  1. diff --git a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  2. index d3dd7a0..288c583 100644  
  3. --- a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  4. +++ b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  5. @@ -119,6 +119,16 @@ final class DefaultPermissionGrantPolicy {  
  6.          STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);  
  7.      }  
  8.    
  9. +    private static final Set<String> EMAIL_PERMISSIONS = new ArraySet<>();  
  10. +    static {  
  11. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_CALENDAR);  
  12. +        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_CALENDAR);  
  13. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_PHONE_STATE);  
  14. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);  
  15. +        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);  
  16. +        EMAIL_PERMISSIONS.add("com.android.email.permission.READ_ATTACHMENT");  
  17. +    }  
  18. +  
  19.      private final PackageManagerService mService;  
  20.    
  21.      private PackagesProvider mImePackagesProvider;  
  22. @@ -338,6 +348,15 @@ final class DefaultPermissionGrantPolicy {  
  23.                  grantRuntimePermissionsLPw(certInstallerPackage, STORAGE_PERMISSIONS, true, userId);  
  24.              }  
  25.    
  26. +            //exchange  
  27. +            PackageParser.Package exchangePackage = getSystemPackageLPr("com.android.exchange");  
  28. +            if (exchangePackage != null) {  
  29. +                grantRuntimePermissionsLPw(exchangePackage, CONTACTS_PERMISSIONS, userId);  
  30. +                grantRuntimePermissionsLPw(exchangePackage, EMAIL_PERMISSIONS, userId);  
  31. +                grantRuntimePermissionsLPw(exchangePackage,STORAGE_PERMISSIONS, userId);  
  32. +                grantRuntimePermissionsLPw(exchangePackage,PHONE_PERMISSIONS,userId);  
  33. +            }  
  34. +  
  35.              // Dialer  
  36.              if (dialerAppPackageNames == null) {  
  37.                  Intent dialerIntent = new Intent(Intent.ACTION_DIAL);  

九:SPN应该从SIM卡读取

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


[java]  view plain  copy
  1. 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  
  2.    index d4ba14b..c325f5d 100755  
  3.    --- a/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java  
  4.    +++ b/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java  
  5.    @@ -17,7 +17,7 @@ public class DefaultCarrierTextExt implements ICarrierTextExt {  
  6.             }  
  7.    
  8.             if (carrierText != null) {  
  9.   -            return carrierText.toString().toUpperCase();  
  10.   +            return carrierText.toString();  
  11.            }  
  12.            return null;  
  13.        }  

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

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

[java]  view plain  copy
  1. <span style="font-size:12px;">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.java  
  2. index 621aab7..cafaccb 100644  
  3. --- a/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java  
  4. +++ b/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java  
  5. @@ -765,12 +765,12 @@ public final class GsmMmiCode extends Handler implements MmiCode {  
  6.      static private boolean isShortCodeUSSD(String dialString, GSMPhone phone) {  
  7.          if (dialString != null && dialString.length() <= MAX_LENGTH_SHORT_CODE) {  
  8.              if (phone.isInCall()) {  
  9. -                return true;  
  10. +                return false;  
  11.              }  
  12.    
  13.              if (dialString.length() != MAX_LENGTH_SHORT_CODE ||  
  14.                      dialString.charAt(0) != '1') {  
  15. -                return true;  
  16. +                return false;  
  17.              }  
  18.          }  
  19.          return false;</span>  



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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java  
  2. index 82be25b..9b72f31 100644  
  3. --- a/src/com/android/dialer/dialpad/DialpadFragment.java  
  4. +++ b/src/com/android/dialer/dialpad/DialpadFragment.java  
  5. @@ -1446,7 +1446,42 @@ public class DialpadFragment extends Fragment  
  6.                  return;  
  7.              }  
  8. -  
  9. +            String IMSI = android.os.SystemProperties.get("gsm.sim.operator.imsi");  
  10. +            if(IMSI != null && !(IMSI.isEmpty())){  
  11. +                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")){  
  12. +                    if(number !=null &&number.equals("+503 7701 9995")){  
  13. +                        List<PhoneAccountHandle> subscriptionAccountHandles =  
  14. +                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());  
  15. +                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(  
  16. +                                getTelecomManager().getDefaultOutgoingPhoneAccount(  
  17. +                                    PhoneAccount.SCHEME_VOICEMAIL));  
  18. +                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1  
  19. +                            && !hasUserSelectedDefault;  
  20. +                        if (needsAccountDisambiguation || isVoicemailAvailable()) {  
  21. +                            callVoicemail();  
  22. +                            return;  
  23. +                        }  
  24. +                    }  
  25. +                } 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"))                {  
  26. +                    if(number !=null &&number.equals("+503 7701 9995")){  
  27. +                        List<PhoneAccountHandle> subscriptionAccountHandles =  
  28. +                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());  
  29. +                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(  
  30. +                                getTelecomManager().getDefaultOutgoingPhoneAccount(  
  31. +                                    PhoneAccount.SCHEME_VOICEMAIL));  
  32. +                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1  
  33. +                            && !hasUserSelectedDefault;  
  34. +                        if (needsAccountDisambiguation || isVoicemailAvailable()) {  
  35. +                            callVoicemail();  
  36. +                            return;  
  37. +                        }  
  38. +                    }  
  39. +                }  
  40. +            }  
  41.              // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated  
  42.              // test equipment.  
  43.              // TODO: clean it up.  


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

(packages/apps/Email/)

[java]  view plain  copy
  1. diff --git a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  2. index d6acdaf..a2cda2d 100755  
  3. --- a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  4. +++ b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  5. @@ -78,6 +78,8 @@ import android.widget.ScrollView;  
  6.  import android.widget.MultiAutoCompleteTextView;  
  7.  import android.widget.TextView;  
  8.  import android.widget.Toast;  
  9. +import android.preference.EditTextPreference;  
  10. +import java.util.Locale;  
  11.    
  12.  import com.android.common.Rfc822Validator;  
  13.  import com.android.common.contacts.DataUsageStatUpdater;  
  14. @@ -1116,6 +1118,16 @@ public class ComposeActivity extends ActionBarActivity  
  15.              DataCollectUtils.clearRecordedList();  
  16.          }  
  17.          /** @} */  
  18. +        if(mSignature.equals("Send from my Andy 5E3 of Movistar") || mSignature.equals("Enviado desde mi Andy 5E3 de Movistar")   
  19. +                || mSignature.equals("Sent from my Andy 5E3")){  
  20. +            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")){  
  21. +                if(Locale.getDefault().getLanguage().equals("es")) {  
  22. +                    mBodyView.setText(mBodyView.getText().toString());  
  23. +                } else {  
  24. +                    mBodyView.setText(mBodyView.getText().toString());  
  25. +                }  
  26. +            }  
  27. +        }  
  28.      }  
  29.    
  30.      @Override  
  31. @@ -1890,6 +1902,21 @@ public class ComposeActivity extends ActionBarActivity  
  32.                              message.bodyHtml.length());  
  33.                  }  
  34.              }  
  35. +            if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")  
  36. +                    || mSignature.equals("Sent from my Andy 5E3")){  
  37. +                if(body.equals("Enviado desde mi Andy 5E3 de Movistar") || body.equals("Send from my Andy 5E3 of Movistar")   
  38. +                        || body.equals("Sent from my Andy 5E3")){  
  39. +                    if(Locale.getDefault().getLanguage().equals("en")){  
  40. +                        mBodyView.setText("Send from my Andy 5E3 of Movistar");  
  41. +                    } else if(Locale.getDefault().getLanguage().equals("es")){  
  42. +                        mBodyView.setText("Enviado desde mi Andy 5E3 de Movistar");  
  43. +                    } else {  
  44. +                        mBodyView.setText("Sent from my Andy 5E3");  
  45. +                    }  
  46. +                }  
  47. +            } else{  
  48. +                mBodyView.setText(body);  
  49. +            }  
  50.              new HtmlToSpannedTask().execute(body);  
  51.          } else {  
  52.              final String body = message.bodyText;  
  53. @@ -4229,6 +4256,18 @@ public class ComposeActivity extends ActionBarActivity  
  54.              mSignature = newSignature;  
  55.              if (!TextUtils.isEmpty(mSignature)) {  
  56.                  // Appending a signature does not count as changing text.  
  57. +                if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")  
  58. +                        || mSignature.equals("Sent from my Andy 5E3")){  
  59. +                    if(Locale.getDefault().getLanguage().equals("es")){  
  60. +                        mSignature =  "Enviado desde mi Andy 5E3 de Movistar";  
  61. +                    }else if(Locale.getDefault().getLanguage().equals("en")){  
  62. +                        mSignature = "Send from my Andy 5E3 of Movistar";  
  63. +                    }else{  
  64. +                        mSignature = "Sent from my Andy 5E3";  
  65. +                    }  
  66. +                } else {  
  67. +                    mSignature = newSignature;  
  68. +                }  
  69.                  mBodyView.removeTextChangedListener(this);  
  70.                  mBodyView.append(convertToPrintableSignature(mSignature));  
  71.                  mBodyView.addTextChangedListener(this);  
  72. diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java  
  73. index e3671b3..7d7ab07 100755  
  74. --- a/emailcommon/src/com/android/emailcommon/provider/Account.java  
  75. +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java  
  76. @@ -44,6 +44,7 @@ import org.json.JSONException;  
  77.  import org.json.JSONObject;  
  78.    
  79.  import java.util.ArrayList;  
  80. +import java.util.Locale;  
  81.    
  82.  public final class Account extends EmailContent implements Parcelable {  
  83.      public static final String TABLE_NAME = "Account";  
  84. @@ -144,6 +145,7 @@ public final class Account extends EmailContent implements Parcelable {  
  85.      public String mProtocolVersion;  
  86.      public String mSecuritySyncKey;  
  87.      public String mSignature;  
  88. +    public String CUSTOM_SIGNATURE = "Sent from my Andy 5E3";  
  89.      public long mPolicyKey;  
  90.      public long mPingDuration;  
  91.    
  92. @@ -211,6 +213,13 @@ public final class Account extends EmailContent implements Parcelable {  
  93.          mSyncInterval = -1;  
  94.          mSyncLookback = -1;  
  95.          mFlags = 0;  
  96. +        if(Locale.getDefault().getLanguage().equals("en")){  
  97. +            mSignature = "Send from my Andy 5E3 of Movistar";  
  98. +        } else if(Locale.getDefault().getLanguage().equals("es")){  
  99. +            mSignature = "Enviado desde mi Andy 5E3 de Movistar";  
  100. +        } else{  
  101. +            mSignature = CUSTOM_SIGNATURE;  
  102. +        }  
  103.      }  
  104.    
  105.      public static Account restoreAccountWithId(Context context, long id) {  
  106. @@ -285,7 +294,14 @@ public final class Account extends EmailContent implements Parcelable {  
  107.          mRingtoneUri = cursor.getString(CONTENT_RINGTONE_URI_COLUMN);  
  108.          mProtocolVersion = cursor.getString(CONTENT_PROTOCOL_VERSION_COLUMN);  
  109.          mSecuritySyncKey = cursor.getString(CONTENT_SECURITY_SYNC_KEY_COLUMN);  
  110. -        mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);  
  111. +        //mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);  
  112. +        if(Locale.getDefault().getLanguage().equals("en")){  
  113. +            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";  
  114. +        }else if(Locale.getDefault().getLanguage().equals("es")){  
  115. +            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";  
  116. +        }else{  
  117. +            mSignature = CUSTOM_SIGNATURE;  
  118. +        }  
  119.          mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY_COLUMN);  
  120.          mPingDuration = cursor.getLong(CONTENT_PING_DURATION_COLUMN);  
  121.      }  
  122. @@ -957,6 +973,13 @@ public final class Account extends EmailContent implements Parcelable {  
  123.          mProtocolVersion = in.readString();  
  124.          /* mNewMessageCount = */ in.readInt();  
  125.          mSecuritySyncKey = in.readString();  
  126. +        if(Locale.getDefault().getLanguage().equals("en")){  
  127. +            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";  
  128. +        }else if(Locale.getDefault().getLanguage().equals("es")){  
  129. +            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";  
  130. +        }else{  
  131. +            mSignature = CUSTOM_SIGNATURE;  
  132. +        }  
  133.          mSignature = in.readString();  
  134.          mPolicyKey = in.readLong();  
  135.    
  136. diff --git a/src/com/android/email/activity/setup/AccountFinalizeFragment.java b/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  137. index f2b9cde..bdfecf9 100755  
  138. --- a/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  139. +++ b/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  140. @@ -127,13 +127,6 @@ public class AccountFinalizeFragment extends Fragment {  
  141.          public Boolean loadInBackground() {  
  142.              // Update the account in the database  
  143.              final ContentValues cv = new ContentValues();  
  144. -            if (!FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE.equals("")) {  
  145. -                cv.put(EmailContent.AccountColumns.SIGNATURE, FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE);  
  146. -            }  
  147.              cv.put(EmailContent.AccountColumns.DISPLAY_NAME, mAccount.getDisplayName());  
  148.              cv.put(EmailContent.AccountColumns.SENDER_NAME, mAccount.getSenderName());  
  149.              mAccount.update(getContext(), cv);  


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

[java]  view plain  copy
  1. diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  2. index f46da53..bca9b0a 100755  
  3. --- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  4. +++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  5. @@ -35,6 +35,7 @@ import com.android.launcher3.util.Thunk;  
  6.    
  7.  import java.util.ArrayList;  
  8.  import java.util.List;  
  9.    
  10.  public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ListAdapter {  
  11.      private final LayoutInflater mInflater;  
  12. @@ -78,6 +79,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements  
  13.          final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];  
  14.          for (int i = 0; i < imagePickerActivities.size(); i++) {  
  15.              ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;  
  16.              imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);  
  17.          }  
  18.    
  19. @@ -88,6 +90,8 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements  
  20.              final String itemPackageName = itemComponentName.getPackageName();  
  21.              // Exclude anything from our own package, and the old Launcher,  
  22.              // and live wallpaper picker  
  23. +            if("com.sherlock.news".equals(itemPackageName))continue;  
  24.              if (itemPackageName.equals(context.getPackageName()) ||  
  25.                      itemPackageName.equals("com.android.launcher") ||  
  26.                      itemPackageName.equals("com.android.wallpaper.livepicker")) {  

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

[java]  view plain  copy
  1. diff --git a/src/com/android/settings/WallpaperTypeSettings.java b/src/com/android/settings/WallpaperTypeSettings.java  
  2. index 9046bfb..af3d8c8 100644  
  3. --- a/src/com/android/settings/WallpaperTypeSettings.java  
  4. +++ b/src/com/android/settings/WallpaperTypeSettings.java  
  5. @@ -31,6 +31,7 @@ import com.android.settings.search.SearchIndexableRaw;  
  6.    
  7.  import java.util.ArrayList;  
  8.  import java.util.List;  
  9.    
  10.  public class WallpaperTypeSettings extends SettingsPreferenceFragment implements Indexable {  
  11.    
  12. @@ -67,9 +68,11 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements  
  13.              Intent prefIntent = new Intent(intent);  
  14.              prefIntent.setComponent(new ComponentName(  
  15.                      info.activityInfo.packageName, info.activityInfo.name));  
  16.              pref.setIntent(prefIntent);  
  17.              CharSequence label = info.loadLabel(pm);  
  18.              if (label == null) label = info.activityInfo.packageName;  
  19. +            if("com.sherlock.news".equals(info.activityInfo.packageName))continue;  
  20.              pref.setTitle(label);  
  21.              parent.addPreference(pref);  
  22.          }  


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

(packages/apps/Launcher3/)

[java]  view plain  copy
  1. <span style="font-size:12px;">diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java  
  2. index aca2402..6974ee9 100755  
  3. --- a/src/com/android/launcher3/IconCache.java  
  4. +++ b/src/com/android/launcher3/IconCache.java  
  5. @@ -588,6 +588,9 @@ public class IconCache {  
  6.                  entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);  
  7.              }  
  8.          }  
  9. +        if (info != null) {  
  10. +           entry.title = info.getLabel();  
  11. +        }  
  12.          return entry;  
  13.      }  
  14.    
  15. diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java  
  16. index c90677d..62d6531 100755  
  17. --- a/src/com/android/launcher3/LauncherModel.java  
  18. +++ b/src/com/android/launcher3/LauncherModel.java  
  19. @@ -3754,9 +3754,13 @@ public class LauncherModel extends BroadcastReceiver  
  20.              info.setIcon(icon == null ? mIconCache.getDefaultIcon(user) : icon);  
  21.          }  
  22.    
  23. -        // from the db  
  24. -        if (TextUtils.isEmpty(info.title) && c != null) {  
  25. -            info.title =  Utilities.trim(c.getString(titleIndex));  
  26. +        //// from the db  
  27. +        //if (TextUtils.isEmpty(info.title) && c != null) {  
  28. +        //    info.title =  Utilities.trim(c.getString(titleIndex));  
  29. +        //}  
  30. +        // from PMS.  
  31. +        if (lai != null) {  
  32. +            info.title = lai.getLabel();  
  33.          }  
  34.    
  35.          // fall back to the class name of the activity</span>  

十五:

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

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

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

[java]  view plain  copy
  1. diff --git a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  2. index 3d7ac48..c32acf5 100755  
  3. --- a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  4. +++ b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  5. @@ -134,8 +134,10 @@ public class CbProvider extends ContentProvider {  
  6.              // break;  
  7.          case URL_CHANNEL:  
  8.              qb.setTables(CbDatabaseHelper.CHANNEL_TABLE);  
  9. +            if (selection == null || !selection.contains("sub_id")) {  
  10.              qb.appendWhere("(sub_id = " + SmsProvider.getSubIdFromUri(url)  
  11.                      + ")");  
  12. +            }  
  13.              break;  
  14.          case URL_CONVERSATION:  
  15.              // qb.setTables(CbDatabaseHelper.CONVERSATION_TABLE);  

(vendor/)

[java]  view plain  copy
  1. diff --git a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  2. index 1e224e1..c70aa39 100755  
  3. --- a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  4. +++ b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  5. @@ -534,6 +534,12 @@ add for MClock update sms database  
  6.              <intent-filter>  
  7.                  <action android:name="android.provider.Telephony.SMS_CB_RECEIVED" />  
  8.              </intent-filter>  
  9.   
  10. +            <intent-filter>  
  11. +                <action android:name="android.intent.action.SIM_STATE_CHANGED" />  
  12. +            </intent-filter>  
  13.          </receiver>  
  14.    
  15.          <!-- Catch-all receiver for broadcasts that don't have associated security -->  
  16. 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.java  
  17. index 7415026..816a1f5 100755  
  18. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java  
  19. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java  
  20. @@ -64,6 +64,8 @@ import com.android.mms.MmsApp;  
  21.  import com.android.mms.util.MmsLog;  
  22.  import com.mediatek.mms.util.PermissionCheckUtil;  
  23.    
  24. +import com.android.internal.telephony.TelephonyIntents;  
  25. +  
  26.  /** 
  27.   * M: 
  28.   * Handle incoming SMSes.  Just dispatches the work off to a Service. 
  29. @@ -98,7 +100,14 @@ public class CBMessageReceiver extends BroadcastReceiver { 
  30.                          + intent.getAction() + ", result = " + getResultCode()); 
  31.   
  32.          intent.setClass(context, CBMessageReceiverService.class); 
  33. +/* 
  34.          intent.putExtra("result", getResultCode()); 
  35. + */  
  36. +        android.util.Log.d(" CBMessageReceiver "" CBMessageReceiver.onReceiveWithPrivilege 97 ");  
  37. +        if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {  
  38. +            intent.putExtra("result", getResultCode());  
  39. +        }  
  40.          beginStartingService(context, intent);  
  41.      }  
  42.    
  43. 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.java  
  44. index 35b3133..aea9c3a 100755  
  45. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java  
  46. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java  
  47. @@ -81,6 +81,18 @@ import com.mediatek.mms.ext.IOpCBMessageReceiverServiceExt;  
  48.  import com.mediatek.opmsg.util.OpMessageUtils;  
  49.    
  50.  import android.telephony.SubscriptionManager;  
  51. +import android.provider.Telephony;  
  52. +import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;  
  53. +import android.content.ContentValues;  
  54. +import android.database.Cursor;  
  55. +import android.util.Log;  
  56. +import com.android.internal.telephony.IccCardConstants;  
  57. +import com.android.internal.telephony.TelephonyIntents;  
  58. +import android.telephony.SmsManager;  
  59. +import android.provider.Telephony.Sms.Intents;  
  60.    
  61.  /** 
  62.   * M: 
  63. @@ -97,6 +109,19 @@ public class CBMessageReceiverService extends Service { 
  64.   
  65.      private static final Uri MESSAGE_URI = Telephony.SmsCb.CONTENT_URI; 
  66.      private static final int DEFAULT_SUB_ID = 1; 
  67. +    private static final int MESSAGE_SET_STATE = 33; 
  68. +    private static final int MESSAGE_SET_CONFIG = 32; 
  69. +    private static final String KEYID = "_id"; 
  70. +    private static final String NAME = "name"; 
  71. +    private static final String NUMBER = "number"; 
  72. +    private static final String ENABLE = "enable"; 
  73. +    private static final String SUBID = "sub_id"; 
  74. +    private static final Uri CHANNEL_URI = Uri.parse("content://cb/channel"); 
  75. +    private static final int EVENT_RETRY_ADD_CHANNEL_TIME_OUT = 101; 
  76. +    private static boolean isAddingDefaultChannel = false; 
  77.   
  78.      public Handler mToastHandler = new Handler() { 
  79.          @Override 
  80. @@ -159,6 +184,7 @@ public class CBMessageReceiverService extends Service { 
  81.          public void handleMessage(Message msg) { 
  82.              int serviceId = msg.arg1; 
  83.              Intent intent = (Intent) msg.obj; 
  84. +            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 185 serviceId="+serviceId+" msg.what="+msg.what+" intent="+intent); // modify by mtk_debug 2015-3-19; 
  85.              if (intent != null) { 
  86.                  String action = intent.getAction(); 
  87.                  // NEED Replace with CB ACTION 
  88. @@ -166,12 +192,266 @@ public class CBMessageReceiverService extends Service { 
  89.                      handleCBMessageReceived(intent); 
  90.                  } 
  91.              } 
  92. + 
  93. +            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 162 "); // modify by mtk_debug 2015-3-05; 
  94. +            if(TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())){ 
  95. +                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage receiver a ACTION_SIM_STATE_CHANGED 164 "); // modify by mtk_debug 2015-3-05; 
  96. +                synchronized(this){ 
  97. +                    handleSIMStateChangedReceived(intent); 
  98. +                } 
  99. +            } 
  100.              // NOTE: We MUST not call stopSelf() directly, since we need to 
  101.              // make sure the wake lock acquired by AlertReceiver is released. 
  102. -            CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId); 
  103. +            if(!isAddingDefaultChannel){ 
  104. +                CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId); 
  105. +            } 
  106.          } 
  107.      } 
  108.   
  109. +    private void handleSIMStateChangedReceived(Intent intent) { 
  110. +        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 191 "); // modify by mtk_debug 2015-3-05; 
  111. +        int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); 
  112. +        String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); 
  113. +        // boolean stateExtra = intent.getBooleanExtra("ready",false); 
  114. +        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 214 stateExtra="+stateExtra);  
  115. +        if(IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)){ 
  116. +            // if(stateExtra){ 
  117. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",919)) 
  118. +            { 
  119. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database"); 
  120. +                isAddingDefaultChannel=false; 
  121. +            }else{ 
  122. +                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02; 
  123. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  124. +                {   
  125. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  126. +                    addCustomChanneltoList(subId,"CL-Alerta Local",919);  
  127. +                    isAddingDefaultChannel=false;  
  128. +  
  129. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  130. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  131. +  
  132. +                }else{  
  133. +  
  134. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;  
  135. +                    //add retry  
  136. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  137. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  138. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;  
  139. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  140. +                        isAddingDefaultChannel=true;  
  141. +                    }  
  142. +  
  143. +  
  144. +                }  
  145. +  
  146. +            }  
  147. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",50))  
  148. +            {  
  149. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  150. +                isAddingDefaultChannel=false;  
  151. +            }else{  
  152. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //      modify by mtk_debug 2015-3-02;  
  153. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  154. +                {  
  155. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  156. +                    addCustomChanneltoList(subId,"CL-Alerta Local",50);  
  157. +                    isAddingDefaultChannel=false;  
  158. +  
  159. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  160. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  161. +  
  162. +                }else{  
  163. +  
  164. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;  
  165. +                    //add retry  
  166. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  167. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  168. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;  
  169. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  170. +                        isAddingDefaultChannel=true;  
  171. +                    }  
  172. +  
  173. +  
  174. +                }  
  175. +  
  176. +            }  
  177. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",921))  
  178. +            {  
  179. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  180. +                isAddingDefaultChannel=false;  
  181. +            }else{  
  182. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //  modify by mtk_debug 2015-3-02;  
  183. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  184. +                {  
  185. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  186. +                    addCustomChanneltoList(subId,"CL-Alerta Local",921);  
  187. +                    isAddingDefaultChannel=false;  
  188. +  
  189. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  190. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  191. +  
  192. +                }else{  
  193. +   
  194. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;  
  195. +                    //add retry  
  196. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  197. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  198. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;  
  199. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  200. +                        isAddingDefaultChannel=true;  
  201. +                    }  
  202. +  
  203. +  
  204. +                }  
  205. +  
  206. +            }  
  207. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",4370))  
  208. +            {  
  209. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  210. +                isAddingDefaultChannel=false;  
  211. +            }else{  
  212. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02;  
  213. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  214. +                {   
  215. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  216. +                    addCustomChanneltoList(subId,"CL-Alerta Local",4370);  
  217. +                    isAddingDefaultChannel=false;  
  218. +  
  219. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  220. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  221. +  
  222. +                }else{  
  223. +  
  224. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;  
  225. +                    //add retry  
  226. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  227. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  228. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;  
  229. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  230. +                        isAddingDefaultChannel=true;  
  231. +                    }  
  232. +  
  233. +  
  234. +                }  
  235. +  
  236. +            }  
  237. +  
  238. +        }  
  239. +  
  240. +    }  
  241. +  
  242. +    private void addCustomChanneltoList(int mSubId,String channelName,int channelNum){  
  243. +        Log.d(TAG, "addCustomChanneltoList: mSubId=" + mSubId  
  244. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  245. +  
  246. +        SmsBroadcastConfigInfo[] objectList = new SmsBroadcastConfigInfo[1];  
  247. +        objectList[0] = new SmsBroadcastConfigInfo(channelNum,channelNum, -1, -1true);  
  248. +  
  249. +        Log.d(TAG, "addCustomChanneltoList: setCellBroadcastSmsConfig");  
  250. +        //SmsManagerEx.getDefault().setCellBroadcastSmsConfig(objectList, objectList, mSimId);  
  251. +        boolean isSetConfigSuccess = SmsManager.getSmsManagerForSubscriptionId(mSubId).setCellBroadcastSmsConfig(objectList, objectList);  
  252. +        if(isSetConfigSuccess){  
  253. +            Log.d(" CBMessageReceiverService "" CBMessageReceiverService.addCustomChanneltoList set channel " +channelNum +" success 784 "); // modify by mtk_debug 2015-3-05;  
  254. +            addChannelToDatabase(mSubId,channelName,channelNum);  
  255. +        }else{  
  256. +            Log.d(" CBMessageReceiverService "" CBMessageReceiverService.addCustomChanneltoList set channel "+ channelNum +" failed 786 "); // modify by mtk_debug 2015-3-05;  
  257. +        }  
  258. +  
  259. +  
  260. +        Log.d(TAG, " CBMessageReceiverService addCustomChanneltoList: function end");  
  261. +    }  
  262. +  
  263. +  
  264. +  
  265. +    private boolean addChannelToDatabase(int mSubId,String channelName,int channelNum){  
  266. +            // ClearChannel();  
  267. +        Log.d(TAG, "addChannelToDatabase: mSubId=" + mSubId  
  268. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  269. +        String[] projection = new String[] { NUMBER, SUBID};  
  270. +        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")";   
  271. +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";  
  272. +        Cursor cursornum = null;  
  273. +        Cursor cursorid = null;  
  274. +  
  275. +        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,  
  276. +                projection,  
  277. +                NUMBER + " = ? AND " +  
  278. +                SUBID + " = ?",  
  279. +                new String[] {String.valueOf(channelNum), String.valueOf(mSubId)},  
  280. +                null);  
  281. +        Log.d(TAG, "addChannelToDatabase: cursor.getCount"+cursorzz.getCount());  
  282. +        if(cursorzz.getCount() == 0){//if ((cursornum.getCount() == 0)&&(cursorid.getCount() == 0)){   
  283. +            Log.d(" CBMessageReceiverService "" SmsReceiverService.addChannelToDatabase add mSubId=" + mSubId  
  284. +                    + ", channelName= " + channelName + ", channelNum= " + channelNum +"to database"); // modify by mtk_debug 2015-3-05;  
  285. +            ContentValues values = new ContentValues();  
  286. +            values.put(NAME,channelName);  
  287. +            values.put(NUMBER, channelNum);  
  288. +            values.put(ENABLE, true);   //请注意:如果贵司希望预置的频道默认为disable状态,把true改成false即可  
  289. +            values.put(SUBID, mSubId);  
  290. +            try {  
  291. +                //if(mSimId==PhoneConstants.SUB1){  
  292. +                this.getContentResolver().insert(CHANNEL_URI, values);  
  293. +                //}else if(mSimId==PhoneConstants.SUB2){  
  294. +                // this.getContentResolver().insert(CHANNEL_URI1, values);  
  295. +                //}  
  296. +            } catch (Exception e){  
  297. +                Log.d(" CBMessageReceiverService "" SmsReceiverService.addChannelToDatabase exception 828 "); // modify by mtk_debug 2015-3-05;  
  298. +                //cursornum.close();  
  299. +                //cursorid.close();  
  300. +                cursorzz.close();  
  301. +                return false;  
  302. +            }  
  303. +            //cursornum.close();  
  304. +            // cursorid.close();  
  305. +            cursorzz.close();  
  306. +            return true;  
  307. +        }  
  308. +        else{  
  309. +            //cursornum.close();  
  310. +            //cursorid.close();  
  311. +            cursorzz.close();  
  312. +            return false;  
  313. +        }  
  314. +  
  315. +    }   
  316. +  
  317. +  
  318. +    private boolean queryIfChannelInDatabase(int mSubId,String channelName,int channelNum){  
  319. +  
  320. +        Log.d(TAG, "queryIfChannelInDatabase: mSubId=" + mSubId  
  321. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  322. +        String[] projection = new String[] { NUMBER, SUBID};  
  323. +        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")";   
  324. +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";  
  325. +        Cursor cursornum = null;  
  326. +        Cursor cursorid = null;  
  327. +  
  328. +        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,  
  329. +                projection,  
  330. +                NUMBER + " = ? AND " +  
  331. +                SUBID + " = ?",  
  332. +                new String[] {String.valueOf(channelNum),String.valueOf(mSubId)},  
  333. +                null);  
  334. +  
  335. +        if(cursorzz != null&&cursorzz.getCount() > 0){  
  336. +            //if ((cursornum.getCount() != 0)&&(cursorid.getCount() != 0)){  
  337. +            Log.d(TAG, "queryIfChannelInDatabase: cursor.getCount"+cursorzz.getCount());  
  338. +            cursorzz.close();  
  339. +            return true;  
  340. +  
  341. +  
  342. +        }else{  
  343. +            cursorzz.close();  
  344. +            Log.d(TAG, "queryIfChannelInDatabase: return false");  
  345. +            return false;  
  346. +        }  
  347. +  
  348. +    }  
  349. +// End of Vanzo:tanglei  
  350. +  
  351.      private void handleCBMessageReceived(Intent intent) {  
  352.          // TODO need replace with cb message.  
  353.          Bundle extras = intent.getExtras();  
  354. 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.java  
  355. index c17f2b0..d784299 100755  
  356. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java  
  357. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java  
  358. @@ -218,6 +218,9 @@ public class CellBroadcastSettings extends TimeConsumingPreferenceActivity  
  359.              } else {  
  360.                  channel.setSummary(R.string.disable);  
  361.              }  
  362. +            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)")) {  
  363. +                channel.setEnabled(false);  
  364. +            }  
  365.    
  366.              channel.setOnPreferenceClickListener(new OnPreferenceClickListener() {  
  367.                  public boolean onPreferenceClick(Preference arg0) {  




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

[java]  view plain  copy
  1. diff --git a/Telephony/src/com/android/phone/MobileNetworkSettings.java b/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  2. index d1dbc6f..4a30ffa 100644  
  3. --- a/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  4. +++ b/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  5. @@ -962,6 +962,7 @@ public class MobileNetworkSettings extends PreferenceActivity implements  
  6.                  switch (buttonNetworkMode) {  
  7.                      case Phone.NT_MODE_WCDMA_PREF:  
  8.                      case Phone.NT_MODE_GSM_ONLY:  
  9. +                    case Phone.NT_MODE_WCDMA_ONLY:  
  10.                      case Phone.NT_MODE_LTE_GSM_WCDMA:  
  11.                      case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:  
  12.                      case Phone.NT_MODE_CDMA:  
  13. @@ -1193,6 +1194,9 @@ public class MobileNetworkSettings extends PreferenceActivity implements  
  14.          // @}  
  15.          switch (NetworkMode) {  
  16.              case Phone.NT_MODE_WCDMA_ONLY:  
  17. +                mButtonEnabledNetworks.setValue(Integer.toString(Phone.NT_MODE_WCDMA_ONLY));  
  18. +                mButtonEnabledNetworks.setSummary(R.string.network_3G_only);  
  19. +                break;  
  20.              case Phone.NT_MODE_GSM_UMTS:  
  21.              case Phone.NT_MODE_WCDMA_PREF:  
  22.                  if (!mIsGlobalCdma) {  


十七: 掉指示灯功能

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

[java]  view plain  copy
  1. diff --git a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  2. +index 9440315..d0fad5c 100755  
  3. --- a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  4. +++ b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  5. @@ -56,7 +56,7 @@ public class FactoryMode extends Activity implements OnItemClickListener {  
  6.    
  7.      private TextView mMotherBoardResult;  
  8.    
  9. -    public static boolean mHavePsensor = true;  
  10. +    public static boolean mHavePsensor = false;  
  11.    
  12.      public static boolean mHaveMsensor = true;  

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

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

[java]  view plain  copy
  1. diff --git a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  2. index a0d1577..0b17327 100644  
  3. --- a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  4. +++ b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  5. @@ -26,7 +26,7 @@  
  6.              android:title="@string/preferences_show_week_num_title" />  
  7.          <ListPreference  
  8.              android:key="preferences_week_start_day"  
  9. -            android:defaultValue="@string/preferences_week_start_day_default"  
  10. +            android:defaultValue="2"  
  11.              android:title="@string/preferences_week_start_day_title"  
  12.              android:entries="@array/preferences_week_start_day_labels"  
  13.              android:entryValues="@array/preferences_week_start_day_values"  


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

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

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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java b/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  2. index ae053df..955a749 100644  
  3. --- a/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  4. +++ b/src/com/android/gallery3d/data/FilterEmptyPromptSet.java  
  5. @@ -44,7 +44,7 @@ public class FilterEmptyPromptSet extends MediaSet implements ContentListener {  
  6.          if (itemCount > 0) {  
  7.              return itemCount;  
  8.          } else {  
  9. -            return 1;  
  10. +            return 0;  
  11.          }  
  12.      }  


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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/calculator2/CalculatorExpressionBuilder.java b/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  2. index fc229f0..df85076 100755  
  3. --- a/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  4. +++ b/src/com/android/calculator2/CalculatorExpressionBuilder.java  
  5. @@ -19,6 +19,7 @@ package com.android.calculator2;  
  6.  import android.content.Context;  
  7.  import android.text.SpannableStringBuilder;  
  8.  import android.text.TextUtils;  
  9. +import android.util.Log;  
  10.    
  11.  public class CalculatorExpressionBuilder extends SpannableStringBuilder {  
  12.    
  13. @@ -65,6 +66,16 @@ public class CalculatorExpressionBuilder extends SpannableStringBuilder {  
  14.                          break;  
  15.                      }  
  16. +                    if (start > 0 && "-".indexOf(expr.charAt(start - 1)) != -1) {  
  17. +                        appendExpr = "";  
  18. +                        break;  
  19. +                    }  
  20.   
  21.                      // don't allow multiple successive operators  
  22.                      while (start > 0 && "+-*/".indexOf(expr.charAt(start - 1)) != -1) {  
  23.                          --start;  


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

frameworks/

[java]  view plain  copy
  1. diff --git a/base/core/java/android/app/Activity.java b/base/core/java/android/app/Activity.java  
  2. index f6ecec3..1696a5e 100644  
  3. --- a/base/core/java/android/app/Activity.java  
  4. +++ b/base/core/java/android/app/Activity.java  
  5. @@ -117,7 +117,7 @@ import java.lang.annotation.RetentionPolicy;  
  6.  import java.util.ArrayList;  
  7.  import java.util.HashMap;  
  8.  import java.util.List;  
  9. -  
  10. +import android.content.BroadcastReceiver;  
  11.  /** 
  12.   * An activity is a single, focused thing that the user can do.  Almost all 
  13.   * activities interact with the user, so the Activity class takes care of 
  14. @@ -1742,6 +1742,20 @@ public class Activity extends ContextThemeWrapper 
  15.      public void onConfigurationChanged(Configuration newConfig) { 
  16.          if (DEBUG_LIFECYCLE) Slog.v(TAG, "onConfigurationChanged " + this + ": " + newConfig); 
  17.          mCalled = true; 
  18. +        Intent mIntent = new Intent("Configuration_orientation"); 
  19.  
  20. +        if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){ 
  21. +            mIntent.putExtra("ori_status",1); 
  22. +            Log.d("houcongxi","ori_status-------1111111111"); 
  23. +            this.sendBroadcast(mIntent); 
  24. +        }else{ 
  25. +            mIntent.putExtra("ori_status",2); 
  26. +            Log.d("houcongxi","ori_status-------2222222222"); 
  27. +            this.sendBroadcast(mIntent); 
  28. +        } 
  29.   
  30.          mFragments.dispatchConfigurationChanged(newConfig); 
  31.   
  32. diff --git a/base/core/java/android/provider/Settings.java b/base/core/java/android/provider/Settings.java 
  33. index 7222da6..daf099e 100644 
  34. --- a/base/core/java/android/provider/Settings.java 
  35. +++ b/base/core/java/android/provider/Settings.java 
  36. @@ -1505,6 +1505,11 @@ public final class Settings { 
  37.   
  38.              // At one time in System, then Global, but now back in Secure 
  39.              MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS); 
  40. +            MOVED_TO_SECURE.add(Secure.DEV_FORCE_SHOW_NAVBAR); 
  41.          } 
  42.   
  43.          private static final HashSet<String> MOVED_TO_GLOBAL; 
  44. @@ -4269,6 +4274,18 @@ public final class Settings { 
  45.          @Deprecated 
  46.          public static final String ANDROID_ID = Secure.ANDROID_ID; 
  47.   
  48. +        /** 
  49. +         * Developer options - Navigation Bar show switch 
  50. +         * @deprecated Use {@link android.provider.Settings.Secure#DEV_FORCE_SHOW_NAVBAR} instead 
  51. +         * @hide 
  52. +         */  
  53. +        @Deprecated  
  54. +        public static final String DEV_FORCE_SHOW_NAVBAR = Secure.DEV_FORCE_SHOW_NAVBAR;  
  55. +  
  56.          /** 
  57.           * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 
  58.           */  
  59. @@ -5073,6 +5090,16 @@ public final class Settings {  
  60.           */  
  61.          public static final String ANDROID_ID = "android_id";  
  62.    
  63. +        /**   
  64. +         * Developer options - Navigation Bar show switch 
  65. +         * @hide 
  66. +         */  
  67. +        public static final String DEV_FORCE_SHOW_NAVBAR = "dev_force_show_navbar";  
  68. +  
  69.          /** 
  70.           * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead 
  71.           */  
  72. diff --git a/base/core/java/android/view/ViewRootImpl.java b/base/core/java/android/view/ViewRootImpl.java  
  73. index 1ffc935..5c16de7 100644  
  74. --- a/base/core/java/android/view/ViewRootImpl.java  
  75. +++ b/base/core/java/android/view/ViewRootImpl.java  
  76. @@ -111,6 +111,13 @@ import android.content.Intent;  
  77.  import com.android.featureoption.FeatureOption;  
  78.    
  79. +import android.content.IntentFilter;  
  80. +import android.content.BroadcastReceiver;  
  81. +  
  82.  /** 
  83.   * The top of a view hierarchy, implementing the needed protocol between View 
  84.   * and the WindowManager.  This is for the most part an internal implementation 
  85. @@ -454,12 +461,25 @@ public final class ViewRootImpl implements ViewParent, 
  86.      private static final String DUMP_IMAGE_PTAH = "/data/dump/"; 
  87.      private static final String DATE_FORMAT_STRING = "yyyyMMdd_hhmmss"; 
  88.      private static final String DUMP_IMAGE_FORMAT = ".png"; 
  89. - 
  90. +    private int screenWidth, screenHeight; 
  91. +    private int ori; 
  92. +    private int orl; 
  93.      public ViewRootImpl(Context context, Display display) { 
  94.          mContext = context; 
  95.          mWindowSession = WindowManagerGlobal.getWindowSession(); 
  96.          mDisplay = display; 
  97.          mBasePackageName = context.getBasePackageName(); 
  98. +        screenWidth=display.getWidth(); 
  99. +        screenHeight=display.getHeight(); 
  100. +        Log.d("houcongxi","screenWidth:"+screenWidth+"---,screenHeight:"+screenHeight); 
  101.   
  102.          mDisplayAdjustments = display.getDisplayAdjustments(); 
  103.   
  104. @@ -496,6 +516,17 @@ public final class ViewRootImpl implements ViewParent, 
  105.          mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); 
  106.          loadSystemProperties(); 
  107. +        Configuration mCon=mContext.getResources().getConfiguration(); 
  108. +        orl= mCon.orientation; 
  109. +        Log.d("houcongxi",orl+"+++++++++++++++++++++++"); 
  110. +        IntentFilter mOriIntentFilter = new IntentFilter(); 
  111. +        mOriIntentFilter.addAction("Configuration_orientation"); 
  112. +        mContext.registerReceiver(mOriBroadcastReceiver, mOriIntentFilter); 
  113. + 
  114.          /** 
  115.           * M: increase instance count and check log property to determine 
  116.           * whether to enable/disable log system. @{ 
  117. @@ -514,6 +545,20 @@ public final class ViewRootImpl implements ViewParent, 
  118.          /** @} */  
  119.      }  
  120. +    private BroadcastReceiver mOriBroadcastReceiver = new BroadcastReceiver(){  
  121. +       @Override  
  122. +            public void onReceive(Context context, Intent intent) {  
  123. +                String action = intent.getAction();  
  124. +                if(action.equals("Configuration_orientation")){  
  125. +                ori=intent.getIntExtra("ori_status",0);  
  126. +                Log.d("houcongxi",ori+"ori++++++++++++++");  
  127. +                }  
  128. +            }  
  129. +    };  
  130.      public static void addFirstDrawHandler(Runnable callback) {  
  131.          synchronized (sFirstDrawHandlers) {  
  132.              if (!sFirstDrawComplete) {  
  133. @@ -4744,7 +4789,15 @@ public final class ViewRootImpl implements ViewParent,  
  134.              }  
  135.              return FORWARD;  
  136.          }  
  137. -  
  138. +        private float startY = 0;  
  139. +        private float endY = 0;  
  140. +        private float startX = 0;  
  141. +        private float endX = 0;  
  142. +      
  143. @@ -4761,12 +4814,34 @@ public final class ViewRootImpl implements ViewParent,  
  144.              final MotionEvent event = (MotionEvent)q.mEvent;  
  145.              mAttachInfo.mUnbufferedDispatchRequested = false;  
  146.              boolean handled = mView.dispatchPointerEvent(event);  
  147. +            int action = event.getAction();  
  148.    
  149. +            switch (action & MotionEvent.ACTION_MASK) {  
  150. +                case  MotionEvent.ACTION_DOWN:  
  151. +                    startY = event.getY();  
  152. +                    startX = event.getX();  
  153. +                    break;  
  154. +                case MotionEvent.ACTION_UP:  
  155. +                    endY = event.getY();  
  156. +                    endX = event.getX();  
  157. +                    Intent mIntent = new Intent("forceAddNavigationBar");  
  158. +                    if(startY - endY > 8&&(endY>screenHeight-460)&&(ori==1||orl==1)){  
  159. +                        Log.d("houcongxi","Swipe up");  
  160. +                        mContext.sendBroadcast(mIntent);  
  161. +                    }else if(startX - endX > 8&&(endX>screenWidth-460&&(ori==2||orl==2))){  
  162. +                        Log.d("houcongxi","swipe left");  
  163. +                        mContext.sendBroadcast(mIntent);  
  164. +                    }   
  165. +                    break;  
  166. +            }  
  167.              if(FeatureOption.VANZO_FEATURE_GOLBAL_3FINGER_SCREENSHOT){  
  168. -                int action = event.getAction();  
  169.                  if(event.getPointerCount() > 3){  
  170.                      mPointerCount = false;  
  171.                      mThreeClick = true;  
  172. diff --git a/base/packages/SettingsProvider/res/values/defaults.xml b/base/packages/SettingsProvider/res/values/defaults.xml  
  173. index 5d7ea01..71f289f 100644  
  174. --- a/base/packages/SettingsProvider/res/values/defaults.xml  
  175. +++ b/base/packages/SettingsProvider/res/values/defaults.xml  
  176. @@ -184,6 +184,9 @@  
  177.           Override to disable immersive mode confirmation for certain packages. -->  
  178.      <string name="def_immersive_mode_confirmations" translatable="false"></string>  
  179.    
  180. +    <!-- Defaults for Settings.System.DEV_FORCE_SHOW_NAVBAR. -->  
  181. +    <integer name="def_force_disable_navkeys">0</integer>  
  182. +  
  183.      <!-- Default for Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE -->  
  184.      <integer name="def_wifi_scan_always_available">0</integer>  
  185.    
  186. diff --git a/base/packages/SystemUI/res/layout/navigation_bar.xml b/base/packages/SystemUI/res/layout/navigation_bar.xml  
  187. index c92ba45..d98d4f0 100644  
  188. --- a/base/packages/SystemUI/res/layout/navigation_bar.xml  
  189. +++ b/base/packages/SystemUI/res/layout/navigation_bar.xml  
  190. @@ -43,7 +43,23 @@  
  191.    
  192.              <!-- navigation controls -->  
  193.              <View  
  194. -                android:layout_width="@dimen/navigation_side_padding"  
  195. +                android:id="@+id/divider_view"  
  196. +                android:layout_width="5dp"  
  197. +                android:layout_height="match_parent"  
  198. +                android:layout_weight="0"  
  199. +                android:visibility="invisible"  
  200. +                />  
  201. +            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"  
  202. +                android:layout_width="35dp"  
  203. +                android:layout_height="match_parent"  
  204. +                android:src="@drawable/ic_hide_navigationbar_x"  
  205. +                android:layout_weight="0"  
  206. +                android:scaleType="center"  
  207. +                android:contentDescription="@string/accessibility_back"  
  208. +                />  
  209. +  
  210. +            <View  
  211. +                android:layout_width="10dp"  
  212.                  android:layout_height="match_parent"  
  213.                  android:layout_weight="0"  
  214.                  android:visibility="invisible"  
  215. @@ -56,6 +72,7 @@  
  216.                  android:layout_weight="0"  
  217.                  android:scaleType="center"  
  218.                  android:contentDescription="@string/accessibility_back"  
  219. +                android:paddingRight="-20dp"  
  220.                  />  
  221.              <View  
  222.                  android:layout_width="0dp"  
  223. @@ -72,6 +89,7 @@  
  224.                  android:layout_weight="0"  
  225.                  android:scaleType="center"  
  226.                  android:contentDescription="@string/accessibility_home"  
  227. +                android:paddingRight="-20dp"  
  228.                  />  
  229.              <View  
  230.                  android:layout_width="0dp"  
  231. @@ -86,6 +104,7 @@  
  232.                  android:layout_weight="0"  
  233.                  android:scaleType="center"  
  234.                  android:contentDescription="@string/accessibility_recent"  
  235. +                android:paddingRight="-20dp"  
  236.                  />  
  237.              <FrameLayout  
  238.                  android:layout_width="@dimen/navigation_side_padding"  
  239. @@ -260,6 +279,21 @@  
  240.                  android:contentDescription="@string/accessibility_back"  
  241.                  />  
  242.              <View  
  243. +                android:layout_height="match_parent"  
  244. +                android:layout_width="match_parent"  
  245. +                android:layout_weight="1"  
  246. +                android:visibility="invisible"  
  247. +                />  
  248. +            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/collapse"  
  249. +                android:layout_height="@dimen/navigation_key_width"  
  250. +                android:layout_width="match_parent"  
  251. +                android:src="@drawable/ic_hide_navigationbar_y"  
  252. +                android:scaleType="center"  
  253. +                android:layout_weight="0"  
  254. +                android:contentDescription="@string/accessibility_back"  
  255. +                />  
  256. +            <View  
  257. +                android:id="@+id/divider_view"  
  258.                  android:layout_height="@dimen/navigation_side_padding"  
  259.                  android:layout_width="match_parent"  
  260.                  android:layout_weight="0"  
  261. 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  
  262. index a0d07a0..24dcf14 100644  
  263. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java  
  264. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java  
  265. @@ -68,6 +68,15 @@ import com.mediatek.multiwindow.MultiWindowProxy;  
  266.  import com.mediatek.systemui.ext.DefaultNavigationBarPlugin;  
  267.  import com.mediatek.systemui.ext.INavigationBarPlugin;  
  268.  import android.os.UserHandle;  
  269. +import android.content.Intent;  
  270. +import android.provider.Settings;  
  271. +import android.content.BroadcastReceiver;  
  272. +import android.os.SystemProperties;  
  273. +import android.content.IntentFilter;  
  274.    
  275.    
  276.    
  277. @@ -214,6 +223,13 @@ public class NavigationBarView extends LinearLayout {  
  278.    
  279.      public NavigationBarView(Context context, AttributeSet attrs) {  
  280.          super(context, attrs);  
  281. +         IntentFilter mAddIntentFilter = new IntentFilter();  
  282. +         mAddIntentFilter.addAction("refresh_navigationbar_for_ic");  
  283. +         mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);  
  284.    
  285.          mDisplay = ((WindowManager)context.getSystemService(  
  286.                  Context.WINDOW_SERVICE)).getDefaultDisplay();  
  287. @@ -544,6 +560,17 @@ public class NavigationBarView extends LinearLayout {  
  288.          mCurrentView = mRotatedViews[Surface.ROTATION_0];  
  289.    
  290.          getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);  
  291. +    if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"true)) {  
  292. +            getCollapseButton().setOnClickListener(mCollapseClickListener);  
  293. +        } else {  
  294. +            getCollapseButton().setVisibility(View.GONE);  
  295. +            getDividerView().setVisibility(View.GONE);  
  296. +        }  
  297.    
  298.          updateRTLOrder();  
  299.      }  
  300. @@ -565,6 +592,22 @@ public class NavigationBarView extends LinearLayout {  
  301.    
  302.          mDeadZone = (DeadZone) mCurrentView.findViewById(R.id.deadzone);  
  303. +        if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"true)) {  
  304. +            //  if (getCollapseButton() != null) {  
  305. +            getCollapseButton().setOnClickListener(mCollapseClickListener);  
  306. +            //  }  
  307. +        } else {  
  308. +            //  if (getCollapseButton() != null) {  
  309. +            getCollapseButton().setVisibility(View.GONE);  
  310. +            getDividerView().setVisibility(View.GONE);  
  311. +            //  }   
  312. +        }  
  313. +  
  314.          // force the low profile & disabled states into compliance  
  315.          mBarTransitions.init();  
  316.          setDisabledFlags(mDisabledFlags, true /* force */);  
  317. @@ -787,6 +830,53 @@ public class NavigationBarView extends LinearLayout {  
  318.      public interface OnVerticalChangedListener {  
  319.          void onVerticalChanged(boolean isVertical);  
  320.      }  
  321. +    public View getCollapseButton() {  
  322. +        return mCurrentView.findViewById(R.id.collapse);  
  323. +    }  
  324. +  
  325. +    public View getDividerView() {  
  326. +        return mCurrentView.findViewById(R.id.divider_view);  
  327. +    }  
  328. +  
  329. +    private final OnClickListener mCollapseClickListener = new OnClickListener() {  
  330. +        @Override  
  331. +            public void onClick(View view) {  
  332. +                Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  333. +                Log.d("houcongxi","onclick:"+Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,-1));  
  334. +                Intent mIntent = new Intent("removeNavigationBar");  
  335. +                if (SystemProperties.getBoolean("persist.sys.navigationbarstatus"false)) {  
  336. +                    mContext.sendBroadcast(mIntent);  
  337. +                }  
  338. +            }  
  339. +    };  
  340. +    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){  
  341. +        @Override  
  342. +            public void onReceive(Context context, Intent intent) {  
  343. +                String action = intent.getAction();  
  344. +                //让他消失,然后在出现的广播,动画以后做  
  345. +                Intent mIntent = new Intent("removeNavigationBar");  
  346. +                mContext.sendBroadcast(mIntent);  
  347. +                new Handler().postDelayed(new Runnable(){  
  348. +                        public void run() {  
  349. +                        Intent nIntent = new Intent("forceAddNavigationBar");  
  350. +                        mContext.sendBroadcast(nIntent);  
  351. +                        }  
  352. +                        }, 700);  
  353. +  
  354. +                /*   if(getCollapseButton().getVisibility()==View.VISIBLE){ 
  355. +                     getCollapseButton().setVisibility(View.GONE); 
  356. +                     getDividerView().setVisibility(View.GONE); 
  357. +                     }else{ 
  358. +                     getCollapseButton().setOnClickListener(mCollapseClickListener); 
  359. +                     getCollapseButton().setVisibility(View.VISIBLE); 
  360. +                     getDividerView().setVisibility(View.VISIBLE); 
  361. +                     }*/  
  362. +            }  
  363. +    };  
  364.    
  365.      /// M: add for multi window @{  
  366.      private BroadcastReceiver mFloatWindowBroadcastReceiver = new BroadcastReceiver() {  
  367. 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  
  368. index 392b6b7..2113397 100644  
  369. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java  
  370. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java  
  371. @@ -416,6 +416,43 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  372.    
  373.      // ensure quick settings is disabled until the current user makes it through the setup wizard  
  374.      private boolean mUserSetup = false;  
  375. +  
  376. +    private void forceAddNavigationBar() {  
  377. +        // If we have no Navbar view and we should have one, create it  
  378. +        if (mNavigationBarView != null) {  
  379. +            return;  
  380. +        }  
  381. +        removeNavigationBar();  
  382. +        android.util.Log.e("houcongxi""================="+mNavigationBarView);  
  383. +  
  384. +        mNavigationBarView =  
  385. +            (NavigationBarView) View.inflate(mContext, R.layout.navigation_bar, null);  
  386. +  
  387. +        mNavigationBarView.setDisabledFlags(mDisabled1);  
  388. +        //mNavigationBarView.setDisabledFlags(mDisabled2);  
  389. +        mNavigationBarView.setBar(this);  
  390. +        mNavigationBarView.setBackgroundColor(0x00000000);  
  391. +        //mNavigationBarView.invalidate();  
  392. +  
  393. +        android.util.Log.e("houcongxi""========222========"+mNavigationBarView);  
  394. +        addNavigationBar();  
  395. +        repositionNavigationBar();  
  396. +  
  397. +    }  
  398. +    private void removeNavigationBar() {  
  399. +        if (mNavigationBarView == nullreturn;  
  400. +        if (mNavigationBarView != null) {  
  401. +            mWindowManager.removeViewImmediate(mNavigationBarView);  
  402. +            mNavigationBarView = null;  
  403. +        }  
  404. +  
  405. +        //mWindowManager.removeView(mNavigationBarView);  
  406. +        //mNavigationBarView = null;  
  407. +    }  
  408.      private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) {  
  409.          @Override  
  410.          public void onChange(boolean selfChange) {  
  411. @@ -1123,6 +1160,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  412.          ThreadedRenderer.overrideProperty("ambientRatio", String.valueOf(1.5f));  
  413.          mStatusBarPlmnPlugin.addPlmn((LinearLayout)mStatusBarView.  
  414.                                       findViewById(R.id.status_bar_contents), mContext);  
  415. +        IntentFilter mAddIntentFilter = new IntentFilter();  
  416. +        mAddIntentFilter.addAction("removeNavigationBar");  
  417. +        mContext.registerReceiver(mrBroadcastReceiver, mAddIntentFilter);  
  418. +  
  419. +        IntentFilter mRemIntentFilter = new IntentFilter();  
  420. +        mRemIntentFilter.addAction("forceAddNavigationBar");  
  421. +        mContext.registerReceiver(mrBroadcastReceiver, mRemIntentFilter);  
  422.    
  423.          return mStatusBarView;  
  424.      }  
  425. @@ -4514,6 +4562,31 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,  
  426.      }  
  427.      /// M: Support "Operator plugin - Customize Carrier Label for PLMN". @}  
  428.    
  429. +    private BroadcastReceiver mrBroadcastReceiver = new BroadcastReceiver(){  
  430. +        @Override  
  431. +            public void onReceive(Context context, Intent intent) {  
  432. +                String action = intent.getAction();  
  433. +                int num=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,0);  
  434. +                boolean visible=(num==1)?true:false;  
  435. +                Log.d("houcongxi","===visible:"+visible);  
  436. +                if(action.equals("removeNavigationBar")){  
  437. +                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  438. +                    removeNavigationBar();  
  439. +                }else if(action.equals("forceAddNavigationBar")&&!visible){  
  440. +                    forceAddNavigationBar();  
  441. +                    Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);  
  442. +  
  443. +                    int num2=Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR,1);  
  444. +                    boolean visible2=(num2==1)?true:false;  
  445. +                    Log.d("houcongxi","-----visible2:"+visible2);  
  446. +                }  
  447. +            }  
  448. +    };  
  449. +// End of Vanzo:houcongxi  
  450. +  
  451.      /// M:add for multi window @{  
  452.      public void registerMWProxyAgain()  
  453.      {  
  454. diff --git a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  455. index 65f9eb2..c848034 100644  
  456. --- a/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  457. +++ b/base/services/core/java/com/android/server/policy/PhoneWindowManager.java  
  458. @@ -1859,8 +1859,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {  
  459.          String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");  
  460.          if ("1".equals(navBarOverride)) {  
  461.              mHasNavigationBar = false;  
  462. +            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0);  
  463.          } else if ("0".equals(navBarOverride)) {  
  464.              mHasNavigationBar = true;  
  465. +            Settings.Secure.putInt(mContext.getContentResolver(),Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 1);  
  466.          }  
  467.    
  468.          // 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)

[java]  view plain  copy
  1. diff --git a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  2.  index 4a7183a..06560bb 100644  
  3.  --- a/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  4.  +++ b/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java  
  5.  @@ -348,7 +348,7 @@ public class UsbDeviceManager {  
  6.           // current USB state  
  7.           private boolean mConnected;  
  8.           private boolean mConfigured;  
  9.  -        private boolean mUsbDataUnlocked;  
  10.  +        private boolean mUsbDataUnlocked = true;  
  11.           private String mCurrentFunctions;  
  12.           private boolean mCurrentFunctionsApplied;  
  13.           private UsbAccessory mCurrentAccessory;  
  14.  @@ -1134,7 +1134,7 @@ public class UsbDeviceManager {  
  15.                       mUsbConfigured = mConfigured;  
  16.                       if (!mConnected) {  
  17.                           // When a disconnect occurs, relock access to sensitive user data  
  18.  -                        mUsbDataUnlocked = false;  
  19.  +                        //mUsbDataUnlocked = false;  
  20.                      }  
  21.                       updateUsbNotification();  
  22.                      updateAdbNotification();  
  23.  @@ -1143,7 +1143,7 @@ public class UsbDeviceManager {  
  24.                          updateCurrentAccessory();  
  25.                      } else if (!mConnected) {  
  26.                          // restore defaults when USB is disconnected  
  27. -                        setEnabledFunctions(nullfalse);  
  28. +                        //setEnabledFunctions(null, false);  
  29.                      }  
  30.                      if (mBootCompleted) {  
  31.                          updateUsbStateBroadcast();  

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

(frameworks/)

[java]  view plain  copy
  1. diff --git a/base/api/current.txt b/base/api/current.txt  
  2. index d7fdb2d..d23c46a 100644  
  3. --- a/base/api/current.txt  
  4. +++ b/base/api/current.txt  
  5. @@ -32521,6 +32521,7 @@ package android.text.format {  
  6.      method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);  
  7.      method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);  
  8.      method public static java.text.DateFormat getDateFormat(android.content.Context);  
  9. +    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);  
  10.      method public static char[] getDateFormatOrder(android.content.Context);  
  11.      method public static java.text.DateFormat getLongDateFormat(android.content.Context);  
  12.      method public static java.text.DateFormat getMediumDateFormat(android.content.Context);  
  13. diff --git a/base/api/system-current.txt b/base/api/system-current.txt  
  14. index 3c88e59..193bd36 100644  
  15. --- a/base/api/system-current.txt  
  16. +++ b/base/api/system-current.txt  
  17. @@ -34813,6 +34813,7 @@ package android.text.format {  
  18.      method public static java.lang.CharSequence format(java.lang.CharSequence, java.util.Calendar);  
  19.      method public static java.lang.String getBestDateTimePattern(java.util.Locale, java.lang.String);  
  20.      method public static java.text.DateFormat getDateFormat(android.content.Context);  
  21. +    method public static java.text.DateFormat getDateFormatForSetting(android.content.Context, java.lang.String);  
  22.      method public static char[] getDateFormatOrder(android.content.Context);  
  23.      method public static java.text.DateFormat getLongDateFormat(android.content.Context);  
  24.      method public static java.text.DateFormat getMediumDateFormat(android.content.Context);  
  25. diff --git a/base/core/java/android/text/format/DateFormat.java b/base/core/java/android/text/format/DateFormat.java  
  26. index 8d5555d..1555939 100755  
  27. --- a/base/core/java/android/text/format/DateFormat.java  
  28. +++ b/base/core/java/android/text/format/DateFormat.java  
  29. @@ -292,7 +292,14 @@ public class DateFormat {  
  30.       * @return the {@link java.text.DateFormat} object that properly formats the date.  
  31.       */  
  32.      public static java.text.DateFormat getDateFormat(Context context) {  
  33. +/* 
  34. + * add choose date format 
  35.          return java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); 
  36. + */  
  37. +        String value = Settings.System.getString(context.getContentResolver(),  
  38. +                Settings.System.DATE_FORMAT);  
  39. +        return getDateFormatForSetting(context, value);  
  40.      }  
  41.    
  42.      /** 
  43. @@ -325,9 +332,16 @@ public class DateFormat { 
  44.       * order returned here. 
  45.       */  
  46.      public static char[] getDateFormatOrder(Context context) {  
  47. +/*  
  48. + * add choose date format 
  49.          return ICU.getDateFormatOrder(getDateFormatString()); 
  50. + */  
  51. +        return ICU.getDateFormatOrder(getDateFormatString(context));  
  52.      }  
  53.    
  54. +/*  
  55. + * add choose date format 
  56.      private static String getDateFormatString() { 
  57.          java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); 
  58.          if (df instanceof SimpleDateFormat) { 
  59. @@ -336,6 +350,13 @@ public class DateFormat { 
  60.   
  61.          throw new AssertionError("!(df instanceof SimpleDateFormat)"); 
  62.      } 
  63. + */  
  64. +    private static String getDateFormatString(Context context) {  
  65. +        String value = Settings.System.getString(context.getContentResolver(),  
  66. +                Settings.System.DATE_FORMAT);  
  67. +        return getDateFormatStringForSetting(context, value);  
  68. +    }  
  69.    
  70.      /** 
  71.       * Given a format string and a time in milliseconds since Jan 1, 1970 GMT, returns a 
  72. @@ -636,4 +657,116 @@ public class DateFormat { 
  73.      private static String zeroPad(int inValue, int inMinDigits) { 
  74.          return String.format(Locale.getDefault(), "%0" + inMinDigits + "d", inValue); 
  75.      } 
  76. +/*  
  77. + * TODO: replace this line with your comment 
  78. + */  
  79. +  
  80. +    public static java.text.DateFormat getDateFormatForSetting(Context context, String value) {  
  81. +        String format = getDateFormatStringForSetting(context, value);  
  82. +        return new java.text.SimpleDateFormat(format);  
  83. +    }  
  84. +  
  85. +    private static String getDateFormatStringForSetting(Context context, String value) {  
  86. +        String result = null;  
  87. +        if (value != null) {  
  88. +            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{  
  89. +            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";  
  90. +            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";  
  91. +            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";  
  92. +            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";  
  93. +  
  94. +            int day = value.indexOf(dayValue);  
  95. +            int month = value.indexOf(monthValue);  
  96. +            int year = value.indexOf(yearValue);  
  97. +            int week = value.indexOf(weekValue);  
  98. +  
  99. +            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {  
  100. +                String template = null;  
  101. +                if (week < day) {  
  102. +                    if (year < month && year < day) {  
  103. +                        if (month < day) {  
  104. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);  
  105. +                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);  
  106. +                        } else {  
  107. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);  
  108. +                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);  
  109. +                        }  
  110. +                    } else if (month < day) {  
  111. +                        if (day < year) {  
  112. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  113. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  114. +                        } else {  
  115. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  116. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  117. +                        }  
  118. +                    } else {  
  119. +                        if (month < year) {  
  120. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  121. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  122. +                        } else {  
  123. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  124. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  125. +                        }  
  126. +                    }  
  127. +                } else {  
  128. +                    if (year < month && year < day) {  
  129. +                        if (month < day) {  
  130. +                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);  
  131. +                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);  
  132. +                        } else {  
  133. +                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);  
  134. +                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);  
  135. +                        }  
  136. +                    } else if (month < day) {  
  137. +                        if (day < year) {  
  138. +                            template = context.getString(com.mediatek.internal.R.string.month_day_year_wday);  
  139. +                            result = String.format(template, monthValue, dayValue, yearValue, weekValue);  
  140. +                        } else {  
  141. +                            template = context.getString(com.mediatek.internal.R.string.month_year_day_wday);  
  142. +                            result = String.format(template, monthValue, yearValue, dayValue, weekValue);  
  143. +                        }  
  144. +                    } else {  
  145. +                        if (month < year) {  
  146. +                            template = context.getString(com.mediatek.internal.R.string.day_month_year_wday);  
  147. +                            result = String.format(template, dayValue, monthValue, yearValue, weekValue);  
  148. +                        } else {  
  149. +                            template = context.getString(com.mediatek.internal.R.string.day_year_month_wday);  
  150. +                            result = String.format(template, dayValue, yearValue, monthValue, weekValue);  
  151. +                        }  
  152. +                    }  
  153. +                }  
  154. +  
  155. +                return result;  
  156. +                /// M: @}  
  157. +        } else if (month >= 0 && day >= 0 && year >= 0) {  
  158. +            String template = context.getString(com.android.internal.R.string.numeric_date_template);  
  159. +            if (year < month && year < day) {  
  160. +                if (month < day) {  
  161. +                    result = String.format(template, yearValue, monthValue, dayValue);  
  162. +                } else {  
  163. +                    result = String.format(template, yearValue, dayValue, monthValue);  
  164. +                }  
  165. +            } else if (month < day) {  
  166. +                if (day < year) {  
  167. +                    result = String.format(template, monthValue, dayValue, yearValue);  
  168. +                } else { // unlikely  
  169. +                    result = String.format(template, monthValue, yearValue, dayValue);  
  170. +                }  
  171. +            } else { // date < month  
  172. +                if (month < year) {  
  173. +                    result = String.format(template, dayValue, monthValue, yearValue);  
  174. +                } else { // unlikely  
  175. +                    result = String.format(template, dayValue, yearValue, monthValue);  
  176. +                }  
  177. +            }  
  178. +  
  179. +            return result;  
  180. +        }  
  181. +        }  
  182. +  
  183. +        // The setting is not set; use the locale's default.  
  184. +        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);  
  185. +        return d.shortDateFormat4;  
  186. +    }  
  187.  }  
  188. diff --git a/base/core/res/res/values/donottranslate-cldr.xml b/base/core/res/res/values/donottranslate-cldr.xml  
  189. index a8e2b2b..80db6e4 100755  
  190. --- a/base/core/res/res/values/donottranslate-cldr.xml  
  191. +++ b/base/core/res/res/values/donottranslate-cldr.xml  
  192. @@ -1,6 +1,7 @@  
  193.  <?xml version="1.0" encoding="UTF-8"?>  
  194.  <resources xmlns:android="http://schemas.android.com/apk/res/android"  
  195.      xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  196. +    <string name="numeric_date_template">"%s/%s/%s"</string>  
  197.      <string name="month_day_year">%B %-e, %Y</string>  
  198.      <string name="time_of_day">%-l:%M:%S %p</string>  
  199.      <string name="date_and_time">%b %-e, %Y, %-l:%M:%S %p</string>  
  200. diff --git a/base/core/res/res/values/symbols.xml b/base/core/res/res/values/symbols.xml  
  201. index e9faf09..50a869a 100644  
  202. --- a/base/core/res/res/values/symbols.xml  
  203. +++ b/base/core/res/res/values/symbols.xml  
  204. @@ -2325,7 +2325,7 @@  
  205.     <java-symbol type="string" name="global_action_reboot" />  
  206.     <java-symbol type="string" name="reboot_confirm_question" />  
  207.     <java-symbol type="string" name="reboot_confirm" />  
  208. -  
  209. +   <java-symbol type="string" name="numeric_date_template" />  
  210.  <!-- Vanzo:tanglei on: Wed, 21 Jan 2015 11:47:03 +0800  
  211.  -->  
  212.    <!-- For Smart Wake -->  
  213. diff --git a/base/packages/Keyguard/res/values/strings_custom.xml b/base/packages/Keyguard/res/values/strings_custom.xml  
  214. new file mode 100755  
  215. index 0000000..c688ae5  
  216. --- /dev/null  
  217. +++ b/base/packages/Keyguard/res/values/strings_custom.xml  
  218. @@ -0,0 +1,4 @@  
  219. +<?xml version="1.0" encoding="utf-8"?>  
  220. +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">  
  221. +    <string name="default_date_format"><xliff:g id="default_date_format">dd-MM-yyyy</xliff:g></string>  
  222. +</resources>  
  223. diff --git a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  224. index 86244b8..6c22fea 100644  
  225. --- a/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  226. +++ b/base/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java  
  227. @@ -35,6 +35,12 @@ import android.widget.GridLayout;  
  228.  import android.widget.LinearLayout;  
  229.  import android.widget.TextClock;  
  230.  import android.widget.TextView;  
  231. +/*  
  232. + * add choose date format 
  233. + */  
  234. +import android.provider.Settings;  
  235. +import libcore.icu.LocaleData;  
  236.    
  237.  import com.android.internal.widget.LockPatternUtils;  
  238.    
  239. @@ -165,8 +171,17 @@ public class KeyguardStatusView extends GridLayout {  
  240.      }  
  241.    
  242.      public void refreshTime() {  
  243. +/*  
  244. + * add choose date format 
  245.          mDateView.setFormat24Hour(Patterns.dateView); 
  246.          mDateView.setFormat12Hour(Patterns.dateView); 
  247. + */  
  248. +        String dateFormat = getCustomDateFormatString(mContext);  
  249. +        if (dateFormat == null || "".equals(dateFormat))  
  250. +            dateFormat = getResources().getString(R.string.default_date_format);  
  251. +        mDateView.setFormat24Hour(dateFormat);  
  252. +        mDateView.setFormat12Hour(dateFormat);  
  253.    
  254.          if (bA1Support) {  
  255.              mClockView.setFormat12Hour(Patterns.clockView12);  
  256. @@ -286,4 +301,118 @@ public class KeyguardStatusView extends GridLayout {  
  257.              cacheKey = key;  
  258.          }  
  259.      }  
  260. +  
  261. +/*  
  262. + * add choose date format 
  263. + * this part was ported from 82lp 
  264. +*/  
  265. +    private String getCustomDateFormatString(Context context) {  
  266. +        String value = Settings.System.getString(context.getContentResolver(),  
  267. +                Settings.System.DATE_FORMAT);  
  268. +        return getDateFormatStringForSetting(context, value);  
  269. +    }  
  270. +  
  271. +    private String getDateFormatStringForSetting(Context context, String value) {  
  272. +        String result = null;  
  273. +        if (value != null) {  
  274. +            /// M: add week and arrange month day year according to resource's date format defination for settings. CR: ALPS00049014 @{  
  275. +            String dayValue = value.indexOf("dd") < 0 ? "d" : "dd";  
  276. +            String monthValue = value.indexOf("MMMM") < 0 ? (value.indexOf("MMM") < 0 ? (value.indexOf("MM") < 0 ? "M" : "MM") : "MMM") : "MMMM";  
  277. +            String yearValue = value.indexOf("yyyy") < 0 ? "y" : "yyyy";  
  278. +            String weekValue = value.indexOf("EEEE") < 0 ? "E" : "EEEE";  
  279. +  
  280. +            int day = value.indexOf(dayValue);  
  281. +            int month = value.indexOf(monthValue);  
  282. +            int year = value.indexOf(yearValue);  
  283. +            int week = value.indexOf(weekValue);  
  284. +  
  285. +            if (week >= 0 && month >= 0 && day >= 0 && year >= 0) {  
  286. +                String template = null;  
  287. +                if (week < day) {  
  288. +                    if (year < month && year < day) {  
  289. +                        if (month < day) {  
  290. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_month_day);  
  291. +                            result = String.format(template, weekValue, yearValue, monthValue, dayValue);  
  292. +                        } else {  
  293. +                            template = context.getString(com.mediatek.internal.R.string.wday_year_day_month);  
  294. +                            result = String.format(template, weekValue, yearValue, dayValue, monthValue);  
  295. +                        }  
  296. +                    } else if (month < day) {  
  297. +                        if (day < year) {  
  298. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  299. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  300. +                        } else {  
  301. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  302. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  303. +                        }  
  304. +                    } else {  
  305. +                        if (month < year) {  
  306. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  307. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  308. +                        } else {  
  309. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  310. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  311. +                        }  
  312. +                    }  
  313. +                } else {  
  314. +                    if (year < month && year < day) {  
  315. +                        if (month < day) {  
  316. +                            template = context.getString(com.mediatek.internal.R.string.year_month_day_wday);  
  317. +                            result = String.format(template, yearValue, monthValue, dayValue, weekValue);  
  318. +                        } else {  
  319. +                            template = context.getString(com.mediatek.internal.R.string.year_day_month_wday);  
  320. +                            result = String.format(template, yearValue, dayValue, monthValue, weekValue);  
  321. +                        }  
  322. +                    } else if (month < day) {  
  323. +                        if (day < year) {  
  324. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_day_year);  
  325. +                            result = String.format(template, weekValue, monthValue, dayValue, yearValue);  
  326. +                        } else {  
  327. +                            template = context.getString(com.mediatek.internal.R.string.wday_month_year_day);  
  328. +                            result = String.format(template, weekValue, monthValue, yearValue, dayValue);  
  329. +                        }  
  330. +                    } else {  
  331. +                        if (month < year) {  
  332. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_month_year);  
  333. +                            result = String.format(template, weekValue, dayValue, monthValue, yearValue);  
  334. +                        } else {  
  335. +                            template = context.getString(com.mediatek.internal.R.string.wday_day_year_month);  
  336. +                            result = String.format(template, weekValue, dayValue, yearValue, monthValue);  
  337. +                        }  
  338. +                    }  
  339. +                }  
  340. +  
  341. +                return result;  
  342. +                /// M: @}  
  343. +        } else if (month >= 0 && day >= 0 && year >= 0) {  
  344. +            String template = context.getString(com.android.internal.R.string.numeric_date_template);  
  345. +            if (year < month && year < day) {  
  346. +                if (month < day) {  
  347. +                    result = String.format(template, yearValue, monthValue, dayValue);  
  348. +                } else {  
  349. +                    result = String.format(template, yearValue, dayValue, monthValue);  
  350. +                }  
  351. +            } else if (month < day) {  
  352. +                if (day < year) {  
  353. +                    result = String.format(template, monthValue, dayValue, yearValue);  
  354. +                } else { // unlikely  
  355. +                    result = String.format(template, monthValue, yearValue, dayValue);  
  356. +                }  
  357. +            } else { // date < month  
  358. +                if (month < year) {  
  359. +                    result = String.format(template, dayValue, monthValue, yearValue);  
  360. +                } else { // unlikely  
  361. +                    result = String.format(template, dayValue, yearValue, monthValue);  
  362. +                }  
  363. +            }  
  364. +  
  365. +            return result;  
  366. +        }  
  367. +        }  
  368. +  
  369. +        // The setting is not set; use the locale's default.  
  370. +        LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);  
  371. +        return d.shortDateFormat4;  
  372. +    }  
  373.  }  
  374. 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  
  375. index 186005c..d9eaabc 100644  
  376. --- a/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java  
  377. +++ b/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java  
  378. @@ -31,6 +31,11 @@ import java.text.SimpleDateFormat;  
  379.  import java.util.Date;  
  380.  import java.util.Locale;  
  381.    
  382. +/*  
  383. + */  
  384. +import java.util.Calendar;  
  385. +import android.text.format.DateFormat;  
  386. +// End of Vanzo:songlixin  
  387.  public class DateView extends TextView {  
  388.      private static final String TAG = "DateView";  
  389.    
  390. @@ -98,6 +103,8 @@ public class DateView extends TextView {  
  391.      }  
  392.    
  393.      protected void updateClock() {  
  394. +/*  
  395. + * porting jb2->kk #53983 
  396.          if (mDateFormat == null) { 
  397.              final Locale l = Locale.getDefault(); 
  398.              final String fmt = DateFormat.getBestDateTimePattern(l, mDatePattern); 
  399. @@ -111,5 +118,10 @@ public class DateView extends TextView { 
  400.              setText(text); 
  401.              mLastText = text; 
  402.          } 
  403. + */  
  404. +        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(mContext);  
  405. +        final Calendar now = Calendar.getInstance();  
  406. +        setText(shortDateFormat.format(now.getTime()));  
  407.      }  
  408.  }  
packages/apps/Settings/

[java]  view plain  copy
  1. diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml  
  2. index 39d8743..f169374 100644  
  3. --- a/res/xml/date_time_prefs.xml  
  4. +++ b/res/xml/date_time_prefs.xml  
  5. @@ -53,4 +53,12 @@  
  6.          android:title="@string/date_time_24hour"  
  7.          />  
  8.    
  9. +<!--  
  10. +add date format  
  11. +-->  
  12. +    <ListPreference  
  13. +        android:key="date_format"  
  14. +        android:title="@string/date_time_date_format"  
  15. +        android:summary="dd/MM/yyyy"/>  
  16.  </PreferenceScreen>  
  17. diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java  
  18. index 474f026..fed3f03 100644  
  19. --- a/src/com/android/settings/DateTimeSettings.java  
  20. +++ b/src/com/android/settings/DateTimeSettings.java  
  21. @@ -81,6 +81,12 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  22.      private SwitchPreference mAutoTimeZonePref;  
  23.      private Preference mTimeZone;  
  24.      private Preference mDatePref;  
  25. +/* 
  26. + * add date format 
  27. + */  
  28. +    private static final String KEY_DATE_FORMAT = "date_format";  
  29. +    private ListPreference mDateFormat;  
  30.    
  31.      // /M: add for GPS time sync feature @{  
  32.      private static final int DIALOG_GPS_CONFIRM = 2;  
  33. @@ -151,8 +157,50 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  34.          mTime24Pref = findPreference("24 hour");  
  35.          mTimeZone = findPreference("timezone");  
  36.          mDatePref = findPreference("date");  
  37. +/* 
  38. + * add date format 
  39. +        if (isFirstRun) { 
  40. +            getPreferenceScreen().removePreference(mTime24Pref); 
  41. +        } 
  42. + */  
  43. +        mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);  
  44. +        if (isFirstRun) {  
  45. +            getPreferenceScreen().removePreference(mTime24Pref);  
  46. +            getPreferenceScreen().removePreference(mDateFormat);  
  47. +        }  
  48. +        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);  
  49. +        String [] formattedDates = new String[dateFormats.length];  
  50. +        String currentFormat = getDateFormat();  
  51. +        // Initialize if DATE_FORMAT is not set in the system settings  
  52. +        // This can happen after a factory reset (or data wipe)  
  53. +        if (currentFormat == null) {  
  54. +            currentFormat = "";  
  55. +        }  
  56. +  
  57. +        // Prevents duplicated values on date format selector.  
  58. +        mDummyDate.set(mDummyDate.get(Calendar.YEAR), mDummyDate.DECEMBER, 311300);  
  59. +  
  60. +        for (int i = 0; i < formattedDates.length; i++) {  
  61. +/* 
  62. + * TODO: replace this line with your comment 
  63. +            String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime()); 
  64. + */  
  65. +            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());  
  66. +  
  67. +            if (dateFormats[i].length() == 0) {  
  68. +                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);  
  69. +            } else {  
  70. +                formattedDates[i] = formatted;  
  71. +            }  
  72. +        }  
  73. +  
  74. +        mDateFormat.setEntries(formattedDates);  
  75. +        mDateFormat.setEntryValues(R.array.date_format_values);  
  76. +        mDateFormat.setValue(currentFormat);  
  77. +  
  78.    
  79. -        // /M: modify as MTK add GPS time Sync feature  
  80.          boolean autoEnabled = autoTimeEnabled || autoTimeGpsEnabled;  
  81.          mTimePref.setEnabled(!autoEnabled);  
  82.          mDatePref.setEnabled(!autoEnabled);  
  83. @@ -193,18 +241,51 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  84.          // We use 13:00 so we can demonstrate the 12/24 hour options.  
  85.          mDummyDate.set(now.get(Calendar.YEAR), 11311300);  
  86.          Date dummyDate = mDummyDate.getTime();  
  87. +/* 
  88. + * add date format 
  89. + */  
  90. +        java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);  
  91. +        mDateFormat.setSummary(shortDateFormat.format(dummyDate));  
  92. +  
  93.          mDatePref.setSummary(DateFormat.getLongDateFormat(context).format(now.getTime()));  
  94.          mTimePref.setSummary(DateFormat.getTimeFormat(getActivity()).format(now.getTime()));  
  95.          mTimeZone.setSummary(ZoneGetter.getTimeZoneOffsetAndName(now.getTimeZone(), now.getTime()));  
  96.          mTime24Pref.setSummary(DateFormat.getTimeFormat(getActivity()).format(dummyDate));  
  97.      }  
  98.    
  99. +/* 
  100. + * add date format 
  101. + */  
  102. +    private void updateDateFormatEntries() {  
  103. +        String [] dateFormats = getResources().getStringArray(R.array.date_format_values);  
  104. +        String [] formattedDates = new String[dateFormats.length];  
  105. +        for (int i = 0; i < formattedDates.length; i++) {  
  106. +          //  String formatted =DateFormat.getTimeFormat(getActivity()).format(mDummyDate.getTime());  
  107. +            String formatted =DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i]).format(mDummyDate.getTime());  
  108. +            if (dateFormats[i].length() == 0) {  
  109. +                formattedDates[i] = getResources().getString(R.string.normal_date_format, formatted);  
  110. +            } else {  
  111. +                formattedDates[i] = formatted;  
  112. +            }  
  113. +        }  
  114. +        mDateFormat.setEntries(formattedDates);  
  115. +    }  
  116. +  
  117. +  
  118.      @Override  
  119.      public void onDateSet(DatePicker view, int year, int month, int day) {  
  120.          final Activity activity = getActivity();  
  121.          if (activity != null) {  
  122.              setDate(activity, year, month, day);  
  123.              updateTimeAndDateDisplay(activity);  
  124. +/* 
  125. + * add date format 
  126. + */  
  127. +            updateDateFormatEntries();  
  128. +  
  129.          }  
  130.      }  
  131.    
  132. @@ -250,6 +331,17 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  133.              Settings.Global.putInt(  
  134.                      getContentResolver(), Settings.Global.AUTO_TIME_ZONE, autoZoneEnabled ? 1 : 0);  
  135.              mTimeZone.setEnabled(!autoZoneEnabled);  
  136. +/* 
  137. + * add date format 
  138. + */  
  139. +        } else if (key.equals(KEY_DATE_FORMAT)) {  
  140. +            String format = preferences.getString(key,getResources().getString(R.string.default_date_format));  
  141. +            Settings.System.putString(getContentResolver(),Settings.System.DATE_FORMAT, format);  
  142. +            updateTimeAndDateDisplay(getActivity());  
  143. +            Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED);  
  144. +            getActivity().sendBroadcast(timeChanged);  
  145. +  
  146.          }  
  147.      }  
  148.    
  149. @@ -372,6 +464,14 @@ public class DateTimeSettings extends SettingsPreferenceFragment  
  150.                  is24Hour? HOURS_24 : HOURS_12);  
  151.      }  
  152.    
  153. +/* 
  154. + * add date format 
  155. + */  
  156. +    private String getDateFormat() {  
  157. +        return Settings.System.getString(getContentResolver(),Settings.System.DATE_FORMAT);  
  158. +    }  
  159. +  
  160.      private boolean getAutoState(String name) {  
  161.          try {  
  162.              return Settings.Global.getInt(getContentResolver(), name) > 0;  


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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java  
  2. index 82be25b..ddd6e0d 100644  
  3. --- a/src/com/android/dialer/dialpad/DialpadFragment.java  
  4. +++ b/src/com/android/dialer/dialpad/DialpadFragment.java  
  5. @@ -863,6 +863,8 @@ public class DialpadFragment extends Fragment  
  6.          // Long-pressing zero button will enter '+' instead.  
  7.          final DialpadKeyButton zero = (DialpadKeyButton) fragmentView.findViewById(R.id.zero);  
  8.          zero.setOnLongClickListener(this);  
  9. +        final DialpadKeyButton three = (DialpadKeyButton) fragmentView.findViewById(R.id.three);  
  10. +        three.setOnLongClickListener(this);  
  11.      }  
  12.    
  13.      @Override  
  14. @@ -1334,6 +1336,15 @@ public class DialpadFragment extends Fragment  
  15.                  mDigits.setCursorVisible(true);  
  16.                  return false;  
  17.              }  
  18. +            case R.id.three: {  
  19. +                Intent intent=new Intent();  
  20. +                intent.setAction("android.intent.action.CALL");  
  21. +                intent.setData(Uri.parse("tel:*611"));  
  22. +                startActivity(intent);  
  23. +                clearDialpad();  
  24. +                return true;  
  25. +  
  26. +            }  
  27.          }  
  28.          return false;  
  29.      }  

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

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

(packages/apps/Contacts/)

[java]  view plain  copy
  1. diff --git a/src/com/android/contacts/editor/AggregationSuggestionEngine.java b/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  2. index bc3f7dc..3122cb1 100644  
  3. --- a/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  4. +++ b/src/com/android/contacts/editor/AggregationSuggestionEngine.java  
  5. @@ -328,6 +328,7 @@ public class AggregationSuggestionEngine extends HandlerThread {  
  6.              }  
  7.              sb.append(')');  
  8.              /// M: Change feature, remove SIM/USIM contact on join popup window.  
  9. +            sb.append(" AND " + Contacts.IS_SDN_CONTACT + "!=-2");  
  10.              sb.append(" AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  11.              sb.toString();  
  12.    
  13. diff --git a/src/com/android/contacts/list/JoinContactListAdapter.java b/src/com/android/contacts/list/JoinContactListAdapter.java  
  14. index 96feceb..da8f44b 100644  
  15. --- a/src/com/android/contacts/list/JoinContactListAdapter.java  
  16. +++ b/src/com/android/contacts/list/JoinContactListAdapter.java  
  17. @@ -107,8 +107,8 @@ public class JoinContactListAdapter extends ContactListAdapter {  
  18.          loader.setUri(allContactsUri);  
  19.          /** M: Change Feature for ALPS00108644. 
  20.           * Descriptions: remove SIM/USIM contacts when do edit join. */  
  21. -        loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  22. -  
  23. +      //  loader.setSelection(Contacts._ID + "!=?" + " AND " + Contacts.INDICATE_PHONE_SIM + "=-1");  
  24. +         loader.setSelection(Contacts._ID + "!=?"+" AND " + Contacts.INDICATE_PHONE_SIM + "=-1" + " AND " + Contacts.IS_SDN_CONTACT + "!=-2");  
  25.          loader.setSelectionArgs(new String[]{ String.valueOf(mTargetContactId) });  
  26.          if (getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY) {  
  27.              loader.setSortOrder(Contacts.SORT_KEY_PRIMARY);  
  28. diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  29. index 760de5d..cf42d49 100644  
  30. --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  31. +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java  
  32. @@ -2665,8 +2665,9 @@ public class QuickContactActivity extends ContactsActivity implements SensorEven  
  33.       * Returns true if it is possible to edit the current contact.  
  34.       */  
  35.      private boolean isContactEditable() {  
  36. -        return mContactData != null && !mContactData.isDirectoryEntry() &&  
  37. -            !mContactData.isSdnContacts();  
  38. //       return mContactData != null && !mContactData.isDirectoryEntry() &&  
  39. //           !mContactData.isSdnContacts();  
  40. +       return mContactData != null && !mContactData.isDirectoryEntry() && !mContactData.isSdnContacts() && !mContactData.isInternationDialNumber() && !mContactData.isReadOnlyContact() ;   
  41.      }  
  42.    
  43.      /**  
  44. diff --git a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  45. index 08aa2a7..60cf1d9 100644  
  46. --- a/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  47. +++ b/src/com/mediatek/contacts/list/MultiBasePickerAdapter.java  
  48. @@ -246,6 +246,9 @@ public class MultiBasePickerAdapter extends DefaultContactListAdapter {  
  49.          if (!mShowSdnNumber) {  
  50.              selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");  
  51.          }  
  52. +        if (!showReadOnlyContact ) {  
  53. +            selection.append(" AND " + Contacts.IS_SDN_CONTACT + "=0");  
  54. +        }  
  55.          loader.setSelection(selection.toString());  
  56.      }  
  57.    
  58. diff --git a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  59. index 7f0035a..921df88 100644  
  60. --- a/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  61. +++ b/src/com/mediatek/contacts/list/MultiDeletionPickerFragment.java  
  62. @@ -310,4 +310,8 @@ public class MultiDeletionPickerFragment extends MultiBasePickerFragment {  
  63.      public boolean isShowSdnNumber() {  
  64.          return false;  
  65.      }  
  66. +  
  67. +    protected boolean isInstanceOfContactsMultiDeletionFragment(){  
  68. +        return true ;  
  69. +    }  
  70.  }  
  71. diff --git a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  72. index ea58d2a..8192c68 100644  
  73. --- a/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  74. +++ b/src/com/mediatek/contacts/simcontact/BootCmpReceiver.java  
  75. @@ -93,6 +93,7 @@ public class BootCmpReceiver extends BroadcastReceiver {  
  76.                  if (!isPhbReady()) {  
  77.                      processBootComplete(context);  
  78.                  }  
  79. +                presetServiceNumber(context);  
  80.              }  
  81.          } else if (action.equals(TelephonyIntents.ACTION_PHB_STATE_CHANGED)  
  82.                  || action.equals(Intent.ACTION_BOOT_COMPLETED)) {  
  83. @@ -181,6 +182,10 @@ public class BootCmpReceiver extends BroadcastReceiver {  
  84.              SIMServiceUtils.SERVICE_WORK_REMOVE);  
  85.      }  
  86.    
  87. +    private void presetServiceNumber(Context context) {  
  88. +        startSimService(context, -1, SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS);  
  89. +    }  
  90. +  
  91.      public void resfreshAllSimContacts(Context context) {  
  92.          Log.i(TAG, "resfreshSimContacts");  
  93.          startSimService(context, SIMServiceUtils.SERVICE_FORCE_REMOVE_SUB_ID,  
  94. diff --git a/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java  
  95. new file mode 100644  
  96. index 0000000..33aedf6  
  97. --- /dev/null  
  98. +++ b/src/com/mediatek/contacts/simservice/PresetContactsImportProcessor.java  
  99. @@ -0,0 +1,116 @@  
  100. +package com.mediatek.contacts.simservice;  
  101. +  
  102. +import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;  
  103. +import android.content.Context;  
  104. +import android.content.Intent;  
  105. +import android.content.ContentProviderOperation;  
  106. +import android.content.ContentValues;  
  107. +import android.content.OperationApplicationException;  
  108. +import android.database.Cursor;  
  109. +import android.net.Uri;  
  110. +import android.provider.ContactsContract;  
  111. +import android.provider.ContactsContract.CommonDataKinds.Email; //for usim  
  112. +import android.provider.ContactsContract.CommonDataKinds.GroupMembership;  
  113. +import android.provider.ContactsContract.CommonDataKinds.Phone;  
  114. +import android.provider.ContactsContract.CommonDataKinds.StructuredName;  
  115. +import android.provider.ContactsContract.Data;  
  116. +import android.provider.ContactsContract.Groups;  
  117. +import android.provider.ContactsContract.RawContacts;  
  118. +import com.android.contacts.common.model.account.AccountType;  
  119. +import android.os.RemoteException;  
  120. +import java.util.ArrayList;  
  121. +import com.mediatek.contacts.simservice.SIMProcessorManager.ProcessorCompleteListener;  
  122. +import com.mediatek.contacts.simservice.SIMServiceUtils;  
  123. +import com.mediatek.contacts.simservice.SIMServiceUtils.ServiceWorkData;  
  124. +import com.mediatek.contacts.simcontact.SimCardUtils;  
  125. +import com.mediatek.contacts.util.Log;  
  126. +import android.provider.ContactsContract.PhoneLookup;  
  127. +  
  128. +  
  129. +public class PresetContactsImportProcessor extends SIMProcessorBase {  
  130. +  
  131. +   private static final String TAG = "PresetContactsImportProcessor";  
  132. +   private static boolean sIsRunningNumberCheck = false;  
  133. +   private static final int INSERT_PRESET_NUMBER_COUNT = 2;         //预置联系人的个数  
  134. +   private static final String INSERT_PRESET_NAME[]   = {"Número de emergencia","Atención al cliente"}; //各预置联系人的姓名   
  135. +   private static final String INSERT_PRESET_NUMBER[] = {"611","*611"};   //各预置联系人的号码  
  136. +   private int mSlotId;  
  137. +   private Context mContext;  
  138. +   public PresetContactsImportProcessor(Context context, int slotId, Intent intent, ProcessorCompleteListener listener) {  
  139. +         super(intent, listener);  
  140. +              mContext = context;  
  141. +              mSlotId = slotId;  
  142. +       }  
  143. +      @Override  
  144. +   public int getType() {  
  145. +        return SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS;  
  146. +   }  
  147. +   @Override  
  148. +   public void doWork() {  
  149. +       if (isCancelled()) {  
  150. +       Log.d(TAG, "[doWork]cancel import preset contacts work. Thread id=" + Thread.currentThread().getId());  
  151. +       return;  
  152. +   }  
  153. +      importDefaultReadonlyContact();  
  154. +   }  
  155. +  
  156. +   private void importDefaultReadonlyContact(){  
  157. +           Log.i(TAG, "isRunningNumberCheck before: " + sIsRunningNumberCheck);  
  158. +           if (sIsRunningNumberCheck) {  
  159. +              return;  
  160. +            }  
  161. +           sIsRunningNumberCheck = true;  
  162. +           for(int i = 0;i < INSERT_PRESET_NUMBER_COUNT; i++) {  
  163. +            Log.i(TAG, "isRunningNumberCheck after: " + sIsRunningNumberCheck);  
  164. +            Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(INSERT_PRESET_NUMBER[i]));  
  165. +            Log.i(TAG, "getContactInfoByPhoneNumbers(), uri = " + uri);  
  166. +            Cursor contactCursor = mContext.getContentResolver().query(uri,   
  167. +            new String[] {PhoneLookup.DISPLAY_NAME, PhoneLookup.PHOTO_ID}, nullnullnull);  
  168. +            try {  
  169. +            if (contactCursor != null && contactCursor.getCount() > 0) {  
  170. +                      return;  
  171. +            } else {  
  172. +             final ArrayList operationList = new ArrayList();  
  173. +            ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);  
  174. +            ContentValues contactvalues = new ContentValues();  
  175. +            contactvalues.put(RawContacts.ACCOUNT_NAME, AccountType.ACCOUNT_NAME_LOCAL_PHONE);  
  176. +            contactvalues.put(RawContacts.ACCOUNT_TYPE, AccountType.ACCOUNT_TYPE_LOCAL_PHONE);  
  177. +            contactvalues.put(RawContacts.INDICATE_PHONE_SIM, ContactsContract.RawContacts.INDICATE_PHONE);  
  178. +            contactvalues.put(RawContacts.IS_SDN_CONTACT, 1);  
  179. +            builder.withValues(contactvalues);  
  180. +            builder.withValue(RawContacts.AGGREGATION_MODE, RawContacts.AGGREGATION_MODE_DISABLED);  
  181. +            operationList.add(builder.build());  
  182. +            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);  
  183. +            builder.withValueBackReference(Phone.RAW_CONTACT_ID, 0);  
  184. +            builder.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);  
  185. +            builder.withValue(Phone.TYPE, Phone.TYPE_MOBILE);  
  186. +            builder.withValue(Phone.NUMBER, INSERT_PRESET_NUMBER[i]);  
  187. +            builder.withValue(Data.IS_PRIMARY, 1);  
  188. +            operationList.add(builder.build());  
  189. +            builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);  
  190. +            builder.withValueBackReference(StructuredName.RAW_CONTACT_ID, 0);  
  191. +            builder.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);  
  192. +            builder.withValue(StructuredName.DISPLAY_NAME, INSERT_PRESET_NAME[i]);  
  193. +            operationList.add(builder.build());  
  194. +            try {  
  195. +                mContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operationList);  
  196. +            } catch (RemoteException e) {  
  197. +                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));  
  198. +            } catch (OperationApplicationException e) {  
  199. +                    Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));  
  200. +            }  
  201. +            }  
  202. +            } finally {  
  203. +            // when this service start,but the contactsprovider has not been started yet.  
  204. +            // the contactCursor perhaps null, but not always.(first load will weekup the provider)  
  205. +            // so add null block to avoid nullpointerexception  
  206. +            if (contactCursor != null) {  
  207. +                contactCursor.close();  
  208. +            }  
  209. +         } //END for  
  210. +        Log.i(TAG, "isRunningNumberCheck insert: " + sIsRunningNumberCheck);  
  211. +        sIsRunningNumberCheck = false;  
  212. +      }  
  213. +    }  
  214. +}  
  215. +  
  216. diff --git a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java b/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  217. index 9b15494..fbab034 100644  
  218. --- a/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  219. +++ b/src/com/mediatek/contacts/simservice/SIMProcessorManager.java  
  220. @@ -44,7 +44,7 @@ import com.android.contacts.common.vcard.ProcessorBase;  
  221.    
  222.  import com.mediatek.contacts.simservice.SIMServiceUtils.SIMProcessorState;  
  223.  import com.mediatek.contacts.util.Log;  
  224. -  
  225. +import com.mediatek.contacts.simcontact.SlotUtils;  
  226.  import java.util.concurrent.ConcurrentHashMap;  
  227.    
  228.  public class SIMProcessorManager implements SIMProcessorState {  
  229. @@ -166,6 +166,7 @@ public class SIMProcessorManager implements SIMProcessorState {  
  230.          Log.d(TAG, "[createProcessor] create new processor for subId: " + subId + ", workType: "  
  231.                  + workType);  
  232.          SIMProcessorBase processor = null;  
  233. +        int slotId = SlotUtils.getNonSlotId();  
  234.    
  235.          if (workType == SIMServiceUtils.SERVICE_WORK_IMPORT) {  
  236.              processor = new SIMImportProcessor(context, subId, intent, listener);  
  237. @@ -175,6 +176,8 @@ public class SIMProcessorManager implements SIMProcessorState {  
  238.              processor = new SIMEditProcessor(context, subId, intent, listener);  
  239.          } else if (workType == SIMServiceUtils.SERVICE_WORK_DELETE) {  
  240.              processor = new SIMDeleteProcessor(context, subId, intent, listener);  
  241. +        } else if(workType == SIMServiceUtils.SERVICE_WORK_IMPORT_PRESET_CONTACTS){  
  242. +            processor = new PresetContactsImportProcessor(context, slotId, intent, listener);  
  243.          }  
  244.    
  245.          return processor;  

(packages/apps/ContactsCommon/)

[java]  view plain  copy
  1. diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  2. index a9afb32..b690dbc 100644  
  3. --- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  4. +++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java  
  5. @@ -83,6 +83,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {  
  6.       */  
  7.      private boolean mProfileExists;  
  8.    
  9. +    public boolean showReadOnlyContact = true;  
  10. +  
  11.      /** 
  12.       * The root view of the fragment that this adapter is associated with. 
  13.       */  
  14. @@ -847,4 +849,8 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter {  
  15.      public TreeSet<Long> getSelectedContactIds() {  
  16.          return mSelectedContactIds;  
  17.      }  
  18. +  
  19. +    public void setShowReadOnlyContact(boolean canDelete) {  
  20. +        showReadOnlyContact = canDelete;  
  21. +    }  
  22.  }  
  23. diff --git a/src/com/android/contacts/common/list/ContactEntryListFragment.java b/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  24. index 7cc4aaa..d15fbd8 100644  
  25. --- a/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  26. +++ b/src/com/android/contacts/common/list/ContactEntryListFragment.java  
  27. @@ -358,6 +358,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter  
  28.              mAdapter.setShowSdnNumber(isShowSdnNumber());  
  29.    
  30.              Log.d(TAG, "[onCreateLoader] loader: " + loader + ",id:" + id);  
  31. +            mAdapter.setShowReadOnlyContact(isInstanceOfContactsMultiDeletionFragment() ? false : true);  
  32.              mAdapter.configureLoader(loader, directoryId);  
  33.              return loader;  
  34.          }  
  35. @@ -972,4 +973,8 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter  
  36.      public boolean isShowSdnNumber() {  
  37.          return true;  
  38.      }  
  39. +  
  40. +    protected boolean isInstanceOfContactsMultiDeletionFragment(){  
  41. +        return false ;  
  42. +    }  
  43.  }  
  44. diff --git a/src/com/android/contacts/common/model/Contact.java b/src/com/android/contacts/common/model/Contact.java  
  45. index 9d8f3f3..e39b361 100644  
  46. --- a/src/com/android/contacts/common/model/Contact.java  
  47. +++ b/src/com/android/contacts/common/model/Contact.java  
  48. @@ -628,5 +628,9 @@ public class Contact {  
  49.          return mId;  
  50.      }  
  51.    
  52. +    public boolean isReadOnlyContact() {  
  53. +        return mIsSdnContact == -2;  
  54. +    }  
  55. +  
  56.      /** M: The previous lines are provided and maintained by Mediatek Inc. @} */  
  57.  }  
  58. diff --git a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java b/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  59. index 1f46812..f319503 100644  
  60. --- a/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  61. +++ b/src/com/mediatek/contacts/simservice/SIMServiceUtils.java  
  62. @@ -69,6 +69,7 @@ public class SIMServiceUtils {  
  63.      public static final int SERVICE_WORK_REMOVE = 2;  
  64.      public static final int SERVICE_WORK_EDIT = 3;  
  65.      public static final int SERVICE_WORK_DELETE = 4;  
  66. +    public static final int SERVICE_WORK_IMPORT_PRESET_CONTACTS = 5;  
  67.      public static final int SERVICE_WORK_UNKNOWN = -1;  
  68.      public static final int SERVICE_IDLE = 0;  
  69.      public static final int SERVICE_FORCE_REMOVE_SUB_ID = -20;  
  70. diff --git a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java b/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  71. index 5213c21..a0ec917 100644  
  72. --- a/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  73. +++ b/src/com/mediatek/contacts/util/ContactsCommonListUtils.java  
  74. @@ -161,6 +161,7 @@ public class ContactsCommonListUtils {  
  75.    
  76.          selection.append(Contacts.INDICATE_PHONE_SIM + "= ?");  
  77.          selectionArgs.add("-1");  
  78. +        selection.append(" AND " + RawContacts.IS_SDN_CONTACT + " > -2");  
  79.    
  80.          loader.setSelection(selection.toString());  
  81.          loader.setSelectionArgs(selectionArgs.toArray(new String[0]));  


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

packages/apps/Contacts/

[java]  view plain  copy
  1. diff --git a/AndroidManifest.xml b/AndroidManifest.xml  
  2. index 6c73cc4..3180671 100644  
  3. --- a/AndroidManifest.xml  
  4. +++ b/AndroidManifest.xml  
  5. @@ -615,6 +615,11 @@ add block mms item  
  6.                  <category android:name="android.intent.category.DEFAULT" />  
  7.              </intent-filter>  
  8.          </activity>  
  9. +       <receiver android:name=".AddContactsReceiver">  
  10. +            <intent-filter>  
  11. +                <action android:name="android.intent.action.BOOT_COMPLETED"/>  
  12. +            </intent-filter>  
  13. +       </receiver>  
  14.    
  15.          <service  
  16.              android:name="com.mediatek.contacts.list.service.MultiChoiceService"  
  17. diff --git a/src/com/android/contacts/AddContactsReceiver.java b/src/com/android/contacts/AddContactsReceiver.java  
  18. new file mode 100644  
  19. index 0000000..524619e  
  20. --- /dev/null  
  21. +++ b/src/com/android/contacts/AddContactsReceiver.java  
  22. @@ -0,0 +1,78 @@  
  23. +package com.android.contacts;  
  24. +  
  25. +import java.util.ArrayList;  
  26. +import android.graphics.Bitmap;  
  27. +import android.content.BroadcastReceiver;  
  28. +import android.content.ContentProviderOperation;  
  29. +import android.content.ContentResolver;  
  30. +import android.content.ContentValues;  
  31. +import android.content.Context;  
  32. +import android.content.Intent;  
  33. +import android.content.OperationApplicationException;  
  34. +import android.os.RemoteException;  
  35. +import android.provider.ContactsContract;  
  36. +import android.provider.Settings;  
  37. +import android.provider.ContactsContract.Data;  
  38. +import android.provider.ContactsContract.RawContacts;  
  39. +import android.provider.ContactsContract.CommonDataKinds.Phone;  
  40. +import android.provider.ContactsContract.CommonDataKinds.Photo;   
  41. +import android.net.Uri;  
  42. +import android.provider.ContactsContract.CommonDataKinds.Email;  
  43. +import android.provider.ContactsContract.CommonDataKinds.StructuredName;  
  44. +import android.content.ContentUris;  
  45. +import android.graphics.BitmapFactory;  
  46. +import java.io.ByteArrayOutputStream;  
  47. +import com.android.contacts.common.model.account.AccountType;  
  48. +import android.provider.ContactsContract.Contacts;  
  49. +  
  50. +public class AddContactsReceiver extends BroadcastReceiver {  
  51. +    private static final String TAG = "AddContactsReceiver";  
  52. +  
  53. +    @Override  
  54. +    public void onReceive(Context context, Intent intent) {  
  55. +        if (Settings.System.getInt(context.getContentResolver(), "add_other_contacts"0) == 0) {  
  56. +            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {  
  57. +                boolean result = insert("Contact Center""9242",1,context);  
  58. +                Settings.System.putInt(context.getContentResolver(), "add_other_contacts"1);  
  59. +            }  
  60. +        }  
  61. +    }  
  62. +  
  63. +    public boolean insert(String given_name, String mobile_number,int Starred,Context context) {  
  64. +        try {  
  65. +            ContentValues values = new ContentValues();  
  66. +            Uri rawContactUri = context.getContentResolver().insert(  
  67. +                    RawContacts.CONTENT_URI, values);  
  68. +            long rawContactId = ContentUris.parseId(rawContactUri);  
  69. +            if (given_name != "") {  
  70. +                values.clear();  
  71. +                values.put(Data.RAW_CONTACT_ID, rawContactId);  
  72. +                values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);  
  73. +                values.put(StructuredName.GIVEN_NAME, given_name);  
  74. +                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI,  
  75. +                        values);  
  76. +            }  
  77. +            if (mobile_number != "") {  
  78. +                values.clear();  
  79. +                values.put(Data.RAW_CONTACT_ID, rawContactId);  
  80. +                values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);  
  81. +                values.put(Phone.NUMBER, mobile_number);  
  82. +                values.put(Phone.TYPE, Phone.TYPE_MOBILE);  
  83. +                context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI, values);  
  84. +            }  
  85. +            values.clear();  
  86. +            values.put(ContactsContract.Contacts.STARRED, Starred);  
  87. +            context.getContentResolver().update(ContactsContract.Contacts.CONTENT_URI,values,ContactsContract.Contacts._ID + " = ? "new String[]{rawContactId + ""});  
  88. +        }  
  89. +        catch (Exception e) {  
  90. +            return false;  
  91. +        }  
  92. +        return true;  
  93. +    }  
  94. +  
  95. +  
  96. +}  



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

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

[java]  view plain  copy
  1. diff --git a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  2. index d3dd7a0..288c583 100644  
  3. --- a/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  4. +++ b/base/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java  
  5. @@ -119,6 +119,16 @@ final class DefaultPermissionGrantPolicy {  
  6.          STORAGE_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);  
  7.      }  
  8.    
  9. +    private static final Set<String> EMAIL_PERMISSIONS = new ArraySet<>();  
  10. +    static {  
  11. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_CALENDAR);  
  12. +        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_CALENDAR);  
  13. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_PHONE_STATE);  
  14. +        EMAIL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);  
  15. +        EMAIL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);  
  16. +        EMAIL_PERMISSIONS.add("com.android.email.permission.READ_ATTACHMENT");  
  17. +    }  
  18. +  
  19.      private final PackageManagerService mService;  
  20.    
  21.      private PackagesProvider mImePackagesProvider;  
  22. @@ -338,6 +348,15 @@ final class DefaultPermissionGrantPolicy {  
  23.                  grantRuntimePermissionsLPw(certInstallerPackage, STORAGE_PERMISSIONS, true, userId);  
  24.              }  
  25.    
  26. +            //exchange  
  27. +            PackageParser.Package exchangePackage = getSystemPackageLPr("com.android.exchange");  
  28. +            if (exchangePackage != null) {  
  29. +                grantRuntimePermissionsLPw(exchangePackage, CONTACTS_PERMISSIONS, userId);  
  30. +                grantRuntimePermissionsLPw(exchangePackage, EMAIL_PERMISSIONS, userId);  
  31. +                grantRuntimePermissionsLPw(exchangePackage,STORAGE_PERMISSIONS, userId);  
  32. +                grantRuntimePermissionsLPw(exchangePackage,PHONE_PERMISSIONS,userId);  
  33. +            }  
  34. +  
  35.              // Dialer  
  36.              if (dialerAppPackageNames == null) {  
  37.                  Intent dialerIntent = new Intent(Intent.ACTION_DIAL);  

九:SPN应该从SIM卡读取

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


[java]  view plain  copy
  1. 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  
  2.    index d4ba14b..c325f5d 100755  
  3.    --- a/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java  
  4.    +++ b/base/packages/Keyguard/ext/src/com/mediatek/keyguard/ext/DefaultCarrierTextExt.java  
  5.    @@ -17,7 +17,7 @@ public class DefaultCarrierTextExt implements ICarrierTextExt {  
  6.             }  
  7.    
  8.             if (carrierText != null) {  
  9.   -            return carrierText.toString().toUpperCase();  
  10.   +            return carrierText.toString();  
  11.            }  
  12.            return null;  
  13.        }  

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

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

[java]  view plain  copy
  1. <span style="font-size:12px;">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.java  
  2. index 621aab7..cafaccb 100644  
  3. --- a/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java  
  4. +++ b/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmMmiCode.java  
  5. @@ -765,12 +765,12 @@ public final class GsmMmiCode extends Handler implements MmiCode {  
  6.      static private boolean isShortCodeUSSD(String dialString, GSMPhone phone) {  
  7.          if (dialString != null && dialString.length() <= MAX_LENGTH_SHORT_CODE) {  
  8.              if (phone.isInCall()) {  
  9. -                return true;  
  10. +                return false;  
  11.              }  
  12.    
  13.              if (dialString.length() != MAX_LENGTH_SHORT_CODE ||  
  14.                      dialString.charAt(0) != '1') {  
  15. -                return true;  
  16. +                return false;  
  17.              }  
  18.          }  
  19.          return false;</span>  



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

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

[java]  view plain  copy
  1. diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java  
  2. index 82be25b..9b72f31 100644  
  3. --- a/src/com/android/dialer/dialpad/DialpadFragment.java  
  4. +++ b/src/com/android/dialer/dialpad/DialpadFragment.java  
  5. @@ -1446,7 +1446,42 @@ public class DialpadFragment extends Fragment  
  6.                  return;  
  7.              }  
  8. -  
  9. +            String IMSI = android.os.SystemProperties.get("gsm.sim.operator.imsi");  
  10. +            if(IMSI != null && !(IMSI.isEmpty())){  
  11. +                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")){  
  12. +                    if(number !=null &&number.equals("+503 7701 9995")){  
  13. +                        List<PhoneAccountHandle> subscriptionAccountHandles =  
  14. +                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());  
  15. +                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(  
  16. +                                getTelecomManager().getDefaultOutgoingPhoneAccount(  
  17. +                                    PhoneAccount.SCHEME_VOICEMAIL));  
  18. +                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1  
  19. +                            && !hasUserSelectedDefault;  
  20. +                        if (needsAccountDisambiguation || isVoicemailAvailable()) {  
  21. +                            callVoicemail();  
  22. +                            return;  
  23. +                        }  
  24. +                    }  
  25. +                } 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"))                {  
  26. +                    if(number !=null &&number.equals("+503 7701 9995")){  
  27. +                        List<PhoneAccountHandle> subscriptionAccountHandles =  
  28. +                            PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity());  
  29. +                        boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(  
  30. +                                getTelecomManager().getDefaultOutgoingPhoneAccount(  
  31. +                                    PhoneAccount.SCHEME_VOICEMAIL));  
  32. +                        boolean needsAccountDisambiguation = subscriptionAccountHandles.size() > 1  
  33. +                            && !hasUserSelectedDefault;  
  34. +                        if (needsAccountDisambiguation || isVoicemailAvailable()) {  
  35. +                            callVoicemail();  
  36. +                            return;  
  37. +                        }  
  38. +                    }  
  39. +                }  
  40. +            }  
  41.              // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated  
  42.              // test equipment.  
  43.              // TODO: clean it up.  


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

(packages/apps/Email/)

[java]  view plain  copy
  1. diff --git a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  2. index d6acdaf..a2cda2d 100755  
  3. --- a/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  4. +++ b/UnifiedEmail/src/com/android/mail/compose/ComposeActivity.java  
  5. @@ -78,6 +78,8 @@ import android.widget.ScrollView;  
  6.  import android.widget.MultiAutoCompleteTextView;  
  7.  import android.widget.TextView;  
  8.  import android.widget.Toast;  
  9. +import android.preference.EditTextPreference;  
  10. +import java.util.Locale;  
  11.    
  12.  import com.android.common.Rfc822Validator;  
  13.  import com.android.common.contacts.DataUsageStatUpdater;  
  14. @@ -1116,6 +1118,16 @@ public class ComposeActivity extends ActionBarActivity  
  15.              DataCollectUtils.clearRecordedList();  
  16.          }  
  17.          /** @} */  
  18. +        if(mSignature.equals("Send from my Andy 5E3 of Movistar") || mSignature.equals("Enviado desde mi Andy 5E3 de Movistar")   
  19. +                || mSignature.equals("Sent from my Andy 5E3")){  
  20. +            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")){  
  21. +                if(Locale.getDefault().getLanguage().equals("es")) {  
  22. +                    mBodyView.setText(mBodyView.getText().toString());  
  23. +                } else {  
  24. +                    mBodyView.setText(mBodyView.getText().toString());  
  25. +                }  
  26. +            }  
  27. +        }  
  28.      }  
  29.    
  30.      @Override  
  31. @@ -1890,6 +1902,21 @@ public class ComposeActivity extends ActionBarActivity  
  32.                              message.bodyHtml.length());  
  33.                  }  
  34.              }  
  35. +            if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")  
  36. +                    || mSignature.equals("Sent from my Andy 5E3")){  
  37. +                if(body.equals("Enviado desde mi Andy 5E3 de Movistar") || body.equals("Send from my Andy 5E3 of Movistar")   
  38. +                        || body.equals("Sent from my Andy 5E3")){  
  39. +                    if(Locale.getDefault().getLanguage().equals("en")){  
  40. +                        mBodyView.setText("Send from my Andy 5E3 of Movistar");  
  41. +                    } else if(Locale.getDefault().getLanguage().equals("es")){  
  42. +                        mBodyView.setText("Enviado desde mi Andy 5E3 de Movistar");  
  43. +                    } else {  
  44. +                        mBodyView.setText("Sent from my Andy 5E3");  
  45. +                    }  
  46. +                }  
  47. +            } else{  
  48. +                mBodyView.setText(body);  
  49. +            }  
  50.              new HtmlToSpannedTask().execute(body);  
  51.          } else {  
  52.              final String body = message.bodyText;  
  53. @@ -4229,6 +4256,18 @@ public class ComposeActivity extends ActionBarActivity  
  54.              mSignature = newSignature;  
  55.              if (!TextUtils.isEmpty(mSignature)) {  
  56.                  // Appending a signature does not count as changing text.  
  57. +                if(mSignature.equals("Enviado desde mi Andy 5E3 de Movistar") || mSignature.equals("Send from my Andy 5E3 of Movistar")  
  58. +                        || mSignature.equals("Sent from my Andy 5E3")){  
  59. +                    if(Locale.getDefault().getLanguage().equals("es")){  
  60. +                        mSignature =  "Enviado desde mi Andy 5E3 de Movistar";  
  61. +                    }else if(Locale.getDefault().getLanguage().equals("en")){  
  62. +                        mSignature = "Send from my Andy 5E3 of Movistar";  
  63. +                    }else{  
  64. +                        mSignature = "Sent from my Andy 5E3";  
  65. +                    }  
  66. +                } else {  
  67. +                    mSignature = newSignature;  
  68. +                }  
  69.                  mBodyView.removeTextChangedListener(this);  
  70.                  mBodyView.append(convertToPrintableSignature(mSignature));  
  71.                  mBodyView.addTextChangedListener(this);  
  72. diff --git a/emailcommon/src/com/android/emailcommon/provider/Account.java b/emailcommon/src/com/android/emailcommon/provider/Account.java  
  73. index e3671b3..7d7ab07 100755  
  74. --- a/emailcommon/src/com/android/emailcommon/provider/Account.java  
  75. +++ b/emailcommon/src/com/android/emailcommon/provider/Account.java  
  76. @@ -44,6 +44,7 @@ import org.json.JSONException;  
  77.  import org.json.JSONObject;  
  78.    
  79.  import java.util.ArrayList;  
  80. +import java.util.Locale;  
  81.    
  82.  public final class Account extends EmailContent implements Parcelable {  
  83.      public static final String TABLE_NAME = "Account";  
  84. @@ -144,6 +145,7 @@ public final class Account extends EmailContent implements Parcelable {  
  85.      public String mProtocolVersion;  
  86.      public String mSecuritySyncKey;  
  87.      public String mSignature;  
  88. +    public String CUSTOM_SIGNATURE = "Sent from my Andy 5E3";  
  89.      public long mPolicyKey;  
  90.      public long mPingDuration;  
  91.    
  92. @@ -211,6 +213,13 @@ public final class Account extends EmailContent implements Parcelable {  
  93.          mSyncInterval = -1;  
  94.          mSyncLookback = -1;  
  95.          mFlags = 0;  
  96. +        if(Locale.getDefault().getLanguage().equals("en")){  
  97. +            mSignature = "Send from my Andy 5E3 of Movistar";  
  98. +        } else if(Locale.getDefault().getLanguage().equals("es")){  
  99. +            mSignature = "Enviado desde mi Andy 5E3 de Movistar";  
  100. +        } else{  
  101. +            mSignature = CUSTOM_SIGNATURE;  
  102. +        }  
  103.      }  
  104.    
  105.      public static Account restoreAccountWithId(Context context, long id) {  
  106. @@ -285,7 +294,14 @@ public final class Account extends EmailContent implements Parcelable {  
  107.          mRingtoneUri = cursor.getString(CONTENT_RINGTONE_URI_COLUMN);  
  108.          mProtocolVersion = cursor.getString(CONTENT_PROTOCOL_VERSION_COLUMN);  
  109.          mSecuritySyncKey = cursor.getString(CONTENT_SECURITY_SYNC_KEY_COLUMN);  
  110. -        mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);  
  111. +        //mSignature = cursor.getString(CONTENT_SIGNATURE_COLUMN);  
  112. +        if(Locale.getDefault().getLanguage().equals("en")){  
  113. +            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";  
  114. +        }else if(Locale.getDefault().getLanguage().equals("es")){  
  115. +            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";  
  116. +        }else{  
  117. +            mSignature = CUSTOM_SIGNATURE;  
  118. +        }  
  119.          mPolicyKey = cursor.getLong(CONTENT_POLICY_KEY_COLUMN);  
  120.          mPingDuration = cursor.getLong(CONTENT_PING_DURATION_COLUMN);  
  121.      }  
  122. @@ -957,6 +973,13 @@ public final class Account extends EmailContent implements Parcelable {  
  123.          mProtocolVersion = in.readString();  
  124.          /* mNewMessageCount = */ in.readInt();  
  125.          mSecuritySyncKey = in.readString();  
  126. +        if(Locale.getDefault().getLanguage().equals("en")){  
  127. +            CUSTOM_SIGNATURE = "Send from my Andy 5E3 of Movistar";  
  128. +        }else if(Locale.getDefault().getLanguage().equals("es")){  
  129. +            CUSTOM_SIGNATURE = "Enviado desde mi Andy 5E3 de Movistar";  
  130. +        }else{  
  131. +            mSignature = CUSTOM_SIGNATURE;  
  132. +        }  
  133.          mSignature = in.readString();  
  134.          mPolicyKey = in.readLong();  
  135.    
  136. diff --git a/src/com/android/email/activity/setup/AccountFinalizeFragment.java b/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  137. index f2b9cde..bdfecf9 100755  
  138. --- a/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  139. +++ b/src/com/android/email/activity/setup/AccountFinalizeFragment.java  
  140. @@ -127,13 +127,6 @@ public class AccountFinalizeFragment extends Fragment {  
  141.          public Boolean loadInBackground() {  
  142.              // Update the account in the database  
  143.              final ContentValues cv = new ContentValues();  
  144. -            if (!FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE.equals("")) {  
  145. -                cv.put(EmailContent.AccountColumns.SIGNATURE, FeatureOption.VANZO_FEATURE_EMAIL_DEFAULT_SIGNATURE);  
  146. -            }  
  147.              cv.put(EmailContent.AccountColumns.DISPLAY_NAME, mAccount.getDisplayName());  
  148.              cv.put(EmailContent.AccountColumns.SENDER_NAME, mAccount.getSenderName());  
  149.              mAccount.update(getContext(), cv);  


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

[java]  view plain  copy
  1. diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  2. index f46da53..bca9b0a 100755  
  3. --- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  4. +++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java  
  5. @@ -35,6 +35,7 @@ import com.android.launcher3.util.Thunk;  
  6.    
  7.  import java.util.ArrayList;  
  8.  import java.util.List;  
  9.    
  10.  public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ListAdapter {  
  11.      private final LayoutInflater mInflater;  
  12. @@ -78,6 +79,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements  
  13.          final ComponentName[] imageActivities = new ComponentName[imagePickerActivities.size()];  
  14.          for (int i = 0; i < imagePickerActivities.size(); i++) {  
  15.              ActivityInfo activityInfo = imagePickerActivities.get(i).activityInfo;  
  16.              imageActivities[i] = new ComponentName(activityInfo.packageName, activityInfo.name);  
  17.          }  
  18.    
  19. @@ -88,6 +90,8 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements  
  20.              final String itemPackageName = itemComponentName.getPackageName();  
  21.              // Exclude anything from our own package, and the old Launcher,  
  22.              // and live wallpaper picker  
  23. +            if("com.sherlock.news".equals(itemPackageName))continue;  
  24.              if (itemPackageName.equals(context.getPackageName()) ||  
  25.                      itemPackageName.equals("com.android.launcher") ||  
  26.                      itemPackageName.equals("com.android.wallpaper.livepicker")) {  

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

[java]  view plain  copy
  1. diff --git a/src/com/android/settings/WallpaperTypeSettings.java b/src/com/android/settings/WallpaperTypeSettings.java  
  2. index 9046bfb..af3d8c8 100644  
  3. --- a/src/com/android/settings/WallpaperTypeSettings.java  
  4. +++ b/src/com/android/settings/WallpaperTypeSettings.java  
  5. @@ -31,6 +31,7 @@ import com.android.settings.search.SearchIndexableRaw;  
  6.    
  7.  import java.util.ArrayList;  
  8.  import java.util.List;  
  9.    
  10.  public class WallpaperTypeSettings extends SettingsPreferenceFragment implements Indexable {  
  11.    
  12. @@ -67,9 +68,11 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements  
  13.              Intent prefIntent = new Intent(intent);  
  14.              prefIntent.setComponent(new ComponentName(  
  15.                      info.activityInfo.packageName, info.activityInfo.name));  
  16.              pref.setIntent(prefIntent);  
  17.              CharSequence label = info.loadLabel(pm);  
  18.              if (label == null) label = info.activityInfo.packageName;  
  19. +            if("com.sherlock.news".equals(info.activityInfo.packageName))continue;  
  20.              pref.setTitle(label);  
  21.              parent.addPreference(pref);  
  22.          }  


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

(packages/apps/Launcher3/)

[java]  view plain  copy
  1. <span style="font-size:12px;">diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java  
  2. index aca2402..6974ee9 100755  
  3. --- a/src/com/android/launcher3/IconCache.java  
  4. +++ b/src/com/android/launcher3/IconCache.java  
  5. @@ -588,6 +588,9 @@ public class IconCache {  
  6.                  entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, user);  
  7.              }  
  8.          }  
  9. +        if (info != null) {  
  10. +           entry.title = info.getLabel();  
  11. +        }  
  12.          return entry;  
  13.      }  
  14.    
  15. diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java  
  16. index c90677d..62d6531 100755  
  17. --- a/src/com/android/launcher3/LauncherModel.java  
  18. +++ b/src/com/android/launcher3/LauncherModel.java  
  19. @@ -3754,9 +3754,13 @@ public class LauncherModel extends BroadcastReceiver  
  20.              info.setIcon(icon == null ? mIconCache.getDefaultIcon(user) : icon);  
  21.          }  
  22.    
  23. -        // from the db  
  24. -        if (TextUtils.isEmpty(info.title) && c != null) {  
  25. -            info.title =  Utilities.trim(c.getString(titleIndex));  
  26. +        //// from the db  
  27. +        //if (TextUtils.isEmpty(info.title) && c != null) {  
  28. +        //    info.title =  Utilities.trim(c.getString(titleIndex));  
  29. +        //}  
  30. +        // from PMS.  
  31. +        if (lai != null) {  
  32. +            info.title = lai.getLabel();  
  33.          }  
  34.    
  35.          // fall back to the class name of the activity</span>  

十五:

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

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

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

[java]  view plain  copy
  1. diff --git a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  2. index 3d7ac48..c32acf5 100755  
  3. --- a/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  4. +++ b/TelephonyProvider/src/com/android/providers/telephony/CbProvider.java  
  5. @@ -134,8 +134,10 @@ public class CbProvider extends ContentProvider {  
  6.              // break;  
  7.          case URL_CHANNEL:  
  8.              qb.setTables(CbDatabaseHelper.CHANNEL_TABLE);  
  9. +            if (selection == null || !selection.contains("sub_id")) {  
  10.              qb.appendWhere("(sub_id = " + SmsProvider.getSubIdFromUri(url)  
  11.                      + ")");  
  12. +            }  
  13.              break;  
  14.          case URL_CONVERSATION:  
  15.              // qb.setTables(CbDatabaseHelper.CONVERSATION_TABLE);  

(vendor/)

[java]  view plain  copy
  1. diff --git a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  2. index 1e224e1..c70aa39 100755  
  3. --- a/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  4. +++ b/mediatek/proprietary/packages/apps/Mms/AndroidManifest.xml  
  5. @@ -534,6 +534,12 @@ add for MClock update sms database  
  6.              <intent-filter>  
  7.                  <action android:name="android.provider.Telephony.SMS_CB_RECEIVED" />  
  8.              </intent-filter>  
  9.   
  10. +            <intent-filter>  
  11. +                <action android:name="android.intent.action.SIM_STATE_CHANGED" />  
  12. +            </intent-filter>  
  13.          </receiver>  
  14.    
  15.          <!-- Catch-all receiver for broadcasts that don't have associated security -->  
  16. 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.java  
  17. index 7415026..816a1f5 100755  
  18. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java  
  19. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiver.java  
  20. @@ -64,6 +64,8 @@ import com.android.mms.MmsApp;  
  21.  import com.android.mms.util.MmsLog;  
  22.  import com.mediatek.mms.util.PermissionCheckUtil;  
  23.    
  24. +import com.android.internal.telephony.TelephonyIntents;  
  25. +  
  26.  /** 
  27.   * M: 
  28.   * Handle incoming SMSes.  Just dispatches the work off to a Service. 
  29. @@ -98,7 +100,14 @@ public class CBMessageReceiver extends BroadcastReceiver { 
  30.                          + intent.getAction() + ", result = " + getResultCode()); 
  31.   
  32.          intent.setClass(context, CBMessageReceiverService.class); 
  33. +/* 
  34.          intent.putExtra("result", getResultCode()); 
  35. + */  
  36. +        android.util.Log.d(" CBMessageReceiver "" CBMessageReceiver.onReceiveWithPrivilege 97 ");  
  37. +        if (!TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {  
  38. +            intent.putExtra("result", getResultCode());  
  39. +        }  
  40.          beginStartingService(context, intent);  
  41.      }  
  42.    
  43. 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.java  
  44. index 35b3133..aea9c3a 100755  
  45. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java  
  46. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbmsg/CBMessageReceiverService.java  
  47. @@ -81,6 +81,18 @@ import com.mediatek.mms.ext.IOpCBMessageReceiverServiceExt;  
  48.  import com.mediatek.opmsg.util.OpMessageUtils;  
  49.    
  50.  import android.telephony.SubscriptionManager;  
  51. +import android.provider.Telephony;  
  52. +import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;  
  53. +import android.content.ContentValues;  
  54. +import android.database.Cursor;  
  55. +import android.util.Log;  
  56. +import com.android.internal.telephony.IccCardConstants;  
  57. +import com.android.internal.telephony.TelephonyIntents;  
  58. +import android.telephony.SmsManager;  
  59. +import android.provider.Telephony.Sms.Intents;  
  60.    
  61.  /** 
  62.   * M: 
  63. @@ -97,6 +109,19 @@ public class CBMessageReceiverService extends Service { 
  64.   
  65.      private static final Uri MESSAGE_URI = Telephony.SmsCb.CONTENT_URI; 
  66.      private static final int DEFAULT_SUB_ID = 1; 
  67. +    private static final int MESSAGE_SET_STATE = 33; 
  68. +    private static final int MESSAGE_SET_CONFIG = 32; 
  69. +    private static final String KEYID = "_id"; 
  70. +    private static final String NAME = "name"; 
  71. +    private static final String NUMBER = "number"; 
  72. +    private static final String ENABLE = "enable"; 
  73. +    private static final String SUBID = "sub_id"; 
  74. +    private static final Uri CHANNEL_URI = Uri.parse("content://cb/channel"); 
  75. +    private static final int EVENT_RETRY_ADD_CHANNEL_TIME_OUT = 101; 
  76. +    private static boolean isAddingDefaultChannel = false; 
  77.   
  78.      public Handler mToastHandler = new Handler() { 
  79.          @Override 
  80. @@ -159,6 +184,7 @@ public class CBMessageReceiverService extends Service { 
  81.          public void handleMessage(Message msg) { 
  82.              int serviceId = msg.arg1; 
  83.              Intent intent = (Intent) msg.obj; 
  84. +            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 185 serviceId="+serviceId+" msg.what="+msg.what+" intent="+intent); // modify by mtk_debug 2015-3-19; 
  85.              if (intent != null) { 
  86.                  String action = intent.getAction(); 
  87.                  // NEED Replace with CB ACTION 
  88. @@ -166,12 +192,266 @@ public class CBMessageReceiverService extends Service { 
  89.                      handleCBMessageReceived(intent); 
  90.                  } 
  91.              } 
  92. + 
  93. +            Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage 162 "); // modify by mtk_debug 2015-3-05; 
  94. +            if(TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())){ 
  95. +                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.ServiceHandler.handleMessage receiver a ACTION_SIM_STATE_CHANGED 164 "); // modify by mtk_debug 2015-3-05; 
  96. +                synchronized(this){ 
  97. +                    handleSIMStateChangedReceived(intent); 
  98. +                } 
  99. +            } 
  100.              // NOTE: We MUST not call stopSelf() directly, since we need to 
  101.              // make sure the wake lock acquired by AlertReceiver is released. 
  102. -            CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId); 
  103. +            if(!isAddingDefaultChannel){ 
  104. +                CBMessageReceiver.finishStartingService(CBMessageReceiverService.this, serviceId); 
  105. +            } 
  106.          } 
  107.      } 
  108.   
  109. +    private void handleSIMStateChangedReceived(Intent intent) { 
  110. +        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 191 "); // modify by mtk_debug 2015-3-05; 
  111. +        int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); 
  112. +        String stateExtra = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE); 
  113. +        // boolean stateExtra = intent.getBooleanExtra("ready",false); 
  114. +        Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived 214 stateExtra="+stateExtra);  
  115. +        if(IccCardConstants.INTENT_VALUE_ICC_READY.equals(stateExtra)){ 
  116. +            // if(stateExtra){ 
  117. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",919)) 
  118. +            { 
  119. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database"); 
  120. +                isAddingDefaultChannel=false; 
  121. +            }else{ 
  122. +                Log.d(" CBMessageReceiverService ", " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02; 
  123. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  124. +                {   
  125. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  126. +                    addCustomChanneltoList(subId,"CL-Alerta Local",919);  
  127. +                    isAddingDefaultChannel=false;  
  128. +  
  129. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  130. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  131. +  
  132. +                }else{  
  133. +  
  134. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;  
  135. +                    //add retry  
  136. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  137. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  138. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;  
  139. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  140. +                        isAddingDefaultChannel=true;  
  141. +                    }  
  142. +  
  143. +  
  144. +                }  
  145. +  
  146. +            }  
  147. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",50))  
  148. +            {  
  149. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  150. +                isAddingDefaultChannel=false;  
  151. +            }else{  
  152. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //      modify by mtk_debug 2015-3-02;  
  153. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  154. +                {  
  155. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  156. +                    addCustomChanneltoList(subId,"CL-Alerta Local",50);  
  157. +                    isAddingDefaultChannel=false;  
  158. +  
  159. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  160. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  161. +  
  162. +                }else{  
  163. +  
  164. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;  
  165. +                    //add retry  
  166. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  167. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  168. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;  
  169. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  170. +                        isAddingDefaultChannel=true;  
  171. +                    }  
  172. +  
  173. +  
  174. +                }  
  175. +  
  176. +            }  
  177. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",921))  
  178. +            {  
  179. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  180. +                isAddingDefaultChannel=false;  
  181. +            }else{  
  182. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); //  modify by mtk_debug 2015-3-02;  
  183. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  184. +                {  
  185. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  186. +                    addCustomChanneltoList(subId,"CL-Alerta Local",921);  
  187. +                    isAddingDefaultChannel=false;  
  188. +  
  189. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  190. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  191. +  
  192. +                }else{  
  193. +   
  194. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by  mtk_debug 2015-3-05;  
  195. +                    //add retry  
  196. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  197. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  198. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by         mtk_debug 2015-3-19;  
  199. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  200. +                        isAddingDefaultChannel=true;  
  201. +                    }  
  202. +  
  203. +  
  204. +                }  
  205. +  
  206. +            }  
  207. +            if(queryIfChannelInDatabase(subId,"CL-Alerta Local",4370))  
  208. +            {  
  209. +                Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 in database");  
  210. +                isAddingDefaultChannel=false;  
  211. +            }else{  
  212. +                Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived subid="+subId+" channel1 50 not in database 699 "); // modify by mtk_debug 2015-3-02;  
  213. +                if(SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(true))/*这里会先把CB打开*/  
  214. +                {   
  215. +                    Log.d(TAG, " CBMessageReceiverService.handleSIMStateChangedReceived addCustomChanneltoList(subId,Channel1,50);");  
  216. +                    addCustomChanneltoList(subId,"CL-Alerta Local",4370);  
  217. +                    isAddingDefaultChannel=false;  
  218. +  
  219. +                    //请注意:如果贵司做了开机默认关闭小区广播的feature,请取消下面这句code的注释  
  220. +                    //SmsManager.getSmsManagerForSubscriptionId(subId).activateCellBroadcastSms(false); //用于关闭小区广播开关  
  221. +  
  222. +                }else{  
  223. +  
  224. +                    Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived activateCellBroadcastSms fail 716 "); // modify by mtk_debug 2015-3-05;  
  225. +                    //add retry  
  226. +                    if (!mServiceHandler.hasMessages(EVENT_RETRY_ADD_CHANNEL_TIME_OUT)) {  
  227. +                        Message msg = mServiceHandler.obtainMessage(EVENT_RETRY_ADD_CHANNEL_TIME_OUT,intent);  
  228. +                        Log.d(" CBMessageReceiverService "" CBMessageReceiverService.handleSIMStateChangedReceived send retry message 235 "); // modify by mtk_debug 2015-3-19;  
  229. +                        mServiceHandler.sendMessageDelayed(msg, 2000);  
  230. +                        isAddingDefaultChannel=true;  
  231. +                    }  
  232. +  
  233. +  
  234. +                }  
  235. +  
  236. +            }  
  237. +  
  238. +        }  
  239. +  
  240. +    }  
  241. +  
  242. +    private void addCustomChanneltoList(int mSubId,String channelName,int channelNum){  
  243. +        Log.d(TAG, "addCustomChanneltoList: mSubId=" + mSubId  
  244. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  245. +  
  246. +        SmsBroadcastConfigInfo[] objectList = new SmsBroadcastConfigInfo[1];  
  247. +        objectList[0] = new SmsBroadcastConfigInfo(channelNum,channelNum, -1, -1true);  
  248. +  
  249. +        Log.d(TAG, "addCustomChanneltoList: setCellBroadcastSmsConfig");  
  250. +        //SmsManagerEx.getDefault().setCellBroadcastSmsConfig(objectList, objectList, mSimId);  
  251. +        boolean isSetConfigSuccess = SmsManager.getSmsManagerForSubscriptionId(mSubId).setCellBroadcastSmsConfig(objectList, objectList);  
  252. +        if(isSetConfigSuccess){  
  253. +            Log.d(" CBMessageReceiverService "" CBMessageReceiverService.addCustomChanneltoList set channel " +channelNum +" success 784 "); // modify by mtk_debug 2015-3-05;  
  254. +            addChannelToDatabase(mSubId,channelName,channelNum);  
  255. +        }else{  
  256. +            Log.d(" CBMessageReceiverService "" CBMessageReceiverService.addCustomChanneltoList set channel "+ channelNum +" failed 786 "); // modify by mtk_debug 2015-3-05;  
  257. +        }  
  258. +  
  259. +  
  260. +        Log.d(TAG, " CBMessageReceiverService addCustomChanneltoList: function end");  
  261. +    }  
  262. +  
  263. +  
  264. +  
  265. +    private boolean addChannelToDatabase(int mSubId,String channelName,int channelNum){  
  266. +            // ClearChannel();  
  267. +        Log.d(TAG, "addChannelToDatabase: mSubId=" + mSubId  
  268. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  269. +        String[] projection = new String[] { NUMBER, SUBID};  
  270. +        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")";   
  271. +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";  
  272. +        Cursor cursornum = null;  
  273. +        Cursor cursorid = null;  
  274. +  
  275. +        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,  
  276. +                projection,  
  277. +                NUMBER + " = ? AND " +  
  278. +                SUBID + " = ?",  
  279. +                new String[] {String.valueOf(channelNum), String.valueOf(mSubId)},  
  280. +                null);  
  281. +        Log.d(TAG, "addChannelToDatabase: cursor.getCount"+cursorzz.getCount());  
  282. +        if(cursorzz.getCount() == 0){//if ((cursornum.getCount() == 0)&&(cursorid.getCount() == 0)){   
  283. +            Log.d(" CBMessageReceiverService "" SmsReceiverService.addChannelToDatabase add mSubId=" + mSubId  
  284. +                    + ", channelName= " + channelName + ", channelNum= " + channelNum +"to database"); // modify by mtk_debug 2015-3-05;  
  285. +            ContentValues values = new ContentValues();  
  286. +            values.put(NAME,channelName);  
  287. +            values.put(NUMBER, channelNum);  
  288. +            values.put(ENABLE, true);   //请注意:如果贵司希望预置的频道默认为disable状态,把true改成false即可  
  289. +            values.put(SUBID, mSubId);  
  290. +            try {  
  291. +                //if(mSimId==PhoneConstants.SUB1){  
  292. +                this.getContentResolver().insert(CHANNEL_URI, values);  
  293. +                //}else if(mSimId==PhoneConstants.SUB2){  
  294. +                // this.getContentResolver().insert(CHANNEL_URI1, values);  
  295. +                //}  
  296. +            } catch (Exception e){  
  297. +                Log.d(" CBMessageReceiverService "" SmsReceiverService.addChannelToDatabase exception 828 "); // modify by mtk_debug 2015-3-05;  
  298. +                //cursornum.close();  
  299. +                //cursorid.close();  
  300. +                cursorzz.close();  
  301. +                return false;  
  302. +            }  
  303. +            //cursornum.close();  
  304. +            // cursorid.close();  
  305. +            cursorzz.close();  
  306. +            return true;  
  307. +        }  
  308. +        else{  
  309. +            //cursornum.close();  
  310. +            //cursorid.close();  
  311. +            cursorzz.close();  
  312. +            return false;  
  313. +        }  
  314. +  
  315. +    }   
  316. +  
  317. +  
  318. +    private boolean queryIfChannelInDatabase(int mSubId,String channelName,int channelNum){  
  319. +  
  320. +        Log.d(TAG, "queryIfChannelInDatabase: mSubId=" + mSubId  
  321. +                + ", channelName= " + channelName + ", channelNum= " + channelNum);  
  322. +        String[] projection = new String[] { NUMBER, SUBID};  
  323. +        String SELECTIONNum = "(" + NUMBER + " = " + channelNum + ")";   
  324. +        String SELECTIONid = "(" + SUBID + " = " + mSubId + ")";  
  325. +        Cursor cursornum = null;  
  326. +        Cursor cursorid = null;  
  327. +  
  328. +        Cursor cursorzz = this.getContentResolver().query(CHANNEL_URI,  
  329. +                projection,  
  330. +                NUMBER + " = ? AND " +  
  331. +                SUBID + " = ?",  
  332. +                new String[] {String.valueOf(channelNum),String.valueOf(mSubId)},  
  333. +                null);  
  334. +  
  335. +        if(cursorzz != null&&cursorzz.getCount() > 0){  
  336. +            //if ((cursornum.getCount() != 0)&&(cursorid.getCount() != 0)){  
  337. +            Log.d(TAG, "queryIfChannelInDatabase: cursor.getCount"+cursorzz.getCount());  
  338. +            cursorzz.close();  
  339. +            return true;  
  340. +  
  341. +  
  342. +        }else{  
  343. +            cursorzz.close();  
  344. +            Log.d(TAG, "queryIfChannelInDatabase: return false");  
  345. +            return false;  
  346. +        }  
  347. +  
  348. +    }  
  349. +// End of Vanzo:tanglei  
  350. +  
  351.      private void handleCBMessageReceived(Intent intent) {  
  352.          // TODO need replace with cb message.  
  353.          Bundle extras = intent.getExtras();  
  354. 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.java  
  355. index c17f2b0..d784299 100755  
  356. --- a/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java  
  357. +++ b/mediatek/proprietary/packages/apps/Mms/src/com/mediatek/cb/cbsettings/CellBroadcastSettings.java  
  358. @@ -218,6 +218,9 @@ public class CellBroadcastSettings extends TimeConsumingPreferenceActivity  
  359.              } else {  
  360.                  channel.setSummary(R.string.disable);  
  361.              }  
  362. +            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)")) {  
  363. +                channel.setEnabled(false);  
  364. +            }  
  365.    
  366.              channel.setOnPreferenceClickListener(new OnPreferenceClickListener() {  
  367.                  public boolean onPreferenceClick(Preference arg0) {  




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

[java]  view plain  copy
  1. diff --git a/Telephony/src/com/android/phone/MobileNetworkSettings.java b/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  2. index d1dbc6f..4a30ffa 100644  
  3. --- a/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  4. +++ b/Telephony/src/com/android/phone/MobileNetworkSettings.java  
  5. @@ -962,6 +962,7 @@ public class MobileNetworkSettings extends PreferenceActivity implements  
  6.                  switch (buttonNetworkMode) {  
  7.                      case Phone.NT_MODE_WCDMA_PREF:  
  8.                      case Phone.NT_MODE_GSM_ONLY:  
  9. +                    case Phone.NT_MODE_WCDMA_ONLY:  
  10.                      case Phone.NT_MODE_LTE_GSM_WCDMA:  
  11.                      case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:  
  12.                      case Phone.NT_MODE_CDMA:  
  13. @@ -1193,6 +1194,9 @@ public class MobileNetworkSettings extends PreferenceActivity implements  
  14.          // @}  
  15.          switch (NetworkMode) {  
  16.              case Phone.NT_MODE_WCDMA_ONLY:  
  17. +                mButtonEnabledNetworks.setValue(Integer.toString(Phone.NT_MODE_WCDMA_ONLY));  
  18. +                mButtonEnabledNetworks.setSummary(R.string.network_3G_only);  
  19. +                break;  
  20.              case Phone.NT_MODE_GSM_UMTS:  
  21.              case Phone.NT_MODE_WCDMA_PREF:  
  22.                  if (!mIsGlobalCdma) {  


十七: 掉指示灯功能

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

[java]  view plain  copy
  1. diff --git a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  2. +index 9440315..d0fad5c 100755  
  3. --- a/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  4. +++ b/packages/FactoryMode/src/com/mediatek/factorymode/FactoryMode.java  
  5. @@ -56,7 +56,7 @@ public class FactoryMode extends Activity implements OnItemClickListener {  
  6.    
  7.      private TextView mMotherBoardResult;  
  8.    
  9. -    public static boolean mHavePsensor = true;  
  10. +    public static boolean mHavePsensor = false;  
  11.    
  12.      public static boolean mHaveMsensor = true;  

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

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

[java]  view plain  copy
  1. diff --git a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  2. index a0d1577..0b17327 100644  
  3. --- a/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  4. +++ b/mediatek/proprietary/packages/apps/Calendar/res/xml/general_preferences.xml  
  5. @@ -26,7 +26,7 @@  
  6.              android:title="@string/preferences_show_week_num_title" />  
  7.          <ListPreference  
  8.              android:key="preferences_week_start_day"  
  9. -            android:defaultValue="@string/preferences_week_start_day_default"  
  10. +            android:defaultValue="2"  
  11.              android:title="@string/preferences_week_start_day_title"  
  12.              android:entries="@array/preferences_week_start_day_labels"  
  13.              android:entryValues="@array/preferences_week_start_day_values"  


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

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

猜你喜欢

转载自blog.csdn.net/zhangbijun1230/article/details/80821557
今日推荐