924 Commits

Author SHA1 Message Date
Ben Gruver
9dbbfcda81 Merge "Pass the originating uid to the package verifier" into jb-mr1-dev 2012-09-28 10:58:19 -07:00
Jeff Sharkey
625239a054 Migrate more Secure settings to Global.
Migrate networking, storage, battery, DropBox, and PackageManager
related Secure settings to Global table.

Bug: 7232014, 7231331, 7231198
Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
2012-09-27 16:22:53 -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
Xia Wang
3272a38dbc Fix Wifi Stress test after wifi settings are moved to Settings.global
Change-Id: I823e99b39bc340683b686bb0dd43a473865656f0
2012-09-26 09:23:59 -07:00
Jeff Sharkey
4fbbda4cec Handle multi-user mountObb() requests.
Since emulated external storage paths differ based on execution
context, carefully fix up paths for various use-cases:

1. When sending paths to DefaultContainerService, always scope
   OBB paths as belonging to USER_OWNER.
2. When sending paths to vold, always build emulated storage paths
   visible to root.
3. Always use the original untouched path when talking with apps.

Mount OBB containers using shared app GID, so that an app can read
the mount point across users.

Handle legacy paths like "/sdcard" by resolving the canonical path
before sending to MountService.  Move tests to servicestests, and
add tests for new path generation logic.

Bug: 7212801
Change-Id: I078c52879cd08d9c8a52cc8c83ac7ced1e8035e7
2012-09-25 17:34:48 -07:00
Dianne Hackborn
50cdf7c306 Fix issue #7214090: Need to be able to post notifications to all users
Also fix a bunch of system services that should be doing this.  And
while doing that, found I needed to fix PendingIntent to evaluate
USER_CURRENT at the point of sending, not creation.

Note that this may end up with us having some notification shown to
non-primary users that lead to settings UI that should only be for
the primary user (such as the vpn notification).  I'm not sure what
to do about this, maybe we need a different UI to come up there or
something, but showing the actual notification for those users at
least seems less broken than not telling them at all.

Change-Id: Iffc51e2d7c847e3d05064d292ab93937646a1ab7
2012-09-24 10:55:46 -07:00
Tsu Chiang Chuang
6cc5d7fc0b Merge "fix broken user build: do not throw an error when in user flavor." into jb-mr1-dev 2012-09-20 15:35:00 -07:00
Tsu Chiang Chuang
0cfb73de1c fix broken user build: do not throw an error when in user flavor.
Change-Id: I43d210f1b342707acbdb79f9ef6c924b43684dd3
2012-09-20 15:27:23 -07:00
Tsu Chiang Chuang
c1ec220c4b Merge "Change the way how airplane mode is set, since it has been moved to Settings.Global namespace. Also run as a system app, since only system apps can change airplane mode." into jb-mr1-dev 2012-09-20 15:04:10 -07:00
Tsu Chiang Chuang
35fae68cc3 Change the way how airplane mode is set, since it has been moved to
Settings.Global namespace. Also run as a system app, since only system
apps can change airplane mode.

Change-Id: I317f9c94361cfca182356fd292e5b0b41553d1ab
2012-09-20 14:58:48 -07:00
Jeff Sharkey
daa57e8d18 Migrate network stats from removed users.
When a user is removed, migrate all network stats belonging to that
user into special UID_REMOVED bucket.  Also removes those stats from
kernel to avoid double-counting if another user is created.

Bug: 7194784
Change-Id: I03f1d660fe3754566326b7749cae8068fc224ea9
2012-09-19 14:54:05 -07:00
Geremy Condra
fd5a80f6e9 Code cleanup for X509TrustManagerExtensionsTest.java
Change-Id: I85584f7a9dbc726be811f783d125efcf70c9f6af
2012-09-18 14:44:54 -07:00
Geremy Condra
cb4c581975 Fix bad isinstance check in X509TrustManagerExtensions and add test.
Change-Id: I333957186655b2543a637dafa8c51b0bba9d4dfb
2012-09-18 13:43:32 -07:00
Christopher Tate
16aa973617 Per-user content observer APIs
Callers with INTERACT_ACROSS_USERS_FULL permission can now observe content
for a given user's view (and can notify content uri changes targeted to a
specific user).  An observer watching for UserHandle.USER_ALL will see all
notifications for the given uri across all users; similarly, a notifier
who specifies USER_ALL will broadcast the change to all observers across
all users.

