44 Commits

Author SHA1 Message Date
Amith Yamasani
483f3b06ea 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
2012-03-22 10:08:24 -07:00
Dianne Hackborn
e639da7baa 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
2012-02-23 16:39:15 -08: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
Ashish Sharma
92a208c6d3 Add a command option to display installerPackageName
Change-Id: I2e5cb5891c610531d9ba7c359fd5dd521f8ecfec
2011-12-09 00:31:54 -08:00
Kenny Root
5ab2157bf1 Infrastructure to support package verifier
Allow a package verifier to approve or disapprove of a package being
installed.

Change-Id: Ibfea0f2b1aaa4ab1589a4e59f96144702b9bf94b
2011-08-15 17:26:31 -07:00
Dianne Hackborn
46d110329e Small cleanup of am/pm commands.
Change-Id: I5af730bc177635821a82d4dd3ec9130a5dcd525a
2011-06-24 13:22:45 -07:00
Dianne Hackborn
0ac3031c15 Implement remaining infrastructure for user disabling apps.
Change-Id: If8135eb0e27ec36f8f159eb7b6397add7acd0299
2011-06-17 14:49:45 -07:00
Kenny Root
a51b6fd6f8 resolved conflicts for merge of b2d0ee16 to master
Change-Id: I4483a6d0ccecfea4a1e66bb6eba80d13e8b9a3a4
2011-05-19 15:02:18 -07:00
Kenny Root
e6cd0c747e resolved conflicts for merge of 2433c443 to honeycomb-plus-aosp
Change-Id: I3385f57e5761679e6700bcbe3c41deb3ecd43ba1
2011-05-19 12:48:14 -07:00
Kenny Root
2433c443bb am f2006f31: Merge "Break apart queries to getInstalled* API" into gingerbread
* commit 'f2006f3123dcdf598e052051041b49c89710b53e':
  Break apart queries to getInstalled* API
2011-05-19 11:04:01 -07:00
Dianne Hackborn
3d0724dc22 resolved conflicts for merge of 0e59729b to master
Change-Id: I2d3a6bddf66b1df0c101c45ea2fec1cf65caf01b
2011-05-12 15:39:41 -07:00
Dianne Hackborn
0f1de9adde New compat mode front end: UI and persistence.
Adds a really crappy UI for toggling compat mode.

Persists compat mode selection across boots.

Turns on compat mode by default for newly installed apps.

Change-Id: Idc83494397bd17c41450bc9e9a05e4386c509399
2011-05-12 13:28:45 -07:00
Kenny Root
0e2c0f37d9 Break apart queries to getInstalled* API
To avoid blowing past the Binder IPC limit, change the
PackageManagerService to have a DB-like interaction where the client
tells the service the last "row" that it read.

The fact that we use a HashMap instead of a TreeMap makes this
problematic. For now we're just making a new ArrayList for the keys and
then sorting them for each call. This can make the API slower for callers
of this, but it's probably greatly overshadowed by the cost of the data
transfer itself.

Bug: 4064282
Change-Id: Ic370fd148d4c3813ae4f2daffa1a7c28d63d5a09
2011-04-19 09:57:54 -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
Kenny Root
c39bb4aaa7 Switch to returnCode for IPackageDeleteObserver
Before the IPackageDeleteObserver only knew whether the deletion
succeeded or failed, but not the reason why.

Bug: 2520191
Change-Id: I1f0d7c04f06c539660b6e17e7e133defb0f61b5b
2011-03-01 09:27:57 -08:00
Dianne Hackborn
4f05220d10 Merge commit '690d20bb53ba2485f59d128b365eff991d5cc3e6' into manualmerge 2011-01-09 11:59:12 -08:00
Dianne Hackborn
95db1cfc74 am cd23823d: Merge "Fix issue # 3227963: SecurityException: Neither user 10023 nor..." into gingerbread
* commit 'cd23823d4f533431c76baa104eb50b7803b3b391':
  Fix issue # 3227963: SecurityException: Neither user 10023 nor...
2011-01-09 11:44:17 -08:00
Dianne Hackborn
690d20bb53 Fix issue # 3227963: SecurityException: Neither user 10023 nor...
...current process has android.permission.WAKE_LOCK

When updating a system app, we would actually uninstall the package
of the system app, which also meant removing its uid...!  It was just
luck that we would get the same uid when installing the update after
that.  During that time, if anyone tried to do anything related to
that uid, it would be unknown.

This change tweaks how we go about replacing system apps by making
it more like normal apps -- to make this work, if we need to disable
the system app, we generate a new PackageSetting from the current
system app and replace it into our data structures, so we can update
that without trashing the current correct information about the (still
actually there) system app.

Also fixed a problem where we were not killing the currently running
app before installing, like we do when updating a normal application.

And fixed a problem where we were not deleting the /data .apk when
uninstalling a system app update.

