150 Commits

Author SHA1 Message Date
Todd Kennedy
8d9366cfe9 Remove 2nd line from failure
In an attempt to provide more detailed information to the end-user, we
caused tests to fail [they parse the output of the 'pm' command]. Remove
the 2nd line of the output that was causing the failure.

Also took the opportunity to merge changes from the Pm command to the
Cmd command.

Bug: 26131598
Change-Id: I459f9ec8978d87dd571136222f780039e426474e
2015-12-16 13:47:14 -08:00
Todd Kennedy
1fd413f637 Merge "Temporarily stop proxying to cmd" 2015-12-08 17:07:15 +00:00
Lenka Trochtova
c4dd021322 Introduce ephemeral users.
BUG: 24883058

Change-Id: I2e1d6aa184142c2a3dc0415c0cd407573453cf41
2015-12-08 15:47:10 +01:00
Todd Kennedy
9619d049bf Temporarily stop proxying to cmd
Unless the APK is streamed, proxying pm install commands to the cmd command
will generally not work on any system that has SElinux enforcement. This
is due to the system sever [where cmd commands are run] not having access
to the directories where files are uploaded to. We'll re-enable the proxy
once we determine an appropriate, safe location for uploaded APKs.

Bug: 25769800
Change-Id: I73b2da0b03fe8bd9ce29e20b37cb4eeff9b491b4
2015-12-07 13:26:08 -08:00
Todd Kennedy
2699f06555 Add ephemeral installs
* Add a new --ephemeral argument to 'adb install'
* Add plumbing to internally track ephemeralness
* Create new app directory for ephemeral installs

Bug: 25119046
Change-Id: I1d379f5ccd42e9444c9051eef2d025a37bd824fe
2015-12-03 14:47:01 -08:00
Todd Kennedy
72cfcd02b8 Move 'un/install' to cmd
Move the implementation of the install variants and uninstall to the cmd
command. Additionally, make two other important changes: 1) replace calls
to the legacy PackageManager#installPackageAsUser with the PackageInstaller
2) allow streaming package bits for 'pm install'

Change-Id: I5680f57208d377daadb69b2cc09c233c02fe5016
2015-11-09 15:07:18 -08:00
Todd Kennedy
18bc3305e4 Revert "Move 'un/install' to cmd"
This reverts commit ec059d839de6d061085dcfd85ce6565dcf4d5b69.

Change-Id: Ieaa1373e96fb4cc20aa41c3159518bd9e86c572b
2015-11-09 15:36:43 +00:00
Todd Kennedy
ec059d839d Move 'un/install' to cmd
Move the implementation of the install variants and uninstall to the cmd
command. Additionally, make two other important changes: 1) replace calls
to the legacy PackageManager#installPackageAsUser with the PackageInstaller
2) allow streaming package bits for 'pm install'

Change-Id: Ia49dac0ccd6470f9d1c1964bdeb3c0b22b856075
2015-11-06 09:27:22 -08:00
Brian Carlstrom
ce8bf86d6d Merge "Fixes for sm and pm usage" am: ffb15da518 am: 671d5965f7
am: f73e78fe1c

* commit 'f73e78fe1cb6803a29f7f85b49792f4e8a7350c8':
  Fixes for sm and pm usage
2015-11-05 18:55:49 +00:00
Brian Carlstrom
82bfca4609 Fixes for sm and pm usage
sm showed IllegalArgumentException after usage.
pm inconsistently used "return showUsage()"

Bug: 20948199
Change-Id: I5828489a9d4ef2eabfb97dd408d66e1560a5a983
2015-11-05 10:33:40 -08:00
Todd Kennedy
60459abb21 Implement shell commands for package and user services
Only implement the 'list' package service command. More will follow
in future CLs.

Change-Id: Iae225cd4ee63c7d468a4fd882d8cb4b6b76ccc09
2015-11-02 16:19:50 -08:00
Xiaohui Chen
f5bf0de1aa clean up USER_OWNER in Pm command
Change-Id: I3092cdf1ca619b4c1ba881955b8a55b97ba10e24
2015-10-26 10:45:15 -07:00
Brian Carlstrom
80435a7fcd am bd5b6252: am b9a28ae1: am f916524f: Merge "Add support for --user to "pm path" for work profile use"
* commit 'bd5b6252a5dd068c2db30fbbd16e87a656047197':
  Add support for --user to "pm path" for work profile use
2015-10-15 16:16:07 +00:00
Brian Carlstrom
f916524f44 Merge "Add support for --user to "pm path" for work profile use" 2015-10-15 15:55:45 +00:00
Makoto Onuki
008b932d95 Fix "pm list permissions GROUP"
The command wasn't parsing a group name correctly.

