【
本文分三篇。本篇介绍更复杂的定制过程。
】
(接下来进一步细化上一篇的修改,前六节请参见:http://blog.csdn.net/aimingoo/article/details/7939116)
7、一些遗留问题的修改
=======
上面是最简版本,只是为了突出核心功能的实现,但实际留下的问题还是不少的。下面一一道来。
1) 呀。是成功了呢,不过一会儿就被改回来了。
---------
[修改, 2012.09.04。方法名写错的,应该是updateInCallBackground(),而不是updateScreen()]
这并不是普遍性的问题,有些拔号面板是有背景的,有些则是背景透明而直接显示桌面的。对于有背景的拔号面板,Phone.apk通常会在InCallScreen.smali中有一个updateInCallBackground()方法,找到它的几处调用,注释掉即可。或者干脆把updateInCallBackground()改成空函数就好了。
如果找不到updateInCallBackground()函数,则尝试找一个setBackgroundResource()这个方法,看哪里重绘了mMainFrame的背景即可。
2) 下一次电话呼入的时候,会残留上一个电话使用的大头贴
---------
是的。这应该在此次电话结束时清理掉。这很简单,修改InCallScreen.smali,找到
.method private delayedCleanupAfterDisconnect()V
... ## fixed by aimingoo ## 重置背景 const/4 v0, 0x0 iget-object v1, p0, Lcom/android/phone/InCallScreen;->mMainFrame:Landroid/view/ViewGroup; invoke-virtual {v1, v0}, Landroid/view/ViewGroup;->setBackgroundResource(I)V ## 这里参见本遗留问题第5项有关setPersonInfoStyle()的说明 const/4 v0, 0x1 iget-object v1, p0, Lcom/android/phone/InCallScreen;->mCallCard:Lcom/android/phone/CallCard; invoke-virtual {v1, v0}, Lcom/android/phone/CallCard;->setPersonInfoStyle(Z)V ##end fix. :cond_3 :goto_0 return-void ## <<- 注意从这行代码往上找 ...
# # 不必在得到头像时更新cardCard中的头像 # .method private static final showCachedImage(Landroid/widget/ImageView;Lcom/android/internal/telephony/CallerInfo;)Z ... ## iget-object v0, p1, Lcom/android/internal/telephony/CallerInfo;->cachedPhoto:Landroid/graphics/drawable/Drawable; ## ## invoke-static {p0, v0}, Lcom/android/phone/CallCard;->showImage(Landroid/widget/ImageView;Landroid/graphics/drawable/Drawable;)V ...
#--------- # 在完成初始化后,处理一些背景 # - CallCard.smali #--------- .method protected onFinishInflate()V …… iput-object v0, p0, Lcom/android/phone/CallCard;->mPrimaryCallInfo:Landroid/view/ViewGroup; ## fixed by aimingoo ## for callCardPersonInfo.clild(0) const v0, 0x7f070020 invoke-virtual {p0, v0}, Lcom/android/phone/CallCard;->findViewById(I)Landroid/view/View; move-result-object v0 check-cast v0, Landroid/view/ViewGroup; const v1, 0x0 invoke-virtual {v0, v1}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View; move-result-object v0 invoke-virtual {v0}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable; move-result-object v0 const/16 v1, 0x40 invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V ## for phoneMsgContainer const v0, 0x7f070028 invoke-virtual {p0, v0}, Lcom/android/phone/CallCard;->findViewById(I)Landroid/view/View; move-result-object v0 invoke-virtual {v0}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable; move-result-object v0 invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V ## end fix. #--------- # 在完成初始化后,处理一些背景 # - InCallTouchUi.smali #--------- .method protected onFinishInflate()V …… iput-object v1, p0, Lcom/android/phone/InCallTouchUi;->stop_layout:Landroid/widget/LinearLayout; ## fixed by aimingoo ## for bottomButtons @ mInCallControls iget-object v1, p0, Lcom/android/phone/InCallTouchUi;->mInCallControls:Landroid/view/View; const v2, 0x7f070074 invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View; move-result-object v0 const/16 v1, 0x40 invoke-virtual {v0}, Landroid/view/View;->getBackground()Landroid/graphics/drawable/Drawable; move-result-object v0 invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V ## for endButton @ mEndButton iget-object v1, p0, Lcom/android/phone/InCallTouchUi;->mEndButton:Landroid/widget/Button; invoke-virtual {v1}, Landroid/widget/Button;->getBackground()Landroid/graphics/drawable/Drawable; move-result-object v0 const/16 v1, 0x60 invoke-virtual {v0, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V ## end fix.
.method public setPersonInfoStyle(Z)V .locals 2 .parameter "toDefault" if-nez p1, :cond_0 ## 42.0F const/high16 v0, 0x4228 ## CallCard.pA == mName iget-object v1, p0, Lcom/android/phone/CallCard;->pA:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## 28.0F const/high16 v0, 0x41b8 ## CallCard.pC == mPhoneNumber iget-object v1, p0, Lcom/android/phone/CallCard;->pC:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## CallCard.pB == mLocation iget-object v1, p0, Lcom/android/phone/CallCard;->pB:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## bacground const v0, 0x80CCCCCC invoke-virtual {v1}, Landroid/widget/TextView;->getParent()Landroid/view/ViewParent; move-result-object v1 check-cast v1, Landroid/view/ViewGroup; invoke-virtual {v1, v0}, Landroid/view/ViewGroup;->setBackgroundColor(I)V :goto_0 return-void :cond_0 ## 25.0F const/high16 v0, 0x41c8 ## CallCard.pA == mName iget-object v1, p0, Lcom/android/phone/CallCard;->pA:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## 18.0F const/high16 v0, 0x4190 ## CallCard.pC == mPhoneNumber iget-object v1, p0, Lcom/android/phone/CallCard;->pC:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## CallCard.pB == mLocation iget-object v1, p0, Lcom/android/phone/CallCard;->pB:Landroid/widget/TextView; invoke-virtual {v1, v0}, Landroid/widget/TextView;->setTextSize(F)V ## bacground const v0, 0x0 invoke-virtual {v1}, Landroid/widget/TextView;->getParent()Landroid/view/ViewParent; move-result-object v1 check-cast v1, Landroid/view/ViewGroup; invoke-virtual {v1, v0}, Landroid/view/ViewGroup;->setBackgroundResource(I)V goto :goto_0 .end method
#--------- # 使拔号面板全屏 # - in InCallScreen.smali # - 修改代码必须位于InCallScreen;->setContentView()调用之前!!! #--------- .method protected onCreate(Landroid/os/Bundle;)V …… ## fixed by aimingoo. invoke-virtual {p0}, Lcom/android/phone/InCallScreen;->getWindow()Landroid/view/Window; move-result-object v2 const/16 v1, 0x400 invoke-virtual {v2, v1, v1}, Landroid/view/Window;->setFlags(II)V ## fix end. …… const v1, 0x7f030012 invoke-virtual {p0, v1}, Lcom/android/phone/InCallScreen;->setContentView(I)V
##--------- ## 注释掉下面的代码,使打开图片选取时显示一个“自由的”截图框 ## - .line xxx这样的代码可能与具体的反编译有关,不必在意。 ##--------- ## .line 406 ## const-string v12, "outputX" ## ## const/16 v13, 0x100 ## ## invoke-virtual {v8, v12, v13}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent; ## ## .line 407 ## const-string v12, "outputY" ## ## const/16 v13, 0x100 ## ## invoke-virtual {v8, v12, v13}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent; ## ## .line 408 ## const-string v12, "aspectX" ## ## const/4 v13, 0x1 ## ## invoke-virtual {v8, v12, v13}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent; ## ## .line 409 ## const-string v12, "aspectY" ## ## const/4 v13, 0x1 ## ## invoke-virtual {v8, v12, v13}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;