Commit Graph

47 Commits

Author SHA1 Message Date
Bernhard Rosenkränzer
7fb390d10c Mark 2 unused paramters as such
Mark 2 unused paramters to prevent clang from erroring out

Change-Id: Ifc9b4a5b820bd6318e9259e737e708d25fdb174b
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
2014-11-23 22:28:26 +01:00
Mike Lockwood
754f16fcf4 Merge "Fix installd command line parser" 2014-11-21 05:02:51 +00:00
Narayan Kamath
091ea779d4 Add an installd command to mark the end of boot.
bug: 18280671

(cherry picked from commit b1a6c2f95a)

Change-Id: I97542875ffff1b68ab324e9b04fb9266c82633cc
2014-11-19 14:43:05 +00:00
Serguei Katkov
62bb385728 Fix installd command line parser
Parser does not take into account that the last argument can be empty.
In this case it will skip end of line marker and continue parsing.

Change-Id: I2d029a69ed22cef497893e592ff3275ced97f85f
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
2014-11-05 13:39:43 +06:00
Robin Lee
0adea3b792 am 60fd3fee: Migrate CA certificates to all users
* commit '60fd3feecab4336d964ca8e31c7c3220e1afb558':
  Migrate CA certificates to all users
2014-10-15 19:26:36 +00:00
Robin Lee
60fd3feeca Migrate CA certificates to all users
Copies the /data/misc/keychain/cacert-* directories to all users on
the device, whereas previously they were simply copied to user 0.

This is a shallow copy so anything that wasn't supposed to be there
will disappear.

Bug: 17811821
Change-Id: Iae5909ab8d5efdb83c9c8fdf0e10ab7060d022cc
2014-10-15 19:04:33 +00:00
Dan Albert
9e8b528926 resolved conflicts for merge of 07c9557f to lmp-dev-plus-aosp
Change-Id: Ic212ab2ee90b1cc7db7203210b047c870bb5c476
2014-09-12 09:00:50 -07:00
Chih-Hung Hsieh
99d9fb15b4 Fix warnings on unused variables and parameters.
BUG: 17474723
Change-Id: If40f5e765090cfb970e4129b78b1e74cf8bad217
2014-09-11 16:57:59 -07:00
Jeff Sharkey
770180a4dd Add new system APK locations.
Add /system/priv-app and /oem/app paths to system paths.  Also allow
rmdex on system apps, and quietly ignore when it was already removed.

Also relax logging when clearing code cache, since it's optional.

Bug: 17205122
Change-Id: I4fc4d0f63a3596937c4defbd64e1f8a1c563f02d
2014-09-09 08:22:58 -07:00
Alex Light
8b17ac6bd6 Remove obsolete prunedexcache
Bug: 16875245

(cherry picked from commit 5f727f8694)

Change-Id: I06e14c405aa4af295795982c1d236be3cb00e893
2014-08-28 16:54:54 -07:00
Alex Light
5f727f8694 Remove obsolete prunedexcache
Bug: 16875245

Change-Id: I06e14c405aa4af295795982c1d236be3cb00e893
2014-08-28 23:30:52 +00:00
Calin Juravle
4f60ac2bbc Add vm_safe_mode to dexopt.
The flag enforces interpret-only flag for dex2oat.

Bug: 12457423

(cherry picked from commit b1efac1035)
(cherry picked from commit 97477d203e)

Change-Id: I215339527e998b24e274c8df42a5024839e6a9fa
2014-08-27 16:16:05 +01:00
Calin Juravle
b1efac1035 Add vm_safe_mode to dexopt.
The flag enforces interpret-only flag for dex2oat.

Bug: 12457423
Change-Id: Ifdafcc1afa32996577fa44c5682eeb58c79772ac
2014-08-26 18:10:40 +01:00
Alex Light
43c5d30795 Make system use patchoat to relocate during runtime.
Make installd understand a patchoat directive and carry it out.

Bug: 15358152

(cherry picked from commit 7365a10689)

Change-Id: Id84a15e626ddde63876914068d3d9aa037abc65b
2014-08-06 16:27:55 -07:00
Alex Light
7365a10689 Make system use patchoat to relocate during runtime.
Make installd understand a patchoat directive and carry it out.

