History log of /frameworks/base/services/java/com/android/server/pm/Settings.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2298ef2f7f89d7a5cab6ef4790d8cbdb189e73e9 05-Nov-2013 Christopher Tate <ctate@google.com> Extend preferred-app preload support for complex resolutions

Support factory defaults that involve specific type+scheme matching.

Bug 11372979

Change-Id: I0d68937797d6b4bc996a8707a7cd21491a3aae3b
/frameworks/base/services/java/com/android/server/pm/Settings.java
707a59dc9a50765c32b0c7a02cc66833cfa5d77e 25-Oct-2013 Erin Dahlgren <edahlgren@google.com> Have the package manager write mimetype of preferred activities to xml.

Issue: 11372979
Change-Id: I5ea4e94c978845426e2650946d0bba076d161c19
/frameworks/base/services/java/com/android/server/pm/Settings.java
9f08820025d67a6baff8e404ec1d634f22244c01 23-Oct-2013 Christopher Tate <ctate@google.com> Edge case: overriden system package moved & became privileged in OTA

Because properly continuing permission grants post-OTA has changed
policy to include privilege considerations based on install location,
make sure that we re-evaluate when we determine that the apk has
moved from its pre-OTA location.

Bug 11271490

Change-Id: I6c09986e2851a67504268b289932588457c05dfc
/frameworks/base/services/java/com/android/server/pm/Settings.java
628946a6efd7931fac59b3236b58b53c58c6bf20 19-Oct-2013 Christopher Tate <ctate@google.com> Fix priv-app edge case across OTAs

In this case:

1. Privileged system app FOO is overlain by an installed update,
2. FOO was replaced during an OTA,
3. The new in-system FOO introduced new privileged permission requests
that had not been requested by the original FOO,
4. the update version of FOO still had a higher version code than
the new FOO on the system disk, and
5. the update version of FOO had been requesting these same (newly-
added-to-system-apk) permissions all along;

then the newly-added privileged permission requests were incorrectly being
refused. FOO should be able to use any privileged permission used by the
APK sited on the system disk; but instead, it was only being granted the
permissions used by the *original* version of FOO, even though the system
FOO now attempted to use them.

Still with me?

The fix is to (a) properly track privileged-install state when processing
known-to-be-hidden system packages, and (b) to tie the semantics of the
permission grant more explicitly to that evaluated state, rather than
using the prior (rather fragile) fixed-up privilege calculation applied
to the overlain apk's parse records.

Bug 11271490

Change-Id: Id8a45d667e52f3b5d18109e3620d5865f85bb9c9
/frameworks/base/services/java/com/android/server/pm/Settings.java
878deb3c7b33a0c508137143c776e07bab0296cf 15-Oct-2013 Dianne Hackborn <hackbod@google.com> Fix issue #11223335: APR: Lots of failures in procstats due to...

...bad cleanup of crashing processes

We now have a special path for crashing processes, to silently
clean up their state.

Also some tweaks to Log/Slog.wtf to get better stack crawl
summaries in APR.

Change-Id: Ieced26989907a6e7615b6fa033813fced78d7474
/frameworks/base/services/java/com/android/server/pm/Settings.java
06dc8484b4bf4028eed1e289b1d441eecaa22edf 23-Aug-2013 Christopher Tate <ctate@google.com> Fix handling of privileged permissions on update

When a bundled app is upgraded, only reprocess ungranted 'system'
permissions if the bundled apk is privileged.

Also adds the 'privileged' flag to the dumpsys flag summary.

Bug 10503183

Change-Id: Ic6560fc904e5970fc871a155c898744a6607f851
/frameworks/base/services/java/com/android/server/pm/Settings.java
86b391cd03ba2c3e71e78ce2ccf8dd073ac409cf 14-Sep-2013 Christopher Tate <ctate@google.com> Prune shared users that the system declares but does not use

Bug 10184643

Change-Id: I72c5177c621c24fac34bf8744eb6c5108b6d3464
/frameworks/base/services/java/com/android/server/pm/Settings.java
cc8f710a503ebda563caf2fcfc584de5e2ed76c4 11-Sep-2013 Jeff Sharkey <jsharkey@android.com> Include system packages in packages.list.

This provides group membership to the FUSE daemon, since system
packages like NFC and Bluetooth hold sdcard_rw.

Bug: 10610659
Change-Id: I7428e999cfa4087ffe220b9d8bd80827191ab997
/frameworks/base/services/java/com/android/server/pm/Settings.java
5dea7d554a6c9655ad2b578f900fe8840c86934b 03-Sep-2013 Jeff Sharkey <jsharkey@android.com> Skip packages with missing metadata.

Otherwise this would result in NPE, and packages.list would never
be updated.

Bug: 10577538
Change-Id: I35a4407dbc283ab20a4c45a2ea1a14b04044c98c
/frameworks/base/services/java/com/android/server/pm/Settings.java
e9ecc8b49992840249bfb9d5d52b8824dd5de39b 22-Aug-2013 Amith Yamasani <yamasani@google.com> Improve Intent disambig dialog behavior

