History log of /frameworks/native/cmds/installd/InstalldNativeService.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
06bb57e2ec61df5016c9c73f885b59b34025e399 01-Jun-2017 Andreas Gampe <agampe@google.com> Installd: deleteOdex's outputPath can be null

Add @nullable, as the outputPath can be null for system apps.

Bug: 62236497
Test: m
Test: Fill up /data, apply OTA
Change-Id: I61d86721b485f85195b153d76ce25412dcb68be6
(cherry picked from commit c523409f0fd03aa498cedc486f85e9a4b7257f3a)
/frameworks/native/cmds/installd/InstalldNativeService.h
28443c23fb22fd9cc07117842c4c2155e3fde5fc 30-May-2017 Jeff Sharkey <jsharkey@android.com> Consistent "low storage" behavior.

When freeing cached data, the caller can now provide a "reserved"
size which we won't clear cached data from.

Bug: 38008706
Test: cts-tradefed run commandAndExit cts-dev -m CtsJobSchedulerTestCases -t android.jobscheduler.cts.StorageConstraintTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Change-Id: Ieb91b3e5345a950d4785fd7915f520f0a68a567a
(cherry picked from commit 60f8a5330ca921d936ae306bf6d17596b82b518c)
/frameworks/native/cmds/installd/InstalldNativeService.h
d712f0ccc120357e1267a04ac6de9dd732b27e76 03-May-2017 Jeff Sharkey <jsharkey@android.com> Clear cached files on external storage.

When clearing cached files belonging to an app, include any cached
files on external storage. Since we need to keep sdcardfs in the
loop about any file deletions, we always mutate by going through the
sdcardfs layer instead of behind its back.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 37486230, 37566983, 37913442, 37914374
Change-Id: If174bf7eaf682da83cf0ab1b4938fe9a5956d464
/frameworks/native/cmds/installd/InstalldNativeService.h
a084fcdcd052d71e8205a2eea0955911b99160b9 18-Apr-2017 Jeff Sharkey <jsharkey@android.com> Fix external cache and secondary user bugs.

External cache files now have their own GID range, so measure using
those quotas. Fix secondary user code measurement, since it always
lives under user 0. Fix secondary user data measurement in manual
mode; we need to match based on appId instead of pure UID.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 35812899, 35844919, 37193650
Change-Id: Ic3b153798164c33ea10e8a4dabc65edff26c56ca
/frameworks/native/cmds/installd/InstalldNativeService.h
cb556e340b50d16e8fac41b0c69d8d35bd7915f9 05-Apr-2017 Calin Juravle <calin@google.com> Restore selinux labels for secondary dex oat directory

Bug: 36896515
Test: adb shell cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
adb shell ls
/data/user_de/0/com.google.android.gms/app_chimera/m/0000000c/oat/arm64/
-Z
youtube loads gms modules without extracting from apk

Change-Id: I4e12a6f532a1442a840e3ed8d01b98dd9a328eb6
/frameworks/native/cmds/installd/InstalldNativeService.h
e12d5964a8d14abe7f2eb6e57469cbe7f7391a19 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Offer to "fixup" GIDs used for app data.

We recently started tracking cached app data using a per-app GID for
the "cache" and "code_cache" directories and their contents. For
upgraded devices, we ideally want to "fixup" the GIDs of any existing
data while the device is still showing the boot animation, instead of
blocking the user when they unlock the device.

Since all the information we need is available in metadata, we can
update GIDs before the user has unlocked data. We're pretty paranoid
and we only pivot between the normal app GID and the cache GID; any
other GID values are ignored.

This "fixup" method can also be used in the future to ensure
consistency of the files on disk. Also fix bug by always using
"fts_path" instead of "fts_accpath" which is based on racy chdir().

Test: /data/nativetest/installd_service_test/installd_service_test
Bug: 34201111, 35084485
Change-Id: Ia52694f3763cba09926082c08f0766477e03e39c
/frameworks/native/cmds/installd/InstalldNativeService.h
b26786d647b624498c11405075e5223d1853f30a 12-Mar-2017 Jeff Sharkey <jsharkey@android.com> Finer-grained locking for size operations.

Disk space measurements are read-only and don't perform mutations,
so other installd operations shouldn't block them.

If there's an ongoing parallel operation (such as a dexopt) that
could race and skew the results, that's no different than an actively
running app changing it's disk usage during the measurement.

