Loading

MTK A15 无听筒默认使用扬声器

1.默认免提通话,优先使用蓝牙或者有线耳机:

call.initAnalytics();
// by mz
call.setStartWithSpeakerphoneOn(isSpeakerphoneEnabledForTablet());
if (getForegroundCall() != null) {
    getForegroundCall().getAnalytics().setCallIsInterrupted(true);
    call.getAnalytics().setCallIsAdditional(true);
}

// by mz
final boolean useSpeakerForTablet = isSpeakerphoneEnabledForTablet();
call.setStartWithSpeakerphoneOn(speakerphoneOn || (useSpeakerForVideoCall && allowVideo)
        || (useSpeakerWhenDocked && useSpeakerForDock) || useSpeakerForTablet);
call.setVideoState(videoState);

if (speakerphoneOn) {
    Log.i(this, "%s Starting with speakerphone as requested", call);
} else if (useSpeakerWhenDocked && useSpeakerForDock) {
    Log.i(this, "%s Starting with speakerphone because car is docked.", call);
} else if (useSpeakerForVideoCall) {
    Log.i(this, "%s Starting with speakerphone because its a video call.", call);
}

/**
 * by mz
 * Determines if the speakerphone should be automatically enabled for the call.  Speakerphone
 * should be enabled if the device is tablet and bluetooth or the wired headset are not in
 * use.
 * @return {@code true} if the speakerphone should be enabled.
 */
private boolean isSpeakerphoneEnabledForTablet() {
    boolean result = false;
    Log.i(TAG, "isSpeakerphoneEnabledForTablet");
    if (!mWiredHeadsetManager.isPluggedIn() && !mBluetoothRouteManager.isBluetoothAvailable()) {
        Log.i(TAG, "isSpeakerphoneEnabledForTablet," + "no headset && no bt!");
        if (mCallAudioManager.getCallAudioState().getRoute() != CallAudioState.ROUTE_SPEAKER) {
            result = true;
            Log.i(TAG, "isSpeakerphoneEnabledForTablet, set route to speaker");
        }
    }
    return result;
}

2.去除通话中听筒选项

    // by mz
    // initItem(
    //     (TextView) view.findViewById(R.id.audioroute_earpiece),
    //     CallAudioState.ROUTE_EARPIECE,
    //     audioState,
    //     DialerImpression.Type.IN_CALL_SWITCH_AUDIO_ROUTE_EARPIECE);
    // by mz

    // TODO(a bug): set peak height correctly to fully expand it in landscape mode.
    return view;
  <!-- by mz -->
  <!-- <TextView
      android:id="@+id/audioroute_earpiece"
      style="@style/AudioRouteItem"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:drawableStart="@drawable/ic_phone_audio_grey600_24dp"
      android:text="@string/audioroute_phone"
      android:textAlignment="viewStart"/> -->
  <!-- by mz -->
posted @ 2025-11-19 13:23  codermz1998  阅读(4)  评论(0)    收藏  举报