背景:由于没有听筒,所以直接在电话状态下只有免提模式;
修改记录:
java
qssi/packages/services/Telecomm/src/com/android/server/telecom/CallAudioRouteStateMachine.java
private void createStates(int earpieceControl) {
switch (earpieceControl) {
case EARPIECE_FORCE_DISABLED:
mDoesDeviceSupportEarpieceRoute = false;
break;
case EARPIECE_FORCE_ENABLED:
mDoesDeviceSupportEarpieceRoute = false;//modified
break;
default:
mDoesDeviceSupportEarpieceRoute = false;//checkForEarpieceSupport();//modified
}
addState(mActiveEarpieceRoute);
addState(mActiveHeadsetRoute);
addState(mActiveBluetoothRoute);
addState(mActiveSpeakerRoute);
addState(mRingingBluetoothRoute);
addState(mQuiescentEarpieceRoute);
addState(mQuiescentHeadsetRoute);
addState(mQuiescentBluetoothRoute);
addState(mQuiescentSpeakerRoute);
mStateNameToRouteCode = new HashMap<>(8);
mStateNameToRouteCode.put(mQuiescentEarpieceRoute.getName(), ROUTE_EARPIECE);
mStateNameToRouteCode.put(mQuiescentBluetoothRoute.getName(), ROUTE_BLUETOOTH);
mStateNameToRouteCode.put(mQuiescentHeadsetRoute.getName(), ROUTE_WIRED_HEADSET);
mStateNameToRouteCode.put(mQuiescentSpeakerRoute.getName(), ROUTE_SPEAKER);
mStateNameToRouteCode.put(mRingingBluetoothRoute.getName(), ROUTE_BLUETOOTH);
mStateNameToRouteCode.put(mActiveEarpieceRoute.getName(), ROUTE_EARPIECE);
mStateNameToRouteCode.put(mActiveBluetoothRoute.getName(), ROUTE_BLUETOOTH);
mStateNameToRouteCode.put(mActiveHeadsetRoute.getName(), ROUTE_WIRED_HEADSET);
mStateNameToRouteCode.put(mActiveSpeakerRoute.getName(), ROUTE_SPEAKER);
mRouteCodeToQuiescentState = new HashMap<>(4);
mRouteCodeToQuiescentState.put(ROUTE_EARPIECE, mQuiescentEarpieceRoute);
mRouteCodeToQuiescentState.put(ROUTE_BLUETOOTH, mQuiescentBluetoothRoute);
mRouteCodeToQuiescentState.put(ROUTE_SPEAKER, mQuiescentSpeakerRoute);
mRouteCodeToQuiescentState.put(ROUTE_WIRED_HEADSET, mQuiescentHeadsetRoute);
}
之后验证来电/通话只有免提模式,点击免提按钮也是不能切换的;