FAQ11272][Audio App]微信语音通话(听筒模式),音量侧键不能调音量
来源:互联网 发布:软交换网络各节点功能 编辑:程序博客网 时间:2024/04/29 19:56
[DESCRIPTION]
微信语音通话(听筒模式),音量侧键不能调音量
[SOLUTION]
google参考机也是如此,不过可以按如下修改:
alps\frameworks\base\media\java\android\media\AudioService.java
1.private boolean isInCommunication() {
boolean isOffhook = false;
boolean isOffhook = false;
if (mVoiceCapable) {
try {
ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
if (phone != null) isOffhook = phone.isOffhook();
} catch (RemoteException e) {
Log.w(TAG, "Couldn't connect to phone service", e);
}
}
// Add for wechat start
return (isOffhook || getMode() == AudioManager.MODE_IN_COMMUNICATION || getMode() == AudioManager.MODE_IN_CALL);
// Add for wechat end
}
try {
ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
if (phone != null) isOffhook = phone.isOffhook();
} catch (RemoteException e) {
Log.w(TAG, "Couldn't connect to phone service", e);
}
}
// Add for wechat start
return (isOffhook || getMode() == AudioManager.MODE_IN_COMMUNICATION || getMode() == AudioManager.MODE_IN_CALL);
// Add for wechat end
}
2.public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags) {
if (DEBUG_VOL) Log.d(TAG, "adjustSuggestedStreamVolume() stream="+suggestedStreamType);
int streamType;
if (mVolumeControlStream != -1) {
streamType = mVolumeControlStream;
// Add for wechat start
if(streamType== AudioSystem.STREAM_MUSIC && AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0) && getMode() == AudioManager.MODE_IN_CALL && !AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL, 0))
streamType = getActiveStreamType(suggestedStreamType);
// Add for wechat end
} else {
streamType = getActiveStreamType(suggestedStreamType);
}
if (DEBUG_VOL) Log.d(TAG, "adjustSuggestedStreamVolume() stream="+suggestedStreamType);
int streamType;
if (mVolumeControlStream != -1) {
streamType = mVolumeControlStream;
// Add for wechat start
if(streamType== AudioSystem.STREAM_MUSIC && AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0) && getMode() == AudioManager.MODE_IN_CALL && !AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL, 0))
streamType = getActiveStreamType(suggestedStreamType);
// Add for wechat end
} else {
streamType = getActiveStreamType(suggestedStreamType);
}
// Play sounds on STREAM_RING only and if lock screen is not on.
if ((streamType != STREAM_REMOTE_MUSIC) &&
(flags & AudioManager.FLAG_PLAY_SOUND) != 0 &&
((mStreamVolumeAlias[streamType] != AudioSystem.STREAM_RING)
|| (mKeyguardManager != null && mKeyguardManager.isKeyguardLocked()))) {
flags &= ~AudioManager.FLAG_PLAY_SOUND;
}
if ((streamType != STREAM_REMOTE_MUSIC) &&
(flags & AudioManager.FLAG_PLAY_SOUND) != 0 &&
((mStreamVolumeAlias[streamType] != AudioSystem.STREAM_RING)
|| (mKeyguardManager != null && mKeyguardManager.isKeyguardLocked()))) {
flags &= ~AudioManager.FLAG_PLAY_SOUND;
}
if (streamType == STREAM_REMOTE_MUSIC) {
// don't play sounds for remote
flags &= ~(AudioManager.FLAG_PLAY_SOUND|AudioManager.FLAG_FIXED_VOLUME);
//if (DEBUG_VOL) Log.i(TAG, "Need to adjust remote volume: calling adjustRemoteVolume()");
adjustRemoteVolume(AudioSystem.STREAM_MUSIC, direction, flags);
} else {
adjustStreamVolume(streamType, direction, flags);
}
}
// don't play sounds for remote
flags &= ~(AudioManager.FLAG_PLAY_SOUND|AudioManager.FLAG_FIXED_VOLUME);
//if (DEBUG_VOL) Log.i(TAG, "Need to adjust remote volume: calling adjustRemoteVolume()");
adjustRemoteVolume(AudioSystem.STREAM_MUSIC, direction, flags);
} else {
adjustStreamVolume(streamType, direction, flags);
}
}
3.public void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage) {
if (mUseFixedVolume) {
return;
}
if (DEBUG_VOL) Log.d(TAG, "adjustStreamVolume() stream="+streamType+", dir="+direction);
if (mUseFixedVolume) {
return;
}
if (DEBUG_VOL) Log.d(TAG, "adjustStreamVolume() stream="+streamType+", dir="+direction);
ensureValidDirection(direction);
ensureValidStreamType(streamType);
// Add for wechat start
if (streamType == AudioSystem.STREAM_MUSIC
&& AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)
&& getMode() == AudioManager.MODE_IN_CALL
&& !AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL, 0)) {
streamType = getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
}
// Add for wechat end
ensureValidStreamType(streamType);
// Add for wechat start
if (streamType == AudioSystem.STREAM_MUSIC
&& AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)
&& getMode() == AudioManager.MODE_IN_CALL
&& !AudioSystem.isStreamActive(AudioSystem.STREAM_VOICE_CALL, 0)) {
streamType = getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
}
// Add for wechat end
0 0
- FAQ11272][Audio App]微信语音通话(听筒模式),音量侧键不能调音量
- 语音通话 切换扬声器和听筒
- AHK在Win7下不能调音量
- ios微信语音播放之切换听筒和扬声器
- QQ和微信语音音量分析
- 香港微信已经有语音通话功能了
- 使用环信SDK开发免费语音通话app原型测试成功
- Android——实现微信语音音量变化说话
- android音量键调节听筒音量的大小
- mt6735 [Speech]通话过程中连接BT再切换成听筒,上行音量变小
- android调音量
- mt6735 [Audio Common]通话时,概率性出现听筒或喇叭无声问题,如何debug
- android 微信听筒无声
- 环信语音消息听筒和扬声器的切换
- Audio系列之音量键
- 微信4.2版本雷锋网抢先独家评测 支持视频和语音通话
- iOS适配后台打电话和qq微信视频语音通话
- android播放语音,切换听筒模式遇到的问题
- 生产apk自动添加了 READ_PHONE_STATE 权限
- HBase常用Shell命令
- RobotArt让机器人写字的神秘故事
- openwrt 设置IP,通过源代码
- UIAccelerometer 加速计
- FAQ11272][Audio App]微信语音通话(听筒模式),音量侧键不能调音量
- nodejs基础: 如何升级Noejs版本
- UVa 11729 Commando War
- Android使用Application总结
- 计算机网络的cookie理解
- android容联云IM会话界面chattingFragment修改的简单介绍
- 1、顺(逆)时针旋转MxN矩阵
- Share 分享 UM 分享
- 第十三周项目:形状类族的中的纯虚函数