This change also allows measurements to happen in parallel, so we can
no longer rely on getcwd() being stable, which means all fts(3) users
now need to use FTS_NOCHDIR.

Bug: 36032444, 35706513
Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/pm/InstallerTest.java
Change-Id: I67d303d3ecce148052d41444cef67381b1d34ab0
/frameworks/native/cmds/installd/InstalldNativeService.h
325b8c94a5ae47b7903ea5fe386a78466d6cb3b7 21-Feb-2017 Jeff Sharkey <jsharkey@android.com> Method to test for quota support.

Framework logic needs to change its behavior depending on how quickly
disk usage calculations can be performed.

Test: builds, boots
Bug: 34690590
Change-Id: I6139d1ea6a6084b1fd42062e2032ec9f515f6d98
/frameworks/native/cmds/installd/InstalldNativeService.h
bd9683607d391a29b1422a50f8972267e9bddc47 25-Jan-2017 Calin Juravle <calin@google.com> [Installd] Clean up logic for secondary dex oat files

Add a new method to installd, reconcileSecondaryOdex, which checks if
the given dex files still exist and if not, deletes the oat files that
were generated for it.

Test: devices bots
adb shell cmd package reconcile-secondary-dex
com.android.google.gms (after artificially/temporarily renaming some
dex files)

Bug: 32871170

Change-Id: I8465a7be9fd4e44e191ad40f7bd0f41c8b2d6f73
/frameworks/native/cmds/installd/InstalldNativeService.h
5c6944c35211accd783d2584fac6421dd0af5bdd 15-Dec-2015 MÃ¥rten Kongstad <marten.kongstad@sonymobile.com> installd: add command 'removeIdmap'

Add an installd command to remove an idmap file. This is the inverse of
the 'idmap' command and is intended for clean-up once an idmap file is
no longer needed because an APK was removed, etc.

This commit depends on a corresponding commit in frameworks/base (with
the same Change-Id).

Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: Iae19a519803f0c172b02a32faa283ef36f43863c
/frameworks/native/cmds/installd/InstalldNativeService.h
88ddd94834dae9c5862a07a1e4432b171b2f5d9f 18-Jan-2017 Jeff Sharkey <jsharkey@android.com> First pass at updated cache clearing logic.

The old clearing algorithm is very naive and it sorts all cached files
globally by modified time. This sadly lets apps gamify the system by
setting their modified times far in the future, and it's very
expensive because it requires a global filesystem traversal to free
up even the smallest amount of data.

Instead, this CL introduces a much more fair cache clearing algorithm
that deletes files from specific UIDs based on how much cache space
that UID is using proportional to the space allocated to them. This
new design has several nice properties:

-- It uses the recently added quotactl() feature to rapidly target
the apps that are using the most space.
-- We only need to traverse the filesystem for UIDs that actively
enter the crosshairs of the clearing algorithm.
-- Disciplined apps who stay under their allocated quota will be
the last to have their cached data cleared.
-- This design can be easily adapted to support additional features
such as atomic purging and tombstones.

In summary, the new algorithm is extremely efficient when freeing up
the typical small-to-medium amounts of disk space, and is only
moderately less efficient than the old algorithm when forced to clear
all cached data.

Test: builds, boots, clearing strategy looks sane
Bug: 33965858
Change-Id: I66f95089cb33f1add3f31fcf1082ab2469870fda
/frameworks/native/cmds/installd/InstalldNativeService.h
66b1a12e7a120f85042669bb58f1db864616b506 17-Jan-2017 Jeff Sharkey <jsharkey@android.com> Handle devices without quota, speed up lookup.

Start tracking which block devices have quota support, and gracefully
clear FLAG_USE_QUOTA when no support is present.

Also build a cached map of mounted volumes that support quota, which
halves the average quota calculation speed from 0.70ms to 0.35ms,
since we're no longer parsing procfs every time.

Test: builds, boots, common operations work
Bug: 34249218
Change-Id: Ie791df7801b67495331f3eea256c018860c9b4f6
/frameworks/native/cmds/installd/InstalldNativeService.h
7a9059e8ed297a8e025c843b632c7c8571682b46 17-Jan-2017 Jeff Sharkey <jsharkey@android.com> Wrap all installd operations in lock.

Historically installd has a single lock up in the framework, but
we're starting to call in from multiple locations, so installd needs
to protect itself.

This specifically applies to any disk measurement requests, which
use the optimized fts(3) mode which uses chdir() internally.