Keep track of last chosen activity for a particular intent, similar
to how it is tracked for "Always" choices.
Pre-select the last chosen activity if previously the user picked
"Just once".
Downgrade "Always" to "Last chosen" if there's a new kid on the block,
instead of removing it entirely.
Add methods to set and get last chosen entry.

UI - switch from Grid to List.

Bug: 9958096

Change-Id: Ied57147739a3ade1d36c3a7ec1e8ce77e5c5bb16
/frameworks/base/services/java/com/android/server/pm/Settings.java
02e4d16ed9a0499ad72f2ff427e8bf0e85d7ae06 13-Aug-2013 Jeff Sharkey <jsharkey@android.com> Add GIDs to packages.list, update SD card perms.

Write supplementary GIDs to packages.list for lower-level system
components to parse.

WRITE_EXTERNAL_STORAGE also implies sdcard_r GID. Switch to always
enforce READ_EXTERNAL_STORAGE permission. Update permission docs to
mention new behavior.

Change-Id: I316ba4b21beebb387ac05c80980ae9b38235b37d
/frameworks/base/services/java/com/android/server/pm/Settings.java
184a0100abc431fc3d6d8dd1b20212b84958cada 11-Jul-2013 Jeff Sharkey <jsharkey@android.com> Allow packages.list access with new GID.

The FUSE daemon is using packages.list to map from package name to
appId after it drops permissions, so create a new "package_info" GID
to grant read access.

Also switches FileUtils to use Libcore.os.

Change-Id: I9451ca4e90e8a985526805c6df0888a244a1db36
/frameworks/base/services/java/com/android/server/pm/Settings.java
dd72c9ed558158f889a8cdfed8a108553ba5a562 06-Aug-2013 Ben Gruver <bgruv@google.com> Improve the logic for determining whether the caller is a system app

Bug: 10024554
Change-Id: I742e918840a98dd83d713bdf7a43a919674e65fe
/frameworks/base/services/java/com/android/server/pm/Settings.java
b09491f271c0a647632e5a99bfe280cbb7106195 23-Jul-2013 Dianne Hackborn <hackbod@google.com> Add new facility for apps to declared their preferred intents.

This is an extension from the existing data/etc/perferred-apps
facility. Now applications pre-installed on the system image
can declare which intents they would like to be considered the
preferred app for. When the system firsts initializes, or the
application settings are reset, these are used to configured
the current preferred app settings appropriately.

You use this with a new <preferred> tag under your activity,
which indicates which intents you would like to be the preferred
handler for. The syntax for this is written much like an
intent filter, however semantically it is not really an intent
filter and so has some important differences:

- You can not use globbing patterns (for SSPs or paths).
- You can use only one action (if you use more than one it
will only use the first one, so be careful).

Semantically what this is actually used for is a template
from which to generate a set of Intent objects, which are used
to probe the current environment in order to see if there are
multiple activities that can handle the Intent and, if so,
generate a new preferred setting for that pointing to your app.

As an example, here is how the preferred tag might be written
for the Maps application:

<preferred>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="maps.google.com" />
<data android:path="/" />
<data android:pathPrefix="/maps" />
</preferred>
<preferred>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="geo" />
</preferred>

From this, we generate the following set of potential Intents
to be matched, all with ACTION_VIEW, CATEGORY_DEFAULT+CATEGORY_BROWSABLE:

Change-Id: I7fd42aec8b6109c7dd20012529662362f1b7437a
http://maps.google.com/
http://maps.google.com/maps
https://maps.google.com/
https://maps.google.com/maps
geo:
/frameworks/base/services/java/com/android/server/pm/Settings.java
655d0e2029e6ae77a47e922dce4c4989818b8dd1 12-Jun-2013 Amith Yamasani <yamasani@google.com> Single-user restrictions

Introduces a new "blocked" state for each package. This is used to temporarily
disable an app via Settings->Restrictions.

PIN creation and challenge activities for use by Settings and other apps. PIN
is stored by the User Manager and it manages the interval for retry attempts
across reboots.

Change-Id: I4915329d1f72399bbcaf93a9ca9c0d2e69d098dd
/frameworks/base/services/java/com/android/server/pm/Settings.java
e201f581f6b535ff85f8748ce9333d895df40249 18-Jun-2013 Geremy Condra <gcondra@google.com> Merge "Stop spewing errors into the logs."
bf7b1f4744da64539ad33361fe0c0b0892790564 18-Jun-2013 Geremy Condra <gcondra@google.com> Stop spewing errors into the logs.

These are for debugging. Marking them that way.

Bug: 9479475
Change-Id: Ia0c27829583ecbab58a60a8c8350e9c099b812c2
/frameworks/base/services/java/com/android/server/pm/Settings.java
df1c0bf7744d4abd3e2000fcfec01c119b857c75 13-Jun-2013 Dianne Hackborn <hackbod@google.com> Add scheme specific part to IntentFilter.