Change-Id: I966e56e2f7b3eab2531be6bec8f744735b865910
2015-10-02 16:51:56 -07:00
Fyodor Kupolov
02cb6e773b Added --restricted option for create-user command
Also moved restricted profile create/setup logic from Settings to
UMS.createRestrictedProfile.

Bug: 24212155
Bug: 24303609
Change-Id: I0346a3368de53f4bb4b6e054349f19adac959d7f
2015-09-28 10:01:54 -07:00
Bart Sears
9249a90977 Revert "Added --restricted option for create-user command"
This reverts commit 737b216b5c28f7d7162f219136d4e8a9eb1a486b.

Change-Id: I4c43967933bb2e46cdb8ad6e643d7037d722cab2
2015-09-26 01:58:59 +00:00
Brian Carlstrom
f83612b295 Add support for --user to "pm path" for work profile use
Change-Id: Ic8bb923e15a40f32cc7daa6a344250abfc81e423
2015-09-25 13:08:35 -07:00
Fyodor Kupolov
737b216b5c Added --restricted option for create-user command
Also moved restricted profile create/setup logic from Settings to
UMS.createRestrictedProfile.

Bug: 24212155
Bug: 24303609
Change-Id: I5f0d48bcbd3c0b51927926b874fd057c15ac5219
2015-09-25 11:22:13 -07:00
Chris Tate
dcaf0eccb2 am 748dd873: am 8d662a07: am e49dcfed: am 9b7a4ac5: am e62421f1: Merge "Teach Pm about the "always ask" link-handling state" into mnc-dev
* commit '748dd8736fa15f426a5accb265141a6046aa2636':
  Teach Pm about the "always ask" link-handling state
2015-08-26 00:47:50 +00:00
Christopher Tate
47dd08d7fb Teach Pm about the "always ask" link-handling state
Bug 23511867

Change-Id: I74b3c8222a7d22541a96b698edd1a175d378e48f
2015-08-25 12:39:04 -07:00
Xiaohui Chen
2a5c3e59c8 pm: translate incoming user id for installation
Currently the pm install commands will not take virtual user id like
-2.  Adding this feature will make it easier to install packages in a
multi-user environment.

Bug: 19913735
Change-Id: I68b13cf8f2290158f0f4ec5c0966853719c2e80f
2015-08-24 11:00:14 -07:00
Chris Tate
848dd4bfc9 am 14e12258: am 13845aea: am b2d4c550: am b47890c4: am 7e7d79ef: Merge "Make "Ask every time" actually work that way" into mnc-dev
* commit '14e122582c45e236bf2e4c59d10438816f2eed09':
  Make "Ask every time" actually work that way
2015-08-14 17:44:39 +00:00
Christopher Tate
56f0ff3c48 Make "Ask every time" actually work that way
..in link-opening behavior.  If a candidate is marked as "ask
every time," then the user is guaranteed to get a disambiguation
prompt including that candidate even when some other candidate
app is in the "always prefer this over a browser" state.

Bug 23147746

Change-Id: I904d8697a992b3f16f32b1c1b49c2bf9424c7137
2015-08-13 18:56:05 -07:00
Xiaohui Chen
2ccf49e7f4 Clean up USER_OWNER references in am/pm commands.
Bug: 19913735
Change-Id: I9cd27dc037048f4e5e312c769fc59669a4abf3e3
2015-08-04 15:28:29 -07:00
David Stevens
6323fff7df Merge "Add cmd to reset default component enabled setting" 2015-07-23 23:50:52 +00:00
David Stevens
f6ec60dd1e Add cmd to reset default component enabled setting
Change-Id: Ice5e366643bb5c536b579089dcc98e06c9bb5645
2015-07-23 16:42:29 -07:00
Christopher Tate
387225ff01 Add 'pm' operation to set a package's app-linking state
Set an app's state:

  pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined}

Read an app's current state:

  pm get-app-link [--user USER_ID] PACKAGE

The latter prints to stdout one of the strings usable as an argument to
set-app-link.  If an error is encountered, the string printed to
stderr begins with "Error: ".

Bug 19628527

Change-Id: I68b6dc24445917807345a8cf5baa2078490740af
2015-07-20 17:45:17 -07:00
Jeff Sharkey
396080dd02 Add grant flag support to "install-create" verb.
This matches the "install" behavior.

Bug: 22331569
Change-Id: I07bfe067bd4be01fc92126750b0ff25a5c5ba5c9
2015-07-09 09:16:07 -07:00
Dianne Hackborn
ca8e6da41c Fix issue #22023824: Download folder is not created in internal storage
The media provider and some other things need to be given storage access.