And added a new option to the "pm" command to clear the data associated
with an app.

Change-Id: I0e879677849aa42950a3c360bf78ad820e87674b
2010-12-22 16:31:44 -08:00
Dianne Hackborn
ccc7141313 resolved conflicts for merge of 78e9f4cb to master
Change-Id: I1135361e6d66f524c3f349e2bf1f31bd4191c634
2010-12-13 14:55:25 -08:00
Dianne Hackborn
78e9f4cbae am e4a59519: Fix issue #3154576: battery stats checkin should include UID -> packages+ map
* commit 'e4a5951925f16f18dae91ed65567e96528f17fee':
  Fix issue #3154576: battery stats checkin should include UID -> packages+ map
2010-12-13 14:37:09 -08:00
Dianne Hackborn
e4a5951925 Fix issue #3154576: battery stats checkin should include UID -> packages+ map
Includes some other small fixes to battery collection and a few
other things.

Output of package info looks like this:

5,0,i,uid,1000,com.android.settings
5,0,i,uid,1000,com.android.providers.subscribedfeeds
5,0,i,uid,1000,com.android.providers.settings
5,0,i,uid,1000,com.android.server.vpn
5,0,i,uid,1000,android
5,0,i,uid,1000,com.android.systemui
5,0,i,uid,1000,com.google.android.backup
5,0,i,uid,1001,com.android.phone
5,0,i,uid,1001,com.android.providers.telephony
5,0,i,uid,1022,com.android.nfc
5,0,i,uid,10021,com.google.android.location
5,0,i,uid,10021,com.google.android.syncadapters.calendar
5,0,i,uid,10021,com.google.android.gsf
5,0,i,uid,10021,com.google.android.syncadapters.contacts
5,0,i,uid,10026,com.android.providers.downloads.ui
5,0,i,uid,10026,com.android.providers.media
5,0,i,uid,10026,com.android.providers.drm
5,0,i,uid,10026,com.android.providers.downloads
5,0,i,uid,10032,com.android.launcher
5,0,i,uid,10039,com.google.android.gm
5,0,i,uid,10041,com.google.android.gallery3d
5,0,i,uid,10049,com.android.providers.calendar

Change-Id: I9e38f254eef146339113ad270f5c6e8b60fb7a1d
2010-12-13 14:31:40 -08:00
Jean-Baptiste Queru
edebb2fe1d am b087ceea: am 40eade14: Merge from open-source master
* commit 'b087ceead79bcb304e5793c6ae9109ce590847dc':
  Fix crash by "adb shell pm list permissions -f|-s"
2010-12-02 08:03:25 -08:00
Ali Utku Selen
1c3274ca12 Fix crash by "adb shell pm list permissions -f|-s"
pm command makes the assumption that every permission should
contain android:description and android:label attributes while
they are not mandatory. If a permission does not contain these
two attributes, we get "android.content.res.
Resources$NotFoundException: String resource ID #0x0"
followed by a NPE when using -f or -s options.

With the following change, users will get "null" in output for
respective fields.

Change-Id: I4e7f407592fa071abdab1d979775f46ec27dc9d2
2010-11-30 16:22:56 +01:00
Joe Malin
babe28e01c Doc change: Update pm command usage for test packages
Change-Id: If9c51e0265394538023a913fa271dfb80f14a92e
2010-08-31 13:31:20 -07:00
Suchi Amalapurapu
40e472521a Fix 2579461
Move install location values to secure settings.
Diable attribute for UI. Set default value to auto.
Add command line interface to set install location via pm.

Change-Id: I80e97b3d24845adad7102f40dcbe238f00efa406
2010-04-07 20:43:54 -07:00
Suchi Amalapurapu
e99bb5f10b Add new method call back in MountService.
PackageManager invokes this call back when its done handling
the media status update.
Add new uid check for updateExternalMediaStatus
Change killPids method in ActivityManager.
Remove mountsd command in Pm.java We cannot arbitrarily enable/disable
packages in PackageManager now.

Change-Id: I28dcba4afd2b4486f68abdaa1628a31b66544c91
2010-03-22 10:49:49 -07:00
Suchi Amalapurapu
14b6abda13 Add new install flag to install on internal flash only
Change default install location policy for new flag.
New error code for media unavailable.

Change-Id: I5a5d0828b067692b2b94a15a2bcc7534f796c1a2
2010-03-17 18:43:31 -07:00
Suchi Amalapurapu
8946dd3355 Move package from internal to external and vice versa. 2010-02-19 14:20:54 -08:00
Suchi Amalapurapu
5b993ce7bc Include install location preference when installing packages.
Changes include
Add new remote call in default container service to determine
install location.
Rename INSTALL_ON_SDCARD
Remove recommentAppInstall method
Add some additional flags used in remote stubs.
Move check for protected apps prior to copy.
Unit tests