Change-Id: I063d086cdc742800b8e31ddf2942f2e9230e2785
/frameworks/base/services/java/com/android/server/pm/Settings.java
cbfd23ee6f14445c3e17c5169abbc80c216fa137 11-Jun-2013 Dianne Hackborn <hackbod@google.com> Add new API to retrieve a dumpsys of a single package.

Adds a platform API, and pm command. Fixes some issues with
dumping per-package data in package manager, makes battery
stats able to dump per-package state.

Change-Id: I76ee6d059f0ba17f7a7061886792b1b716d46d2d
/frameworks/base/services/java/com/android/server/pm/Settings.java
a05a3686130ccef0c6ec9f2b567b088b8ed64059 02-Apr-2013 Dianne Hackborn <hackbod@google.com> am 69fe4069: am 006c6338: Merge "Fix bug in initializing preferred activities." into jb-mr2-dev

* commit '69fe40692973bf480019d71dea85d01d24eb7a68':
Fix bug in initializing preferred activities.
4d491a605e3449b224c9f9abb641ac7b00cd346b 02-Apr-2013 Dianne Hackborn <hackbod@google.com> Fix bug in initializing preferred activities.

Now that we are smarter about the initialization, we need
to do this after all packages are scanned.

Change-Id: I598f5ef84dcc83779bbff29e4c92136c63fb32de
/frameworks/base/services/java/com/android/server/pm/Settings.java
3868a19759ca39f46729d52d5216c2e76a5c21cd 29-Mar-2013 Geremy Condra <gcondra@google.com> am a54e0643: am 9d034deb: am 24948d3c: am 946a5c91: Merge "Save off the seinfo value with packages.list."

* commit 'a54e064365706d40c55c2984cca1f15a6bf3e8fb':
Save off the seinfo value with packages.list.
9d034debdd7226ea33530143710fcb962144be22 29-Mar-2013 Geremy Condra <gcondra@google.com> am 24948d3c: am 946a5c91: Merge "Save off the seinfo value with packages.list."

* commit '24948d3ca7ff7fa70ee85e9aa7530239d7b482b2':
Save off the seinfo value with packages.list.
d734b4f285dff25ed5fed63349d259ff15a07d60 28-Mar-2013 Dianne Hackborn <hackbod@google.com> am 6b8e7b35: am bf20aa76: Merge "Keep track of who has disabled applications." into jb-mr2-dev

* commit '6b8e7b35ef763d29a30c87a5a95ef941d39a8ee9':
Keep track of who has disabled applications.
3fa3c28a356108a6558b6b54a0b10e1a5cc4f1b6 27-Mar-2013 Dianne Hackborn <hackbod@google.com> Keep track of who has disabled applications.

Change-Id: I2640d3dc2200b589e2beb42a43cc93efd090f06e
/frameworks/base/services/java/com/android/server/pm/Settings.java
4a4537331be12e7ac11066931c845ec9d8064571 26-Mar-2013 Robert Craig <rpcraig@tycho.ncsc.mil> Save off the seinfo value with packages.list.

Patch adds the seinfo label per package to the file.
This is of particular interest to the run-as program
which uses the seinfo tag to correctly label the
app security context before running the shell.

Change-Id: I9d7ea47c920b1bc09a19008345ed7fd0aa426e87
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
/frameworks/base/services/java/com/android/server/pm/Settings.java
1e0c8e69891c89a86b2d9879e3c1985563a56f49 28-Nov-2012 rpcraig <rpcraig@tycho.ncsc.mil> Proper security labeling of multi-user data directories.

This patch covers 2 cases. When an app is installed
and the resulting data directory is created for all
existing users. And when a new user is created and
all existing app data directories are created for
the new user.

Change-Id: Iacaba6d9d18d5337e65713960d14efe32006b330
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
/frameworks/base/services/java/com/android/server/pm/Settings.java
dc37c5f2e32d167059382ec4bba68d4f12922516 13-Mar-2013 Dianne Hackborn <hackbod@google.com> am 0c42b580: am 53149acf: Merge "Implement limited shared libraries in apks." into jb-mr2-dev

* commit '0c42b58041dc0ede9865335fa48637fb6b677cd3':
Implement limited shared libraries in apks.
c895be7bc68b6f5b37fbb9881f464dd5ea0eb017 12-Mar-2013 Dianne Hackborn <hackbod@google.com> Implement limited shared libraries in apks.

You can now declare shared libraries in apks that are
on the system image. This is like the existing mechanism
of using raw jar files as shared libraries, but since they
are contained in an apk the library can actually be updated
from the Play Store. And this even (mostly) works.

There are some deliberate limitations on this feature. A
new shared library *must* be declared by an apk on the system
image. Installing an update to a system image apk does not
allow you to add new shared libraries; they must be defined
by everything on the base system image. This allows us to
get rid of a lot of ugly edge cases (shared libraries that were
there disappearing after an update is uninstalled for example)
and give some brakes on apps that happen to be pre-installed
on devices from being able to throw in new shared libraries
after the fact.

