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.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
@ -753,7 +754,10 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
}
|
||||
|
||||
mVideoInviteInProgress.setVisibility(View.GONE);
|
||||
mVideo.setEnabled(LinphonePreferences.instance().isVideoEnabled());
|
||||
mVideo.setEnabled(
|
||||
LinphonePreferences.instance().isVideoEnabled()
|
||||
&& call != null
|
||||
&& !call.mediaInProgress());
|
||||
|
||||
boolean videoEnabled =
|
||||
LinphonePreferences.instance().isVideoEnabled()
|
||||
|
@ -778,12 +782,31 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
|
||||
RelativeLayout.LayoutParams lp =
|
||||
(RelativeLayout.LayoutParams) mLocalPreview.getLayoutParams();
|
||||
|
||||
lp.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
lp.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
|
||||
int left = lp.leftMargin + (x - mPreviewX);
|
||||
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.topMargin = top;
|
||||
mLocalPreview.setLayoutParams(lp);
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.linphone.contacts.ContactsManager;
|
|||
import org.linphone.contacts.ContactsUpdatedListener;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.ChatMessage;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomCapabilities;
|
||||
|
@ -77,6 +78,7 @@ import org.linphone.core.ChatRoomListener;
|
|||
import org.linphone.core.ChatRoomSecurityLevel;
|
||||
import org.linphone.core.Content;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.EventLog;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.Participant;
|
||||
|
@ -121,6 +123,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
private int mContextMenuMessagePosition;
|
||||
private LinearLayout mTopBar;
|
||||
private ImageView mChatRoomSecurityLevel;
|
||||
private CoreListenerStub mCoreListener;
|
||||
|
||||
private InputContentInfoCompat mCurrentInputContentInfo;
|
||||
|
||||
|
@ -345,6 +348,15 @@ public class ChatMessagesFragment extends Fragment
|
|||
onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
mCoreListener =
|
||||
new CoreListenerStub() {
|
||||
@Override
|
||||
public void onCallStateChanged(
|
||||
Core lc, Call call, Call.State state, String message) {
|
||||
displayChatRoomHeader();
|
||||
}
|
||||
};
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -352,6 +364,11 @@ public class ChatMessagesFragment extends Fragment
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
core.addListener(mCoreListener);
|
||||
}
|
||||
|
||||
ContactsManager.getInstance().addContactsListener(this);
|
||||
|
||||
addVirtualKeyboardVisiblityListener();
|
||||
|
@ -380,6 +397,11 @@ public class ChatMessagesFragment extends Fragment
|
|||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
core.removeListener(mCoreListener);
|
||||
}
|
||||
|
||||
ContactsManager.getInstance().removeContactsListener(this);
|
||||
removeVirtualKeyboardVisiblityListener();
|
||||
LinphoneService.instance().getNotificationManager().setCurrentlyDisplayedChatRoom(null);
|
||||
|
|
|
@ -76,6 +76,35 @@ public class BluetoothReceiver extends BroadcastReceiver {
|
|||
} else {
|
||||
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 {
|
||||
Log.w("[Bluetooth] Bluetooth unknown action: " + action);
|
||||
}
|
||||
|
|
|
@ -204,12 +204,12 @@ public class AndroidAudioManager {
|
|||
if (mBluetoothAdapter != null && mBluetoothHeadset != null) {
|
||||
Log.i("[Audio Manager] [Bluetooth] Closing HEADSET profile proxy");
|
||||
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
|
||||
}
|
||||
|
||||
Log.i("[Audio Manager] [Bluetooth] Unegistering bluetooth receiver");
|
||||
if (mBluetoothReceiver != null) {
|
||||
mContext.unregisterReceiver(mBluetoothReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
|
@ -533,21 +533,16 @@ public class AndroidAudioManager {
|
|||
Log.i(
|
||||
"[Audio Manager] [Bluetooth] Registering bluetooth receiver");
|
||||
|
||||
mContext.registerReceiver(
|
||||
mBluetoothReceiver,
|
||||
new IntentFilter(
|
||||
BluetoothHeadset
|
||||
.ACTION_CONNECTION_STATE_CHANGED));
|
||||
mContext.registerReceiver(
|
||||
mBluetoothReceiver,
|
||||
new IntentFilter(
|
||||
BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED));
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
|
||||
filter.addAction(
|
||||
BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
|
||||
filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
|
||||
filter.addAction(
|
||||
BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
|
||||
|
||||
Intent sticky =
|
||||
mContext.registerReceiver(
|
||||
mBluetoothReceiver,
|
||||
new IntentFilter(
|
||||
AudioManager
|
||||
.ACTION_SCO_AUDIO_STATE_UPDATED));
|
||||
mContext.registerReceiver(mBluetoothReceiver, filter);
|
||||
int state =
|
||||
sticky.getIntExtra(
|
||||
AudioManager.EXTRA_SCO_AUDIO_STATE,
|
||||
|
|
Loading…
Reference in a new issue