Also, seems like we should give storage access to the camera app as well.

And add a dump dump command that will dump data about a particular
permission name.

Change-Id: Idaaa9bba2ff4dc95290cf6d17e5df933df91e909
2015-06-26 13:28:29 -07:00
Dianne Hackborn
a750a63d63 Fix issue #21814207 and issue #21814212 (alarm manager)
Issue #21814207: AlarmManager.setAndAllowWhileIdle should also allow wake locks.

Introduce a whole new infrastructure for providing options when
sending broadcasts, much like ActivityOptions.  There is a single
option right now, asking the activity manager to apply a tempory
whitelist to each receiver of the broadcast.

Issue #21814212: Need to allow configuration of alarm manager parameters

The various alarm manager timing configurations are not modifiable
through settings, much like DeviceIdleController.  Also did a few
tweaks in the existing DeviceIdleController impl.

Change-Id: Ifd01013185acc4de668617b1e46e78e30ebed041
2015-06-17 11:41:45 -07:00
Jeff Sharkey
ab2340996a Flags to select storage volume for app installs.
Remote callers can now provide the "--install-location" value from
the APK to help select a location, or they can explicitly force a
volume by UUID.

Bug: 21676789
Change-Id: Iefc92d770a851fc33e37edbf259fdb8df2b14ae5
2015-06-09 21:42:22 -07:00
Svet Ganov
4ccca50d7e Fix grant/revoke to act on owner by default and log invalid user id.
bug:21163229

Change-Id: I66d0cc130b37b5752ed06afc73259ed41bfb7830
2015-05-14 16:24:19 -07:00
Svet Ganov
8c7f700a59 Add permission meta-state flags to support grant/revoke permission policy.
We now maintain a mata-state with each permission in the form of flags
specyfying the policy for this permission. This enables support of the
following use cases:

1. The user denies a permission with prejudice in which case an app cannot
   request the permission at runtime. If an app requests such a permssion
   it gets a denial unless the user grants the permission from settings.

2. A legacy app with disabled app-ops being upgraded to support runtime
   permissions. The disabled app ops are converted to permission revocations.
   The app ops manager is a part of the activity manger which sits on top
   of the package manager, hence the latter cannot have a dependency on the
   former. To avoid this the package installer which is the global
   permission managment authority marks the permission as revoked on
   upgrade and the package manager revokes it on upgrade.

3. A device policy fixing a permission in a granted or revoked state. This
   additional information is folded in the meta-state flags and neither
   apps can request such permissions if revoked not the user can change
   the permission state in the UI.

Change-Id: I443e8a7bb94bfcb4ff6003d158e1408c26149811
2015-05-11 17:13:57 -07:00
Jeff Sharkey
275e3e43f2 Migrate primary external storage.
Wire up through MountService to call down into vold.  Watch for
unsolicited events that report progress, including special value "82"
that signals that copy has finished.  We use this value to persist
the volumeUuid in case of unexpected reboot, since it indicates the
new volume is ready.

Wire progress updates through existing callback pipeline.

Update the volume mounting code to match against the persisted UUID
when selecting the primary external storage.

Bug: 19993667
Change-Id: Id46957610fb43517bbfbc368f29b7d430664590d
2015-04-24 18:01:45 -07:00
Jeff Sharkey
620b32b316 Package and storage movement callbacks.
Since package and primary storage movement can take quite awhile,
we want to have SystemUI surface progress and allow the Settings
app to be torn down while the movement proceeds in the background.

Movement requests now return a unique ID that identifies an ongoing
operation, and interested parties can observe ongoing progress and
final status.  Internally, progress and status are overloaded so
the values 0-100 are progress, and any values outside that range
are terminal status.

Add explicit constants for special-cased volume UUIDs, and change
the APIs to accept VolumeInfo to reduce confusion.  Internally the
UUID value "null" means internal storage, and "primary_physical"
means the current primary physical volume.  These values are used
for both package and primary storage movement destinations.

Persist the current primary storage location in MountService
metadata, since it can be moved over time.

Surface disk scanned events with separate volume count so we can
determine when it's partitioned successfully.  Also send broadcast
to support TvSettings launching into adoption flow.

Bug: 19993667
Change-Id: Ic8a4034033c3cb3262023dba4a642efc6795af10
2015-04-23 20:32:17 -07:00
Jeff Sharkey
529f91fc8e Always send volume UUID with installd commands.
Since packages can be moved to other volumes, all relevant commands
to installd now require an explicit volume UUID parameter.

Bug: 20275577
Change-Id: Ie84f5bc43c7aada5800b8d71692c7928b42b965e
2015-04-18 21:11:58 -07:00
Benjamin Franz
39fb7fd730 Allow silent package install for device owner.
Allow the device owner to silently install and remove packages using the
PackageInstaller APIs. Show notifications to the user after the
installation / deletion was successful.

