当前位置: 首页>>代码示例>>Java>>正文


Java Compatibility.getInCallStream方法代码示例

本文整理汇总了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);
       	
       }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:MediaManager.java

示例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();
	}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:32,代码来源:MediaManager.java

示例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();
	}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:33,代码来源:MediaManager.java

示例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;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:37,代码来源:MediaManager.java


注:本文中的com.csipsimple.utils.Compatibility.getInCallStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。