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

Commit e0f8214e authored by Andras Kloczl's avatar Andras Kloczl Committed by András Klöczl
Browse files

Prevent using invalid result uri during multi user image change

Test: manual
Bug: 172939189
Change-Id: I3e6f6200e82e86d6a2085652906ad2d0d44814f5
Merged-In: I3e6f6200e82e86d6a2085652906ad2d0d44814f5
Merged-In: Id2e598878b3250e8b3590905c6def561e2437d55
Merged-In: I15e15ad88b768a5b679de32c5429d921d850a3cb
parent efb2543e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.ContactsContract.DisplayPhoto;
import android.provider.MediaStore;
import android.util.EventLog;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
@@ -116,6 +117,14 @@ public class EditUserPhotoController {
        }
        final Uri pictureUri = data != null && data.getData() != null
                ? data.getData() : mTakePictureUri;

        // Check if the result is a content uri
        if (!ContentResolver.SCHEME_CONTENT.equals(pictureUri.getScheme())) {
            Log.e(TAG, "Invalid pictureUri scheme: " + pictureUri.getScheme());
            EventLog.writeEvent(0x534e4554, "172939189", -1, pictureUri.getPath());
            return false;
        }

        switch (requestCode) {
            case REQUEST_CODE_CROP_PHOTO:
                onPhotoCropped(pictureUri, true);