In working on this, I ran into a recently introduced bug where
uninstalling updated to system apps would fail. This was done
to allow for the new restricted users that don't have all
system apps, but conflicts with the existing semantics for
uninstalling system apps. To fix this I added a new uninstall
flag that lets you switch on the new mode if desired.

Also to implement the desired logic for limitations on declaring
new shared libraries in app updates, I needed to slightly tweak
the initial boot to keep the Package object for hidden system
packages associated with their PackageSetting, so we can look at
it to determine which shared libraries are allowed. I think
this is probably more right than it was before -- we already
need to parse the package anyway, so we have it, and when you
install an update to a system app we are in this same state
until you reboot anyway.

And having this fixed also allowed me to fix another bug where
we wouldn't grant a new permission to an updated app if its
system image version is updated to request the permission but
its version is still older than whatever is currently installed
as an update. So that's good.

Also add new sample code showing the implementation of an apk
shared library and a client app using it.

Change-Id: I8ccca8f3c3bffd036c5968e22bd7f8a73e69be22
/frameworks/base/services/java/com/android/server/pm/Settings.java
12c1838198b8d494ca33d0702068dd01e531636c 07-Mar-2013 Geremy Condra <gcondra@google.com> Add check for UID reuse.

The goal here is to make sure that we aren't allocating a UID that
could have been in use since the last time the device booted.

Bug: 8256571

(cherry picked from commit af70d15543c89a53f064492f4e3d17c446e00039)

Change-Id: I8b11811df8d5a8ad1aa064abb43db020aceb29e3
/frameworks/base/services/java/com/android/server/pm/Settings.java
f1bcca82158c39da3c3696f9af954be2c0be1809 08-Jan-2013 Geremy Condra <gcondra@google.com> Added the KeySetManager.

Bug: 7554291
Change-Id: Ic693a544f1e2cab20f6540b3fc4ff673e35bd2c6
/frameworks/base/services/java/com/android/server/pm/Settings.java
8a2ed1d7c0c4f6476e39cc37d9ebd29c7562ce01 30-Jan-2013 Dianne Hackborn <hackbod@google.com> Improve configuration of default preferred apps.

The file that defines default preferred apps is now more
robust. It is no longer a raw dump of the package
manager settings, but instead a more general list of a
target activity and filter. When reading it, the remaining
information (match value, set of potential matches) is
determined dynamically.

Change-Id: I0edc6e0d2ed3dd2a6e2238992f18f7fc1f51d8d4
/frameworks/base/services/java/com/android/server/pm/Settings.java
fd7adedebf88427162a3ce27fcc9cfd3893c869d 23-Jan-2013 Dianne Hackborn <hackbod@google.com> Add new disabled state for "optional" built-in apps.

The disabled state allows you to make an app disabled
except for whatever parts of the system still want to
provide access to them and automatically enable them
if the user want to use it.

Currently the input method manager service is the only
part of the system that supports this, so you can put
an IME in this state and it will generally look disabled
but still be available in the IME list and once selected
switched to the enabled state.

Change-Id: I77f01c70610d82ce9070d4aabbadec8ae2cff2a3
/frameworks/base/services/java/com/android/server/pm/Settings.java
1506921e8e7897be8297365dcaf15f4c6d6eb472 10-Jan-2013 Nick Kralevich <nnk@google.com> Revert "App home directories are now 0700 for targetSdkVersion > 17"

This reverts commit 92091fa9636403728fe94cc83400495a8612c2d3.

Bug: 7966399
Bug: 7208882
/frameworks/base/services/java/com/android/server/pm/Settings.java
92091fa9636403728fe94cc83400495a8612c2d3 13-Dec-2012 Nick Kralevich <nnk@google.com> App home directories are now 0700 for targetSdkVersion > 17

Pass targetSdkVersion to installd so it knows the appropriate
permissions to apply to the app's home directory.

Bug: 7208882
Change-Id: Ia62ed36b32ee5af01077fb10a586024411be8ed4
/frameworks/base/services/java/com/android/server/pm/Settings.java
13579ed3305bf89b41a9fa88e1347f0e0769d279 29-Nov-2012 Dianne Hackborn <hackbod@google.com> Cleaner initial boot.

This does some cleanup of the initial boot, especially when
booting in "no core apps" mode for encryption/decryption.

Change-Id: Ifb3949f580e52f54559e603c4b0b104f6bac2f6c
/frameworks/base/services/java/com/android/server/pm/Settings.java
f031f230f5e42613dab6b30431fac9b2839d68e6 27-Oct-2012 Amith Yamasani <yamasani@google.com> Fix for some downloaded apps showing up on all users

Bug: 7226656

In the case of packages with sharedUserId, the packages were inserted
into mPackages a little later. We were reading the package restrictions
before this happened and so the apps were being removed from the restricted
list, effectively setting installed=true.

Moved the block that reads the restrictions to after the processing of
mPendingPackages.

Also, don't setInstalled for all users in the pending packages processing.

Change-Id: I382787e45fecdb871d80ffb4d854782d8e32e4a7
/frameworks/base/services/java/com/android/server/pm/Settings.java
6309271f7b0f27ee725e36bfa48b4d250e44006f 07-Oct-2012 Dianne Hackborn <hackbod@google.com> Fix issue #7295951: Mako asks which Launcher to use at every re-boot