The API handles both USER_ALL or USER_CURRENT, and explicitly forbids
any other "pseudouser" designations.

This CL also revs the Settings provider to notify with USER_ALL for
changes to global settings, and with only the affected user's handle
for all other changes.

Bug 7122169

Change-Id: I94248b11aa91d1beb0a36432e82fe5725bb1264f
2012-09-17 16:35:36 -07:00
Kenny Root
e15bdc2da4 Add test for failed dexopt
Bug: 7010829
Change-Id: Ie0616ff2c3739ad73733857de6d04243b2be2fca
2012-09-16 16:25:51 -07:00
rich cannings
13d428e830 Send more information to verifiers
Send package name, version code and the uid of the application requesting the
install to package verifiers.

Bug: 7164155
Change-Id: I2464dc5d4551f60b4f38f7982495a8920c83e1cd
2012-09-14 14:25:52 -07:00
Christopher Tate
78d2a66ac1 Fix Settings writes to a different user
Oops.  Stacked bugs:  first, the desired user handle was not properly
being passed from the call() entry point to the database operations;
then on top of that, the client-side cache management was still
looking in the local user's cache for the data, so a request to read
a different user's settings would return the local user's instead if
that key was already known to the local user's cache.

Reads and writes of a different user's settings are now uncached,
so they're relatively much slower.  They're rare, however, so this
is not something to worry about unless we encounter a real world
case where it's a significant factor.

This CL also adds a bit of cross-user settings read/write testing
to the existing provider suite.  These new tests caught both the
known wrong-user-write bug and discovered the client-side cache
bug, so yay.

Finally, the existing wholesale mutual-exclusion approach would
deadlock in certain circumstances due to the fact that the
settings database creation code might have to call out to the
Package Manager while populating the bookmark/shortcut table,
and the Package Manager would then call back into the settings
provider in the course of handling that request.  The synchronization
regime has been significantly tightened up now: now the database
code [which is known to deal with concurrency itself] is allowed
to cope with multiple parallel openers of the same db; this
allows the settings provider to avoid calling out to other parts
of the system even implicitly while its internal lock is held.

Change-Id: Ib77d445b4a2ec658cc5c210830f6977c981f87ed
2012-09-13 19:15:54 -07:00
Christopher Tate
4e2eb6581f Merge "Update airplane-mode manipulation for the new Settings namespace" into jb-mr1-dev 2012-09-10 17:16:17 -07:00
Christopher Tate
c09cdce1b0 Update airplane-mode manipulation for the new Settings namespace
Quick Settings and global actions (aka longpress-Power) toggles are
included in this CL.  The Settings app manipulations are updated in
a different CL because that's a different git package.

Bug 7132230

Change-Id: I50838f5e8d7b25a750d2bcae90bf384b09816dbb
2012-09-10 16:50:57 -07:00
Kenny Root
ddbe50df2c Move native libraries to /data/app-lib
Instead of unpacking libraries into /data/data/<appname>/lib, unpack
them into /data/app-lib so that multi-user applications can use the same
libraries.

Change-Id: I636dafb5a9eea8cf5a41f1360698e7695455f385
2012-09-10 11:54:36 -07:00
Kenny Root
e64e097147 Add a native library to test APKs
In order to make sure we have unpacking and deletion working, add a fake
JNI library to every APK.

This can be expanded in the future to make sure replacement is working
correctly as well.

Change-Id: I1ad04c61df9518429aa17795b8a9d3608791cd8e
2012-09-09 15:12:16 -07:00
Kenny Root
7e921a157d Add more testing for native libraries
Make sure that native library paths have the correct permissions and
owners. Also make it easier to do a "String#startsWith" test so we can
get better errors when it fails.

Change the observer to have more sane semantics with a CountDownLatch
instead of weird synchronization on a local variable.

