History log of /frameworks/native/cmds/installd/utils.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
54e292e1ea87b504b552393d2e9bc800458bd0c1 11-May-2016 Jeff Sharkey <jsharkey@android.com> Search both CE/DE storage when clearing caches.

Now that we have two data storage locations, we need to scan them
both when freeing up disk space. Clean up logic to use new
get_known_users() API.

Bug: 26056125
Change-Id: Ic05c0022d6f5eb438967b69402b1900678f3858b
/frameworks/native/cmds/installd/utils.cpp
379a12b0072b322c7f86e690a8e8a220e500861c 15-Apr-2016 Jeff Sharkey <jsharkey@android.com> Consistent creation/destruction of user data.

Preparing and destroying users currently needs to be split across
installd, system_server, and vold, since no single party has all the
required SELinux permissions.

Start passing down flags so we only prepare/destroy storage areas
that have keys currently installed.

Add delete_dir_contents_and_dir() argument to ignore ENOENT, since
all we care about is the directory being gone.

Bug: 27896918
Change-Id: Ia1cccc9b35e6ff09e3ca50effeab676157b856e8
/frameworks/native/cmds/installd/utils.cpp
1d992f9f7886f98e46f98430d6c1d061cc31fdb3 13-Apr-2016 Jeff Sharkey <jsharkey@android.com> Build target path before closedir().

Otherwise ent->d_name could be cleared out, and we'd aim at the
top-level data directory, which has disastrous results when clearing
app data.

Bug: 28155330
Change-Id: Icf7df835d76816dfbe2894fdae708033df983825
/frameworks/native/cmds/installd/utils.cpp
2f720f7ec5c9d0b91defc85878e7330b10f8e89a 11-Apr-2016 Jeff Sharkey <jsharkey@android.com> Use inode numbers for CE storage, fix sizes.

Certain operations, such as clearing/destroying app data, or just
counting on-disk size, require us to know the CE storage directory
of a particular app. To facilitate these operations, offer a method
to get the inode of a CE directory, and accept that inode number
for later operations.

In previous releases, we started installing apps using a new
directory-based layout, where all app code, unpacked native libraries,
and optimized code is bundled together. So now we only have a single
path to measure for code size.

Start measuring both CE and DE storage data usage for apps, and tweak
the reporting so that empty cache/data directories actually show up
as "0 bytes".

Fix bugs in disk usage counting, since st_blksize has no bearing on
the allocated disk space. Also don't double-count "." and ".."
directories when measuring storage.

Bug: 27828915, 27197819
Change-Id: I350b951f5c24165edb253ac663c9aae020c24dc9
/frameworks/native/cmds/installd/utils.cpp
b06f98aabc5381fd6366526d9b31b5d0345481b6 28-Mar-2016 Calin Juravle <calin@google.com> Don't report errors when trying to delete a non-existing profile dir

Also, put destroy_app_current_profiles behind FLAG_STORAGE_DE flag.

Bug: 27081617
Change-Id: Ib8b9ff292784c659259ceb4339b803e3580da7ed
/frameworks/native/cmds/installd/utils.cpp
6a1648e2f161cb1d7c46aa9d27e8062521a9f314 01-Feb-2016 Calin Juravle <calin@google.com> Extract profile files in their dedicated folder

Current profiles (the ones which have not been used for
compilation) are stored in /data/misc/profiles/cur/0/pkgname/.

Reference profiles (the merged of all user profiles, used for
compilation) are stored in /data/misc/profiles/ref/pkgname.

The profile analysis flow has been changed to use profman
before calling dex2oat. profman decides if there is a need
for compilation and does the merging.

Bug: 26719109
Bug: 26563023
Bug: 26881016

Change-Id: I5a86ed5fd07a28e2e580f9c108428527ba7993b6
/frameworks/native/cmds/installd/utils.cpp
e02657d627a85628ec6f0f398fb85283b8d91bfa 13-Jan-2016 Jeff Sharkey <jsharkey@android.com> Remove older migration code.

We used to offer to migrate pre-multi-user devices to the new
multi-user layout around JB, but the new layout has been the default
for many years now, so it's safe to remove this logic.

All core directory creation is now handled by init.rc where FBE
policies can be setup correctly, so we shouldn't be in the business
of doing system bootstrapping here.

Remove some lingering FBE debugging code.

Bug: 26466827
Change-Id: I1dfe9c8fc02b64013a5c45cea99bf8f61f7d1d5b
/frameworks/native/cmds/installd/utils.cpp
02d0de56c75347a0cb8d5a8565dc8c4ee7616057 12-Nov-2015 Andreas Gampe <agampe@google.com> Installd: Refactor in preparation for OTA

