Merge "Add dynamic uid info for tracking the sip service usage." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
ea52d35e56
@ -32,6 +32,7 @@ import android.net.sip.SipProfile;
|
|||||||
import android.net.sip.SipSessionAdapter;
|
import android.net.sip.SipSessionAdapter;
|
||||||
import android.net.sip.SipSessionState;
|
import android.net.sip.SipSessionState;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@ -97,6 +98,7 @@ public final class SipService extends ISipService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void open(SipProfile localProfile) {
|
public void open(SipProfile localProfile) {
|
||||||
|
localProfile.setCallingUid(Binder.getCallingUid());
|
||||||
if (localProfile.getAutoRegistration()) {
|
if (localProfile.getAutoRegistration()) {
|
||||||
openToReceiveCalls(localProfile);
|
openToReceiveCalls(localProfile);
|
||||||
} else {
|
} else {
|
||||||
@ -119,6 +121,7 @@ public final class SipService extends ISipService.Stub {
|
|||||||
|
|
||||||
public synchronized void open3(SipProfile localProfile,
|
public synchronized void open3(SipProfile localProfile,
|
||||||
String incomingCallBroadcastAction, ISipSessionListener listener) {
|
String incomingCallBroadcastAction, ISipSessionListener listener) {
|
||||||
|
localProfile.setCallingUid(Binder.getCallingUid());
|
||||||
if (TextUtils.isEmpty(incomingCallBroadcastAction)) {
|
if (TextUtils.isEmpty(incomingCallBroadcastAction)) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"empty broadcast action for incoming call");
|
"empty broadcast action for incoming call");
|
||||||
@ -165,6 +168,7 @@ public final class SipService extends ISipService.Stub {
|
|||||||
|
|
||||||
public synchronized ISipSession createSession(SipProfile localProfile,
|
public synchronized ISipSession createSession(SipProfile localProfile,
|
||||||
ISipSessionListener listener) {
|
ISipSessionListener listener) {
|
||||||
|
localProfile.setCallingUid(Binder.getCallingUid());
|
||||||
if (!mConnected) return null;
|
if (!mConnected) return null;
|
||||||
try {
|
try {
|
||||||
SipSessionGroupExt group = createGroup(localProfile);
|
SipSessionGroupExt group = createGroup(localProfile);
|
||||||
@ -362,16 +366,7 @@ public final class SipService extends ISipService.Stub {
|
|||||||
|
|
||||||
private SipProfile duplicate(SipProfile p) {
|
private SipProfile duplicate(SipProfile p) {
|
||||||
try {
|
try {
|
||||||
return new SipProfile.Builder(p.getUserName(), p.getSipDomain())
|
return new SipProfile.Builder(p).setPassword("*").build();
|
||||||
.setProfileName(p.getProfileName())
|
|
||||||
.setPassword("*")
|
|
||||||
.setPort(p.getPort())
|
|
||||||
.setProtocol(p.getProtocol())
|
|
||||||
.setOutboundProxy(p.getProxyAddress())
|
|
||||||
.setSendKeepAlive(p.getSendKeepAlive())
|
|
||||||
.setAutoRegistration(p.getAutoRegistration())
|
|
||||||
.setDisplayName(p.getDisplayName())
|
|
||||||
.build();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.wtf(TAG, "duplicate()", e);
|
Log.wtf(TAG, "duplicate()", e);
|
||||||
throw new RuntimeException("duplicate profile", e);
|
throw new RuntimeException("duplicate profile", e);
|
||||||
|
@ -47,6 +47,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
private boolean mSendKeepAlive = false;
|
private boolean mSendKeepAlive = false;
|
||||||
private boolean mAutoRegistration = true;
|
private boolean mAutoRegistration = true;
|
||||||
private boolean mAllowOutgoingCall = false;
|
private boolean mAllowOutgoingCall = false;
|
||||||
|
private int mCallingUid = -1;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final Parcelable.Creator<SipProfile> CREATOR =
|
public static final Parcelable.Creator<SipProfile> CREATOR =
|
||||||
@ -293,6 +294,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
mSendKeepAlive = (in.readInt() == 0) ? false : true;
|
mSendKeepAlive = (in.readInt() == 0) ? false : true;
|
||||||
mAutoRegistration = (in.readInt() == 0) ? false : true;
|
mAutoRegistration = (in.readInt() == 0) ? false : true;
|
||||||
mAllowOutgoingCall = (in.readInt() == 0) ? false : true;
|
mAllowOutgoingCall = (in.readInt() == 0) ? false : true;
|
||||||
|
mCallingUid = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@ -306,6 +308,7 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
out.writeInt(mSendKeepAlive ? 1 : 0);
|
out.writeInt(mSendKeepAlive ? 1 : 0);
|
||||||
out.writeInt(mAutoRegistration ? 1 : 0);
|
out.writeInt(mAutoRegistration ? 1 : 0);
|
||||||
out.writeInt(mAllowOutgoingCall ? 1 : 0);
|
out.writeInt(mAllowOutgoingCall ? 1 : 0);
|
||||||
|
out.writeInt(mCallingUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@ -437,4 +440,20 @@ public class SipProfile implements Parcelable, Serializable, Cloneable {
|
|||||||
public boolean isOutgoingCallAllowed() {
|
public boolean isOutgoingCallAllowed() {
|
||||||
return mAllowOutgoingCall;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user