Change-Id: I2437e5ea886d6e6cb8b4edeab80d6053b79857d4
2012-09-09 15:12:16 -07:00
Kenny Root
25c925e665 Throw ALL the exceptions! (in the PackageManagerTests)
Change all the test method headers to throw Exception so we don't have
to try to catch anything during the tests. Catching an exception might
mask an error during the tests.

Also fix a lot of formatting errors that have built up over the years.
This includes 3-space indentations instead of 4-space, missing spaces
between braces and parens, too-long lines, wrapping when it isn't
needed, etc.

Change-Id: Ifccea5f0706b6f9235f37974a5f80bee76c654dd
2012-09-09 12:32:03 -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
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
Dianne Hackborn
5ac72a2959 Improve multi-user broadcasts.
You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
2012-08-30 14:33:22 -07:00
Dianne Hackborn
7767eac323 Keep track of whether an app is installed for each user.
This add a new per-user state for an app, indicating whether
it is installed for that user.

All system apps are always installed for all users (we still
use disable to "uninstall" them).

Now when you call into the package manager to install an app,
it will only install the app for that user unless you supply
a flag saying to install for all users.  Only being installed
for the user is just the normal install state, but all other
users have marked in their state for that app that it is not
installed.

When you call the package manager APIs for information about
apps, uninstalled apps are treated as really being not visible
(somewhat more-so than disabled apps), unless you use the
GET_UNINSTALLED_PACKAGES flag.

If another user calls to install an app that is already installed,
just not for them, then the normal install process takes place
but in addition that user's installed state is toggled on.

The package manager will not send PACKAGE_ADDED, PACKAGE_REMOVED,
PACKAGE_REPLACED etc broadcasts to users who don't have a package
installed or not being involved in a change in the install state.
There are a few things that are not quite right with this -- for
example if you go through a full install (with a new apk) of an
app for one user who doesn't have it already installed, you will
still get the PACKAGED_REPLACED messages even though this is
technically the first install for your user.  I'm not sure how
much of an issue this is.

When you call the existing API to uninstall an app, this toggles
the installed state of the app for that user to be off.  Only if
that is the last user user that has the app uinstalled will it
actually be removed from the device.  Again there is a new flag
you can pass in to force the app to be uninstalled for all users.

Also fixed issues with cleaning external storage of apps, which
was not dealing with multiple users.  We now keep track of cleaning
each user for each package.

Change-Id: I00e66452b149defc08c5e0183fa673f532465ed5
2012-08-24 13:53:13 -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
rich cannings
706e8ba26b Pass URLs to package verifiers
This change passes the originating URL and accompanied referrer to
package verifiers, when available.

Bug: 6544677
Change-Id: I9ebc71bc13f549bd88267e444816151a99bda000
2012-08-20 13:20:14 -07:00
Kenny Root
9a994b5350 am 050c87f8: am a950daf5: Merge changes Ieb566a2a,I953057cd
* commit '050c87f87e2a48c7bc90f5b15fb6e4e37e667286':
  Use Libcore's stat instead of FileUtils#getFileStatus
  Use Libcore.os.stat instead of FileUtils
2012-08-16 16:43:20 -07:00
Kenny Root
050c87f87e am a950daf5: Merge changes Ieb566a2a,I953057cd
* commit 'a950daf5c14a0009c2c62e9c3e0e8d51eb0cf7d9':
  Use Libcore's stat instead of FileUtils#getFileStatus
  Use Libcore.os.stat instead of FileUtils
2012-08-16 16:33:40 -07:00
Kenny Root
98e15e7893 Use Libcore's stat instead of FileUtils#getFileStatus
Remove the last user of FileUtils#getFileStatus and move it to
Libcore.os.stat instead. Then we can remove the JNI code that does the
equivalent of a stat.

Change-Id: Ieb566a2a8a17c2dd0150724b4eb3ac1cc41c823d
2012-08-16 15:27:55 -07:00
Dianne Hackborn
f02b60aa4f Rename UserId to UserHandle.
This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
2012-08-16 12:46:38 -07:00
Jeff Brown
9630704ed3 Power manager rewrite.
The major goal of this rewrite is to make it easier to implement
power management policies correctly.  According, the new
implementation primarily uses state-based rather than event-based
triggers for applying changes to the current power state.

