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 @@ public class InCallTouchUi extends FrameLayout
View.OnTouchListener smallerHitTargetTouchListener = new SmallerHitTarg
mEndButton.setOnTouchListener(smallerHitTargetTouchListener);
}
+ /**
+ * Updates the visibility and/or state of our UI elements, based on
+ * the current state of the phone.
+ */
+ final void updateState(CallManager cm) {
+ updateState(cm,false);
+ }
/**
* Updates the visibility and/or state of our UI elements, based on
* the current state of the phone.
*/
- void updateState(CallManager cm) {
+ void updateState(CallManager cm, boolean force) {
if (mInCallScreen == null) {
log("- updateState: mInCallScreen has been destroyed; bailing out..")
return;
@@ -270,7 +277,7 @@ public class InCallTouchUi extends FrameLayout
// within the last 500 msec, *don't* show the incoming call
// UI even if the phone is still in the RINGING state.
long now = SystemClock.uptimeMillis();
- if (now < mLastIncomingCallActionTime + 500) {
+ if ((!force) && (now < mLastIncomingCallActionTime + 500)) {
log("updateState: Too soon after last action; not drawing!");
showIncomingCallControls = false;
}
InCallScreen.java文件的主要修改如下:
@@ -156,8 +156,9 @@ public class InCallScreen extends Activity
private static final int EVENT_PAUSE_DIALOG_COMPLETE = 120;
private static final int EVENT_HIDE_PROVIDER_OVERLAY = 121; // Time to rem
private static final int REQUEST_UPDATE_SCREEN = 122;
- private static final int PHONE_INCOMING_RING = 123;
- private static final int PHONE_NEW_RINGING_CONNECTION = 124;
+ private static final int REQUEST_FORCE_UPDATE_SCREEN = 123;
+ private static final int PHONE_INCOMING_RING = 124;
+ private static final int PHONE_NEW_RINGING_CONNECTION = 125;
// When InCallScreenMode is UNDEFINED set the default action
// to ACTION_UNDEFINED so if we are resumed the activity will
@@ -417,6 +418,9 @@ public class InCallScreen extends Activity
updateScreen();
break;
+ case REQUEST_FORCE_UPDATE_SCREEN:
+ updateScreen(true);
+ break;
case PHONE_INCOMING_RING:
onIncomingRing();
break;
@@ -2172,7 +2176,21 @@ public class InCallScreen extends Activity