Test: builds, boots, common operations work
Bug: 34330051
Change-Id: Ic746ea890ebcc7b2bf923404874b04dbc19d42ad
/frameworks/native/cmds/installd/InstalldNativeService.h
df2d754b38796e0c49c70e0a67f7d383e3079ff2 07-Jan-2017 Jeff Sharkey <jsharkey@android.com> Methods to calculate user and external disk usage.

Add method to calculate user disk usage, which will be faster than
making a Binder call for every single appId under a user. Add method
to calculate external disk usage, which uses file extensions to track
usage with "audio", "video", and "images" categories.

Add script to generate optimized file extension matcher logic.

Start measuring internal and external storage space separately; new
GIDs are coming in a future CL. Pass down all package names, inodes,
and code paths, since shared UIDs host more than one.

Test: builds, boots, stats are consistent
Bug: 27948817, 32206268
Change-Id: Icb9843ac5159e0e5f1503d9b64e0bcae407e1a5d
/frameworks/native/cmds/installd/InstalldNativeService.h
3dfae0c008576c873c4039bb4c2e54a6adf3720a 13-Dec-2016 Jeff Sharkey <jsharkey@android.com> Offer to measure disk stats using quotas.

Now we're getting somewhere! This CL starts using quotactl() to read
UID/GID quota statistics when called with FLAG_USE_QUOTA, otherwise
it continues using the old heavy-weight traversal for calculation.

We now set the recently defined per-app GID used for identifying
cached data, and we use the sticky GID bit on cache directories to
ensure that newly created data inherits the GID for tracking
purposes. For any existing apps during an upgrade, an initial
bootstrapping case will recursively set this new GID.

This change also shuffles around a bunch of the tedious manual
accounting logic so that we exactly match the new quota statistics.

Test: builds, boots, quota stats match manual stats
Bug: 27948817
Change-Id: I8512c3193ce698f197a3f446e625d6a1c74e7649
/frameworks/native/cmds/installd/InstalldNativeService.h
36a900a0db526d63e899ed5d5b0a463ad7f9236e 20-Dec-2016 Jeff Sharkey <jsharkey@android.com> Remove ~1/3 of the installd calls at boot.

When preparing CE storage for an app, we always perform a second call
to extract any newly created CE directory inode. Let's simplify this
and just return the inode number from the createAppData() call.

Test: builds, boots, reads CE inodes after wipe
Bug: 33463450
Change-Id: I68485e4b9b49e9da7b3ac7c66f50c6abc750b7e3
/frameworks/native/cmds/installd/InstalldNativeService.h
f3e30b936ef103dc0f3d8697e0f86ba82b49609e 10-Dec-2016 Jeff Sharkey <jsharkey@android.com> Filename refactoring, remove DEXOPT_OTA flag.

Test: builds, boots
Bug: 13758960, 30944031
Change-Id: Ib60899fc70b12f76fad9dfad596b513777752703
/frameworks/native/cmds/installd/InstalldNativeService.h
0274c977e3b10b52936fd5b2eb464857f0ca6358 06-Dec-2016 Jeff Sharkey <jsharkey@android.com> Shuffle installd Binder implementation around.

Instead of writing wrapper methods in InstalldNativeService.cpp,
this change shifts the Binder implementation over into the existing
commands.cpp file. This will let us migrate all methods over, and
then perform one final file rename to InstalldNativeService.cpp.

The downside of this approach is that we no longer have a giant kill
switch to quickly switch back.

Moves the moveCompleteApp() method over to Binder.

Test: builds, boots, apps install fine
Bug: 13758960, 30944031
Change-Id: I53550e05bc2b65155c3de18424f67b1a95450a6f
/frameworks/native/cmds/installd/InstalldNativeService.h
9087400f3c82b97aa17a74329c7e65c0a5ff4062 05-Dec-2016 Jeff Sharkey <jsharkey@android.com> Initial Binder interface for installd.

Define an AIDL for installd, starting with a single method. Publish
that interface for the system to start using. We'll circle back and
migrate more methods in future CLs.

Migrating installd to Binder will allow us to get rid of one of
the few lingering text-based command protocols, improving system
maintainability and security.

Test: builds, boots
Bug: 13758960, 30944031
Change-Id: Icdb5320082567e0355d8f76f413f01cfacf0fb99
/frameworks/native/cmds/installd/InstalldNativeService.h