72 Commits

Author SHA1 Message Date
Dave Burke
799916e6ac Merge "Revert "Check non-primary user dirs during package scan"" into jb-mr1-dev 2012-10-23 23:14:15 -07:00
Dave Burke
383fa18b51 Revert "Check non-primary user dirs during package scan"
This reverts commit 4525f5b69cb44a9a0c92f9c525fc47541f456621

Change-Id: I31b7a0860972532478ab3420556b806bfa78739a
2012-10-23 23:12:19 -07:00
Kenny Root
da2509c434 Merge "Check non-primary user dirs during package scan" into jb-mr1-dev 2012-10-23 17:03:09 -07:00
Kenny Root
4525f5b69c Check non-primary user dirs during package scan
During package scan, only the primary user data directories were
checked. If the secondary user didn't have an application directory, it
would happily ignore it. The app would then crash upon startup.

Bug: 7391882
Change-Id: I1fa92aa27386104d4ac6bc5dc92bfbf2e7dfac9f
2012-10-22 18:48:24 -07:00
Kenny Root
9157d3f3b7 Clear data deletes too much
Bug: 7389445
Change-Id: Ic12d7a8e37747dc1a9b71ec5f881b5e440e0a75e
2012-10-22 15:20:52 -07:00
Kenny Root
a3e90798b7 Robustly add symlink and add for non-primary users
Amazingly, some apps still don't use the nativeLibraryPath. So add a lib
symlink for non-primary users to fix that.

Also, there was an error when the symlink existed that it would give up.
This shouldn't really happen, but in that case, just remove it and
create a new one to be safe.

Also, move the downgrade code to the appropriate place. This downgrade
case triggered the above symlink existing bug.

Bug: 7318366
Bug: 7371571
Change-Id: Ia175b36d98f00bdc2f2433b909aafd524eb34d15
2012-10-18 15:12:09 -07:00
Amith Yamasani
54289b8b4a Fix cache deletion for secondary users
Bug: 7249419

Change-Id: Idbc0f9994508059ebf5055aea961b87e08b3673a
2012-10-01 11:19:55 -07:00
Dianne Hackborn
f41496f179 Fix issue #7202950: After clearing data, clear data button is still enabled.
Count the lib symlink against the app's code size.  Also be sure to
look at the new separate lib path for apps, and tweak the size
counting to also count the size of directory entries.

Change-Id: I4b0fd5771f249faa05fd72f08062df885902cc97
2012-09-27 18:48:09 -07:00
Dianne Hackborn
556b09e184 Fix issue #6926562: Ensure all multi-user cache files are managed correctly
Now we correctly iterate through the different user cache dirs.

Also update documentation to describe the new cache pruning behavior,
and deprecate the file modes for making files world readable/writable
which we really don't want people using any more.

Change-Id: I3708df3ddc697b1f5c511143cce7cc40a5a3d0bd
2012-09-24 11:02:45 -07:00
Kenny Root
9bbd70a963 Remove "unlinklib" command from installd
unlinklib is no longer necessary since libraries are now either stored
in an ASEC container or in /data/app-lib

Replace lib directory with a symlink to the /data/app-lib directory even
if it's a dangling link. That way developers don't name something "lib"
in their directory which gets blown away during an update.

Change-Id: I142cf13dba9c13aafbaf0ff8d5e9872cbf1cc910
2012-09-11 10:55:17 -07:00
Kenny Root
0c191624fb Remove "protect" command from installd
No one uses the "protect" command anymore, so remove it from installd.

Change-Id: Ia990bae6f95cd6e317496f5dd173ec15164d7164
2012-09-09 12:12:43 -07:00
Nick Kralevich
7de350a913 installd: fix forward locking symlink
installd was not creating a compatibility symlink when
installing a forward locked application.  Fix.

Bug: 7121527
Change-Id: Ied507ab2b759d8658af563e6ac8f0dbb0d286cce
2012-09-07 15:48:11 -07:00
Nick Kralevich
812b19a425 installd: reduce privileges.
Make installd run with fewer privileges. This will help make
exploitation of installd based vulnerabilities more difficult
to perform.

installd now runs with the following privileges:

* CAP_DAC_OVERRIDE
* CAP_CHOWN

