Merge "Fix double-add of calls"
am: e8a5b8a76d
Change-Id: Ib017fd53fdb728c388c3d6f209c92a5c6931f7ad
This commit is contained in:
@@ -152,13 +152,20 @@ public final class Phone {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Call call = new Call(this, parcelableCall.getId(), mInCallAdapter,
|
Call call = mCallByTelecomCallId.get(parcelableCall.getId());
|
||||||
|
if (call == null) {
|
||||||
|
call = new Call(this, parcelableCall.getId(), mInCallAdapter,
|
||||||
parcelableCall.getState(), mCallingPackage, mTargetSdkVersion);
|
parcelableCall.getState(), mCallingPackage, mTargetSdkVersion);
|
||||||
mCallByTelecomCallId.put(parcelableCall.getId(), call);
|
mCallByTelecomCallId.put(parcelableCall.getId(), call);
|
||||||
mCalls.add(call);
|
mCalls.add(call);
|
||||||
checkCallTree(parcelableCall);
|
checkCallTree(parcelableCall);
|
||||||
call.internalUpdate(parcelableCall, mCallByTelecomCallId);
|
call.internalUpdate(parcelableCall, mCallByTelecomCallId);
|
||||||
fireCallAdded(call);
|
fireCallAdded(call);
|
||||||
|
} else {
|
||||||
|
Log.w(this, "Call %s added, but it was already present", call.internalGetCallId());
|
||||||
|
checkCallTree(parcelableCall);
|
||||||
|
call.internalUpdate(parcelableCall, mCallByTelecomCallId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final void internalRemoveCall(Call call) {
|
final void internalRemoveCall(Call call) {
|
||||||
@@ -190,7 +197,11 @@ public final class Phone {
|
|||||||
} else {
|
} else {
|
||||||
// This call may have come out of audio processing. Try adding it if our target sdk
|
// This call may have come out of audio processing. Try adding it if our target sdk
|
||||||
// version is low enough.
|
// version is low enough.
|
||||||
if (mTargetSdkVersion < SDK_VERSION_R) {
|
// The only two allowable states coming out of audio processing are ACTIVE and
|
||||||
|
// SIMULATED_RINGING.
|
||||||
|
if (mTargetSdkVersion < SDK_VERSION_R && (parcelableCall.getState() == Call.STATE_ACTIVE
|
||||||
|
|| parcelableCall.getState() == Call.STATE_SIMULATED_RINGING)) {
|
||||||
|
Log.i(this, "adding call during update for sdk compatibility");
|
||||||
internalAddCall(parcelableCall);
|
internalAddCall(parcelableCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user