A couple problems:

- We need to clear app preferences later, now that we have encrypted apps.
- The multi-user implementation of this would allow different preferred
apps from different users to potentially interefere with each other.
They are not completely separate data structures.

Change-Id: Id4f1ebb6414fdf30ff1049adaa1efe83dabac01a
/frameworks/base/services/java/com/android/server/pm/Settings.java
d4ac8d7b3de27a9f0e4c6af2496ca71d794e42d1 28-Sep-2012 Dianne Hackborn <hackbod@google.com> 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
/frameworks/base/services/java/com/android/server/pm/Settings.java
752cd922f7091dfd5401faf70dc248934a9dbb6d 24-Sep-2012 Jeff Sharkey <jsharkey@android.com> Always bind to DefaultContainerService as OWNER.

When PackageManagerService deals with external storage, always bind
to DefaultContainerService as USER_OWNER. This avoids binding to a
stopped user, which would fail.

Bug: 7203111
Change-Id: I8e303c7558e8b5cbe4fea0acc9a472b598df0caa
/frameworks/base/services/java/com/android/server/pm/Settings.java
920ace0bbc2d4133dbec991d2636c99a57d6245e 21-Sep-2012 Amith Yamasani <yamasani@google.com> 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
/frameworks/base/services/java/com/android/server/pm/Settings.java
5455f6826f832ed0f07d28a772f4489d7223acb3 09-Sep-2012 Kenny Root <kroot@google.com> Update PackageSetting flags when updating

Commit 5e03e2ca7d25b899b129baad2dd5eca6bf99d88a moved from
PacakgeParser.Package to PackageSetting which revealed that we weren't
updating the pkgFlags when replacing an existing application.

Add flags to PackageSetting so that deletion of the package later succeeds.

Change-Id: I2e0d4e07da31f48b68601f3f3240966b6e17dbdf
/frameworks/base/services/java/com/android/server/pm/Settings.java
11941fd651be468c8ab6c90256616418ecf3a6a8 08-Sep-2012 Dianne Hackborn <hackbod@google.com> Fix crash when setting wallpaper from non-primary user.

When accessing a content provider, there is a check for whether
the provider can run in the caller's process; if so, even if the
provider is currently published, we return to the caller that it
can run locally.

This check was broken -- it had an old condition that allowed
content providers owned by the system UID to run in any other UID's
process. This is wrong, since by definition the other
UIDs would not be able to access the data under the original UID.

We ran into this because the activity picker is part of the
android platform manifest, so runs as the system process. However
it needs to run as the user who invoked it, so when coming from the
non-primary user we spin up a "system" process running as a uid of
that user. Now when that process tries to access the settings
provider, the broken check would think that a new instance of the
settings provider should be created in the caller's process.

Change-Id: I7bf495ed8370cb271bdaec073d5b7dda9e38c546
/frameworks/base/services/java/com/android/server/pm/Settings.java
5e03e2ca7d25b899b129baad2dd5eca6bf99d88a 06-Sep-2012 Dianne Hackborn <hackbod@google.com> 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
/frameworks/base/services/java/com/android/server/pm/Settings.java
61f57379ca2c5b6290c8da7548fa17128f7ab24f 31-Aug-2012 Amith Yamasani <yamasani@google.com> Centralize the creation of the user system directory

Environment.getUserSystemDirectory(int userId)

Use it all relevant places that was hardcoding it.
Also, wipe out the user's system directory when user is removed, otherwise old state
might be transferred to a new user.

Change-Id: I788ce9c4cf9624229e65efa7047bc0c019ccef0a
/frameworks/base/services/java/com/android/server/pm/Settings.java
4428e17c5e05c0dad76da8f1c28ccba62a66cd91 25-Aug-2012 Dianne Hackborn <hackbod@google.com> Some clean up of app install and user management.

UserManagerService is now closely tied to PackageManagerService,
sharing the same locks. There is no longer direct access of
Installer by UserManagerService, instead the package manager is
back to solely owning it.

Creating a new user now correctly only installs system apps for
that user.

Fixed some misc bugs, where we were getting nulls when
querying content providers and instrumentation in uninstalled
users, incorrect locking, etc.

Change-Id: Ife69b6e373d0cf7c5cfc03fc588e36b43ad5d8b0
/frameworks/base/services/java/com/android/server/pm/Settings.java
7767eac3232ba2fb9828766813cdb481d6a97584 24-Aug-2012 Dianne Hackborn <hackbod@google.com> 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
/frameworks/base/services/java/com/android/server/pm/Settings.java
f02b60aa4f367516f40cf3d60fffae0c6fe3e1b8 16-Aug-2012 Dianne Hackborn <hackbod@google.com> Rename UserId to UserHandle.

This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
/frameworks/base/services/java/com/android/server/pm/Settings.java
258848d2ae04f447ff1c18023fa76b139fcc0862 11-Aug-2012 Amith Yamasani <yamasani@google.com> User Manager service to manage users and query user details

