import android.net.sip.SipSessionAdapter;
import android.net.sip.SipSessionState;
import android.net.wifi.WifiManager;
+import android.os.Binder;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.SystemClock;
}
public void open(SipProfile localProfile) {
+ localProfile.setCallingUid(Binder.getCallingUid());
if (localProfile.getAutoRegistration()) {
openToReceiveCalls(localProfile);
} else {
public synchronized void open3(SipProfile localProfile,
String incomingCallBroadcastAction, ISipSessionListener listener) {
+ localProfile.setCallingUid(Binder.getCallingUid());
if (TextUtils.isEmpty(incomingCallBroadcastAction)) {
throw new RuntimeException(
"empty broadcast action for incoming call");
public synchronized ISipSession createSession(SipProfile localProfile,
ISipSessionListener listener) {
+ localProfile.setCallingUid(Binder.getCallingUid());
if (!mConnected) return null;
try {
SipSessionGroupExt group = createGroup(localProfile);
private SipProfile duplicate(SipProfile p) {
try {
- return new SipProfile.Builder(p.getUserName(), p.getSipDomain())
- .setProfileName(p.getProfileName())
- .setPassword("*")
- .setPort(p.getPort())
- .setProtocol(p.getProtocol())
- .setOutboundProxy(p.getProxyAddress())
- .setSendKeepAlive(p.getSendKeepAlive())
- .setAutoRegistration(p.getAutoRegistration())
- .setDisplayName(p.getDisplayName())
- .build();
+ return new SipProfile.Builder(p).setPassword("*").build();
} catch (Exception e) {
Log.wtf(TAG, "duplicate()", e);
throw new RuntimeException("duplicate profile", e);
private boolean mSendKeepAlive = false;
private boolean mAutoRegistration = true;
private boolean mAllowOutgoingCall = false;
+ private int mCallingUid = -1;
/** @hide */
public static final Parcelable.Creator<SipProfile> CREATOR =
mSendKeepAlive = (in.readInt() == 0) ? false : true;
mAutoRegistration = (in.readInt() == 0) ? false : true;
mAllowOutgoingCall = (in.readInt() == 0) ? false : true;
+ mCallingUid = in.readInt();
}
/** @hide */
out.writeInt(mSendKeepAlive ? 1 : 0);
out.writeInt(mAutoRegistration ? 1 : 0);
out.writeInt(mAllowOutgoingCall ? 1 : 0);
+ out.writeInt(mCallingUid);
}
/** @hide */
public boolean isOutgoingCallAllowed() {
return mAllowOutgoingCall;
}
+
+ /**
+ * Sets the calling process's Uid in the sip service.
+ * @hide
+ */
+ public void setCallingUid(int uid) {
+ mCallingUid = uid;
+ }
+
+ /**
+ * Gets the calling process's Uid in the sip settings.
+ * @hide
+ */
+ public int getCallingUid() {
+ return mCallingUid;
+ }
}