For example, when an application requests that the proximity
sensor be used to manage the screen state (by way of a wake lock),
the power manager makes note of the fact that the set of
wake locks changed.  Then it executes a common update function
that recalculates the entire state, first looking at wake locks,
then considering user activity, and eventually determining whether
the screen should be turned on or off.  At this point it may
make a request to a component called the DisplayPowerController
to asynchronously update the display's powe state.  Likewise,
DisplayPowerController makes note of the updated power request
and schedules its own update function to figure out what needs
to be changed.

The big benefit of this approach is that it's easy to mutate
multiple properties of the power state simultaneously then
apply their joint effects together all at once.  Transitions
between states are detected and resolved by the update in
a consistent manner.

The new power manager service has is implemented as a set of
loosely coupled components.  For the most part, information
only flows one way through these components (by issuing a
request to that component) although some components support
sending a message back to indicate when the work has been
completed.  For example, the DisplayPowerController posts
a callback runnable asynchronously to tell the PowerManagerService
when the display is ready.  An important feature of this
approach is that each component neatly encapsulates its
state and maintains its own invariants.  Moreover, we do
not need to worry about deadlocks or awkward mutual exclusion
semantics because most of the requests are asynchronous.

The benefits of this design are especially apparent in
the implementation of the screen on / off and brightness
control animations which are able to take advantage of
framework features like properties, ObjectAnimator
and Choreographer.

The screen on / off animation is now the responsibility
of the power manager (instead of surface flinger).  This change
makes it much easier to ensure that the animation is properly
coordinated with other power state changes and eliminates
the cause of race conditions in the older implementation.

The because of the userActivity() function has been changed
so that it never wakes the device from sleep.  This change
removes ambiguity around forcing or disabling user activity
for various purposes.  To wake the device, use wakeUp().
To put it to sleep, use goToSleep().  Simple.

The power manager service interface and API has been significantly
simplified and consolidated.  Also fixed some inconsistencies
related to how the minimum and maximum screen brightness setting
was presented in brightness control widgets and enforced behind
the scenes.

At present the following features are implemented:

- Wake locks.
- User activity.
- Wake up / go to sleep.
- Power state broadcasts.
- Battery stats and event log notifications.
- Dreams.
- Proximity screen off.
- Animated screen on / off transitions.
- Auto-dimming.
- Auto-brightness control for the screen backlight with
  different timeouts for ramping up versus ramping down.
- Auto-on when plugged or unplugged.
- Stay on when plugged.
- Device administration maximum user activity timeout.
- Application controlled brightness via window manager.

The following features are not yet implemented:

- Reduced user activity timeout for the key guard.
- Reduced user activity timeout for the phone application.
- Coordinating screen on barriers with the window manager.
- Preventing auto-rotation during power state changes.
- Auto-brightness adjustment setting (feature was disabled
  in previous version of the power manager service pending
  an improved UI design so leaving it out for now).
- Interpolated brightness control (a proposed new scheme
  for more compactly specifying auto-brightness levels
  in config.xml).
- Button / keyboard backlight control.
- Change window manager to associated WorkSource with
  KEEP_SCREEN_ON_FLAG wake lock instead of talking
  directly to the battery stats service.
- Optionally support animating screen brightness when
  turning on/off instead of playing electron beam animation
  (config_animateScreenLights).

Change-Id: I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
2012-08-15 03:06:24 -07:00
Amith Yamasani
dc09102c8d Tests for mapping android name to uid
This tests some changes made to bionic.

Change-Id: I7ff8c7f94f6b4bfff64d4e15d4a1a3516a453180
2012-08-13 13:51:01 -07:00
Kenny Root
bccda0aee3 am 194da0b8: am a39fdd11: Merge "Fix AccountManagerServiceTest" into jb-dev
* commit '194da0b8b368ac61b23870224bc0d449ad465bd4':
  Fix AccountManagerServiceTest
2012-07-31 12:36:35 -07:00
Kenny Root
194da0b8b3 am a39fdd11: Merge "Fix AccountManagerServiceTest" into jb-dev
* commit 'a39fdd11e80618acc046fff65b6549b5c8b5aa8d':
  Fix AccountManagerServiceTest
