Fixed video preview display issue while moving + video button enabled while media in progress + chat messages view top bar not refreshed when call is ended + added logs for vendor specific bluetooth headsets actions
This commit is contained in:
parent
5fd28edb36
commit
f38bc0bfed
4 changed files with 88 additions and 19 deletions
|
@ -24,6 +24,7 @@ import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.Point;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -753,7 +754,10 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
mVideoInviteInProgress.setVisibility(View.GONE);
|
mVideoInviteInProgress.setVisibility(View.GONE);
|
||||||
mVideo.setEnabled(LinphonePreferences.instance().isVideoEnabled());
|
mVideo.setEnabled(
|
||||||
|
LinphonePreferences.instance().isVideoEnabled()
|
||||||
|
&& call != null
|
||||||
|
&& !call.mediaInProgress());
|
||||||
|
|
||||||
boolean videoEnabled =
|
boolean videoEnabled =
|
||||||
LinphonePreferences.instance().isVideoEnabled()
|
LinphonePreferences.instance().isVideoEnabled()
|
||||||
|
@ -778,12 +782,31 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
|
|
||||||
RelativeLayout.LayoutParams lp =
|
RelativeLayout.LayoutParams lp =
|
||||||
(RelativeLayout.LayoutParams) mLocalPreview.getLayoutParams();
|
(RelativeLayout.LayoutParams) mLocalPreview.getLayoutParams();
|
||||||
|
|
||||||
lp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
lp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||||
lp.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
lp.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
|
|
||||||
int left = lp.leftMargin + (x - mPreviewX);
|
int left = lp.leftMargin + (x - mPreviewX);
|
||||||
int top = lp.topMargin + (y - mPreviewY);
|
int top = lp.topMargin + (y - mPreviewY);
|
||||||
|
|
||||||
|
int width = lp.width;
|
||||||
|
int height = lp.height;
|
||||||
|
|
||||||
|
Point screenSize = new Point();
|
||||||
|
getWindow().getWindowManager().getDefaultDisplay().getSize(screenSize);
|
||||||
|
|
||||||
|
int statusBarHeight = 0;
|
||||||
|
int resource =
|
||||||
|
getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (resource > 0) {
|
||||||
|
statusBarHeight = getResources().getDimensionPixelSize(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (left < 0
|
||||||
|
|| top < 0
|
||||||
|
|| left + width >= screenSize.x
|
||||||
|
|| top + height + statusBarHeight >= screenSize.y) return;
|
||||||
|
|
||||||
lp.leftMargin = left;
|
lp.leftMargin = left;
|
||||||
lp.topMargin = top;
|
lp.topMargin = top;
|
||||||
mLocalPreview.setLayoutParams(lp);
|
mLocalPreview.setLayoutParams(lp);
|
||||||
|
|
|
@ -70,6 +70,7 @@ import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.contacts.ContactsUpdatedListener;
|
import org.linphone.contacts.ContactsUpdatedListener;
|
||||||
import org.linphone.contacts.LinphoneContact;
|
import org.linphone.contacts.LinphoneContact;
|
||||||
import org.linphone.core.Address;
|
import org.linphone.core.Address;
|
||||||
|
import org.linphone.core.Call;
|
||||||
import org.linphone.core.ChatMessage;
|
import org.linphone.core.ChatMessage;
|
||||||
import org.linphone.core.ChatRoom;
|
import org.linphone.core.ChatRoom;
|
||||||
import org.linphone.core.ChatRoomCapabilities;
|
import org.linphone.core.ChatRoomCapabilities;
|
||||||
|
@ -77,6 +78,7 @@ import org.linphone.core.ChatRoomListener;
|
||||||
import org.linphone.core.ChatRoomSecurityLevel;
|
import org.linphone.core.ChatRoomSecurityLevel;
|
||||||
import org.linphone.core.Content;
|
import org.linphone.core.Content;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
|
import org.linphone.core.CoreListenerStub;
|
||||||
import org.linphone.core.EventLog;
|
import org.linphone.core.EventLog;
|
||||||
import org.linphone.core.Factory;
|
import org.linphone.core.Factory;
|
||||||
import org.linphone.core.Participant;
|
import org.linphone.core.Participant;
|
||||||
|
@ -121,6 +123,7 @@ public class ChatMessagesFragment extends Fragment
|
||||||
private int mContextMenuMessagePosition;
|
private int mContextMenuMessagePosition;
|
||||||
private LinearLayout mTopBar;
|
private LinearLayout mTopBar;
|
||||||
private ImageView mChatRoomSecurityLevel;
|
private ImageView mChatRoomSecurityLevel;
|
||||||
|
private CoreListenerStub mCoreListener;
|
||||||
|
|
||||||
private InputContentInfoCompat mCurrentInputContentInfo;
|
private InputContentInfoCompat mCurrentInputContentInfo;
|
||||||
|
|
||||||
|
@ -345,6 +348,15 @@ public class ChatMessagesFragment extends Fragment
|
||||||
onRestoreInstanceState(savedInstanceState);
|
onRestoreInstanceState(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mCoreListener =
|
||||||
|
new CoreListenerStub() {
|
||||||
|
@Override
|
||||||
|
public void onCallStateChanged(
|
||||||
|
Core lc, Call call, Call.State state, String message) {
|
||||||
|
displayChatRoomHeader();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +364,11 @@ public class ChatMessagesFragment extends Fragment
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
Core core = LinphoneManager.getCore();
|
||||||
|
if (core != null) {
|
||||||
|
core.addListener(mCoreListener);
|
||||||
|
}
|
||||||
|
|
||||||
ContactsManager.getInstance().addContactsListener(this);
|
ContactsManager.getInstance().addContactsListener(this);
|
||||||
|
|
||||||
addVirtualKeyboardVisiblityListener();
|
addVirtualKeyboardVisiblityListener();
|
||||||
|
@ -380,6 +397,11 @@ public class ChatMessagesFragment extends Fragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
Core core = LinphoneManager.getCore();
|
||||||
|
if (core != null) {
|
||||||
|
core.removeListener(mCoreListener);
|
||||||
|
}
|
||||||
|
|
||||||
ContactsManager.getInstance().removeContactsListener(this);
|
ContactsManager.getInstance().removeContactsListener(this);
|
||||||
removeVirtualKeyboardVisiblityListener();
|
removeVirtualKeyboardVisiblityListener();
|
||||||
LinphoneService.instance().getNotificationManager().setCurrentlyDisplayedChatRoom(null);
|
LinphoneService.instance().getNotificationManager().setCurrentlyDisplayedChatRoom(null);
|
||||||
|
|
|
@ -76,6 +76,35 @@ public class BluetoothReceiver extends BroadcastReceiver {
|
||||||
} else {
|
} else {
|
||||||
Log.w("[Bluetooth] Bluetooth headset unknown SCO state changed: " + state);
|
Log.w("[Bluetooth] Bluetooth headset unknown SCO state changed: " + state);
|
||||||
}
|
}
|
||||||
|
} else if (action.equals(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT)) {
|
||||||
|
String command =
|
||||||
|
intent.getStringExtra(BluetoothHeadset.EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD);
|
||||||
|
int type =
|
||||||
|
intent.getIntExtra(
|
||||||
|
BluetoothHeadset.EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE, -1);
|
||||||
|
|
||||||
|
String commandType;
|
||||||
|
switch (type) {
|
||||||
|
case BluetoothHeadset.AT_CMD_TYPE_ACTION:
|
||||||
|
commandType = "AT Action";
|
||||||
|
break;
|
||||||
|
case BluetoothHeadset.AT_CMD_TYPE_READ:
|
||||||
|
commandType = "AT Read";
|
||||||
|
break;
|
||||||
|
case BluetoothHeadset.AT_CMD_TYPE_TEST:
|
||||||
|
commandType = "AT Test";
|
||||||
|
break;
|
||||||
|
case BluetoothHeadset.AT_CMD_TYPE_SET:
|
||||||
|
commandType = "AT Set";
|
||||||
|
break;
|
||||||
|
case BluetoothHeadset.AT_CMD_TYPE_BASIC:
|
||||||
|
commandType = "AT Basic";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
commandType = "AT Unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Log.i("[Bluetooth] Vendor action " + commandType + " : " + command);
|
||||||
} else {
|
} else {
|
||||||
Log.w("[Bluetooth] Bluetooth unknown action: " + action);
|
Log.w("[Bluetooth] Bluetooth unknown action: " + action);
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,11 +204,11 @@ public class AndroidAudioManager {
|
||||||
if (mBluetoothAdapter != null && mBluetoothHeadset != null) {
|
if (mBluetoothAdapter != null && mBluetoothHeadset != null) {
|
||||||
Log.i("[Audio Manager] [Bluetooth] Closing HEADSET profile proxy");
|
Log.i("[Audio Manager] [Bluetooth] Closing HEADSET profile proxy");
|
||||||
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
|
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
|
||||||
|
}
|
||||||
|
|
||||||
Log.i("[Audio Manager] [Bluetooth] Unegistering bluetooth receiver");
|
Log.i("[Audio Manager] [Bluetooth] Unegistering bluetooth receiver");
|
||||||
if (mBluetoothReceiver != null) {
|
if (mBluetoothReceiver != null) {
|
||||||
mContext.unregisterReceiver(mBluetoothReceiver);
|
mContext.unregisterReceiver(mBluetoothReceiver);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core core = LinphoneManager.getCore();
|
Core core = LinphoneManager.getCore();
|
||||||
|
@ -533,21 +533,16 @@ public class AndroidAudioManager {
|
||||||
Log.i(
|
Log.i(
|
||||||
"[Audio Manager] [Bluetooth] Registering bluetooth receiver");
|
"[Audio Manager] [Bluetooth] Registering bluetooth receiver");
|
||||||
|
|
||||||
mContext.registerReceiver(
|
IntentFilter filter = new IntentFilter();
|
||||||
mBluetoothReceiver,
|
filter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
|
||||||
new IntentFilter(
|
filter.addAction(
|
||||||
BluetoothHeadset
|
BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
|
||||||
.ACTION_CONNECTION_STATE_CHANGED));
|
filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
|
||||||
mContext.registerReceiver(
|
filter.addAction(
|
||||||
mBluetoothReceiver,
|
BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
|
||||||
new IntentFilter(
|
|
||||||
BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED));
|
|
||||||
Intent sticky =
|
Intent sticky =
|
||||||
mContext.registerReceiver(
|
mContext.registerReceiver(mBluetoothReceiver, filter);
|
||||||
mBluetoothReceiver,
|
|
||||||
new IntentFilter(
|
|
||||||
AudioManager
|
|
||||||
.ACTION_SCO_AUDIO_STATE_UPDATED));
|
|
||||||
int state =
|
int state =
|
||||||
sticky.getIntExtra(
|
sticky.getIntExtra(
|
||||||
AudioManager.EXTRA_SCO_AUDIO_STATE,
|
AudioManager.EXTRA_SCO_AUDIO_STATE,
|
||||||
|
|
Loading…
Reference in a new issue