These two capabilities are needed to add and remove files
from application's home directories.

* CAP_SETUID
* CAP_SETGID

These permissions are needed to further drop privileges when
running dexopt as the application UID.

"installd" no longer runs with full root privileges.  It cannot,
for example, mount and unmount filesystems, install modules,
perform direct I/O, etc.

Change-Id: Ib407e41e5e4c95f35a5c6a154812c5e8ae3006ed
2012-09-04 14:58:22 -07:00
Jeff Sharkey
8ea0dc6a89 Shared OBB storage across users.
To avoid downloading large OBB files separately for each user,
provide a shared view of /sdcard/Android/obb to all apps.  Added
upgrade step to migrate the owners existing OBB files to become
the default view.

Bug: 7008879
Change-Id: I199321552fa7d4b97d5ed7fc3b3bc41f23618601
2012-08-29 16:20:03 -07:00
Jeff Sharkey
dc9b0128c5 Ensure /data/media before trying to upgrade.
Most devices create the path in their init.rc, but create it just
to be sure.  This fixes emulator boot failure.

Bug: 7058844
Change-Id: Icab3ce11c4304d972d13e1d9a0c269cfe05b9370
2012-08-27 11:41:55 -07:00
Amith Yamasani
794d62f607 Fix permissions on cloned data dirs
This makes the downloaded apk visible to the package installer

Change-Id: I0f60cf279a3c6a08c7479f93ef9135d7428f2385
2012-08-24 12:58:27 -07:00
Dianne Hackborn
0c38049502 Improve multi-user app management.
Introduce API to get per-user storage information, keep track
of services associated with users, and various small cleanup.

Change-Id: I5d4e784e7ff3cccfed627d66a090d2f464202634
2012-08-21 10:34:20 -07:00
Jeff Sharkey
91bbb8a1e9 Create media paths for existing users.
Bug: 6925012
Change-Id: I23bd9187217645cf538e074527c143a911a61299
2012-08-16 23:29:34 -07:00
Jeff Sharkey
5b1ada2562 Multi-user external storage support.
Emulated external storage always has multi-user support using paths
like "/data/media/<user_id>".  Creates and destroys these paths along
with user data.  Uses new ensure_dir() to create directories while
always ensuring permissions.

Add external storage mount mode to zygote, supporting both single-
and multi-user devices.  For example, devices with physical SD cards
are treated as single-user.  Begin migrating to mount mode instead
of relying on sdcard_r GID to enforce READ_EXTERNAL_STORAGE.

Bug: 6925012
Change-Id: I9b872ded992cd078e2c013567d59f9f0032ec02b
2012-08-15 19:45:53 -07:00
Kenny Root
00efe44923 am b3e4b46d: am e583bcf1: Merge "Explicitly set lib dir permissions during unlink" into jb-dev
* commit 'b3e4b46db028c35d6d12c5f8f25b0463833fb51d':
  Explicitly set lib dir permissions during unlink
2012-07-31 09:36:17 -07:00
Kenny Root
b3e4b46db0 am e583bcf1: Merge "Explicitly set lib dir permissions during unlink" into jb-dev
* commit 'e583bcf13c13957bdf20f8bc5e23258b083b2f51':
  Explicitly set lib dir permissions during unlink
2012-07-31 09:34:26 -07:00
Kenny Root
515087d1c5 Explicitly set lib dir permissions during unlink
The default umask changed, so we have to explicitly set the mode of the
lib directory when we create it in unlinklib.

Bug: 6857022
Change-Id: I06fc3f29e99d686bbbb96184d8c314d4cc57e9fe
2012-07-30 15:01:20 -07:00
Nick Kralevich
b8acd060d4 am fa6e1ea7: am 2c932143: Merge "s/LOG/ALOG/ in HAVE_SELINUX blocks"
* commit 'fa6e1ea773a74aa6a996a783ff16c495ab3cc822':
  s/LOG/ALOG/ in HAVE_SELINUX blocks
2012-07-20 10:00:45 -07:00
Dianne Hackborn
197a0c82a1 Improve cleanup of file caches.
This rewrites installd's code for deleting cache files to be better:

- Isn't really stupid about just deleting directories in the order
  they are found on the filesytem; now collects all cache files and
  sorts them by mod time to determine which to delete.