2012-07-31 12:34:30 -07:00
Kenny Root
ae652cc97c Fix AccountManagerServiceTest
The MockAccountAuthenticatorCache needs to implement the new method.

Bug: 6820670
Change-Id: I5d1cb3aecec63602ae4541cd01ae8e28c8328e5a
2012-07-31 12:27:32 -07:00
Irfan Sheriff
cba4d38820 Merge "Update WifiManager API" 2012-07-25 12:25:13 -07:00
Irfan Sheriff
88759bbd31 Update WifiManager API
Use feedback based on NSD to update WifiManager API

Change-Id: I0c1dc74f7e2fa7cd697a995b7194e3e0366d7981
2012-07-24 13:34:36 -07:00
Fabrice Di Meglio
85d28a0004 Merge "Replace left/right with start/end for Gravity / LayoutParams / Padding" 2012-07-24 11:11:02 -07:00
Jeff Sharkey
eaaf396169 Avoid emitting broken ASCII.
Bug: 6131887
Change-Id: Iff13573aad8128cc7ae3613ab718c81e6d0862a1
2012-07-21 12:39:48 -07:00
Fabrice Di Meglio
aac0d4ed02 Replace left/right with start/end for Gravity / LayoutParams / Padding
- see bug #5429822 UI should be mirrored for RTL locales (Arabic, Hebrew, farsi)

Change-Id: Id9af5375fb9b0edeae5232c77e52ecd497bd2e67
2012-07-19 19:21:26 -07:00
Wink Saville
33034b13ca Create telephony-common and mms-common - DO NOT MERGE
These have been created to reduce the size and complexity
of frameworks/base.

mms-common was created by moving all of
  frameworks/base/core/java/com/google/android/mms
to:
   frameworks/opt/mms

telephony-common was created by moving some of
   frameworks/base/telephony
to:
   frameworks/opt/telephony

Change-Id: If6cb3c6ff952767fc10210f923dc0e4b343cd4ad
2012-07-17 12:23:09 -07:00
Wink Saville
5362f17ff5 Merge commit '1b003ef0' into mit
* commit '1b003ef0':
  Create telephony-common and mms-common

Change-Id: Ie8876541dbe7f4c933cf7d69910dd204538bc975
2012-07-11 18:15:50 -07:00
Wink Saville
a639b311e9 Create telephony-common and mms-common
These have been created to reduce the size and complexity
of frameworks/base.

mms-common was created by moving all of
  frameworks/base/core/java/com/google/android/mms
to:
   frameworks/opt/mms

telephony-common was created by moving some of
   frameworks/base/telephony
to:
   frameworks/opt/telephony

Change-Id: If6cb3c6ff952767fc10210f923dc0e4b343cd4ad
2012-07-11 16:02:08 -07:00
Wink Saville
095c58b73a Enhance StateMachine Quitting and logging support. DO NOT MERGE
Make StateMachine#quit non-conditional and remove the need to
process the SM_QUIT_CMD it is now private.

Rename halting to onHalting.

Add onQuitting

Change the message specific logging to be more generic and change
the xxxProcessedMessagesYyy methods to xxxLogRecXyy names. Also add
addLogRec(String) and addLogRec(String, State) as the generic logging
methods.

bug: 5678189
Change-Id: I22f66d11828bfd70498db625fe1be728b90478b7

Conflicts:

	services/java/com/android/server/NsdService.java
2012-07-02 10:57:11 -07:00
Kenny Root
5293d0cb2e Merge "Packages for PackageManagerService tests" 2012-06-20 09:13:47 -07:00
Kenny Root
ec7e483c55 Packages for PackageManagerService tests
Change-Id: I3fd96abb0560fd8c596304d9c233e2f8f3fd8089
2012-06-18 14:31:50 -07:00
Kenny Root
2414c8b37a am 535d3b3f: am 0cf34218: Merge "Adding test cases for getInstalledPackages"
* commit '535d3b3f3363af6a5f2acb620542baec4cb96b45':
  Adding test cases for getInstalledPackages
2012-06-15 16:47:14 -07:00