Refactor installd code so reuse with a few key plugin functions is
possible. Do a bit of code cleanup.

Bug: 25612095
Change-Id: I544604f0a391583a4c07887a8234343a3a255942
/frameworks/native/cmds/installd/utils.cpp
32717f851ec39e44b43dcd2053b091daff5e1753 07-Dec-2015 Todd Kennedy <toddke@google.com> Merge "Create new ephemeral app directory"
c7b8a11974f0bf0b13f47b9fb40059b1c50ec9b6 05-Dec-2015 Elliott Hughes <enh@google.com> Merge "Track rename from base/ to android-base/." am: f31cf3ab0f am: c21980bc12
am: 803823f8b6

* commit '803823f8b6663578922be595755351a9e710d93c':
Track rename from base/ to android-base/.
e4ec9eb7b4c452493589983970ba5ccc501728d1 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename from base/ to android-base/.

Change-Id: I62c18891ffe319d20ff084f5ca2aa0c038c23cd3
/frameworks/native/cmds/installd/utils.cpp
5c1a910e6a2d2c42002dc6ed88ff770336afcb3f 24-Nov-2015 Todd Kennedy <toddke@google.com> Create new ephemeral app directory

Bug: 25119046
Change-Id: I829f7ae1df09f2b7af1cd64fbbad6c1f5a2d716d
/frameworks/native/cmds/installd/utils.cpp
ebf728fd43ab5c7d11a1f9e5fdc775d6740fae0a 18-Nov-2015 Jeff Sharkey <jsharkey@android.com> More device-encrypted directory work.

Unify package directory creation logic, and always create user_de
directories to be ready for emulation mode. Also clean up the new
user_de directories on user deletion, package uninstallation, and
data clearing. Also run restorecon over the new user_de paths.

Bug: 22358539
Change-Id: I65ab1562db8455dae6e99dbd8965409b1bf3c6b0
/frameworks/native/cmds/installd/utils.cpp
f24aae872d79982899fed4911141b05c874b0c50 18-Nov-2015 Calin Juravle <calin@google.com> Merge "Remove obsolete profile handling from installd." am: 8161da7a0e am: a51f45a601
am: 357cb908fa

* commit '357cb908faa88b915c1d2c977f16e533e855f19f':
Remove obsolete profile handling from installd.
63ec2d64196144b2d15d2baffedccfa011d6494f 09-Nov-2015 Jeff Sharkey <jsharkey@android.com> Create device-encrypted directories for apps.

When device has FBE, create device-encrypted storage location when
installing apps.

Also remove "renamepkg" unused command.

Bug: 22358539
Change-Id: Ic56eeecdc64bdaa7429b93426727a243a4e45f47
/frameworks/native/cmds/installd/utils.cpp
df9dadd5e5c287110d837c38aaec12bcf5e5d151 04-Nov-2015 Calin Juravle <calin@google.com> Remove obsolete profile handling from installd.

Bug: 24698874
Bug: 17173268
Change-Id: I140d70262f8f8fa7afd52c3cf63b4abaf401a479
/frameworks/native/cmds/installd/utils.cpp
592e6282cd722ba8075239db85a2707e53f3d3f7 10-Aug-2015 Nick Kralevich <nnk@google.com> am 0e3234b7: am 1efe1bdd: Merge "More O_DIRECTORY | O_NOFOLLOW changes"

* commit '0e3234b7f11048d8291d5427cc0acfb77ba6b843':
More O_DIRECTORY | O_NOFOLLOW changes
2379e15da458aa9aac09c1834eb893540d522ac2 10-Aug-2015 Nick Kralevich <nnk@google.com> am 0e3234b7: am 1efe1bdd: Merge "More O_DIRECTORY | O_NOFOLLOW changes"

* commit '0e3234b7f11048d8291d5427cc0acfb77ba6b843':
More O_DIRECTORY | O_NOFOLLOW changes
8b7acacc93930df9fa9e1ebea4a4394195b2332e 10-Aug-2015 Nick Kralevich <nnk@google.com> More O_DIRECTORY | O_NOFOLLOW changes

Fix a few other spots where we're not using O_NOFOLLOW
with O_DIRECTORY.

Add O_CLOEXEC for good measure.

https://code.google.com/p/android/issues/detail?id=181945

Bug: 23044050
Change-Id: Ib535cbba29cdd587443ea9e1e75831f57fd7a93c
/frameworks/native/cmds/installd/utils.cpp
e34de3a77b5f4d408af3f812b304475e858246ec 10-Aug-2015 Nick Kralevich <nnk@google.com> am c45bad1d: am a1b2eaa2: Merge "installd _delete_dir_contents: add O_NOFOLLOW"