Bug: 19422461
Change-Id: I0506e18c510efd9d04c4aea9b60a37456e689615
2015-04-07 11:02:46 +01:00
Jeff Sharkey
b2b9ab8354 Installing packages to expanded storage.
PackageManager now offers to load/unload packages when expanded
volumes are mounted/unmounted.  Expanded storage volumes are still
treated as FLAG_EXTERNAL_STORAGE from a public API point-of-view,
but this change starts treating the INSTALL_EXTERNAL flag as
exclusively meaning ASEC containers.

Start tracking the UUID of the volume where a package is installed,
giving us a quick way to find relevant packages.  When resolving an
install location, look across all expanded volumes and pick the one
with the largest free space.  When upgrading an existing package,
continue preferring the existing volume.  PackageInstaller now knows
how to stage on these volumes.

Add new movePackage() variant that accepts a target volume UUID
as destination, it will eventually move data too.  Expose this
move command through "pm" command for testing.

Automount expanded volumes when they appear.

Bug: 19993667
Change-Id: I9ca2aa328b9977d34e8b3e153db4bea8b8d6f8e3
2015-04-06 21:17:58 -07:00
Amith Yamasani
3605fac80b Update command line usage for pm
Include the --user flag.

Change-Id: Id2a2bc73f4b7392e308c5946eeb42b21426a1bfd
2015-04-06 13:20:45 -07:00
Svet Ganov
95c1adea0c Add install option to grant all runtime permissions.
Change-Id: I72ba67a72025646a3d53611621b0353d3a86677c
2015-03-24 01:53:50 +00:00
Svetoslav
c6d1c345f4 Runtime permissions: per user permission tracking.
Before all permissions were granted at install time at once, so the user
was persented with an all or nothing choice. In the new runtime permissions
model all dangarous permissions (nomal are always granted and signature
one are granted if signatures match) are not granted at install time and
the app can request them as necessary at runtime.

Before, all granted permission to an app were identical for all users as
granting is performed at install time. However, the new runtime model
allows the same app running under two different users to have different
runtime permission grants. This change refactors the permissions book
keeping in the package manager to enable per user permission tracking.

The change also adds the app facing APIs for requesting runtime permissions.

Change-Id: Icbf2fc2ced15c42ca206c335996206bd1a4a4be5
2015-03-23 18:50:35 -07:00
John Spurlock
08c7116ab9 Remove unused imports in frameworks/base.
Change-Id: I031443de83f93eb57a98863001826671b18f3b17
2015-02-28 14:47:49 -05:00
Hui Shu
9bd1382f21 am e5cb6a25: am bb845152: Merge "pm path needs to return 0 when it succeeds." into lmp-mr1-dev
* commit 'e5cb6a253afa8faffb85c73779a78c74aead23ae':
  pm path needs to return 0 when it succeeds.
2015-01-05 22:20:28 +00:00
Narayan Kamath
1cc57aba81 am 1bafd01a: am 44a5a30a: Merge "Fix "pm list permissions" crash if resource string missing"
* commit '1bafd01a3fc5f94e77d1c18e5a7dcdecddcaa47f':
  Fix "pm list permissions" crash if resource string missing
2014-12-29 11:13:22 +00:00
Narayan Kamath
44a5a30a61 Merge "Fix "pm list permissions" crash if resource string missing" 2014-12-29 11:01:28 +00:00
Hui Shu
ac3151063e pm path needs to return 0 when it succeeds.
BUG: 18721587
Change-Id: I2136d1933e62a20645517d17c1365d214509de16
2014-12-12 14:06:01 -08:00
Evan Charlton
7c006199e5 Have Pm return the correct code
If the command fails, have Pm return a nonzero exit code.

Bug: 18085950
Change-Id: I3de1b8f69aa8f44b2e2109864c1aa093e3b82141
2014-10-31 12:45:25 -07:00
Esteban Talavera
41de9bb6fd Add 'adb dpm' subcommand to set profile owner
Required for GTS tests. Needed to relax the restriction that
only root user can run 'pm create-user' as GTS tests can't
get root permissions.

Bug: 17312478
Change-Id: I1841286ddf51756c73018c087a5f29afeb5b9f15
2014-09-16 10:24:58 +01:00
Jeff Sharkey
5ab6e0bac2 Whoops, wait around for pm result.
poll() returns immediately; we want to take() to wait for the result
to actually arrive.

Bug: 17510699
Change-Id: I87669e79e9941480fed33e4cc8a38de793d59e90
2014-09-15 14:50:41 -07:00