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

Commit 5c2b6c4e authored by Mark Renouf's avatar Mark Renouf
Browse files

Remove userId parameter from exported image URL before sharing

Apps don't generally expect an included userId within content URIs.
Since the URI is not send across to another here (via URI grants)
then it's safe to strip the userId component here.

This covers long screenshots which was missed in a previous patch.

Bug: 291706486
Test: On pixel, set R.string.config_systemImageEditor to
      'com.google.android.apps.photos/.editor.intents.EditActivity'
      take screenshot, EXTEND IT, share, edit -> verify Photos opens
Change-Id: I8610de6edd7fedf7334bcc0e0ff5607f0cc1ef4d
parent 08848c04
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.screenshot;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.HardwareRenderer;
@@ -44,10 +45,10 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.android.internal.app.ChooserActivity;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.view.OneShotPreDrawListener;
import com.android.systemui.res.R;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.res.R;
import com.android.systemui.screenshot.CropView.CropBoundary;
import com.android.systemui.screenshot.ScrollCaptureController.LongScreenshot;
import com.android.systemui.settings.UserTracker;
@@ -421,13 +422,15 @@ public class LongScreenshotActivity extends Activity {
            Log.e(TAG, "failed to export", e);
            return;
        }
        Uri exported = ContentProvider.getUriWithoutUserId(result.uri);
        Log.e(TAG, action + " uri=" + exported);

        switch (action) {
            case EDIT:
                doEdit(result.uri);
                doEdit(exported);
                break;
            case SHARE:
                doShare(result.uri);
                doShare(exported);
                break;
            case SAVE:
                // Nothing more to do