首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

原生Android4.0来电按钮消失的有关问题

2012-07-20 
原生Android4.0来电按钮消失的问题google原生Android 4.0有个bug:来电时,如果用户进行一定操作,来电按钮会

原生Android4.0来电按钮消失的问题
google原生Android 4.0有个bug:来电时,如果用户进行一定操作,来电按钮会消失掉,以致用户无法接听电话.
在我们的项目中,对该问题的修复是通过修改以下几个文件来完成的:
packages/apps/Phone/src/com/android/phone/InCallScreen.java
packages/apps/Phone/src/com/android/phone/InCallTouchUi.java
packages/apps/Phone/src/com/android/phone/RespondViaSmsManager.java

InCallTouchUi.java文件的修改如下:

@@-226,12+226,19@@publicclassInCallTouchUiextendsFrameLayoutView.OnTouchListener=newSmallerHitTarg.();}+/**+     * Updates the visibility and/or state of our UI elements, based on+     * the current state of the phone.+     */+finalvoid(CallManager){+(,false);+}/**      * Updates the visibility and/or state of our UI elements, based on      * the current state of the phone.      */-void(CallManager){+void(CallManager,boolean){if(==null){("- updateState: mInCallScreen has been destroyed; bailing out..")return;@@-270,7+277,7@@publicclassInCallTouchUiextendsFrameLayout// within the last 500 msec, *don't* show the incoming call// UI even if the phone is still in the RINGING state.long=SystemClock.();-if(<+500){+if((!)&&(<+500)){("updateState: Too soon after last action; not drawing!");=false;}

InCallScreen.java文件的主要修改如下:

@@-156,8+156,9@@publicclassInCallScreenextendsActivityprivatestaticfinalint=120;privatestaticfinalint=121;// Time to remprivatestaticfinalint=122;-privatestaticfinalint=123;-privatestaticfinalint=124;+privatestaticfinalint=123;+privatestaticfinalint=124;+privatestaticfinalint=125;// When InCallScreenMode is UNDEFINED set the default action// to ACTION_UNDEFINED so if we are resumed the activity will@@-417,6+418,9@@publicclassInCallScreenextendsActivity();break;+case:+(true);+break;case:();break;@@-2172,7+2176,21@@publicclassInCallScreenextendsActivity.();}-+/**+     * Updates the state of the in-call UI based on the current state of+     * the Phone.  This call has no effect if we're not currently the+     * foreground activity.+     *+     * This method is only allowed to be called from the UI thread (since it+     * manipulates our View hierarchy).  If you need to update the screen from+     * some other thread, or if you just want to "post a request" for the scree+     * to be updated (rather than doing it synchronously), call+     * requestUpdateScreen() instead.+     */+finalprivatevoid()+{+(false);+}/**      * Updates the state of the in-call UI based on the current state of      * the Phone.  This call has no effect if we're not currently the@@ -2184,7 +2202,7 @@ public class InCallScreen extends Activity      * to be updated (rather than doing it synchronously), call      * requestUpdateScreen() instead.      */-privatevoid(){+privatevoid(boolean){if()("updateScreen()...");finalInCallScreenMode=..if(){@@-2245,7+2263,7@@publicclassInCallScreenextendsActivity// Note we update the InCallTouchUi widget before the CallCard,// since the CallCard adjusts its size based on how much vertical// space the InCallTouchUi widget needs.-();+();.();();();@@-3925,13+3943,18@@publicclassInCallScreenextendsActivity=newRespondViaSmsManager();.(this);}-/**      * Updates the state of the in-call touch UI.      */-privatevoid(){+finalprivatevoid(){+(false);+}+/**+     * Updates the state of the in-call touch UI.+     */+privatevoid(boolean){if(!=null){-.();+.(,);}}@@-3941,7+3964,6@@publicclassInCallScreenextendsActivity/* package */InCallTouchUi(){return;}-/**      * Posts a handler message telling the InCallScreen to refresh the      * onscreen in-call UI.@@ -3958,7 +3980,23 @@ public class InCallScreen extends Activity         mHandler.removeMessages(REQUEST_UPDATE_SCREEN);         mHandler.sendEmptyMessage(REQUEST_UPDATE_SCREEN);     }-+    /**+     * Posts a handler message telling the InCallScreen to force refresh the+     * onscreen in-call UI.+     *+     * This is just a wrapper around updateScreen(true), for use by the+     * rest of the phone app or from a thread other than the UI thread.+     *+     * updateScreen() is a no-op if the InCallScreen is not the foreground+     * activity, so it's safe to call this whether or not the InCallScreen+     * is currently visible.+     */+/* package */void(){+if()("requestForceUpdateScreen()...");+.();+.();+.();+}/**      * @return true if it's OK to display the in-call touch UI, given the      * current state of the InCallScreen.


RespondViaSmsManager.java文件的修改如下:

@@-281,7+281,7@@publicclassRespondViaSmsManager{// update itself based on the current telephony state.// (Assuming the incoming call is still ringing, this will// cause the incoming call widget to reappear.)-.();+.();}}


结束!

热点排行