Android6.0 MTK 需求文档(二)

本文档详细列举了在Android 6.0 MTK平台上针对相机、计算器、虚拟按键、USB连接模式、短信、SPN显示、语音信箱等多方面进行的功能调整和优化需求。例如,相机预览窗口删除图片后的横线去除,计算器运算符限制,虚拟按键的隐藏功能,USB默认MTP模式,紧急号码识别,SPN从SIM卡读取,语音信箱设置以及特定语言的电子邮件签名等。
摘要由CSDN通过智能技术生成

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

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

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


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

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

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

                     // don't allow multiple successive operators
                     while (start > 0 && "+-*/".indexOf(expr.charAt(start - 1)) != -1) {
                         --start;


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

frameworks/

diff --git a/base/core/java/android/app/Activity.java b/base/core/java/android/app/Activity.java
index f6ecec3..1696a5e 100644
--- a/base/core/java/android/app/Activity.java
+++ b/base/core/java/android/app/Activity.java
@@ -117,7 +117,7 @@ import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-
+import android.content.BroadcastReceiver;
 /**
  * An activity is a single, focused thing that the user can do.  Almost all
  * activities interact with the user, so the Activity class takes care of
@@ -1742,6 +1742,20 @@ public class Activity extends ContextThemeWrapper
     public void onConfigurationChanged(Configuration newConfig) {
         if (DEBUG_LIFECYCLE) Slog.v(TAG, "onConfigurationChanged " + this + ": " + newConfig);
         mCalled = true;
+        Intent mIntent = new Intent("Configuration_orientation");

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值