Bug: 15358152

Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
2014-08-05 10:22:10 -07:00
Elliott Hughes
119b765a05 Fix implicit declaration of function 'prctl' in installd.
(cherry picked from commit ec535c5ba5)

Change-Id: I3da977d85ce544b23ff00934fdbd201d683e9210
2014-07-18 17:30:32 -07:00
Elliott Hughes
ec535c5ba5 Fix implicit declaration of function 'prctl' in installd.
Change-Id: I469ee15a0a8a79d005b15aad5097b6c13c20ab7e
2014-07-18 17:29:15 -07:00
Jeff Sharkey
c796b681e5 Offer to delete code cache directories.
Bug: 16187224
Change-Id: Ia860b051a34ffdfb4f6e0ea19f90cb73509c4eee
2014-07-15 21:49:51 -07:00
Robin Lee
7c5be65f28 Merge "Rename 'mkuser' command to 'mkuserconfig'" 2014-07-04 08:02:36 +00:00
Narayan Kamath
1e57e4af8a Exclude subdirectories when pruning the dex cache.
This requires a companion package manager change to prune
each instruction specific dex cache individually.

bug: 15677279

Change-Id: I5891981512bde20e49bff65b1842c28886f2b177
2014-06-20 17:46:58 +01:00
Narayan Kamath
8c9bcff892 Merge "Add an installd command to prune dex files." 2014-06-10 21:26:11 +00:00
Robin Lee
7c8bec0179 Rename 'mkuser' command to 'mkuserconfig'
Brings the name more in line with what it actually does.

Change-Id: I0adb14deb1a035abdbe51714356bd0c94ccf04c5
2014-06-10 18:59:55 +01:00
Narayan Kamath
3aee2c5c74 Add an installd command to prune dex files.
This is a straightforward port of logic from
PackageManagerService#pruneDexFiles.

bug: 14407732

Change-Id: I892cff027ddcbb1a4fb37a7af5ecf1697049a188
2014-06-10 15:21:18 +01:00
Robin Lee
07053fcb61 Migrate keychain directories to /data/misc/user/0
With new CA certificates being stored in /data/misc/user/<userid>/
existing ones need to be moved into the same place.

After this update only the owner user will have custom trusted CAs; all
other users will revert to the default set.

Change-Id: I14a4cd6048685902ad5dd3b53494b03fadc41c04
2014-06-05 17:35:50 +00:00
Robin Lee
095c763dd9 Add installd command to create /data/misc user dir
New command 'mkuser <id>' sets up a user directory in /data/misc/user/,
readable by all apps within that user and writeable by the local system
process.

Change-Id: I5ddde8c4a80f606e723bb41aa64581a0720842d5
2014-06-05 14:34:15 +00:00
Narayan Kamath
1b40032077 Add instruction-set arguments to installd commands.
The instruction-set is used to construct the dalvik cache
path and is also passed down to dex2oat.

(cherry picked from commit 791781bfb8)

Change-Id: I43396b16f6eaecacf0fb7d052526fc5a239167ac
2014-05-01 11:38:02 +01:00
Robert Craig
da30dc7336 Modify installd's restorecon function.
Changes above with PMS and below with libselinux
have resulted in a few changes to the restorecon data
api. This change is needed in order to support the new
way to issue a recursive restorecon of certain
/data/data directories.

The restorecondata function has also been modified to
find all users on the device for a given package name
(argument to the function) and to issue a separate
recursive restorecon call for each.

Change-Id: Ie440cba2c96f0907458086348197e1506d31c1b6
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-03-28 14:32:07 -04:00
Stephen Smalley
7abb52bcaf Send libselinux logging to logcat.
Otherwise we can't readily see log messages from libselinux calls
made by installd.

Change-Id: I319b30c181470468fe19dd5fbe9251ef03f1163b
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-03-26 09:31:25 -04:00
Robert Craig
e9887e46ce Extend installd to support SELinux restorecon function.
Implement new restorecondata function which will allow
the relabeling of /data/data and /data/user directories.
This is needed in the case of certain OTAs. Not every
boot will apply this relabeling however. Consult change
I77bf2a0c4c34b1feef6fdf4d6c3bd92dbf32f4a1 for
clarification on this issue.

