Fix crash with the presence + fix issue 1875: Use encoded URL strings for provisioning
This commit is contained in:
parent
d34aa69d79
commit
12e7d572c0
2 changed files with 24 additions and 12 deletions
|
@ -215,36 +215,40 @@ public class LinphoneManager implements LinphoneListener {
|
|||
}
|
||||
|
||||
private boolean isPresenceModelActivitySet() {
|
||||
if (isInstanciated() && getLcIfManagerNotDestroyedOrNull() != null) {
|
||||
return getLc().getPresenceModel() != null || getLc().getPresenceModel().getActivity() != null;
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && lc != null) {
|
||||
return lc.getPresenceModel() != null && lc.getPresenceModel().getActivity() != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void changeStatusToOnline() {
|
||||
if (isInstanciated() && getLcIfManagerNotDestroyedOrNull() != null && isPresenceModelActivitySet() && getLc().getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
|
||||
getLc().getPresenceModel().getActivity().setType(PresenceActivityType.Online);
|
||||
} else if (isInstanciated() && getLcIfManagerNotDestroyedOrNull() != null && !isPresenceModelActivitySet()) {
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
|
||||
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online);
|
||||
} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
|
||||
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Online, null);
|
||||
getLc().setPresenceModel(model);
|
||||
lc.setPresenceModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeStatusToOnThePhone() {
|
||||
if (isInstanciated() && isPresenceModelActivitySet() && getLc().getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
|
||||
getLc().getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
|
||||
lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
|
||||
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
|
||||
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
|
||||
getLc().setPresenceModel(model);
|
||||
lc.setPresenceModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeStatusToOffline() {
|
||||
if (isInstanciated() && isPresenceModelActivitySet() && getLc().getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
|
||||
getLc().getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
|
||||
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
|
||||
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
|
||||
PresenceModel model = LinphoneCoreFactoryImpl.instance().createPresenceModel(PresenceActivityType.Offline, null);
|
||||
getLc().setPresenceModel(model);
|
||||
lc.setPresenceModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
|
@ -108,6 +111,11 @@ public class RemoteProvisioningActivity extends Activity implements LinphoneRemo
|
|||
if (openUri != null) {
|
||||
// We expect something like linphone-config://http://linphone.org/config.xml
|
||||
configUriParam = openUri.getEncodedSchemeSpecificPart().substring(2); // Removes the linphone-config://
|
||||
try {
|
||||
configUriParam = URLDecoder.decode(configUriParam, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
Log.d("Using config uri: " + configUriParam);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue