[HangOn] Handset intent implementation + submodule linphone updated
This commit is contained in:
parent
fce3238022
commit
e0ea1bc98b
9 changed files with 143 additions and 113 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.linphone"
|
||||
<manifest package="org.linphone"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="3253"
|
||||
android:versionName="3.2.5">
|
||||
|
@ -10,8 +10,9 @@
|
|||
android:targetSdkVersion="23"/>
|
||||
|
||||
<!-- Permissions for Push Notification -->
|
||||
<!--<uses-permission android:name="org.linphone.permission.C2D_MESSAGE"/> GCM permission--> <!-- Change package ! -->
|
||||
<!--<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/> GCM permission-->
|
||||
<!-- <uses-permission android:name="org.linphone.permission.C2D_MESSAGE"/> GCM permission -->
|
||||
<!-- Change package ! -->
|
||||
<!-- <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/> GCM permission -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
|
@ -133,7 +134,6 @@
|
|||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
</intent-filter>
|
||||
|
||||
<!--
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
@ -229,7 +229,7 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".PhoneStateChangedReceiver">
|
||||
<intent-filter>
|
||||
<intent-filter android:priority="999">
|
||||
<action android:name="android.intent.action.PHONE_STATE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
@ -237,19 +237,30 @@
|
|||
<!-- This one needs to be registered from application -->
|
||||
<receiver android:name=".KeepAliveReceiver"/>
|
||||
|
||||
<receiver android:name=".HookReceiver" >
|
||||
<intent-filter>
|
||||
<action android:name="com.base.module.phone.HOOKEVENT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Needed for push notification -->
|
||||
<!--<receiver
|
||||
<!--
|
||||
<receiver
|
||||
android:name=".gcm.GCMReceiver"
|
||||
android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
|
||||
|
||||
<category android:name="org.linphone"/>--> <!-- Change package ! -->
|
||||
<!--</intent-filter>
|
||||
<category android:name="org.linphone"/>
|
||||
-->
|
||||
<!-- Change package ! -->
|
||||
<!--
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service android:name=".gcm.GCMService"/>-->
|
||||
<service android:name=".gcm.GCMService"/>
|
||||
-->
|
||||
|
||||
<receiver
|
||||
android:name=".AccountEnableReceiver"
|
||||
|
@ -264,9 +275,7 @@
|
|||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".firebase.FirebaseMessaging">
|
||||
<service android:name=".firebase.FirebaseMessaging">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
||||
</intent-filter>
|
||||
|
@ -318,4 +327,4 @@
|
|||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
|
@ -18,7 +18,7 @@ buildscript {
|
|||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
if (googleFile.exists()) {
|
||||
classpath 'com.google.gms:google-services:3.0.0'
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ android {
|
|||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}
|
||||
buildToolsVersion '25.0.2'
|
||||
}
|
||||
|
||||
///////////// Task /////////////
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Fri Feb 24 09:27:36 CET 2017
|
||||
#Wed Mar 22 15:25:45 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
|
|
|
@ -18,7 +18,7 @@ buildscript {
|
|||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
||||
if (googleFile.exists()) {
|
||||
classpath 'com.google.gms:google-services:3.0.0'
|
||||
}
|
||||
|
|
|
@ -17,32 +17,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneCallStats.LinphoneAddressFamily;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphonePlayer;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
import org.linphone.mediastream.Factory;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
@ -86,6 +60,30 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneCallStats.LinphoneAddressFamily;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphonePlayer;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
@ -273,7 +271,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
enableAndRefreshInCallActions();
|
||||
}
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
// Fragment already created, no need to create it again (else it will generate a memory leak with duplicated fragments)
|
||||
isSpeakerEnabled = savedInstanceState.getBoolean("Speaker");
|
||||
|
@ -403,11 +400,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
contactPicture = (ImageView) findViewById(R.id.contact_picture);
|
||||
avatar_layout = (RelativeLayout) findViewById(R.id.avatar_layout);
|
||||
|
||||
/*if(isTablet()){
|
||||
speaker.setEnabled(false);
|
||||
}
|
||||
speaker.setEnabled(false);*/
|
||||
|
||||
//Options
|
||||
addCall = (ImageView) findViewById(R.id.add_call);
|
||||
addCall.setOnClickListener(this);
|
||||
|
@ -534,7 +526,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
displayMissedChats();
|
||||
}
|
||||
|
||||
private void refreshInCallActions() {
|
||||
protected void setSpeakerEnabled(boolean enabled){
|
||||
isSpeakerEnabled = enabled;
|
||||
}
|
||||
|
||||
protected void refreshInCallActions() {
|
||||
if (!LinphonePreferences.instance().isVideoEnabled() || isConferenceRunning) {
|
||||
enabledVideoButton(false);
|
||||
} else {
|
||||
|
@ -921,7 +917,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
}
|
||||
}
|
||||
|
||||
private void toggleSpeaker() {
|
||||
protected void toggleSpeaker() {
|
||||
isSpeakerEnabled = !isSpeakerEnabled;
|
||||
if (isSpeakerEnabled) {
|
||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||
|
@ -1200,6 +1196,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
|
||||
instance = this;
|
||||
super.onResume();
|
||||
|
||||
|
@ -1207,6 +1204,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled();
|
||||
|
||||
refreshIncallUi();
|
||||
handleViewIntent();
|
||||
|
|
|
@ -18,18 +18,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
package org.linphone;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
@ -44,6 +32,18 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CallIncomingActivity extends LinphoneGenericActivity implements LinphoneSliderTriggered {
|
||||
private static CallIncomingActivity instance;
|
||||
|
||||
|
@ -179,6 +179,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
|||
finish();
|
||||
}
|
||||
if (state == State.StreamsRunning) {
|
||||
Log.e("CallIncommingActivity - onCreate - State.StreamsRunning - speaker = "+LinphoneManager.getLc().isSpeakerEnabled());
|
||||
// The following should not be needed except some devices need it (e.g. Galaxy S).
|
||||
LinphoneManager.getLc().enableSpeaker(LinphoneManager.getLc().isSpeakerEnabled());
|
||||
}
|
||||
|
|
|
@ -1634,7 +1634,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
//LinphoneChatMessage Listener
|
||||
@Override
|
||||
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
|
||||
Log.e(" =======>>>>>>> onLinphoneChatMessageStateChanged - state = "+state.toString());
|
||||
redrawMessageList();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,23 +18,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
package org.linphone;
|
||||
|
||||
import static android.media.AudioManager.MODE_RINGTONE;
|
||||
import static android.media.AudioManager.STREAM_RING;
|
||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.assistant.AssistantActivity;
|
||||
import org.linphone.core.CallDirection;
|
||||
|
@ -79,35 +91,23 @@ import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
|||
import org.linphone.tools.H264Helper;
|
||||
import org.linphone.tools.OpenH264DownloadHelper;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.Vibrator;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static android.media.AudioManager.MODE_RINGTONE;
|
||||
import static android.media.AudioManager.STREAM_RING;
|
||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -145,8 +145,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
private ConnectivityManager mConnectivityManager;
|
||||
private BroadcastReceiver mKeepAliveReceiver;
|
||||
private BroadcastReceiver mDozeReceiver;
|
||||
private BroadcastReceiver mHookReceiver;
|
||||
private IntentFilter mKeepAliveIntentFilter;
|
||||
private IntentFilter mDozeIntentFilter;
|
||||
private IntentFilter mHookIntentFilter;
|
||||
private Handler mHandler = new Handler();
|
||||
private WakeLock mIncallWakeLock;
|
||||
private LinphoneAccountCreator accountCreator;
|
||||
|
@ -822,6 +824,12 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
mServiceContext.registerReceiver(mDozeReceiver, mDozeIntentFilter);
|
||||
}
|
||||
|
||||
mHookIntentFilter = new IntentFilter("com.base.module.phone.HOOKEVENT");
|
||||
mHookIntentFilter.setPriority(999);
|
||||
mHookReceiver = new HookReceiver();
|
||||
mServiceContext.registerReceiver(mHookReceiver, mHookIntentFilter);
|
||||
|
||||
|
||||
updateNetworkReachability();
|
||||
|
||||
resetCameraFromPreferences();
|
||||
|
@ -831,6 +839,20 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
accountCreator.setListener(this);
|
||||
}
|
||||
|
||||
protected void setHandsetMode(Boolean on){
|
||||
if(mLc.isInComingInvitePending() && on){
|
||||
try {
|
||||
mLc.acceptCall(mLc.getCurrentCall());
|
||||
LinphoneActivity.instance().startIncallActivity(mLc.getCurrentCall());
|
||||
}catch(LinphoneCoreException e){}
|
||||
}else if(on && CallActivity.isInstanciated()){
|
||||
CallActivity.instance().setSpeakerEnabled(true);
|
||||
CallActivity.instance().refreshInCallActions();
|
||||
}else if (!on){
|
||||
LinphoneManager.getInstance().terminateCall();
|
||||
}
|
||||
}
|
||||
|
||||
private void copyAssetsFromPackage() throws IOException {
|
||||
copyIfNotExist(R.raw.notes_of_the_optimistic, mRingSoundFile);
|
||||
copyIfNotExist(R.raw.ringback, mRingbackSoundFile);
|
||||
|
@ -1192,7 +1214,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
}
|
||||
|
||||
if (state == State.IncomingReceived && LinphonePreferences.instance().isAutoAnswerEnabled()) {
|
||||
if (state == State.IncomingReceived && (LinphonePreferences.instance().isAutoAnswerEnabled())) {
|
||||
try {
|
||||
mLc.acceptCall(call);
|
||||
} catch (LinphoneCoreException e) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c1434a3f7c029fb69f557fca2b5fa1682786da5f
|
||||
Subproject commit 91c0fc4a174ba25fb5335f5abfb3e07aec086168
|
Loading…
Reference in a new issue