Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c419e7d authored by Pranav Madapurmath's avatar Pranav Madapurmath Committed by Android (Google) Code Review
Browse files

Merge "Resolve API feedback TelecomManager#isInSelfManagedCall" into main

parents 5125c2b8 af6beb57
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -2506,22 +2506,28 @@ 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 it is
         *                          set to true, the userHandle parameter is disregarded.
         * @return {@code true} if there are ongoing calls, {@code false} otherwise.
         */
        @Override
        public boolean isInSelfManagedCall(String packageName, UserHandle userHandle,
                String callingPackage, boolean hasCrossUserAccess) {
                String callingPackage, boolean detectForAllUsers) {
            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 || !Binder.getCallingUserHandle().equals(userHandle)) {
                    enforceInAppCrossUserPermission();
                }

                Log.startSession("TSI.iISMC", Log.getPackageAbbreviation(callingPackage));
                synchronized (mLock) {
                    long token = Binder.clearCallingIdentity();
                    try {
                        return mCallsManager.isInSelfManagedCallCrossUsers(
                                packageName, userHandle, hasCrossUserAccess);
                                packageName, userHandle, detectForAllUsers);
                    } finally {
                        Binder.restoreCallingIdentity(token);
                    }