* commit 'c45bad1dc14a7af1e72ad3585b3b057c38fcec3f':
installd _delete_dir_contents: add O_NOFOLLOW
6611bd6489b9efd3bc41c13aea71387891cef300 10-Aug-2015 Nick Kralevich <nnk@google.com> am c45bad1d: am a1b2eaa2: Merge "installd _delete_dir_contents: add O_NOFOLLOW"

* commit 'c45bad1dc14a7af1e72ad3585b3b057c38fcec3f':
installd _delete_dir_contents: add O_NOFOLLOW
7fd646708c4248b0ee2bb35176b58b298a7b8ae0 10-Aug-2015 Nick Kralevich <nnk@google.com> installd _delete_dir_contents: add O_NOFOLLOW

Add O_NOFOLLOW to make sure we're not following symlinks.

https://code.google.com/p/android/issues/detail?id=181945

Bug: 23044050
Change-Id: I3408309fd401aefb6ebecb2a052bba198eed7633
/frameworks/native/cmds/installd/utils.cpp
d845c96128a40ca5802c0840ae190fa0af7d4735 04-Jun-2015 Narayan Kamath <narayan@google.com> Add an installd command to link files

Given a pair of absolute paths {from_path, to_path} , check that
they are both valid apk subpaths (eg. /data/app/package/foo) and
link(2) to_path to from_path. This is required by staged installs,
where we link existing apks and oat files to their staging location.

bug: 20889739
Change-Id: I3b5e3b43677af68be59308121a4409caaa6a72f0
/frameworks/native/cmds/installd/utils.cpp
d792118c493806eeb24a8203f508e6e18fe93bd7 01-May-2015 Jeff Sharkey <jsharkey@android.com> Offer to move both code and data together.

We now move code under /data/app/com.example when a complete move
is requested. This really only works for new cluster-style installs
that also have native libraries and OAT contained inside.

Teach measuring code about cluster-style installs when measuring
app footprint. Also offer to measure private data space for all
users.

Bug: 19993667, 20275578
Change-Id: I6df7b947cb5cc8a4552f56f4b64a661e8512389f
/frameworks/native/cmds/installd/utils.cpp
e36372423000a906bafae68844ebc6c42d09335a 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> Command to move private app data between volumes.

New "mvuserdata" command will move all private app data from one
volume UUID to another. It leverages the existing "cp" toybox
command to do the heavy lifting for all known users, preserving
details like timestamps and permissions. It invokes restorecon()
to correctly label the new location when the copy is finished.

Changes installd to no longer drop capabilities, so we run as root
again. This also allows us to exec "cp" with CAP_DAC_OVERRIDE and
CAP_FOWNER still in effect.

Bug: 19993667
Change-Id: I1f407a7c4a1af97ca5afc27b04eb16b4936cbdef
/frameworks/native/cmds/installd/utils.cpp
41ea424413c0381ef2aa15fc5bd5d4b88abd23c4 09-Apr-2015 Jeff Sharkey <jsharkey@android.com> More volume UUID awareness.

Teach free_cache() and restorecon_data() about building per-volume
paths. Also clean up restorecon_data() by using std::string when
building paths.

Clearer names for path building utility methods, and tests to verify.

Bug: 19993667
Change-Id: Iacfbcdaa5b901cc2490bc8eba366dfdeb44f1d93
/frameworks/native/cmds/installd/utils.cpp
c03de09173f98506e73e7cf7df21fe11795d4b24 08-Apr-2015 Jeff Sharkey <jsharkey@android.com> Plumb through volume UUID when building paths.

Since app data paths can live on expanded storage devices, accept the
target volume UUID when building paths. The null UUID indicates the
default internal storage.

To improve readability, start using std::string in several places,
which throws when allocations fail. For now, perform last-second
sanity checks on incoming path arguments, but we'll eventually want
to check arguments as they come through installd.cpp, instead of
crashing the entire daemon.

Also remove "lib" symlink code from install() and make_user_data(),
since we're no longer supporting /data/app-lib. The framework
already uses linklib() to create the right symlink for the selected
ISA-specific library dir.

Bug: 19993667
Change-Id: Ib9343575ffb62bf3981e19375de8f3822fc31e28
/frameworks/native/cmds/installd/utils.cpp
19803807cd7ae01868fcfa50305f4a7dd13765e2 07-Apr-2015 Jeff Sharkey <jsharkey@android.com> Switch installd to compile as C++.

This is the minimal change needed to switch it over to C++, which
paves the way for using more robust utilities like std::string.

Change-Id: I80ed6280146875eb6ddbbb340c05450388ca13f0
/frameworks/native/cmds/installd/utils.cpp