- Also deletes cache files in /data/media and for all users.

This also tweaks DeviceStorageMonitor to be a little smarter about
deciding when to flush cache files, having upper and lower limits
that it allows memory to get down to and then flash files to reach
the higher free storage limit.  This should reduce the amount that
we perform flushing when starting to reach the storage limit.

Finally add a new pm command to force a cache flush.

Change-Id: I02229038e1ad553d1168393e5cb6d5025933271d
2012-07-12 14:46:04 -07:00
Joshua Brindle
365861e3aa s/LOG/ALOG/ in HAVE_SELINUX blocks
The latest push changed LOG(E|V) to ALOG(E|V) but it was not updated in HAVE_SELINUX blocks.

Change-Id: I626588589dd00775ba29f2a256ac29e481598dc3
Signed-off-by: Joshua Brindle <jbrindle@tresys.com>
2012-07-10 11:02:01 -04:00
Kenny Root
33ef4ee712 resolved conflicts for merge of 4de60b26 to jb-dev-plus-aosp
Change-Id: Id1b1847a3ab5c0f51ac8a732fce5ba12e5810259
2012-06-18 10:26:36 -07:00
Kenny Root
4503cf67b5 Make lib dir before changing ownership of app dir
Bug: 6668897
Change-Id: I8998a50359892277b15e80b5b5590ff94b125467
2012-06-14 15:28:37 -07:00
Kenny Root
3a3c7e7bc4 am 63dd4c65: am 60b3d59d: Merge "Modify installd to set the SELinux security context on package directories."
* commit '63dd4c65c41187967ba0828d386117f90020840e':
  Modify installd to set the SELinux security context on package directories.
2012-06-08 14:01:54 -07:00
Dianne Hackborn
d0c5f515c0 Fix issue #6295373: "Package com.google.android.apps.authenticator2 has...
...mismatched uid: X on disk, Y in settings" errors on Froyo and Gingerbread

Deal more gracefully with the uid changing in three ways:

1. If the uid on disk has become root, then have installd change it to
   the application's uid.  This is to correct a potential case where
   installd was interrupted while linking or unlinking the libs dir,
   during which it temporarily changes the owner of the dir to root
   so that a malicious app can not get in its way.  So if the uid on
   disk has become root, we assume we can safely just change it back
   to the correct uid.

2. When scaning packages at boot, use the same "delete and rebuild data
   directory" code for third party applications as we have for system
   applications.  This allows us to at least end up in a state where the
   app will run, even if its data is lost.

3. But we really don't want to get in to case 2, so if an application
   update is being installed and we find that the uid we now have for
   the app is different than the one on disk, fail the update.  This will
   protect against for example a developer changing the sharedUserId of
   their app and getting into this bad state.

Bug: 6295373
Change-Id: Ic802fdd818ac62449ff3c61d1fff1aa4d4942f39
2012-06-07 16:57:57 -07:00
Nick Kralevich
7ac3ed1d76 resist umask changes, make dirs 0711
Make sure /data/user directory permissions get explicitly set
regardless of the system umask.

Change directory permissions to 0711. No need for read permissions.

Bug: 3272072
Change-Id: Ida7f3c6656f4e0c9d0a9f7648491cc853c4e44ca
2012-03-23 18:00:47 -07:00
Amith Yamasani
742a671273 Multi-user - 1st major checkin
Switching activity stacks
Cache ContentProvider per user
Long-press power to switch users (on phone)

Added ServiceMap for separating services by user
Launch PendingIntents on the correct user's uid
Fix task switching from Recents list
AppWidgetService is mostly working.

Commands added to pm and am to allow creating and switching profiles.

Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
2012-02-03 12:01:47 -08:00
Stephen Smalley
0b58e6a1a9 Modify installd to set the SELinux security context on package directories.
installd already sets the UID/GID/mode for package directories.
Extend it to also call libselinux to set the SELinux security context.

