本文整理汇总了Java中com.csipsimple.utils.Compatibility.getInCallStream方法的典型用法代码示例。如果您正苦于以下问题:Java Compatibility.getInCallStream方法的具体用法?Java Compatibility.getInCallStream怎么用?Java Compatibility.getInCallStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.csipsimple.utils.Compatibility
的用法示例。
在下文中一共展示了Compatibility.getInCallStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustStreamVolume
import com.csipsimple.utils.Compatibility; //导入方法依赖的package包/类
public void adjustStreamVolume(int streamType, int direction, int flags) {
broadcastVolumeWillBeUpdated(streamType, EXTRA_VALUE_UNKNOWN);
audioManager.adjustStreamVolume(streamType, direction, flags);
if(streamType == AudioManager.STREAM_RING) {
// Update ringer
ringer.updateRingerMode();
}
int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
if(streamType == inCallStream) {
int maxLevel = audioManager.getStreamMaxVolume(inCallStream);
float modifiedLevel = (audioManager.getStreamVolume(inCallStream)/(float) maxLevel)*10.0f;
// Update default stream level
service.getPrefs().setPreferenceFloatValue(SipConfigManager.SND_STREAM_LEVEL, modifiedLevel);
}
}
示例2: saveAudioState
import com.csipsimple.utils.Compatibility; //导入方法依赖的package包/类
/**
* Save current audio mode in order to be able to restore it once done
*/
@SuppressWarnings("deprecation")
private synchronized void saveAudioState() {
if( prefs.getBoolean("isSavedAudioState", false) ) {
//If we have already set, do not set it again !!!
return;
}
ContentResolver ctntResolver = service.getContentResolver();
Editor ed = prefs.edit();
// ed.putInt("savedVibrateRing", audioManager.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER));
// ed.putInt("savedVibradeNotif", audioManager.getVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION));
// ed.putInt("savedRingerMode", audioManager.getRingerMode());
ed.putInt("savedWifiPolicy" , Compatibility.getWifiSleepPolicy(ctntResolver));
int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
ed.putInt("savedVolume", audioManager.getStreamVolume(inCallStream));
int targetMode = getAudioTargetMode();
if(service.getPrefs().useRoutingApi()) {
ed.putInt("savedRoute", audioManager.getRouting(targetMode));
}else {
ed.putBoolean("savedSpeakerPhone", audioManager.isSpeakerphoneOn());
}
ed.putInt("savedMode", audioManager.getMode());
ed.putBoolean("isSavedAudioState", true);
ed.commit();
}
示例3: restoreAudioState
import com.csipsimple.utils.Compatibility; //导入方法依赖的package包/类
/**
* Restore the state of the audio
*/
@SuppressWarnings("deprecation")
private final synchronized void restoreAudioState() {
if( !prefs.getBoolean("isSavedAudioState", false) ) {
//If we have NEVER set, do not try to reset !
return;
}
ContentResolver ctntResolver = service.getContentResolver();
Compatibility.setWifiSleepPolicy(ctntResolver, prefs.getInt("savedWifiPolicy", Compatibility.getWifiSleepPolicyDefault()));
// audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, prefs.getInt("savedVibrateRing", AudioManager.VIBRATE_SETTING_ONLY_SILENT));
// audioManager.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, prefs.getInt("savedVibradeNotif", AudioManager.VIBRATE_SETTING_OFF));
// audioManager.setRingerMode(prefs.getInt("savedRingerMode", AudioManager.RINGER_MODE_NORMAL));
int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
setStreamVolume(inCallStream, prefs.getInt("savedVolume", (int)(audioManager.getStreamMaxVolume(inCallStream)*0.8) ), 0);
int targetMode = getAudioTargetMode();
if(service.getPrefs().useRoutingApi()) {
audioManager.setRouting(targetMode, prefs.getInt("savedRoute", AudioManager.ROUTE_SPEAKER), AudioManager.ROUTE_ALL);
}else {
audioManager.setSpeakerphoneOn(prefs.getBoolean("savedSpeakerPhone", false));
}
audioManager.setMode(prefs.getInt("savedMode", AudioManager.MODE_NORMAL));
Editor ed = prefs.edit();
ed.putBoolean("isSavedAudioState", false);
ed.commit();
}
示例4: actualUnsetAudioInCall
import com.csipsimple.utils.Compatibility; //导入方法依赖的package包/类
/**
* Reset the audio mode
*/
private synchronized void actualUnsetAudioInCall() {
if(!prefs.getBoolean("isSavedAudioState", false) || !isSetAudioMode) {
return;
}
Log.d(THIS_FILE, "Unset Audio In call");
int inCallStream = Compatibility.getInCallStream(userWantBluetooth);
if(bluetoothWrapper != null) {
//This fixes the BT activation but... but... seems to introduce a lot of other issues
//bluetoothWrapper.setBluetoothOn(true);
Log.d(THIS_FILE, "Unset bt");
bluetoothWrapper.setBluetoothOn(false);
}
audioManager.setMicrophoneMute(false);
if(doFocusAudio) {
audioManager.setStreamSolo(inCallStream, false);
audioFocusWrapper.unFocus();
}
restoreAudioState();
if(wifiLock != null && wifiLock.isHeld()) {
wifiLock.release();
}
if(screenLock != null && screenLock.isHeld()) {
Log.d(THIS_FILE, "Release screen lock");
screenLock.release();
}
isSetAudioMode = false;
}