DefaultContainerService first parses the file uri(if content uri is specified
it returns a default install internal only value) and returns
a recommended location. Based on which the temporary id is determined
either a file name or a container id and the file is copied there.
This is then later renamed during install.
Todo's light weight parsing of package when determining location since we
just need the install location attribute only when finding out
recomended location. This will also enable to move the check for
updated system apps(cannot be on sdcard) prior to copying.
2010-02-12 18:50:47 -08:00
Suchi Amalapurapu
fd3530f905 Mount/Unmount secure containers
Persist flags in PackageSetting. Flags are relevant to ApplicationInfo.FLAG_SYSTEM, Application.FLAG_ON_SDCARD, ApplicationInfo.FLAG_FORWARD_LOCK.
New pm command to simulate mount/unmount in Pm. This will be removed
when MountService/vold event generation gets fixed.
Calls from MountService into PackageManager when media gets mounted/unmounted.
Scan the packages and grant permissions when the sdcard gets mounted.
This api might change again.
2010-01-19 14:04:54 -08:00
Suchi Amalapurapu
af8e9f4805 app install on sdcard. provide skeleton implementation
to install an app on sdcard, just resources.
Add new install path for /asec in installd.
ignore . when checking for apk path since the sdcard packages id'ed
by package name.
Add new -s option to adb shell pm
Refactor fwd locked from scanMode to ApplicationInfo.
Add new flag for sd install
Add new parse flags for fwd locking and installing on sdcard
New mock api's in PackageManagerService to invoke MountService api's. These
will be refactored again and so have been wrapped internally.
Some error codes in PackageManager
Changes in PackageManagerService to use mPath and mScanPath during installation
and switch to using PackageParser.Package.applicationInfo attributes for
source and public resource directories.
Some known issues that will be addressed later
 using system_uid for now. needs some tinkering with uid and packagesetting creation to use the actual app uid
 error handling from vold not very robust. ignoring lot of things for now
 sending a delayed destroy to delete packages. will revisit later
 revisit temp file creation later. just copy for now
2010-01-14 14:02:39 -08:00
Dianne Hackborn
039c68e756 The touch screen is probably a feature.
Also extend the feature APIs a bit.

Change-Id: I99e932d7f4e61edb0e20f75c55e9831e4b59a14d
2009-09-26 16:39:23 -07:00
Xavier Ducrohet
23b4faf694 Use reflection to figure out a readable string from install error code.
Instead of a switch that needs to be maintained, the code now
look for public static final int fields in PackageManager
whose names start with INSTALL_FAILED or INSTALL_PARSE_FAILED.

If their int value match the error code, the name of the field
is used as a human readable error string.

Change-Id: If58ddc4d9ccc40a9a8aaec9de4cc7e4931db0292
2009-09-25 11:57:44 -07:00
Xavier Ducrohet
f03fb486ac Add error output to pm for FAILED_MISSING_FEATURE
Change-Id: Ib9955b69b69db7d442402ab33e148cb40dec3d40
2009-08-31 16:42:12 -07:00
Dianne Hackborn
b181118b6e Define TARGET_CPU_ABI for finding native code in .apks 2009-05-22 18:45:25 -07:00
Dianne Hackborn
ade3ecad94 Implement issue #1783881 (manifest option for adb-install-only apps)
You can now use android:testOnly="true" to not allow your .apk to be installed
as a normal app.  The only way to do so is with the pm command and giving the
-t option, which sets a new INSTALL_ALLOW_TEST flag when installing.

I also used this to clean up the install API...  actually, mostly to hide
it, since it is not accessible to apps so shouldn't be in the SDK.  We
will be doing some more work on it, so this will prevent adding yet
another backwards-compatibility-for-no-reason version.
2009-05-12 16:09:43 -07:00
Jacek Surazski
c64322c352 PackageManager keeps track of who installed what.
Stores the package name of the installer app in packages.xml
2009-05-12 23:16:20 +02:00
Dianne Hackborn
851a54143c Implement targetSdkVersion and maxSdkVersion, plus version code names.
This adds new attributes for specifying a targetSdkVersion and maxSdkVersion.
There is a new ApplicationInfo flag that is set if the application has set
its targetSdkVersion to the current platform or later.  Also you can now
use a string for minSdkVersion and targetSdkVerion, to indicate you are
building against a development tree instead of an official platform.
2009-05-08 15:15:36 -07:00
The Android Open Source Project
105925376f auto import from //branches/cupcake_rel/...@140373 2009-03-18 17:39:46 -07:00
The Android Open Source Project
9066cfe988 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project
d83a98f4ce auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project
b798689749 auto import from //branches/cupcake/...@125939 2009-01-09 17:51:23 -08:00
The Android Open Source Project
f013e1afd1 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:43 -08:00
The Android Open Source Project
54b6cfa9a9 Initial Contribution 2008-10-21 07:00:00 -07:00