Android P通话界面不支持听筒音将听筒图标隐藏问题查看
程序员文章站
2022-06-22 08:48:15
Dialer中通话记录界面初始化:packages/apps/Dialer / java/com/android/incallui/CallButtonPresenter.javaotherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle()); boolean showSwapSim = otherAccount != null && !ca...
Dialer中通话记录界面初始化:
packages/apps/Dialer / java/com/android/incallui/CallButtonPresenter.java
otherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
boolean showSwapSim =
otherAccount != null
&& !call.isVoiceMailNumber()
&& DialerCall.State.isDialing(call.getState())
// Most devices cannot make calls on 2 SIMs at the same time.
&& InCallPresenter.getInstance().getCallList().getAllCalls().size() == 1;
boolean enableAudio = true;
if ((AudioModeProvider.getInstance().getAudioState().getSupportedRouteMask() & CallAudioState.ROUTE_BLUETOOTH)
== CallAudioState.ROUTE_BLUETOOTH) {
enableAudio = true;
} else {
enableAudio = false;
}
inCallButtonUi.enableButton(InCallButtonIds.BUTTON_AUDIO, enableAudio);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_HOLD, showHold);
inCallButtonUi.setHold(isCallOnHold);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_MUTE, showMute);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP_SIM, showSwapSim);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_ADD_CALL, true);
inCallButtonUi.enableButton(InCallButtonIds.BUTTON_ADD_CALL, showAddCall);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo);
inCallButtonUi.showButton(InCallButtonIds.BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio);
主要是判断没有连接蓝牙耳机时候,将听筒切换图标置灰处理;
此时如果又连接上蓝牙耳机,则需要将听筒图标设置为可操作状态;连接上蓝牙耳机后,必定会有音频通道的切换,故我们可以直接借用音频通道的切换端口进行设置操作;
普通通话界面的修改文件是:
packages/apps/Dialer / java/com/android/incallui/incall/impl/InCallFragment.java
@Override
public void setAudioState(CallAudioState audioState) {
LogUtil.i("InCallFragment.setAudioState", "audioState: " + audioState);
((SpeakerButtonController) getButtonController(InCallButtonIds.BUTTON_AUDIO))
.setAudioState(audioState);
boolean enableAudio = true;
if ((audioState.getSupportedRouteMask() & CallAudioState.ROUTE_BLUETOOTH)
== CallAudioState.ROUTE_BLUETOOTH) {
enableAudio = true;
} else {
enableAudio = false;
}
getButtonController(InCallButtonIds.BUTTON_AUDIO).setEnabled(enableAudio);
getButtonController(InCallButtonIds.BUTTON_MUTE).setChecked(audioState.isMuted());
}
视频通话界面的操作与此相同,只是文件不同,具体文件是:
packages/apps/Dialer / java/com/android/incallui/video/impl/VideoCallFragment.java
packages/apps/Dialer / java/com/android/incallui/video/impl/SurfaceViewVideoCallFragment.java
以上修改验证可以确定听筒图标的变化。
本文地址:https://blog.csdn.net/liuminx/article/details/107188370
上一篇: DSA_07:递归算法
下一篇: 怎么破解软件注册码