Change-Id: I22d38e3e7facdfcee20a34bf30f1412dbb87761f
2012-01-24 14:48:59 -05:00
Steve Block
c6aacce371 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF)
Change-Id: I1de629b4632a4b3187ca1a28d6416daccd35f924
2012-01-19 14:45:03 -08:00
Steve Block
a51f0e707f Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF)
Change-Id: I8fbdfa7a7581f481968dbb65aa40f7042936d7cb
2012-01-19 14:44:59 -08:00
Steve Block
933e856150 Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF)
Change-Id: I26f76452ac49e2890b14d133c065493d8df0fb4a
2012-01-19 14:44:56 -08:00
Steve Block
06ade6ae1b Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF)
Change-Id: I5321ebd12e9c6248a108529e82c4e1af2a4405e3
2012-01-19 14:44:31 -08:00
Steve Block
3762c31172 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
2012-01-08 13:19:13 +00:00
Steve Block
8564c8da81 Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
2012-01-06 10:07:54 +00:00
Steve Block
6215d3ff4b Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
2012-01-04 20:05:49 +00:00
Kenny Root
cfe82181cb am 7f36d421: am 5a7c9176: Merge "Fix free_cache to actually work" into ics-mr1
* commit '7f36d4217269e79f8409c46f12f10464a1f585ea':
  Fix free_cache to actually work
2011-12-01 14:18:58 -08:00
Kenny Root
ad757e9b36 Fix free_cache to actually work
This broke with some other path-related changes, so it was scanning for
/data/*/cache instead of /data/data/*/cache

Also remove redundant call to restat

Bug: 5686310
Change-Id: Id1661f0f1337858fc9ead53c56ab7557f421c591
2011-12-01 09:07:55 -08:00
Steve Block
71f2cf116a Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
2011-10-26 09:57:54 +01:00
Jeff Brown
bd882b1c87 Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Dianne Hackborn
292f8bc9d1 Plumb information from the framework about asec container size.
Change-Id: Ie0ec3cb6d463aefa341a8cbea80be790451ba5e3
2011-06-28 15:02:44 -07:00
Dianne Hackborn
f741e679c4 resolved conflicts for merge of e2aa0490 to master
Change-Id: Id0448a1598fc93aca0652b29253e02586e35a067
2011-06-09 17:50:36 -07:00
Dianne Hackborn
5fd2169eab Work on issue #4518815: Compatibility mode introduces compatibility regression...
...for Market App iRunner

There were a lot of serious issues with how we updated (or often didn't update)
the display and resource state when switching compatibility mode in conjunction
with restarting and updating application components.  This addresses everything
I could find.

Unfortunately it does *not* fix this particular app.  I am starting to think this
is just an issue in the app.  This change does fix a number of other problems
I could repro, such as switching the compatibility mode of an IME.

Also a few changes here and there to get rid of $#*&^!! debug logs.

Change-Id: Ib15572eac9ec93b4b9966ddcbbc830ce9dec1317
2011-06-08 18:45:43 -07:00
Amith Yamasani
25641ca1ac Merge "Plumbing in PackageManager and installd for multi-user support." 2011-04-19 10:41:20 -07:00
Amith Yamasani
0b285499db Plumbing in PackageManager and installd for multi-user support.
- Create /data/user directory and symlink /data/user/0 -> /data/data for
  backward compatibility
- Create data directories for all packages for new user

- Remove data directories when removing a user

- Create data directories for all users when a package is created

- Clear / Remove data for multiple users

- Fixed a bug in verifying the location of a system app

- pm commands for createUser and removeUser (will be disabled later)

- symlink duplicate lib directories to the original lib directory

Change-Id: Id9fdfcf0e62406a8896aa811314dfc08d5f6ed95
2011-04-15 15:15:27 -07:00
Nick Kralevich
f68327e7e2 Make installd resistant to umask changes.
Bug: 3272072
Change-Id: Ic2d241afcb4d0dabd63fcdadf13b2d48b7f398e8
2011-04-14 16:20:03 -07:00
Kenny Root
86c9584559 Update installd to allow multiuser
* Add ability to select different personas to generate the path to be
  created.

* Move hardcoded paths to read from init's set environment.

* Add unit tests for all the utility functions that build strings to
  make sure they're correct.

* Fill in persona with "0" all the time now. Will be plumbed through in
  later CL.

Change-Id: I0a7f6e3640cb6b052f8823080886ee79e90b679f
2011-04-05 10:45:35 -07:00