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

Skip to content
Commit 0236d1c5 authored by Mark Renouf's avatar Mark Renouf Committed by Matt Casey
Browse files

Work profile screenshots: save to owner

When a work profile screenshot is taken, propagate the
owner UserHandle through to the Image export step. This
change will write the image to the correct user profile
and generate a URI with the userId embedded within using
the form:

    content://10@media/external/images/media/000001.png

Since URIs are user-specific, but not unique among users
the userId prefix will carry this information through
to downstream consumers.

The ID can easily be retrieved from the URI using:

    int userId = ContentProvider.getUserIdFromUri(uri)

If there is no userId within the URI, the return value
will be the same as Process.myUserHandle(), the user of
the current process.

Because of this, an explicit UserHandle may not be
needed if this information is conveyed entirely within
the URI (it is included in this CL as-is).

All behavior changes arising from these changes are
currently gated on the SysUi flags:

SCREENSHOT_REQUEST_PROCESSOR
SCREENSHOT_WORK_PROFILE_POLICY

This change does not include support for long screenshots nor fixes for
screenshot actions (share, edit, etc).

Bug: 159422805
Test: atest ImageExporterTest
Change-Id: I641544f6a1b4685c743e7983d0af156e32796f56
parent c71298e6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment