888 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
Jeff Sharkey
a3e9ff7deb Support pm clear as --user.
Bug: 7352703
Change-Id: I0e9cc4f2313e5424d234c3cb051004c0321d9dac
2012-10-15 16:16:39 -07:00
Jeff Sharkey
4c76ea6b88 Pm command to get maximum users.
Used to drive CTS tests.  Also print success message when removing
a user.

Bug: 7334718
Change-Id: Ia3886ddf860cd000ce567b0fed2ef0a4e2a2295c
2012-10-12 10:46:01 -07:00
Jeff Sharkey
e6d3ccc992 Print newly generated userId.
Bug: 7334718
Change-Id: Id4dc456b079bebbe9f2d7ea2a8343d2215f296dc
2012-10-11 16:44:18 -07:00
Dianne Hackborn
c0bd747b06 Further work on issue #7307399: Framework needs a new pre-user-shutdown...
...phase & callback API

I realized there were a few things wrong with what was there.  The new
ACTION_USER_STARTING was not being sent for the first user at boot, and
there was an existing problem where ACTION_USER_STARTED was sent every
time there was a user switch.

Also improved some debug output of broadcasts to make it easier to see
what is going on in this stuff, and better reporting of why a service
couldn't be started.

Change-Id: Id8a536defbbad1f73d94a37d13762436b822fbe3
2012-10-09 17:57:14 -07:00
Christopher Tate
af75948cdd New command line tool: "settings"
Because the usual content provider interface doesn't allow specification of
the target user under which to perform settings reads/writes, this CL introduces
a new command line app specifically for that.

Usage:

   settings [--user num] get namespace key
   settings [--user num] put namespace key value

If a --user argument is not given, the owner user is targetted.

Bug 7299066

Change-Id: I73108bb76b04fad133cc4e0f218d64490de549f1
2012-10-08 18:39:27 -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
3ff8e1a800 Merge "Fix issue #7211769 and #7244492, thrash around on #7226656." into jb-mr1-dev 2012-09-28 15:54:44 -07:00
Dianne Hackborn
1d35273543 Merge "Fix issue #7202950: After clearing data, clear data button is still enabled." into jb-mr1-dev 2012-09-28 15:52:26 -07:00
Dianne Hackborn
d4ac8d7b3d Fix issue #7211769 and #7244492, thrash around on #7226656.
Issue #7211769: Crash dialog from background user has non-working "report"

The report button now launches the issue reporter for the correct user.
Also for crashes on background users, either disable the report button,
or simply don't show the dialog depending on the build config.

Issue #7244492: Bugreport button in Quick Settings doesn't actually do anything

Now they do.

Issue #7226656: second user seeing primary user's apps

I haven't had any success at reproducing this.  I have tried to tighten up
the path where we create the user to ensure nothing could cause the
user's applications to be accessed before the user it fully created and thus
make them installed...  but I can't convince myself that is the actual problem.

Also tightened up the user switch code to use forground broadcasts for all
of the updates about the switch (since this is really a foreground operation),
added a facility to have BOOT_COMPELTED broadcasts not get launched for
secondary users and use that on a few key system receivers, fixed some debug
output.

Change-Id: Iadf8f8e4878a86def2e495e9d0dc40c4fb347021
2012-09-28 15:37:22 -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
Ben Gruver
37d83a3caf Pass the originating uid to the package verifier
Bug: 6923241
Change-Id: I85a3e0d53b469543cb0551d3a440d2663b5d0697
2012-09-27 13:02:06 -07:00
Dianne Hackborn
b12e1354f2 Maybe fix issue #7211766: bindService() to User u0 While u10 is...
...Forground Sometimes Doesn't Take

The main change here is a one-liner in ActiveServices to check the
uid when deciding whether to remove an item from mPendingServices.
This could cause the problem being seen -- if the same service for
two users is starting at the same time, the second one would blow
away the pending start of the first one.  Unfortunately I have had
trouble reproducing the bug, so I don't know if this is actually
fixing it.  It's a bug, anyway.

The reason so much has changed here is because I spread around
logging and printing of the user ID associated with operations and
objects to make it easier to debug these kind of multi-user things.

Also includes some tweaks to the oom manager to allow more background
processes (I have seen many times in logs where we thrash through
processes because the LRU list is too short), plus to compensate an
additional time-based metric for when to get rid of background processes,
plus some new logic to try to help things like Chrome keep around
their service processes.

Change-Id: Icda77fb2a1dd349969e3ff2c8fff0f19b40b31d3
2012-09-26 14:50:12 -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
Jeff Sharkey
6d51571835 Allow acquiring ContentProviders across users.
Otherwise services like SystemUI will always open content://-style
Uris as USER_OWNER.  Surfaces through createPackageContextAsUser()
which points all ContentResolver operations towards a given user.

Start using in RemoteViews, so that Notifications correctly resolve
image Uris to the sending user.  Also add user support for "content"
shell tool.

Bug: 7202982
Change-Id: I8cb7fb8a812e825bb0b5833799dba87055ff8699
2012-09-21 19:49:43 -07:00
Amith Yamasani
920ace0bbc Query users excluding any being removed
Keep track of user creation and last logged-in time.
adb shell dumpsys users
User switcher shouldn't show users about to be removed.
No need to check for singleton for activities.

Bug: 7194894
Change-Id: Ic9a59ea5bd544920479e191d1a1e8a77f8b6ddcf
2012-09-20 22:33:43 -07:00
Jeff Brown
9ba2a18891 Merge changes I4ad08873,If0562677,I5fe6ba32 into jb-mr1-dev
* changes:
  Don't auto-discover peers until scan requested.
  Use wfdInfo to filter available sinks.
  Allow adb shell am display-size to use bigger sizes.
2012-09-11 13:56:04 -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
Jeff Brown
43aa159128 Allow adb shell am display-size to use bigger sizes.
We now support scaling the logical display to fit the
physical display, whatever size it is.  So we can allow
adb shell am display-size to use more or less arbitrary sizes
although we do enforce an upper and lower bound to
protect the user.

Change-Id: I5fe6ba32ad1f9e4fbcd6915f7d36850b987bbcc0
2012-09-10 17:50:18 -07:00
Dianne Hackborn
4573e29faf Merge "Flesh out multi-user in am commands." into jb-mr1-dev 2012-09-10 15:39:02 -07:00
Dianne Hackborn
1676c856d6 Flesh out multi-user in am commands.
Now we default to the current user instead of user 0 for most commands
(except where we can do the command for all users).

Many more commands take a user argument: force-stop, kill, profile,
dumpheap.

Improved help text.

Change-Id: I719a13b4d31b668f57ca21e51d7043ac3e0d4e1b
2012-09-10 14:52:30 -07:00
Victoria Lease
d7f5a51baf Merge "IME support for trackball and generic motion events" into jb-mr1-dev 2012-09-10 14:12:48 -07:00
Victoria Lease
b38070caa5 IME support for trackball and generic motion events
Trackball and generic motion events now pass through the IME in case
it would like to handle them before passing them on to the view
hierarchy.

While I was at it, I also...
...fixed the documentation on InputMethodService.onKeyUp()
...added documentation to InputMethodService.onTrackballEvent()
...added trackball and generic motion events to the "input" command
...fixed input consistency verification involving ACTION_OUTSIDE

Bug: 7050005
Change-Id: I40ab68df4a9542af6df25de6ec2ec500e4c02902
2012-09-10 14:01:42 -07:00
Guang Zhu
5de4d989fb Merge "Use correct PowerManager call to wake up screen" into jb-mr1-dev 2012-09-09 14:46:44 -07:00
Guang Zhu
783f9e6615 Use correct PowerManager call to wake up screen
The current implementation does not actually wakes up the screen.

Change-Id: Ief2dca013cfe40e03b64273fe7b09822e9ad42a7
2012-09-09 14:43:09 -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
Amith Yamasani
151ec4c9f8 More multi-user methods in PM
pm can list installed packages by user now.

Bug: 6926465

Change-Id: I822311bfd6e7e2d6fb315fc484739fbf953c9bb6
2012-09-08 19:14:00 -07:00
Nick Kralevich
cd620591b7 Merge "installd: fix forward locking symlink" into jb-mr1-dev 2012-09-07 15:58:44 -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
Dianne Hackborn
649d0d71b2 Merge "More multi-user stuff:" into jb-mr1-dev 2012-09-07 14:11:56 -07:00
Dianne Hackborn
5e03e2ca7d More multi-user stuff:
- New (hidden) isUserRunning() API.
- Maintain LRU list of visited users.
- New FLAG_IS_DATA_ONLY for ApplicationInfo.
- Clean up pending intent records when force-stopping a user (or package).
  (Also fixes bug #6880627: PendingIntent.getService() returns stale
  intent of force stopped app)
- Fix force-stopping when installing an app to do the force-stop across
  all users for that app.
- When selecting which processes to kill during a force stop, do this
  based on the actual packages loaded in the process, not just process
  name matching.
- You can now use --user option in am when starting activities, services,
  and instrumentation.
- The am --user option accepts "current" and "all" as arguments.
- The pm uninstall command now uninstalls for all users, so it matches
  the semantics of the install command.
- PhoneWindowManager now explicitly says to start home in the current
  user.
- Activity manager call to retrieve the MIME type from a content provider
  now takes a user argument, so it will direct this to the proper user.
- The package manager uninstall paths are now implemented around
  PackageSetting, not PackageParser.Package.  This allows them to work
  even if the application's apk has been removed (in which case it only
  exists as a PackageSetting, not the PackageParser.Package parsed from
  the apk).

Change-Id: I3522f6fcf32603090bd6e01cc90ce70b6c5aae40
2012-09-07 13:55:23 -07:00
Felipe Leme
3065963f81 Wrapped call to notifyAll() in a synchronized block
Change-Id: I452caa56bef4541b53917bdd6f22034161255dd1
Bug: 7118468
2012-09-06 11:43:03 -07:00
Nick Kralevich
0116136f4c Merge "installd: reduce privileges." into jb-mr1-dev 2012-09-04 16:29:28 -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
Dianne Hackborn
e2bdca5c43 Fix my fix.
Change-Id: I35fce760f8d91fceb554d372e7423749a4ac6d2d
2012-09-04 11:13:41 -07:00
Dianne Hackborn
52fba38f7d Fix build.
Change-Id: I15592889b8679d946e402dcfdeb124df349cbd4d
2012-09-04 11:08:43 -07:00
Dianne Hackborn
4120375d46 Remove Binder.getOrigCallingUid().
Replaced all remaining places that used it with explicit user
specification.

While doing this, I ran into stuff that was creating PendingIntent
objects (that now need to specify the explicit user they are for),
which are also posting notifications...  but have no way to specify
the user for the notification.

So the notification manager in the system process now also gets a
formal concept of a user associated with the notification, which
is passed in to all the necessary aidl calls.  I also removed the
old deprecated aidl interface for posting/cancelling notifications,
since we now always need a user supplied.

There is more work that needs to be done here, though.  For example
I think we need to be able to specify USER_ALL for a notification that
should be shown to all users (such as low storage or low battery).
Along with that, the PendingIntent creation needs to be tweaked to
be able to handle USER_CURRENT by evaluating the user at the point the
pending intent is sent.

That's for another change, however.

Change-Id: I468e14dce8def0e13e0870571e7c31ed32b6310c
2012-08-31 15:11:13 -07:00
Jeff Sharkey
e671ccec0f Merge "Shared OBB storage across users." into jb-mr1-dev 2012-08-30 10:28:52 -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
Dianne Hackborn
80a4af2bbc Start implementing concept of "running" users.
The activity manager now keeps track of which users are running.

Initially, only user 0 is running.

When you switch to another user, that user is started so it is
running.  It is only at this point that BOOT_COMPLETED is sent
for that user and it is allowed to execute anything.

You can stop any user except user 0, which brings it back to the
same state as when you first boot the device.  This is also used
to be able to more cleaning delete a user, by first stopping it
before removing its data.

There is a new broadcast ACTION_USER_STOPPED sent when a user is
stopped; system services need to handle this like they currently
handle ACTION_PACKAGE_RESTARTED when individual packages are
restarted.

Change-Id: I89adbd7cbaf4a0bb72ea201385f93477f40a4119
2012-08-28 16:30:55 -07:00
Jeff Brown
ac66d4a8d6 Merge "Use new surface flinger API." into jb-mr1-dev 2012-08-27 17:15:25 -07:00
Dianne Hackborn
0e17e5bc43 Merge "Fix installing applications from non-primary users." into jb-mr1-dev 2012-08-27 15:59:56 -07:00
Dianne Hackborn
786b44046a Fix installing applications from non-primary users.
We also now send the correct broadcasts to each user.

You no longer need to be running the shell as root
to be able to create/remove users.

Also added some more man page material to the pm command, and
got rid of a bunch of showUsage() calls that now make error
messages completely buried because of how large the usage info
has become.

And the package manager now shows the user each historical broadcast
was sent to.

Change-Id: Iab42498e1352a0c023069139c80fc04d2d69ab4b
2012-08-27 15:16:33 -07:00
Jeff Brown
0b722fe9ce Use new surface flinger API.
Change-Id: Ic888577408a59a36481a48010e19c5e77c24e211
2012-08-27 14:34:53 -07:00
Jeff Sharkey
62e2709c3f Merge "Ensure /data/media before trying to upgrade." into jb-mr1-dev 2012-08-27 11:42:30 -07:00