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

Unverified Commit 84419906 authored by Kevin F. Haggerty's avatar Kevin F. Haggerty
Browse files

Merge tag 'android-security-15.0.0_r6' into staging/lineage-22.1_android-security-15.0.0_r6

Android Security 15.0.0 Release 6 (12895207)

* tag 'android-security-15.0.0_r6':
  Resolve cross account user icon validation.
  Unbind CS if connection is not created within 15 seconds.
  Revert "Unbind CS if connection is not created within 15 seconds."

Change-Id: Ifc6f72856e8e608e5631d0ff30ad6a7f2d07be8c
parents 9eea11e6 2f08be97
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import android.telecom.DisconnectCause;
import android.telecom.Log;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
import android.telecom.TelecomAnalytics;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
@@ -3423,18 +3424,16 @@ public class TelecomServiceImpl {
        // incompatible types.
        if (icon != null && (icon.getType() == Icon.TYPE_URI
                || icon.getType() == Icon.TYPE_URI_ADAPTIVE_BITMAP)) {
            String encodedUser = icon.getUri().getEncodedUserInfo();
            // If there is no encoded user, the URI is calling into the calling user space
            if (encodedUser != null) {
                int userId = Integer.parseInt(encodedUser);
                if (userId != UserHandle.getUserId(Binder.getCallingUid())) {
            int callingUserId = UserHandle.getCallingUserId();
            int requestingUserId = StatusHints.getUserIdFromAuthority(
                    icon.getUri().getAuthority(), callingUserId);
            if(callingUserId != requestingUserId) {
                // If we are transcending the profile boundary, throw an error.
                throw new IllegalArgumentException("Attempting to register a phone account with"
                        + " an image icon belonging to another user.");
            }
        }
    }
    }

    private void validateSimultaneousCallingPackageNames(String appPackageName,
            Set<PhoneAccountHandle> handles) {
+14 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,20 @@ public class TelecomServiceImplTest extends TelecomTestCase {
        // This should fail; security exception will be thrown.
        registerPhoneAccountTestHelper(phoneAccount, false);

        icon = Icon.createWithContentUri(
                new Uri.Builder().scheme("content")
                        .encodedAuthority("10%40media")
                        .path("external/images/media/${mediaId.text}".trim())
                        .build());
        phoneAccount = makePhoneAccount(phHandle).setIcon(icon).build();
        // This should fail; security exception will be thrown
        registerPhoneAccountTestHelper(phoneAccount, false);

        icon = Icon.createWithContentUri( Uri.parse("content://10%40play.ground"));
        phoneAccount = makePhoneAccount(phHandle).setIcon(icon).build();
        // This should fail; security exception will be thrown
        registerPhoneAccountTestHelper(phoneAccount, false);

        icon = Icon.createWithContentUri("content://0@media/external/images/media/");
        phoneAccount = makePhoneAccount(phHandle).setIcon(icon).build();
        // This should succeed.