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

Skip to content
Commit e25b77c1 authored by Eric Biggers's avatar Eric Biggers
Browse files

UsageStatsService: don't create stuff directly in /data/system_de

/data/system_de is only for per-user data; it *must* only contain
per-user encrypted directories.  Only vold should ever create anything
directly in this directory.  In preparation for removing system_server's
write access to this directory (https://r.android.com/2078213), make
UsageStatsService store its globalcomponentusage file at
/data/system/usagestats/globalcomponentusage instead of
/data/system_de/usagestats/globalcomponentusage.

Migration happens lazily, except that the old file and directory aren't
ever deleted since the SELinux policy will no longer allow system_server
to do that; the old file just stops being used.  vold will need to
handle the cleanup instead, or we could just leave the file around.

Note that before Android 11, UsageStatsService stored per-user stats in
/data/system/usagestats/$userId.  These per-user stats are *not* the
same thing as globalcomponentusage, which was added in Android 12.
UsageStatsService contains code to migrate the per-user stats to
/data/system_ce/$userId/usagestats.  This is fine, and is the right
thing to do, since the per-user stats are potentially sensitive per-user
data.  This does mean that UsageStatsService now implements two types of
migrations, and that the source directory for one migration is the
target directory for the other, which is a bit unfortunate.  However,
since different files are involved in each one, it all works out.

Bug: 156305599
Change-Id: I53c16640e8ed8b7eac111990f1cdb3f59579e051
parent 697b47b6
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