Moved a bunch of methods from PackageManager to UserManager.

Fix launching of activities from recents to correct user.

Guest creation APIs

Change-Id: I0733405e6eb2829675665e225c759d6baa2b708f
/frameworks/base/services/java/com/android/server/pm/Settings.java
9ec6cdde9f8f22356dcc9f811d99ebf813194721 31-May-2012 Dianne Hackborn <hackbod@google.com> Optimize memory use of IntentResolver.

Use raw arrays instead of ArrayList for data structures.

Temporarily includes a copy of the old intent resolver for
validating the new implementation.

Change-Id: I988925669b6686ac73b779be6cd6fe3a9fd86660
/frameworks/base/services/java/com/android/server/pm/Settings.java
7d33d0c36c7e8c9de4139af383f7491823055bc7 26-Jun-2012 Kenny Root <kroot@google.com> am c17f92ce: Merge "Use removePackageLI instead of removing mPackages" into jb-dev

* commit 'c17f92ce047e8d62fac829d1df5dae654f7e4de8':
Use removePackageLI instead of removing mPackages
eca64b391408dfdb9ff3ae03fc39cfdb6918f3ad 26-Jun-2012 Kenny Root <kroot@google.com> Use removePackageLI instead of removing mPackages

When adding an system app via OTA, trying to remove it from mPackages
directly doesn't work. The ContentProviders and other things aren't
removed and point to the hidden system app's applicationInfo instead of
the updated app.

Bug: 6685263
Change-Id: I487cf518e0e3c60fae736e9b974617023a7dee8d
/frameworks/base/services/java/com/android/server/pm/Settings.java
56b3a321e7c6f03d1bc0c5c0915d56bc46b7a33e 19-Jun-2012 Dianne Hackborn <hackbod@google.com> am 1991850d: Merge "Implement issue #6680894: Provide a way to configure app defaults..." into jb-dev

* commit '1991850de7bbcc534c2cb457f33055c533542136':
Implement issue #6680894: Provide a way to configure app defaults...
fc8b7fe02630f64a1d6c8ecb06f4c250e7478f1d 19-Jun-2012 Dianne Hackborn <hackbod@google.com> Implement issue #6680894: Provide a way to configure app defaults...

...for a smoother OOB experience

Way provided.

