Loading src/com/android/server/telecom/CallsManager.java +12 −1 Original line number Diff line number Diff line Loading @@ -2080,7 +2080,7 @@ public class CallsManager extends Call.ListenerBase } /** * Given a {@link PhoneAccountHandle} determines if there are and managed calls. * Determines if there are any managed calls. * @return {@code true} if there are managed calls, {@code false} otherwise. */ public boolean hasManagedCalls() { Loading @@ -2088,6 +2088,17 @@ public class CallsManager extends Call.ListenerBase !call.isExternalCall()).count() > 0; } /** * Determines if there are any ongoing managed calls. * @return {@code true} if there are ongoing managed calls, {@code false} otherwise. */ public boolean hasOngoingManagedCalls() { return getNumCallsWithState( false /* isSelfManaged */, null /* excludeCall */, null /* phoneAccountHandle */, LIVE_CALL_STATES) > 0; } private boolean makeRoomForOutgoingCall(Call call, boolean isEmergency) { if (hasMaximumManagedLiveCalls(call)) { // NOTE: If the amount of live calls changes beyond 1, this logic will probably Loading src/com/android/server/telecom/InCallController.java +28 −35 Original line number Diff line number Diff line Loading @@ -84,13 +84,16 @@ public final class InCallController extends CallsManagerListenerBase { private class InCallServiceInfo { private final ComponentName mComponentName; private boolean mIsExternalCallsSupported; private boolean mIsSelfManagedCallsSupported; private final int mType; public InCallServiceInfo(ComponentName componentName, boolean isExternalCallsSupported, boolean isSelfManageCallsSupported, int type) { mComponentName = componentName; mIsExternalCallsSupported = isExternalCallsSupported; mIsSelfManagedCallsSupported = isSelfManageCallsSupported; mType = type; } Loading @@ -102,6 +105,10 @@ public final class InCallController extends CallsManagerListenerBase { return mIsExternalCallsSupported; } public boolean isSelfManagedCallsSupported() { return mIsSelfManagedCallsSupported; } public int getType() { return mType; } Loading @@ -120,18 +127,23 @@ public final class InCallController extends CallsManagerListenerBase { if (mIsExternalCallsSupported != that.mIsExternalCallsSupported) { return false; } if (mIsSelfManagedCallsSupported != that.mIsExternalCallsSupported) { return false; } return mComponentName.equals(that.mComponentName); } @Override public int hashCode() { return Objects.hash(mComponentName, mIsExternalCallsSupported); return Objects.hash(mComponentName, mIsExternalCallsSupported, mIsSelfManagedCallsSupported); } @Override public String toString() { return "[" + mComponentName + " supportsExternal? " + mIsExternalCallsSupported + "]"; return "[" + mComponentName + " supportsExternal? " + mIsExternalCallsSupported + " supportsSelfMg?" + mIsSelfManagedCallsSupported + "]"; } } Loading Loading @@ -658,11 +670,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallAdded(Call call) { if (call.isSelfManaged()) { Log.i(this, "onCallAdded: skipped self-managed %s", call); return; } if (!isBoundToServices()) { bindToServices(call); } else { Loading Loading @@ -700,11 +707,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallRemoved(Call call) { if (call.isSelfManaged()) { Log.i(this, "onCallRemoved: skipped self-managed %s", call); return; } Log.i(this, "onCallRemoved: %s", call); if (mCallsManager.getCalls().isEmpty()) { /** Let's add a 2 second delay before we send unbind to the services to hopefully Loading @@ -728,11 +730,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onExternalCallChanged(Call call, boolean isExternalCall) { if (call.isSelfManaged()) { Log.i(this, "onExternalCallChanged: skipped self-managed %s", call); return; } Log.i(this, "onExternalCallChanged: %s -> %b", call, isExternalCall); List<ComponentName> componentsUpdated = new ArrayList<>(); Loading @@ -748,6 +745,10 @@ public final class InCallController extends CallsManagerListenerBase { continue; } if (call.isSelfManaged() && !info.isSelfManagedCallsSupported()) { continue; } componentsUpdated.add(info.getComponentName()); IInCallService inCallService = entry.getValue(); Loading Loading @@ -798,11 +799,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallStateChanged(Call call, int oldState, int newState) { if (call.isSelfManaged()) { Log.i(this, "onExternalCallChanged: skipped self-managed %s", call); return; } updateCall(call); } Loading @@ -811,11 +807,6 @@ public final class InCallController extends CallsManagerListenerBase { Call call, ConnectionServiceWrapper oldService, ConnectionServiceWrapper newService) { if (call.isSelfManaged()) { Log.i(this, "onConnectionServiceChanged: skipped self-managed %s", call); return; } updateCall(call); } Loading Loading @@ -861,11 +852,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onIsConferencedChanged(Call call) { if (call.isSelfManaged()) { Log.i(this, "onIsConferencedChanged: skipped self-managed %s", call); return; } Log.d(this, "onIsConferencedChanged %s", call); updateCall(call); } Loading Loading @@ -992,7 +978,7 @@ public final class InCallController extends CallsManagerListenerBase { // Last Resort: Try to bind to the ComponentName given directly. Log.e(this, new Exception(), "Package Manager could not find ComponentName: " + componentName +". Trying to bind anyway."); return new InCallServiceInfo(componentName, false, type); return new InCallServiceInfo(componentName, false, false, type); } } Loading Loading @@ -1041,12 +1027,15 @@ public final class InCallController extends CallsManagerListenerBase { boolean isExternalCallsSupported = serviceInfo.metaData != null && serviceInfo.metaData.getBoolean( TelecomManager.METADATA_INCLUDE_EXTERNAL_CALLS, false); boolean isSelfManageCallsSupported = serviceInfo.metaData != null && serviceInfo.metaData.getBoolean( TelecomManager.METADATA_INCLUDE_SELF_MANAGED_CALLS, false); if (requestedType == 0 || requestedType == getInCallServiceType(entry.serviceInfo, packageManager)) { retval.add(new InCallServiceInfo( new ComponentName(serviceInfo.packageName, serviceInfo.name), isExternalCallsSupported, requestedType)); isExternalCallsSupported, isSelfManageCallsSupported, requestedType)); } } } Loading Loading @@ -1160,7 +1149,7 @@ public final class InCallController extends CallsManagerListenerBase { int numCallsSent = 0; for (Call call : calls) { try { if (call.isSelfManaged() || if ((call.isSelfManaged() && !info.isSelfManagedCallsSupported()) || (call.isExternalCall() && !info.isExternalCallsSupported())) { continue; } Loading Loading @@ -1229,6 +1218,10 @@ public final class InCallController extends CallsManagerListenerBase { continue; } if (call.isSelfManaged() && !info.isSelfManagedCallsSupported()) { continue; } ParcelableCall parcelableCall = ParcelableCallUtils.toParcelableCall( call, videoProviderChanged /* includeVideoProvider */, Loading src/com/android/server/telecom/ParcelableCallUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,10 @@ public class ParcelableCallUtils { android.telecom.Call.Details.PROPERTY_IS_EXTERNAL_CALL, Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY, android.telecom.Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY android.telecom.Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY, Connection.PROPERTY_SELF_MANAGED, android.telecom.Call.Details.PROPERTY_SELF_MANAGED }; private static int convertConnectionToCallProperties(int connectionProperties) { Loading src/com/android/server/telecom/TelecomServiceImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -647,6 +647,26 @@ public class TelecomServiceImpl { } } /** * @see android.telecom.TelecomManager#isInManagedCall */ @Override public boolean isInManagedCall(String callingPackage) { try { Log.startSession("TSI.iIMC"); if (!canReadPhoneState(callingPackage, "isInManagedCall")) { throw new SecurityException("Only the default dialer or caller with " + "READ_PHONE_STATE permission can use this method."); } synchronized (mLock) { return mCallsManager.hasOngoingManagedCalls(); } } finally { Log.endSession(); } } /** * @see android.telecom.TelecomManager#isRinging */ Loading Loading
src/com/android/server/telecom/CallsManager.java +12 −1 Original line number Diff line number Diff line Loading @@ -2080,7 +2080,7 @@ public class CallsManager extends Call.ListenerBase } /** * Given a {@link PhoneAccountHandle} determines if there are and managed calls. * Determines if there are any managed calls. * @return {@code true} if there are managed calls, {@code false} otherwise. */ public boolean hasManagedCalls() { Loading @@ -2088,6 +2088,17 @@ public class CallsManager extends Call.ListenerBase !call.isExternalCall()).count() > 0; } /** * Determines if there are any ongoing managed calls. * @return {@code true} if there are ongoing managed calls, {@code false} otherwise. */ public boolean hasOngoingManagedCalls() { return getNumCallsWithState( false /* isSelfManaged */, null /* excludeCall */, null /* phoneAccountHandle */, LIVE_CALL_STATES) > 0; } private boolean makeRoomForOutgoingCall(Call call, boolean isEmergency) { if (hasMaximumManagedLiveCalls(call)) { // NOTE: If the amount of live calls changes beyond 1, this logic will probably Loading
src/com/android/server/telecom/InCallController.java +28 −35 Original line number Diff line number Diff line Loading @@ -84,13 +84,16 @@ public final class InCallController extends CallsManagerListenerBase { private class InCallServiceInfo { private final ComponentName mComponentName; private boolean mIsExternalCallsSupported; private boolean mIsSelfManagedCallsSupported; private final int mType; public InCallServiceInfo(ComponentName componentName, boolean isExternalCallsSupported, boolean isSelfManageCallsSupported, int type) { mComponentName = componentName; mIsExternalCallsSupported = isExternalCallsSupported; mIsSelfManagedCallsSupported = isSelfManageCallsSupported; mType = type; } Loading @@ -102,6 +105,10 @@ public final class InCallController extends CallsManagerListenerBase { return mIsExternalCallsSupported; } public boolean isSelfManagedCallsSupported() { return mIsSelfManagedCallsSupported; } public int getType() { return mType; } Loading @@ -120,18 +127,23 @@ public final class InCallController extends CallsManagerListenerBase { if (mIsExternalCallsSupported != that.mIsExternalCallsSupported) { return false; } if (mIsSelfManagedCallsSupported != that.mIsExternalCallsSupported) { return false; } return mComponentName.equals(that.mComponentName); } @Override public int hashCode() { return Objects.hash(mComponentName, mIsExternalCallsSupported); return Objects.hash(mComponentName, mIsExternalCallsSupported, mIsSelfManagedCallsSupported); } @Override public String toString() { return "[" + mComponentName + " supportsExternal? " + mIsExternalCallsSupported + "]"; return "[" + mComponentName + " supportsExternal? " + mIsExternalCallsSupported + " supportsSelfMg?" + mIsSelfManagedCallsSupported + "]"; } } Loading Loading @@ -658,11 +670,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallAdded(Call call) { if (call.isSelfManaged()) { Log.i(this, "onCallAdded: skipped self-managed %s", call); return; } if (!isBoundToServices()) { bindToServices(call); } else { Loading Loading @@ -700,11 +707,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallRemoved(Call call) { if (call.isSelfManaged()) { Log.i(this, "onCallRemoved: skipped self-managed %s", call); return; } Log.i(this, "onCallRemoved: %s", call); if (mCallsManager.getCalls().isEmpty()) { /** Let's add a 2 second delay before we send unbind to the services to hopefully Loading @@ -728,11 +730,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onExternalCallChanged(Call call, boolean isExternalCall) { if (call.isSelfManaged()) { Log.i(this, "onExternalCallChanged: skipped self-managed %s", call); return; } Log.i(this, "onExternalCallChanged: %s -> %b", call, isExternalCall); List<ComponentName> componentsUpdated = new ArrayList<>(); Loading @@ -748,6 +745,10 @@ public final class InCallController extends CallsManagerListenerBase { continue; } if (call.isSelfManaged() && !info.isSelfManagedCallsSupported()) { continue; } componentsUpdated.add(info.getComponentName()); IInCallService inCallService = entry.getValue(); Loading Loading @@ -798,11 +799,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onCallStateChanged(Call call, int oldState, int newState) { if (call.isSelfManaged()) { Log.i(this, "onExternalCallChanged: skipped self-managed %s", call); return; } updateCall(call); } Loading @@ -811,11 +807,6 @@ public final class InCallController extends CallsManagerListenerBase { Call call, ConnectionServiceWrapper oldService, ConnectionServiceWrapper newService) { if (call.isSelfManaged()) { Log.i(this, "onConnectionServiceChanged: skipped self-managed %s", call); return; } updateCall(call); } Loading Loading @@ -861,11 +852,6 @@ public final class InCallController extends CallsManagerListenerBase { @Override public void onIsConferencedChanged(Call call) { if (call.isSelfManaged()) { Log.i(this, "onIsConferencedChanged: skipped self-managed %s", call); return; } Log.d(this, "onIsConferencedChanged %s", call); updateCall(call); } Loading Loading @@ -992,7 +978,7 @@ public final class InCallController extends CallsManagerListenerBase { // Last Resort: Try to bind to the ComponentName given directly. Log.e(this, new Exception(), "Package Manager could not find ComponentName: " + componentName +". Trying to bind anyway."); return new InCallServiceInfo(componentName, false, type); return new InCallServiceInfo(componentName, false, false, type); } } Loading Loading @@ -1041,12 +1027,15 @@ public final class InCallController extends CallsManagerListenerBase { boolean isExternalCallsSupported = serviceInfo.metaData != null && serviceInfo.metaData.getBoolean( TelecomManager.METADATA_INCLUDE_EXTERNAL_CALLS, false); boolean isSelfManageCallsSupported = serviceInfo.metaData != null && serviceInfo.metaData.getBoolean( TelecomManager.METADATA_INCLUDE_SELF_MANAGED_CALLS, false); if (requestedType == 0 || requestedType == getInCallServiceType(entry.serviceInfo, packageManager)) { retval.add(new InCallServiceInfo( new ComponentName(serviceInfo.packageName, serviceInfo.name), isExternalCallsSupported, requestedType)); isExternalCallsSupported, isSelfManageCallsSupported, requestedType)); } } } Loading Loading @@ -1160,7 +1149,7 @@ public final class InCallController extends CallsManagerListenerBase { int numCallsSent = 0; for (Call call : calls) { try { if (call.isSelfManaged() || if ((call.isSelfManaged() && !info.isSelfManagedCallsSupported()) || (call.isExternalCall() && !info.isExternalCallsSupported())) { continue; } Loading Loading @@ -1229,6 +1218,10 @@ public final class InCallController extends CallsManagerListenerBase { continue; } if (call.isSelfManaged() && !info.isSelfManagedCallsSupported()) { continue; } ParcelableCall parcelableCall = ParcelableCallUtils.toParcelableCall( call, videoProviderChanged /* includeVideoProvider */, Loading
src/com/android/server/telecom/ParcelableCallUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,10 @@ public class ParcelableCallUtils { android.telecom.Call.Details.PROPERTY_IS_EXTERNAL_CALL, Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY, android.telecom.Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY android.telecom.Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY, Connection.PROPERTY_SELF_MANAGED, android.telecom.Call.Details.PROPERTY_SELF_MANAGED }; private static int convertConnectionToCallProperties(int connectionProperties) { Loading
src/com/android/server/telecom/TelecomServiceImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -647,6 +647,26 @@ public class TelecomServiceImpl { } } /** * @see android.telecom.TelecomManager#isInManagedCall */ @Override public boolean isInManagedCall(String callingPackage) { try { Log.startSession("TSI.iIMC"); if (!canReadPhoneState(callingPackage, "isInManagedCall")) { throw new SecurityException("Only the default dialer or caller with " + "READ_PHONE_STATE permission can use this method."); } synchronized (mLock) { return mCallsManager.hasOngoingManagedCalls(); } } finally { Log.endSession(); } } /** * @see android.telecom.TelecomManager#isRinging */ Loading