Crash on Google Photo App after taking and croping image on Android 10 (Q)

275 views Asked by At

I am getting an unexpected crash on Google Photos App for Cropping Image

Here is the full crash log:

2020-12-10 21:16:56.954 26763-27559/? E/DatabaseUtils: Writing exception to parcel
    java.lang.IllegalArgumentException: MIME type application/octet-stream cannot be inserted into content://media/external/images/media/73119; expected MIME type under image/*
        at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2092)
        at com.android.providers.media.MediaProvider.ensureNonUniqueFileColumns(MediaProvider.java:1964)
        at com.android.providers.media.MediaProvider.updateInternal(MediaProvider.java:4711)
        at com.android.providers.media.MediaProvider.update(MediaProvider.java:4518)
        at android.content.ContentProvider$Transport.update(ContentProvider.java:420)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:215)
        at android.os.Binder.execTransactInternal(Binder.java:1036)
        at android.os.Binder.execTransact(Binder.java:1003)
   
   
    --------- beginning of crash
2020-12-10 21:16:56.980 30404-30432/? E/AndroidRuntime: FATAL EXCEPTION: ptz-ui-2-GENERIC_BACKGROUND_TASK
    Process: com.google.android.apps.photos, PID: 30404
    aqxx: Error executing doInBackground in SaveEditTask
        at _1784.a(PG:3)
        at aqyd.k(PG:7)
        at aqyd.o(PG:2)
        at ltx.e(PG:1)
        at ltx.d(PG:5)
        at lts.fc(Unknown Source:5)
        at aqyd.r(PG:6)
        at aqyj.run(PG:14)
        at avmb.run(PG:2)
        at aqys.run(PG:2)
        at avmb.run(PG:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:241)
        at android.app.ActivityThread.main(ActivityThread.java:7617)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
     Caused by: java.lang.IllegalArgumentException: MIME type application/octet-stream cannot be inserted into content://media/external/images/media/73119; expected MIME type under image/*
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
        at android.content.ContentProviderProxy.update(ContentProviderNative.java:578)
        at android.content.ContentResolver.update(ContentResolver.java:1993)
        at lxr.g(PG:20)
        at _649.i(PG:4)
        at lux.b(PG:74)
        at nad.b(PG:1)
        at com.google.android.apps.photos.editor.SaveEditTask.w(PG:13)
        at aqxp.a(Unknown Source:1)
        at awrs.c(Unknown Source:2)
        at awqu.run(PG:4)
        at awru.run(PG:1)
        at awpo.execute(PG:1)
        at awqq.f(PG:2)
        at aqxy.a(PG:1)
        at aqxy.l(PG:6)
        at aqyr.run(PG:2)
        at avmb.run(PG:2)
        at aqek.call(PG:1)
        at aqfn.call(PG:1)
        at aqer.run(PG:8)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
        at aqea.run(PG:2)

I am capturing picture from camera and then cropping then picture.

Launch Camera Code:

void launchCamera(String fileName) {

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
    ContentValues contentValues = new ContentValues();
    contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, fileName);
    contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES);
    contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/*");

    mCapturedPhotoUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

    if (mCapturedPhotoUri != null) {
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedPhotoUri);
    }
    List<ResolveInfo> activities = getPackageManager().queryIntentActivities(intent, 0);
    if (activities.isEmpty()) {
        Log.i(TAG, "No activity found");
    } else {
        startActivityForResult(intent, RESULT_ACTIVITY_IMAGE_FROM_CAMERA);
    }
}

Crop Intent Code:

void performCrop(String fileName) {

    ContentValues contentValues = new ContentValues();
    contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, fileName);
    contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES);
    contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/*");
    
    mCroppedPhotoUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.putExtra("crop", "true");

    intent.setDataAndType(mCapturedPhotoUri, IMAGE_MIME_TYPE);
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, mCroppedPhotoUri);
    intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION
            | Intent.FLAG_GRANT_READ_URI_PERMISSION);
    startActivityForResult(intent, RESULT_ACTIVITY_IMAGE_CROP);
}

I can get cropped Image form 'mCroppedPhotoUri' but after cropping and then around 1/2 sec later Google Photos app crashed(Used Google Photo for cropping). I put crash log at top of the post.

It occurs on Android 10(Q) but works fine on Android 11(R).

Device: motorola one
Android OS: 10
targetSdkVersion: 29
compileSdkVersion: 29

Am i doing something wrong or its bug on Google Photos App?

0

There are 0 answers