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

Unverified Commit fcc9a883 authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-14.0.0_r67' into staging/lineage-21.0_merge-android-14.0.0_r67

Android 14.0.0 release 67

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZteF5AAKCRDorT+BmrEO
# eFXDAKCDvdi61a+0kwoNIMEJISO8d58thACfaM2dgT0/TXePQqd5aM2eHUV/pTw=
# =E6bv
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Sep  4 00:55:48 2024 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 2593 signatures in the past
#      2 years.  Encrypted 4 messages in the past 2 years.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Pranav Madapurmath (3) and Grant Menke (1)
# Via Android Build Coastguard Worker
* tag 'android-14.0.0_r67':
  Resolve cross-user image exploit for conference status hints
  Unbind CallScreeningService when timeout reached.
  Unbind CS if connection is not created within 15 seconds.
  Resolve Telecom UserManager/UserInfo references

Change-Id: Ia32a71c064d7bcadd097ed66b28ca315099e1842
parents 882d9566 39a6d1f5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2083,7 +2083,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
                userHandle = mTargetPhoneAccountHandle.getUserHandle();
            }
            if (userHandle != null) {
                isWorkCall = UserUtil.isManagedProfile(mContext, userHandle);
                isWorkCall = UserUtil.isManagedProfile(mContext, userHandle, mFlags);
            }

            isCallRecordingToneSupported = (phoneAccount.hasCapabilities(
+10 −7
Original line number Diff line number Diff line
@@ -168,7 +168,8 @@ public class CallIntentProcessor {

        if (!callsManager.isSelfManaged(phoneAccountHandle,
                (UserHandle) intent.getParcelableExtra(KEY_INITIATING_USER))) {
            boolean fixedInitiatingUser = fixInitiatingUserIfNecessary(context, intent);
            boolean fixedInitiatingUser = fixInitiatingUserIfNecessary(
                    context, intent, featureFlags);
            // Show the toast to warn user that it is a personal call though initiated in work
            // profile.
            if (fixedInitiatingUser) {
@@ -226,16 +227,18 @@ public class CallIntentProcessor {
     *
     * @return whether the initiating user is fixed.
     */
    static boolean fixInitiatingUserIfNecessary(Context context, Intent intent) {
    static boolean fixInitiatingUserIfNecessary(Context context, Intent intent,
            FeatureFlags featureFlags) {
        final UserHandle initiatingUser = intent.getParcelableExtra(KEY_INITIATING_USER);
        if (UserUtil.isManagedProfile(context, initiatingUser)) {
        if (UserUtil.isManagedProfile(context, initiatingUser, featureFlags)) {
            boolean noDialerInstalled = DefaultDialerManager.getInstalledDialerApplications(context,
                    initiatingUser.getIdentifier()).size() == 0;
            if (noDialerInstalled) {
                final UserManager userManager = UserManager.get(context);
                UserHandle parentUserHandle =
                        userManager.getProfileParent(
                                initiatingUser.getIdentifier()).getUserHandle();
                final UserManager userManager = context.getSystemService(UserManager.class);
                UserHandle parentUserHandle = featureFlags.telecomResolveHiddenDependencies()
                        ? userManager.getProfileParent(initiatingUser)
                        : userManager.getProfileParent(initiatingUser.getIdentifier())
                                .getUserHandle();
                intent.putExtra(KEY_INITIATING_USER, parentUserHandle);

                Log.i(CallIntentProcessor.class, "fixInitiatingUserIfNecessary: no dialer installed"
+5 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public final class CallLogManager extends CallsManagerListenerBase {
        if (phoneAccount != null &&
                phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER)) {
            if (initiatingUser != null &&
                    UserUtil.isManagedProfile(mContext, initiatingUser)) {
                    UserUtil.isManagedProfile(mContext, initiatingUser, mFeatureFlags)) {
                paramBuilder.setUserToBeInsertedTo(initiatingUser);
                paramBuilder.setAddForAllUsers(false);
            } else {
@@ -715,7 +715,10 @@ public final class CallLogManager extends CallsManagerListenerBase {

            // Use shadow provider based on current user unlock state.
            Uri providerUri;
            if (userManager.isUserUnlocked(currentUserId)) {
            boolean isCurrentUserUnlocked = mFeatureFlags.telecomResolveHiddenDependencies()
                    ? userManager.isUserUnlocked(UserHandle.CURRENT)
                    : userManager.isUserUnlocked(currentUserId);
            if (isCurrentUserUnlocked) {
                providerUri = Calls.CONTENT_URI;
            } else {
                providerUri = Calls.SHADOW_CONTENT_URI;
+4 −0
Original line number Diff line number Diff line
@@ -176,6 +176,10 @@ public class CallScreeningServiceHelper {
                            Log.w(TAG, "Cancelling call id process due to timeout");
                        }
                        mFuture.complete(null);
                        mContext.unbindService(serviceConnection);
                    } catch (IllegalArgumentException e) {
                        Log.i(this, "Exception when unbinding service %s : %s", serviceConnection,
                                e.getMessage());
                    } finally {
                        Log.endSession();
                    }
+62 −23
Original line number Diff line number Diff line
@@ -675,7 +675,7 @@ public class CallsManager extends Call.ListenerBase
                () -> audioManager.getStreamVolume(AudioManager.STREAM_RING) > 0);

        SystemSettingsUtil systemSettingsUtil = new SystemSettingsUtil();
        RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context);
        RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context, featureFlags);
        SystemVibrator systemVibrator = new SystemVibrator(context);
        mInCallController = inCallControllerFactory.create(context, mLock, this,
                systemStateHelper, defaultDialerCache, mTimeoutsAdapter,
@@ -749,7 +749,7 @@ public class CallsManager extends Call.ListenerBase
        mVoipCallMonitor.startMonitor();

        // There is no USER_SWITCHED broadcast for user 0, handle it here explicitly.
        final UserManager userManager = UserManager.get(mContext);
        final UserManager userManager = mContext.getSystemService(UserManager.class);
        // Don't load missed call if it is run in split user model.
        if (userManager.isPrimaryUser()) {
            onUserSwitch(Process.myUserHandle());
@@ -1677,9 +1677,15 @@ public class CallsManager extends Call.ListenerBase
        boolean isCallHiddenFromProfile = !isCallVisibleForUser(call, mCurrentUserHandle);
        // For admins, we should check if the work profile is paused in order to reject
        // the call.
        if (mUserManager.isUserAdmin(mCurrentUserHandle.getIdentifier())) {
            isCallHiddenFromProfile &= mUserManager.isQuietModeEnabled(
                call.getAssociatedUser());
        UserManager currentUserManager = mContext.createContextAsUser(mCurrentUserHandle, 0)
                .getSystemService(UserManager.class);
        boolean isCurrentUserAdmin = mFeatureFlags.telecomResolveHiddenDependencies()
                ? currentUserManager.isAdminUser()
                : mUserManager.isUserAdmin(mCurrentUserHandle.getIdentifier());
        if (isCurrentUserAdmin) {
            isCallHiddenFromProfile &= mFeatureFlags.telecomResolveHiddenDependencies()
                    ? currentUserManager.isQuietModeEnabled(call.getAssociatedUser())
                    : mUserManager.isQuietModeEnabled(call.getAssociatedUser());
        }

        // We should always allow emergency calls and also allow non-emergency calls when ECBM
@@ -2136,7 +2142,7 @@ public class CallsManager extends Call.ListenerBase
                                Uri callUri = callToPlace.getHandle();
                                if (PhoneAccount.SCHEME_TEL.equals(callUri.getScheme())) {
                                    int managedProfileUserId = getManagedProfileUserId(mContext,
                                            initiatingUser.getIdentifier());
                                            initiatingUser.getIdentifier(), mFeatureFlags);
                                    if (managedProfileUserId != UserHandle.USER_NULL
                                            &&
                                            mPhoneAccountRegistrar.getCallCapablePhoneAccounts(
@@ -2311,10 +2317,29 @@ public class CallsManager extends Call.ListenerBase
        return mLatestPostSelectionProcessingFuture;
    }

    private static int getManagedProfileUserId(Context context, int userId) {
        UserManager um = context.getSystemService(UserManager.class);
        List<UserInfo> userProfiles = um.getProfiles(userId);
        for (UserInfo uInfo : userProfiles) {
    private static int getManagedProfileUserId(Context context, int userId,
            FeatureFlags featureFlags) {
        UserManager um;
        UserHandle userHandle = UserHandle.of(userId);
        um = featureFlags.telecomResolveHiddenDependencies()
                ? context.createContextAsUser(userHandle, 0).getSystemService(UserManager.class)
                : context.getSystemService(UserManager.class);

        if (featureFlags.telecomResolveHiddenDependencies()) {
            List<UserHandle> userProfiles = um.getAllProfiles();
            for (UserHandle userProfile : userProfiles) {
                UserManager profileUserManager = context.createContextAsUser(userProfile, 0)
                        .getSystemService(UserManager.class);
                if (userProfile.getIdentifier() == userId) {
                    continue;
                }
                if (profileUserManager.isManagedProfile()) {
                    return userProfile.getIdentifier();
                }
            }
        } else {
            List<UserInfo> userInfoProfiles = um.getProfiles(userId);
            for (UserInfo uInfo : userInfoProfiles) {
                if (uInfo.id == userId) {
                    continue;
                }
@@ -2322,6 +2347,7 @@ public class CallsManager extends Call.ListenerBase
                    return uInfo.id;
                }
            }
        }
        return UserHandle.USER_NULL;
    }

@@ -2432,8 +2458,8 @@ public class CallsManager extends Call.ListenerBase
         boolean isSelfManaged = account != null && account.isSelfManaged();
         // Enforce outgoing call restriction for conference calls. This is handled via
         // UserCallIntentProcessor for normal MO calls.
         if (UserUtil.hasOutgoingCallsUserRestriction(mContext, initiatingUser,
                 null, isSelfManaged, CallsManager.class.getCanonicalName())) {
         if (UserUtil.hasOutgoingCallsUserRestriction(mContext, initiatingUser, null,
                 isSelfManaged, CallsManager.class.getCanonicalName(), mFeatureFlags)) {
             return;
         }
         CompletableFuture<Call> callFuture = startOutgoingCall(participants, phoneAccountHandle,
@@ -5536,19 +5562,30 @@ public class CallsManager extends Call.ListenerBase
        mCurrentUserHandle = userHandle;
        mMissedCallNotifier.setCurrentUserHandle(userHandle);
        mRoleManagerAdapter.setCurrentUserHandle(userHandle);
        final UserManager userManager = UserManager.get(mContext);
        List<UserInfo> profiles = userManager.getEnabledProfiles(userHandle.getIdentifier());
        for (UserInfo profile : profiles) {
        final UserManager userManager = mFeatureFlags.telecomResolveHiddenDependencies()
                ? mContext.createContextAsUser(userHandle, 0).getSystemService(
                        UserManager.class)
                : mContext.getSystemService(UserManager.class);
        List<UserHandle> profiles = userManager.getUserProfiles();
        List<UserInfo> userInfoProfiles = userManager.getEnabledProfiles(
                userHandle.getIdentifier());
        if (mFeatureFlags.telecomResolveHiddenDependencies()) {
            for (UserHandle profileUser : profiles) {
                reloadMissedCallsOfUser(profileUser);
            }
        } else {
            for (UserInfo profile : userInfoProfiles) {
                reloadMissedCallsOfUser(profile.getUserHandle());
            }
        }
    }

    /**
     * Because there may be chances that profiles are not started yet though its parent user is
     * switched, we reload missed calls of profile that are just started here.
     */
    void onUserStarting(UserHandle userHandle) {
        if (UserUtil.isProfile(mContext, userHandle)) {
        if (UserUtil.isProfile(mContext, userHandle, mFeatureFlags)) {
            reloadMissedCallsOfUser(userHandle);
        }
    }
@@ -5657,8 +5694,10 @@ public class CallsManager extends Call.ListenerBase
        UserManager userManager = mContext.getSystemService(UserManager.class);
        KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class);

        boolean isUserRestricted = userManager != null
                && userManager.hasUserRestriction(UserManager.DISALLOW_SMS, callingUser);
        boolean hasUserRestriction = mFeatureFlags.telecomResolveHiddenDependencies()
                ? userManager.hasUserRestrictionForUser(UserManager.DISALLOW_SMS, callingUser)
                : userManager.hasUserRestriction(UserManager.DISALLOW_SMS, callingUser);
        boolean isUserRestricted = userManager != null && hasUserRestriction;
        boolean isLockscreenRestricted = keyguardManager != null
                && keyguardManager.isDeviceLocked();
        Log.d(this, "isReplyWithSmsAllowed: isUserRestricted: %s, isLockscreenRestricted: %s",
Loading