mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
[Presence] Log on/off fixed + extra pusblish removed + linphone updated
This commit is contained in:
parent
bc8efdbc52
commit
171e01c4ca
5 changed files with 39 additions and 11 deletions
|
|
@ -447,7 +447,6 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
}
|
||||
|
||||
createInCallStats();
|
||||
LinphoneManager.getInstance().changeStatusToOnThePhone();
|
||||
}
|
||||
|
||||
public void checkAndRequestPermission(String permission, int result) {
|
||||
|
|
|
|||
|
|
@ -52,13 +52,16 @@ import org.linphone.ui.AvatarWithPresenceImage;
|
|||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
|
|
@ -1292,7 +1295,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneManager.getInstance().enableProxyPublish(false);
|
||||
LinphoneManager.getInstance().enableProxyPublish(!isApplicationBroughtToBackground(this));
|
||||
//LinphoneManager.getInstance().subscribeFriendList(false);
|
||||
getIntent().putExtra("PreviousActivity", 0);
|
||||
|
||||
|
|
@ -1313,6 +1316,27 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isApplicationBroughtToBackground(final Activity activity) {
|
||||
ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningTaskInfo> tasks = activityManager.getRunningTasks(1);
|
||||
|
||||
// Check the top Activity against the list of Activities contained in the Application's package.
|
||||
if (!tasks.isEmpty()) {
|
||||
ComponentName topActivity = tasks.get(0).topActivity;
|
||||
try {
|
||||
PackageInfo pi = activity.getPackageManager().getPackageInfo(activity.getPackageName(), PackageManager.GET_ACTIVITIES);
|
||||
for (ActivityInfo activityInfo : pi.activities) {
|
||||
if(topActivity.getClassName().equals(activityInfo.name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch( PackageManager.NameNotFoundException e) {
|
||||
return false; // Never happens.
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
switch (requestCode) {
|
||||
|
|
@ -1379,6 +1403,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mOrientationHelper != null) {
|
||||
|
|
|
|||
|
|
@ -356,8 +356,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
if (lc != null ) {
|
||||
if ((lc.getGlobalState() == GlobalState.GlobalOn) && (LinphoneService.isReady())) {
|
||||
LinphoneProxyConfig[] proxyList = lc.getProxyConfigList();
|
||||
if (!enabled)
|
||||
changeStatusToOffline();
|
||||
// if (!enabled)
|
||||
// changeStatusToOffline();
|
||||
for (LinphoneProxyConfig proxyConfig : proxyList) {
|
||||
proxyConfig.edit();
|
||||
proxyConfig.enablePublish(enabled);
|
||||
|
|
@ -381,7 +381,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
public void changeStatusToOnline() {
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && lc != null) {
|
||||
if ((lc.getGlobalState() == GlobalState.GlobalOn) && (LinphoneService.isReady())) {
|
||||
if ((lc.getGlobalState() == GlobalState.GlobalOn) && (LinphoneService.isReady()) && (lc.getPresenceModel().getActivity().getType() != PresenceActivityType.TV)) {
|
||||
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null);
|
||||
lc.setPresenceModel(model);
|
||||
}
|
||||
|
|
@ -620,8 +620,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
|
||||
|
||||
instance.enableProxyPublish(true);
|
||||
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -834,7 +832,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
public static synchronized void destroy() {
|
||||
if (instance == null) return;
|
||||
getInstance().changeStatusToOffline();
|
||||
sExited = true;
|
||||
instance.doDestroy();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ public class Digit extends Button implements AddressAware {
|
|||
if(which == 0){
|
||||
Log.setEnableLog(false);
|
||||
LinphonePreferences.instance().enableDebugLogs(false);
|
||||
LinphoneCoreFactory.instance().setDebugMode(false, getResources().getString(R.string.app_name));
|
||||
LinphoneCoreFactory.instance().enableLogCollection(false);
|
||||
LinphoneCoreFactory.instance().setDebugMode(false, getResources().getString(R.string.app_name));
|
||||
}
|
||||
if(which == 1) {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
|
@ -157,8 +157,8 @@ public class Digit extends Button implements AddressAware {
|
|||
if(which == 0) {
|
||||
Log.setEnableLog(true);
|
||||
LinphonePreferences.instance().enableDebugLogs(true);
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, getResources().getString(R.string.app_name));
|
||||
LinphoneCoreFactory.instance().enableLogCollection(true);
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, getResources().getString(R.string.app_name));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0215e014f454ba3dcdadb63a44f9b5002489f729
|
||||
Subproject commit 8377540fc541e948eea34d929facb3e5a6d3dd2c
|
||||
Loading…
Add table
Reference in a new issue