Change-Id: I05e8b438950ddb908e46c9168ea6ee601e6d674f
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-03-19 17:37:48 +00:00
Dave Allison
d93707342a ART profiler
Add args to the installd commands for profiler usage.
Make installd create the profile files and allow apps
to write to them.

The profile files are in /data/dalvik-cache/profiles.  This
central location is needed due to permissions issues with
dex2oat reading from an app's data directory.  The solution
is to put the profile file in a directory owned by the
install user and make the file writeable by the shared group
id of for the app.  The app can read and write to these files
only in the profiles directory.  The 'system' user also needs
to be able to read the files in order to determine the amount
of change to the file over time.

Bug: 12877748
Change-Id: I9b8e59e3bd7df8a1bf60fa7ffd376a24ba0eb42f

Conflicts:
	cmds/installd/commands.c
2014-03-07 12:35:52 -08:00
Nick Kralevich
2044ac43e5 Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API." 2014-02-12 23:09:45 +00:00
Stephen Smalley
26288202e7 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:36:11 -05:00
Mårten Kongstad
63568b1430 Runtime resource overlay, iteration 2
Support any number of overlay packages. Support any target package.

UPDATED PACKAGE MATCHING
------------------------
In Runtime resource overlay, iteration 1, only a single overlay package
was considered. Package matching was based on file paths:
/vendor/overlay/system/framework-res.apk corresponded to
/system/framework-res.apk. Introduce a more flexible matching scheme
where any package is an overlay package if its manifest includes

    <overlay targetPackage="com.target.package"/>

For security reasons, an overlay package must fulfill certain criteria
to take effect: see below.

THE IDMAP TOOL AND IDMAP FILES
------------------------------
Idmap files are created by the 'idmap' binary; idmap files must be
present when loading packages. For the Android system, Zygote calls
'idmap' as part of the resource pre-loading. For application packages,
'idmap' is invoked via 'installd' during package installation (similar
to 'dexopt').

UPDATED FLOW
------------
The following is an outline of the start-up sequences for the Android
system and Android apps. Steps marked with '+' are introduced by this
commit.

Zygote initialization
   Initial AssetManager object created
+    idmap --scan creates idmaps for overlays targeting 'android', \
           stores list of overlays in /data/resource-cache/overlays.list
   AssetManager caches framework-res.apk
+  AssetManager caches overlay packages listed in overlays.list

Android boot
   New AssetManager's ResTable acquired
     AssetManager re-uses cached framework-res.apk
+    AssetManager re-uses cached 'android' overlays (if any)

App boot
   ActivityThread prepares AssetManager to load app.apk
+  ActivityThread prepares AssetManager to load app overlays (if any)
   New AssetManager's ResTable acquired as per Android boot

SECURITY
--------
Overlay packages are required to be pre-loaded (in /vendor/overlay).
These packages are trusted by definition. A future iteration of runtime
resource overlay may add support for downloaded overlays, which would
likely require target and overlay signatures match for the overlay to
be trusted.

LOOKUP PRIORITY
---------------
During resource lookup, packages are sequentially queried to provide a
best match, given the constraints of the current configuration. If any
package provide a better match than what has been found so far, it
replaces the previous match. The target package is always queried last.

When loading a package with more than one overlay, the order in which
the overlays are added become significant if several packages overlay
the same resource.

Had downloaded overlays been supported, the install time could have been
used to determine the load order. Regardless, for pre-installed
overlays, the install time is randomly determined by the order in which
the Package Manager locates the packages during initial boot. To support
a well-defined order, pre-installed overlay packages are expected to
define an additional 'priority' attribute in their <overlay> tags:

    <overlay targetPackage="com.target.package" priority="1234"/>

Pre-installed overlays are loaded in order of their priority attributes,
sorted in ascending order.

Assigning the same priority to several overlays targeting the same base
package leads to undefined behaviour. It is the responsibility of the
vendor to avoid this.