Put your defaults in system/etc/preferred-apps/*.xml.

Figure out what to put there with "adb shell dumpsys package preferred-xml".

Bug: 6680894
Change-Id: Ia06bb0061876274a5f80bf06d1ba5ad155edc323
/frameworks/base/services/java/com/android/server/pm/Settings.java
f2fe4cb11b2b93acf1a983e856efe26b6bb79683 12-May-2012 Jeff Sharkey <jsharkey@android.com> am cd586258: Merge "Enforce READ_EXTERNAL through Settings.Secure." into jb-dev

* commit 'cd5862586ab555b53ffd0a62488843838d1aa94d':
Enforce READ_EXTERNAL through Settings.Secure.
f53857716a0db805c51c0cae93550d90e32e4749 11-May-2012 Jeff Sharkey <jsharkey@android.com> Enforce READ_EXTERNAL through Settings.Secure.

Always defers to user-defined setting, when present.

Bug: 6389556
Change-Id: I079d2a41b772facfdac74eefc4c8072fc9284f97
/frameworks/base/services/java/com/android/server/pm/Settings.java
71244f0b6c6908ce13fef6fedf7e0e69cd983527 09-May-2012 Kenny Root <kroot@google.com> am 8a2fe268: Merge "Prune hidden system apps when removed via OTA" into jb-dev

* commit '8a2fe26873f73a7a422cadf9e5ccfd7c68bbd9ca':
Prune hidden system apps when removed via OTA
c52d6fd04316483f4a88f3a087b93bb197cd97f4 08-May-2012 Kenny Root <kroot@google.com> Prune hidden system apps when removed via OTA

System applications which had an update applied to them at some point
were in a semi-broken state when removed via an OTA. The
"updated-package" setting would stay around forever and permissions
wouldn't be revoked.

Change-Id: I908e813b5de59c0f777d9b051253b28255a1c694
/frameworks/base/services/java/com/android/server/pm/Settings.java
bf65cc3bb6f17e4e11418b1ae17f7b7a0f29fd57 01-May-2012 Jean-Baptiste Queru <jbq@google.com> am 8f2e753b: am cbc71bd7: Merge "Fix off-by-one error when filtering application UIDs"

* commit '8f2e753be2343b41f7233e9e0eb79077c8f9a732':
Fix off-by-one error when filtering application UIDs
7ea3e7df1f1ff5dde8ffb42fa179beef679f40ea 21-Apr-2012 Amith Yamasani <yamasani@google.com> Fix dumpsys package.

Was bailing out due to insufficient permissions to query users.

Bug: 6374050
Change-Id: Ic4a4ab32e2efb4d1fc1f1607fd304f99d5382743
/frameworks/base/services/java/com/android/server/pm/Settings.java
5d32e772b3a19c1ac84e665f2885755427d590c8 13-Apr-2012 Jeff Sharkey <jsharkey@android.com> Enforce READ_EXTERNAL on non-user builds.

Enable default enforcement of READ_EXTERNAL_STORAGE on non-user
builds. Users can still explicitly enable enforcement in Settings.

Bug: 6131916
Change-Id: I7dc66b624ad252ed2a2ad3647f3ea85dda7f8e82
/frameworks/base/services/java/com/android/server/pm/Settings.java
1c27576aff247ff1d7789e0a571958726f161593 12-Apr-2012 Jeff Sharkey <jsharkey@android.com> Include enforcement state in dumpsys.

Bug: 6323087
Change-Id: I6d779798538c114ea9816d3bdbbff5552c285df6
/frameworks/base/services/java/com/android/server/pm/Settings.java
135936072b24b090fb63940aea41b408d855a4f3 23-Mar-2012 Amith Yamasani <yamasani@google.com> User management and switching

Broadcast intents that get sent out when users are added/removed/switched.

More work on generating user-specific information in package manager queries.
APIs to update user name and query a user by id.
Removed Package.mSetStopped and mSetEnabled, since they're not user specific.

User removal:
- Cleanup ActivityManager, PackageManager, WallpaperManager, AppWidgetService
and AccountManager.
- Shutdown processes belonging to the user.

Don't show vibrate option in long-press power if there's no vibrator.

Lock the screen when switching users, to force unlocking.

Change-Id: Ib23a721cb75285eef5fd6ba8c7272462764038fa
/frameworks/base/services/java/com/android/server/pm/Settings.java
1358ebe46c47a8c5d80d3f9bc4768805ac80ca46 27-Mar-2012 Magnus Eriksson <eriksson.mag@gmail.com> Fix off-by-one error when filtering application UIDs

A filtering check in writeLPr() mistakenly includes the first application UID
(10000) with the result that the package with UID 10000 is missing from
packages.list. This patch fix the error.

Change-Id: I3651beb346290db8e09317391b95a77aed1946b6
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
/frameworks/base/services/java/com/android/server/pm/Settings.java
483f3b06ea84440a082e21b68ec2c2e54046f5a6 14-Mar-2012 Amith Yamasani <yamasani@google.com> Package restrictions per user

Packages can be enabled/disabled per user.
This requires maintaining stopped/launched states and
enabled / disabled components and packages per user.

Refactored pm.Settings and PackageSettingsBase to keep
track of states per user.

Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml

Changed intent resolution to handle individual user restrictions.
Bunch of IPackageManager calls now have a userId argument.
Make AppWidgetService handle removals of packages.

Added some tests for pm.Settings and PackageManager.

Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
/frameworks/base/services/java/com/android/server/pm/Settings.java
edc84ee8392afa0102f098168329db5bb43a6d4b 20-Mar-2012 Jeff Sharkey <jsharkey@android.com> Selective enforcement of READ_EXTERNAL_STORAGE.

Store enforcement state of specific permissions, allowing them to be
selectively enforced. Currently supports READ_EXTERNAL_STORAGE, which
by default isn't enforced, but enforcement can be enabled at runtime.

Bug: 6131916
Change-Id: I4bcc215a2eb5e6507d6257b577311cbd13c77acf
/frameworks/base/services/java/com/android/server/pm/Settings.java
e639da7baa23121e35aa06d6e182558e0e755696 22-Feb-2012 Dianne Hackborn <hackbod@google.com> New development permissions.

These are permissions that an application can request, but won't
normally be granted. To have the permission granted, the user
must explicitly do so through a new "adb shell pm grant" command.

I put these permissions in the "development tools" permission
group. Looking at the stuff there, I think all of the permissions
we already had in that group should be turned to development
permissions; I don't think any of them are protecting public APIs,
and they are really not things normal applications should use.

The support this, the protectionLevel of a permission has been
modified to consist of a base protection type with additional
flags. The signatureOrSystem permission has thus been converted
to a signature base type with a new "system" flag; you can use
"system" and/or "dangerous" flags with signature permissions as
desired.

The permissions UI has been updated to understand these new types
of permissions and know when to display them. Along with doing
that, it also now shows you which permissions are new when updating
an existing application.

This also starts laying the ground-work for "optional" permissions
(which development permissions are a certain specialized form of).
Completing that work requires some more features in the package
manager to understand generic optional permissions (having a
facility to not apply them when installing), along with the
appropriate UI for the app and user to manage those permissions.

Change-Id: I6571785c6bb5f6b291862b7a9be584885f88f3a5
/frameworks/base/services/java/com/android/server/pm/Settings.java
20963df86f3f27f4c54c1ddf177c57d58f0a9128 05-Jan-2012 Joe Onorato <joeo@google.com> Show the flags in package manager debugging.
/frameworks/base/services/java/com/android/server/pm/Settings.java
21fbd1f7da53dc044737803dccddf8099f1fc1e9 10-Feb-2012 Dianne Hackborn <hackbod@google.com> Some cruft removal.

Change-Id: If4a94bfd4a033748eb13e8f3ff25e24382746778
/frameworks/base/services/java/com/android/server/pm/Settings.java
2f36229db823d152f3efd879e751e81a601a75b0 20-Jan-2012 Andy McFadden <fadden@android.com> Use Map.Entry, not HashMap.Entry

Map.Entry is the defined return value from entrySet(). HashMap.Entry
shouldn't be used directly.

Change-Id: Ia21598c6a73fe7eb22179ce114095f779c903084
/frameworks/base/services/java/com/android/server/pm/Settings.java
70522addd031f6c667849f76c074e463a141c61d 06-Jan-2012 Nick Kralevich <nnk@google.com> Don't allow reading of packagelist files.

Ensure that all requests to read the list of installed packages
go through the PackageManager directly. Don't allow non-system
program to directly read the raw package list files.

Change-Id: Id083e6b3de4dd9173abfdc741ebf3f60997a1052
/frameworks/base/services/java/com/android/server/pm/Settings.java
62539e9efa02c4037d3310a8b4f16f0085cd8c37 10-Nov-2011 Kenny Root <kroot@google.com> Close file on exception as well

Bug: 5458045
Change-Id: I4c79b9c273ff69dda292e5cc7b2b60f8db2edbd9
/frameworks/base/services/java/com/android/server/pm/Settings.java
58f42a59bda3bc912d0d2f81dc65a9d31d140eaa 10-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix issue #5405788: Device continuously opening and closing...

...the "Complete action using" dialog

When an application goes idle, it sends back to the activity manager
the configuration it last used, to make sure the two don't get out
of sync. Fix a bunch of edge cases here in dealing with that, and
be sure to also send the current configuration when launching an
activity so the client is always up-to-date when launching.

Also a small fix to not show the upgrading dialog during first boot.

Change-Id: I14ed366a87cd689d1c78787369e052422290ac6f
/frameworks/base/services/java/com/android/server/pm/Settings.java
0aaa0d931716e9f57a1d84d795fab2df75092756 13-Sep-2011 Kenny Root <kroot@google.com> Add verifier device identity

This adds a special device identifier that is usable only for device
validation. The user will be presented with this number encoded in
easily-transcribable Base32 in the Developer options of Settings.

Change-Id: I4843f55ee90d689a51d0269b22454ca04c1be7ec
/frameworks/base/services/java/com/android/server/pm/Settings.java
b8f400020b201cc40f5e16277af0dbafec38b8a3 20-Jul-2011 Dianne Hackborn <hackbod@google.com> Fix issue #4999574: Disabled system app not listed in Settings after reboot

Change-Id: I1a0a0724f72adcfa6aedffdcd3112bd4faa909d3
/frameworks/base/services/java/com/android/server/pm/Settings.java
0ac3031c159a0904e73eb4439cdc724d8df4a6e6 17-Jun-2011 Dianne Hackborn <hackbod@google.com> Implement remaining infrastructure for user disabling apps.

Change-Id: If8135eb0e27ec36f8f159eb7b6397add7acd0299
/frameworks/base/services/java/com/android/server/pm/Settings.java
3d0724dc220a2e027b9e38f61c39c84c28a505d5 13-May-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 0e59729b to master

Change-Id: I2d3a6bddf66b1df0c101c45ea2fec1cf65caf01b
1d1b4893762c8daad2b31dc79cad2dbcc1b251d2 08-Apr-2011 Kenny Root <kroot@google.com> Updated system packages retain shared user

If a system package was updated that used permissions provided by a
package signed with a different signature, it wouldn't grant
those permissions to the updated system app.

This is because the sharedUser field was not set in the disabled system
package. Therefore it was checking the disabled system package's
individual user permission grants which were empty.

This change populates the sharedUser field for disabled system packages
after reading all the existing shared users from the saved settings
database.

Bug: 4245273
Change-Id: I57c58c4083bd59f45095c184d6ca5a302f79ff6e
/frameworks/base/services/java/com/android/server/pm/Settings.java
447106fc839520d18dcb367ba17fc8ec345bb9e8 23-Mar-2011 Kenny Root <kroot@google.com> Split dump and annotate users of mPackages lock

Split the dump() command between PMS and Settings.

Try to annotate all users of the mPackages lock in preparation for
switch to reader/writer lock.

Also mark some locals final as I was reading through the usage of the
synchronization on mPackages.

Change-Id: Ia7add63e835e67156edf886f98acebe50cc41f70
/frameworks/base/services/java/com/android/server/pm/Settings.java
cf0b38ca6e5aa5efded7dbdbb623f6cd2746c96a 22-Mar-2011 Kenny Root <kroot@google.com> Split PackageManagerService into subclasses

Split PackageManagerService from one monolithic class with several inner
classes to several classes. This will help determining how its data
structures can be reshuffled to provide better separation of concerns.

Change-Id: Ic7571daebdcf13ce08e08f34204c5bbf4140139b
/frameworks/base/services/java/com/android/server/pm/Settings.java