Merge "Add checks for READ_PRIVILEGED_PHONE_STATE." into mnc-dev
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index dfe5849..603ea7e 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -1182,6 +1182,7 @@
if (mConnectionService == null) {
Log.w(this, "conference requested on a call without a connection service.");
} else {
+ Log.event(this, Log.Events.CONFERENCE_WITH, otherCall);
mConnectionService.conference(this, otherCall);
}
}
@@ -1190,6 +1191,7 @@
if (mConnectionService == null) {
Log.w(this, "splitting from conference call without a connection service");
} else {
+ Log.event(this, Log.Events.SPLIT_CONFERENCE);
mConnectionService.splitFromConference(this);
}
}
@@ -1198,6 +1200,7 @@
if (mConnectionService == null) {
Log.w(this, "merging conference calls without a connection service.");
} else if (can(Connection.CAPABILITY_MERGE_CONFERENCE)) {
+ Log.event(this, Log.Events.CONFERENCE_WITH);
mConnectionService.mergeConference(this);
mWasConferencePreviouslyMerged = true;
}
@@ -1207,6 +1210,7 @@
if (mConnectionService == null) {
Log.w(this, "swapping conference calls without a connection service.");
} else if (can(Connection.CAPABILITY_SWAP_CONFERENCE)) {
+ Log.event(this, Log.Events.SWAP);
mConnectionService.swapConference(this);
switch (mChildCalls.size()) {
case 1:
@@ -1245,6 +1249,7 @@
mParentCall.addChildCall(this);
}
+ Log.event(this, Log.Events.SET_PARENT, mParentCall);
for (Listener l : mListeners) {
l.onParentChanged(this);
}
@@ -1274,6 +1279,8 @@
mConferenceLevelActiveCall = call;
mChildCalls.add(call);
+ Log.event(this, Log.Events.ADD_CHILD, call);
+
for (Listener l : mListeners) {
l.onChildrenChanged(this);
}
@@ -1282,6 +1289,7 @@
private void removeChildCall(Call call) {
if (mChildCalls.remove(call)) {
+ Log.event(this, Log.Events.REMOVE_CHILD, call);
for (Listener l : mListeners) {
l.onChildrenChanged(this);
}
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index 452ce77..b5c2eff 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -319,6 +319,11 @@
}
if (mCallAudioState.isMuted() != shouldMute) {
+ // We user CallsManager's foreground call so that we dont ignore ringing calls
+ // for logging purposes
+ Log.event(mCallsManager.getForegroundCall(), Log.Events.MUTE,
+ shouldMute ? "on" : "off");
+
setSystemAudioState(shouldMute, mCallAudioState.getRoute(),
mCallAudioState.getSupportedRouteMask());
}
@@ -440,7 +445,10 @@
if (!force && Objects.equals(oldAudioState, mCallAudioState)) {
return;
}
+
Log.i(this, "setSystemAudioState: changing from %s to %s", oldAudioState, mCallAudioState);
+ Log.event(mCallsManager.getForegroundCall(), Log.Events.AUDIO_ROUTE,
+ CallAudioState.audioRouteToString(mCallAudioState.getRoute()));
mAudioManagerHandler.obtainMessage(
MSG_AUDIO_MANAGER_SET_MICROPHONE_MUTE,
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index 96e9255..d5ab5cf 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -663,6 +663,7 @@
gatewayInfo.getOriginalAddress());
}
+ Log.event(call, Log.Events.START_CONNECTION, Log.piiHandle(call.getHandle()));
try {
mServiceInterface.createConnection(
call.getConnectionManagerPhoneAccount(),
@@ -688,7 +689,7 @@
}
};
- mBinder.bind(callback);
+ mBinder.bind(callback, call);
}
/** @see IConnectionService#abort(String) */
@@ -1018,7 +1019,7 @@
setRemoteServices(callback, simServiceComponentNames, simServiceBinders);
}
}
- });
+ }, null);
}
}
diff --git a/src/com/android/server/telecom/CreateConnectionProcessor.java b/src/com/android/server/telecom/CreateConnectionProcessor.java
index a804fe1..6126e66 100644
--- a/src/com/android/server/telecom/CreateConnectionProcessor.java
+++ b/src/com/android/server/telecom/CreateConnectionProcessor.java
@@ -206,7 +206,6 @@
mCall.setConnectionService(service);
setTimeoutIfNeeded(service, attempt);
- Log.i(this, "Attempting to call from %s", service.getComponentName());
service.createConnection(mCall, new Response(service));
}
} else {
diff --git a/src/com/android/server/telecom/Log.java b/src/com/android/server/telecom/Log.java
index d605a8f..f0ee3fe 100644
--- a/src/com/android/server/telecom/Log.java
+++ b/src/com/android/server/telecom/Log.java
@@ -70,6 +70,17 @@
public static final String STOP_RINGER = "STOP_RINGER";
public static final String START_CALL_WAITING_TONE = "START_CALL_WAITING_TONE";
public static final String STOP_CALL_WAITING_TONE = "STOP_CALL_WAITING_TONE";
+ public static final String START_CONNECTION = "START_CONNECTION";
+ public static final String BIND_CS = "BIND_CS";
+ public static final String CS_BOUND = "CS_BOUND";
+ public static final String CONFERENCE_WITH = "CONF_WITH";
+ public static final String SPLIT_CONFERENCE = "CONF_SPLIT";
+ public static final String SWAP = "SWAP";
+ public static final String ADD_CHILD = "ADD_CHILD";
+ public static final String REMOVE_CHILD = "REMOVE_CHILD";
+ public static final String SET_PARENT = "SET_PARENT";
+ public static final String MUTE = "MUTE";
+ public static final String AUDIO_ROUTE = "AUDIO_ROUTE";
public static final String ERROR_LOG = "ERROR";
/**
@@ -85,6 +96,8 @@
put(REQUEST_DISCONNECT, SET_DISCONNECTED);
put(REQUEST_HOLD, SET_HOLD);
put(REQUEST_UNHOLD, SET_ACTIVE);
+ put(START_CONNECTION, SET_DIALING);
+ put(BIND_CS, CS_BOUND);
}};
}
@@ -154,7 +167,18 @@
pw.print(event.eventId);
if (event.data != null) {
pw.print(" (");
- pw.print(event.data);
+ Object data = event.data;
+
+ if (data instanceof Call) {
+ // If the data is another call, then change the data to the call's CallEvent
+ // ID instead.
+ CallEventRecord record = mCallEventRecordMap.get(data);
+ if (record != null) {
+ data = "Call " + record.mId;
+ }
+ }
+
+ pw.print(data);
pw.print(")");
}
diff --git a/src/com/android/server/telecom/ServiceBinder.java b/src/com/android/server/telecom/ServiceBinder.java
index 4edb4e5..2e63512 100644
--- a/src/com/android/server/telecom/ServiceBinder.java
+++ b/src/com/android/server/telecom/ServiceBinder.java
@@ -62,8 +62,9 @@
* specified callback.
*
* @param callback The callback to notify of the binding's success or failure.
+ * @param call The call for which we are being bound.
*/
- void bind(BindCallback callback) {
+ void bind(BindCallback callback, Call call) {
Log.d(ServiceBinder.this, "bind()");
// Reset any abort request if we're asked to bind again.
@@ -78,9 +79,9 @@
mCallbacks.add(callback);
if (mServiceConnection == null) {
Intent serviceIntent = new Intent(mServiceAction).setComponent(mComponentName);
- ServiceConnection connection = new ServiceBinderConnection();
+ ServiceConnection connection = new ServiceBinderConnection(call);
- Log.d(ServiceBinder.this, "Binding to service with intent: %s", serviceIntent);
+ Log.event(call, Log.Events.BIND_CS, mComponentName);
final int bindingFlags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE;
final boolean isBound;
if (mUserHandle != null) {
@@ -102,11 +103,23 @@
}
private final class ServiceBinderConnection implements ServiceConnection {
+ /**
+ * The initial call for which the service was bound.
+ */
+ private Call mCall;
+
+ ServiceBinderConnection(Call call) {
+ mCall = call;
+ }
+
@Override
public void onServiceConnected(ComponentName componentName, IBinder binder) {
synchronized (mLock) {
Log.i(this, "Service bound %s", componentName);
+ Log.event(mCall, Log.Events.CS_BOUND, componentName);
+ mCall = null;
+
// Unbind request was queued so unbind immediately.
if (mIsBindingAborted) {
clearAbort();