The following example shows the ResTable and PackageGroups after loading
an application and two overlays. The resource lookup framework will
query the packages in the order C, B, A.

        +------+------+-     -+------+------+
        | 0x01 |      |  ...  |      | 0x7f |
        +------+------+-     -+------+------+
            |                           |
        "android"                Target package A
                                        |
                       Pre-installed overlay B (priority 1)
                                        |
                       Pre-installed overlay C (priority 2)

Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
2014-02-03 16:16:40 +01:00
Stephen Smalley
47a351834f restorecon /data/media when re-creating it for multi-user upgrade.
Change-Id: I112c61863f2104d1962697c54cff25106e9b48a0
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-12-17 16:04:20 -05:00
Nick Kralevich
bef08b8d1b Merge "Handle policy reloads within installd rather than restarting it." 2013-11-27 21:09:13 +00:00
Nick Kralevich
e4e91c4ead resolved conflicts for merge of e678897f to klp-dev-plus-aosp
Change-Id: Ie2a5e7a917ab7f5a0ee98300b880d22c7a10bf70
2013-09-20 12:45:20 -07:00
Robert Craig
880d1a957e Proper security labeling of multi-user data directories.
Add seinfo paramater to appropriate make directory
functions. This allows proper labeling for multi-user
scenarios.

Change-Id: Iaba7c40645bc7b6cc823d613da0c3782acf6ddd5
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2013-09-18 13:21:12 +00:00
Stephen Smalley
bd558d6187 Handle policy reloads within installd rather than restarting it.
Restarting installd upon policy reloads has reportedly caused
stability problems for some users.  Stop restarting installd
and instead handle policy reloads within it.

Change-Id: I697a736d8e414cfc6cfa131ed7b97c7f7694d022
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-07-26 15:48:07 -04:00
Jeff Sharkey
abe4fe5b46 Change legacy "persona" references to userid_t.
Offers stronger typing with no functional change.

Change-Id: I09f0262470feec5cfdf26658f998c20550af84d4
2013-07-15 15:16:10 -07:00
Brian Carlstrom
1705fc44fb Moving dex2oat installd patches from frameworks/base
(cherry picked from commit 3fa3a652ba9a7c5b23b6f2bc7c1851d4e23e430f)

Change-Id: I2f9bb66e1b0463bef41805f2d220160880121813
2013-06-19 23:20:49 -07:00
Dianne Hackborn
8b41780d73 Fix issue #8768456: Settings > App Info under reports...
...app storage size for apps w/ .so files

The lib directories are tagged with the apk install number,
so must be explicitly passed down to installd.

Change-Id: Iae8815afd6ba964f5b2ed86a0d04a91827391ed6
2013-05-01 18:55:10 -07:00
Robert Craig
4d3fd4e998 Add seinfo parsing to PackageManagerService.
This patch set allows the PMS to parse the
mac_permissions.xml file which contains the
seinfo values. Each package that is installed
on the device will be assigned an seinfo value
based on policy. This seinfo value will help label
the app process and data directory.  Modifications
include adjustments to ApplicationInfo.java
to store the seinfo tag per package as well as
adjustments to installd to communicate the seinfo
tag to libselinux.

Change-Id: I61ad1ea12fb6a9a6d0b108ec163bc4bf4c954b58
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2013-03-25 17:37:51 -07:00
Nick Kralevich
d747129e1e installd: use correct header file.
This is a port of https://android-review.googlesource.com/52540 ,
which doesn't apply cleanly to master.

Change-Id: I2824bb7afd4e343b5dc8bed9f24002ec1dcbf07f
2013-02-28 16:59:13 -08:00
Nick Kralevich
a2d838a542 Revert "App home directories are now 0700 for targetSdkVersion > 17"
This reverts commit 7f5c84a0b2.

Bug: 7966399
Bug: 7208882
Change-Id: I9fb13cf06c0f6605f3d992525346b14fe3259c66
2013-01-09 16:00:53 -08:00
Nick Kralevich
7f5c84a0b2 App home directories are now 0700 for targetSdkVersion > 17
Have installd set an app's home directory permissions to
0700 if the app has targetSdkVersion > 17.

Bug: 7208882
Change-Id: Iaa4fc42fec69bc1abdfae53704d6264dd6fa965f
2012-12-14 11:53:14 -08:00
Nick Kralevich
f62d2851a8 remove unused code.
Change-Id: Iacc8b2664a0e404dfa554f223a44126c41581ae4
2012-12-12 10:38:54 -08:00
Mike Lockwood
94afecf4b6 Move non-Java commands over from frameworks/base
Change-Id: I0571813c1cfcf66abd36eb9f178fc49b618e88a6
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-10-24 10:45:23 -07:00