Loading src/com/android/server/telecom/CallsManager.java +1 −13 Original line number Diff line number Diff line Loading @@ -4774,19 +4774,7 @@ public class CallsManager extends Call.ListenerBase * @return {@code true} if the app has ongoing calls, or {@code false} otherwise. */ public boolean isInSelfManagedCall(String packageName, UserHandle userHandle) { return isInSelfManagedCallCrossUsers(packageName, userHandle, false); } /** * Determines if there are any ongoing self-managed calls for the given package/user (unless * hasCrossUsers has been enabled). * @param packageName The package name to check. * @param userHandle The {@link UserHandle} to check. * @param hasCrossUserAccess indicates if calls across all users should be returned. * @return {@code true} if the app has ongoing calls, or {@code false} otherwise. */ public boolean isInSelfManagedCallCrossUsers( String packageName, UserHandle userHandle, boolean hasCrossUserAccess) { boolean hasCrossUserAccess = userHandle.equals(UserHandle.ALL); return mSelfManagedCallsBeingSetup.stream().anyMatch(c -> c.isSelfManaged() && c.getTargetPhoneAccount().getComponentName().getPackageName().equals(packageName) && (!hasCrossUserAccess Loading src/com/android/server/telecom/TelecomServiceImpl.java +4 −12 Original line number Diff line number Diff line Loading @@ -2576,34 +2576,26 @@ public class TelecomServiceImpl { * @param packageName the package name of the app to check calls for. * @param userHandle the user handle on which to check for calls. * @param callingPackage The caller's package name. * @param detectForAllUsers indicates if calls should be detected across all users. If the * caller does not have the ability to interact across users, get * managed calls for the caller instead. * @return {@code true} if there are ongoing calls, {@code false} otherwise. */ @Override public boolean isInSelfManagedCall(String packageName, UserHandle userHandle, String callingPackage, boolean detectForAllUsers) { String callingPackage) { try { mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, "READ_PRIVILEGED_PHONE_STATE required."); // Ensure that the caller has the INTERACT_ACROSS_USERS permission if it's trying // to access calls that don't belong to it. if (detectForAllUsers || (userHandle != null && !Binder.getCallingUserHandle().equals(userHandle))) { if (!Binder.getCallingUserHandle().equals(userHandle)) { enforceInAppCrossUserPermission(); } else { // If INTERACT_ACROSS_USERS doesn't need to be enforced, ensure that the user // being checked is the caller. userHandle = Binder.getCallingUserHandle(); } Log.startSession("TSI.iISMC", Log.getPackageAbbreviation(callingPackage)); synchronized (mLock) { long token = Binder.clearCallingIdentity(); try { return mCallsManager.isInSelfManagedCallCrossUsers( packageName, userHandle, detectForAllUsers); return mCallsManager.isInSelfManagedCall( packageName, userHandle); } finally { Binder.restoreCallingIdentity(token); } Loading Loading
src/com/android/server/telecom/CallsManager.java +1 −13 Original line number Diff line number Diff line Loading @@ -4774,19 +4774,7 @@ public class CallsManager extends Call.ListenerBase * @return {@code true} if the app has ongoing calls, or {@code false} otherwise. */ public boolean isInSelfManagedCall(String packageName, UserHandle userHandle) { return isInSelfManagedCallCrossUsers(packageName, userHandle, false); } /** * Determines if there are any ongoing self-managed calls for the given package/user (unless * hasCrossUsers has been enabled). * @param packageName The package name to check. * @param userHandle The {@link UserHandle} to check. * @param hasCrossUserAccess indicates if calls across all users should be returned. * @return {@code true} if the app has ongoing calls, or {@code false} otherwise. */ public boolean isInSelfManagedCallCrossUsers( String packageName, UserHandle userHandle, boolean hasCrossUserAccess) { boolean hasCrossUserAccess = userHandle.equals(UserHandle.ALL); return mSelfManagedCallsBeingSetup.stream().anyMatch(c -> c.isSelfManaged() && c.getTargetPhoneAccount().getComponentName().getPackageName().equals(packageName) && (!hasCrossUserAccess Loading
src/com/android/server/telecom/TelecomServiceImpl.java +4 −12 Original line number Diff line number Diff line Loading @@ -2576,34 +2576,26 @@ public class TelecomServiceImpl { * @param packageName the package name of the app to check calls for. * @param userHandle the user handle on which to check for calls. * @param callingPackage The caller's package name. * @param detectForAllUsers indicates if calls should be detected across all users. If the * caller does not have the ability to interact across users, get * managed calls for the caller instead. * @return {@code true} if there are ongoing calls, {@code false} otherwise. */ @Override public boolean isInSelfManagedCall(String packageName, UserHandle userHandle, String callingPackage, boolean detectForAllUsers) { String callingPackage) { try { mContext.enforceCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE, "READ_PRIVILEGED_PHONE_STATE required."); // Ensure that the caller has the INTERACT_ACROSS_USERS permission if it's trying // to access calls that don't belong to it. if (detectForAllUsers || (userHandle != null && !Binder.getCallingUserHandle().equals(userHandle))) { if (!Binder.getCallingUserHandle().equals(userHandle)) { enforceInAppCrossUserPermission(); } else { // If INTERACT_ACROSS_USERS doesn't need to be enforced, ensure that the user // being checked is the caller. userHandle = Binder.getCallingUserHandle(); } Log.startSession("TSI.iISMC", Log.getPackageAbbreviation(callingPackage)); synchronized (mLock) { long token = Binder.clearCallingIdentity(); try { return mCallsManager.isInSelfManagedCallCrossUsers( packageName, userHandle, detectForAllUsers); return mCallsManager.isInSelfManagedCall( packageName, userHandle); } finally { Binder.restoreCallingIdentity(token); } Loading