1383 Commits

Author SHA1 Message Date
Marco Nelissen
fa4362982c Merge "Broadcast an intent to mediascanner after executing screencap" 2014-09-22 14:34:03 +00:00
Esteban Talavera
c5bf65aa96 Merge "Make dpm command output more test friendly" into lmp-dev 2014-09-18 18:15:49 +00:00
Esteban Talavera
c48bca50fa Make dpm command output more test friendly
Added 'Success' at the beginning of the command output every time
it didn't fail, so that we can easily check the output in tests.
The command is brand new, only used by us on CTS tests, so this
shouldn't break anybody.

Bug: 17312478
Change-Id: Ie67bf5b2f44e658e7009e5bd87f8cb81be515584
2014-09-18 18:32:45 +01:00
Dianne Hackborn
88924b62fc Merge "Fix issue #17536024: The am start's wait option doesn't..." into lmp-dev 2014-09-17 23:07:17 +00:00
Dianne Hackborn
6cfbb71890 Fix issue #17536024: The am start's wait option doesn't...
...give time in some cases

This switch to multiple stacks broke the check to determine if it
should actually wait for a new activity to be shown.  The new check
now also requires that the top activity be resumed, which means
we may get some false positives where we decide to wait and shouldn't,
but that is better than consistently not deciding to wait in some
cases when we should.  (And we will always finish waiting then next
time something becomes visible).

Also add another time, which is how long it took from the startActivity
call to return with the result.  And fix when we decide to report that
we are done so that, in the case where we are bringing an existing
activity to the foreground, we don't wait until its animation is complete.

Change-Id: Id38ca0070f04e7bf8c73e131fb055808553a0e2f
2014-09-17 12:47:35 -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
8246e815ac Merge "Whoops, wait around for pm result." into lmp-dev 2014-09-15 22:55:53 +00: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
Esteban Talavera
9c17388cff Set device admin on dpm set-device-owner command
Bug: 17312478
Change-Id: I4ef730a97d603352eda77f04a2b00fa97c2be662
2014-09-15 11:42:34 +01:00
Jeff Sharkey
71ac935526 Merge "Bring install and install-multiple into parity." into lmp-dev 2014-09-12 18:16:52 +00:00
Esteban Talavera
d09fbafa92 Merge "Add new adb dpm (= DevicePolicyManager) command" into lmp-dev 2014-09-12 10:35:44 +00:00
Esteban Talavera
b5ef162129 Add new adb dpm (= DevicePolicyManager) command
Adds new adb command to execute DevicePolicyManager tasks. First subcommand
allows us to set a device owner on a provisioned device (provided no accounts
are associated with the device). This is required as GTS tests run on provisioned
devices. We plan to add more subcomands required for new GTS tests, such as the
ability to create a managed profile.

Bug: 17312478, 17316711
Change-Id: I2613178ea82a6c6268e7f8012e74c4a852fea0d4
2014-09-12 11:33:59 +01:00
Jeff Sharkey
e980804df1 Bring install and install-multiple into parity.
This ensures that both are using (almost) identical logic when
deciding what installs to proceed with.  Installs from "pm" for all
users now run as OWNER, and rely solely on INSTALL_ALL_USERS to
express intent.  This keeps install session notifications simple.

Since installer UID can vary from installer package name, start
persisting the UID.  Also parse some missing flags for install
sessions.

Bug: 17469392
Change-Id: I6d89b1a787aa2024cc4bebf6b9c29317c358e147
2014-09-11 21:24:00 -07:00
Jeff Brown
c46cd62b5c Merge "Clean entire arg block when setting process name." into lmp-dev 2014-09-11 22:28:43 +00:00
Jeff Brown
00c0cd4a24 Clean entire arg block when setting process name.
When Android processes fork from Zygote, we rewrite the command line
with a new name, eg. "system_server".  When we do this, we should
fill the entire block with zeros to remove corrupted argument
information that may otherwise remain in the /proc/<pid>/cmdline buffer
and be seen in tools and stack dumps.

Fixed an issue where VM options could be overwritten after setting
the nice name if the name was too long.

Bug: 17474152
Change-Id: Ie6cf9ed7752a04300a340e26cd6812bb35c59e1b
2014-09-11 14:19:52 -07:00
Amith Yamasani
f58e532e01 Merge "Apply cross-user restrictions to Shell" into lmp-dev 2014-09-11 16:46:34 +00:00
Amith Yamasani
8cd28b57ed Apply cross-user restrictions to Shell
Even though Shell user is allowed to perform cross-user actions,
lock that path down if the target user has restrictions imposed by
the profile owner device admin that prevents access via adb.

If the profile owner has imposed DISALLOW_DEBUGGING_FEATURES, don't
allow the shell user to make the following types of calls:
start activities, make service calls, access content providers,
send broadcasts, block/unblock packages, clear user data, etc.

Bug: 15086577
Change-Id: I9669fc165953076f786ed51cbc17d20d6fa995c3
2014-09-10 17:15:06 -07:00
Adam Lesinski
65e76d1200 Output recent configs in am get-config command
Change-Id: Ic516e73d2e72ac0dc3136f7226cedd851fe22b85
2014-09-10 15:02:59 -07:00
Amith Yamasani
dda003ffa8 Clean up apks installed for a removed user
When a user is removed, enumerate through all installed packages
to see if any of them are not installed for any user. Delete the
package if no user has it "installed".

Added a pm option to install an apk for a specific user.

Fixed a crash in UserManagerService when executing the above
cleanup - dying users generate a null UserInfo.

Bug: 15426024
Change-Id: I571decde1ae1c257d0da6db153b896aad6d6bcb4
2014-08-29 10:28:38 -07:00
Alex Light
55471dcd0f Change /dalvik-cache to be owned by root.
Bug: 16875245

(cherry picked from commit 79bf4007f559e194205f632b23d2bfb6f8d1e7ba)

Change-Id: I29a70215a2207bc4e0db02ab751d32a68edf4b66
2014-08-28 17:02:37 -07:00
Alex Light
79bf4007f5 Change /dalvik-cache to be owned by root.
Bug: 16875245

Change-Id: I29a70215a2207bc4e0db02ab751d32a68edf4b66
2014-08-28 11:34:50 -07:00
Jeff Hao
1b012d302b Add sample profiling option to am.
Also bundles all profiling options into a class.

Bug: 17040932
Change-Id: I85d675ee1494bdc7308caffdf94145d27c996e9d
2014-08-26 15:54:25 -07:00
Jeff Sharkey
941a8ba1a6 Installing splits into ASECs!
Sessions can now zero-copy data directly into pre-allocated ASEC
containers.  Then at commit time, we compute the total size of the
final app, including any inherited APKs and unpacked libraries, and
resize the container in one step.

This supports both brand new ASEC installs and inheriting from
existing ASEC installs.  To keep things simple, it currently requires
copying any inherited ASEC contents, but this could be optimized in
the future.

Expose new vold resize command, and allow read-write mounting of ASEC
containers.  Move native library extraction into the installer flow,
since it needs to happen before ASEC is sealed.  Move multiArch flag
into NativeLibraryHelper, instead of making everyone pass it
around.  Migrate size calculation to shared location.

Separate "other" package name in public API, provide a path to a
storage device when relevant, and add more docs.

Bug: 16514385
Change-Id: I06c6ce588d312ee7e64cce02733895d640b88456
2014-08-22 16:25:04 -07:00
Adam Lesinski
b5cf61be7c Add Shell command to set AppOps permissions
Change-Id: I6446543b27f0d2d2e69590a2807e713c6d5ccbbc
2014-08-19 11:27:19 -07:00
Jeff Sharkey
3e3b251f46 Merge "PackageInstaller API refactoring." into lmp-dev 2014-08-15 18:56:10 +00:00
Jeff Sharkey
a0907436c0 PackageInstaller API refactoring.
Switch to using IntentSender for results to give installers easier
lifecycle management.  Move param and info objects to inner classes.

Bug: 17008440
Change-Id: I944cfc580325ccc07acf22e0c681a5542d6abc43
2014-08-15 15:57:02 -07:00
RoboErik
78c64cdbd8 Fix crash in legacy apps that register without a looper
Some legacy apps registered their media button receiver in a thread
without a looper. If this happens we need to use the main looper to
prevent a crash.

bug: 16306226
Change-Id: Idf472e649393e2a7ce2a3e1cbb3476003ab17f34
2014-08-14 18:42:54 -07:00
RoboErik
b05ea7bb28 Merge "Add an onSessionDestroyed callback to MediaController.Callback" into lmp-dev 2014-08-14 16:10:21 +00:00
RoboErik
24762bffc3 Add an onSessionDestroyed callback to MediaController.Callback
Callbacks on the controller need to know when the session ceases
to exist.

bug:17009030
Change-Id: I0f1c1cfc51f7dd2203955287cc269667d3765ee4
2014-08-13 15:00:21 -07:00
Narayan Kamath
4903f64ba2 Persist the cpuAbiOverride setting.
If an app is installed with an ABI override (adb install -r --abi)
we should remember this so that we don't revert to the scan derived
ABI on the next reboot.

bug: 16476618

Change-Id: I6085bc0099eb613dd9d3b07113c7c13859780697
2014-08-13 12:41:19 +01:00
Jeff Sharkey
fbd0e9fa37 Surface user action events when un/installing.
This will be used shortly to connect up with permissions
confirmation UI.

Bug: 16515814
Change-Id: If28cecc28549900d960ac107a1fba0b10ce5bd7b
2014-08-07 00:23:54 +00:00
RoboErik
75847b98f3 Add display metadata and change strings to CharSequences
This adds some fields for display purposes to MediaMetadata and also
makes the default for all text CharSequence instead of String. Also
adds a hidden method for getting a Description for the metadata.

bug: 11708293
Change-Id: I0ed58d9ac3aeff41325c4ccf5fed0539bbf03b4d
2014-08-05 14:30:27 -07:00
Svetoslav
976e8bd201 Allow adding widgets from user profiles.
The goal of this change is to enable support for appwidget from
user profiles to the user main profile. A user profile is a user
which is associated as a child of the main user profile. For example,
a user may have a personal (parent) and corporate (child) profile.
The device policy should be able to control whether adding a widget
from a child profile and given packages is allowed. This change
assumes that all packages from managed profiles are white listed.
Another change will add the device policy changes.

Change-Id: I267260b55d74c48b112a29979a9f59eef7a8194e
2014-08-05 20:57:20 +00:00
Jeff Sharkey
1cb2d0d4bb Persist install sessions, more lifecycle.
To resume install sessions across device boots, persist session
details and read at boot.  Drop sessions older than 3 days, since
they're probably buggy installers.

Add session callback lifecycle around open/close to give home apps
details about active installs.  Also give them a well-known intent
to show session details.

Extend Session to list staged APKs and open them read-only, giving
installers a mechanism to verify delivered bits, for example using
MessageDigest, before committing.

Switch to generating random session IDs instead of sequential.

Defensively resize app icons if too large.  Reject runaway
installers when they have too many active sessions.

Bug: 16514389
Change-Id: I66c2266cb82fc72b1eb980a615566773f4290498
2014-07-31 15:17:03 -07:00
RoboErik
031149cd5f Add context to MediaController constructor
This also adds a convenience method to MediaSession to allow getting
a controller instead of having to create and cache your own.

bug:16561220
Change-Id: I87f551a7474e71f1cf2f07e0e541c3a4515cd977
2014-07-28 11:02:15 -07:00
RoboErik
aa4e23bbb3 Add getPackageName to MediaController
This removes the MediaSessionInfo class and adds a method on the
controller to get the package name. This also converts code that
depended on the session's UUID to use the token for comparison or
the Tag in the case of test code that needs a string identifier.

Change-Id: Icb8dc76c70e23e897da8fd07651c524b96372bf9
2014-07-25 16:22:59 -07:00
Jeff Sharkey
20e0c50f60 Offer force-dex-opt when running as root.
Recently we removed the PackageManager inotify triggers, meaning the
only supported ways of installing apps were:

-- adb install -r Foo.apk
-- adb shell stop && adb sync && adb shell start

Iterating on most system apps (like Settings) can use the first
approach, but it doesn't work for "persistent" processes like
SystemUI.  (ActivityManager is very particular about how it deals
with persistent apps, and it always sticks with the first
ApplicationInfo found at boot.)

So to enable rapid iteration on persistent apps, we now offer the
one missing piece of forcing a dexopt with a new pm force-dex-opt
command only available to -eng or -userdebug builds.  Typical use
for iterating on persistent apps now looks like this:

$ mmm frameworks/base/packages/SystemUI/ && adb sync &&
    adb shell pm force-dex-opt com.android.systemui &&
    adb shell kill `pid systemui`

Yay!

Change-Id: I0ae2467f1d7cda56c70ba20953cd25fa8ee766ff
2014-07-25 21:11:47 +00:00
Jeff Sharkey
16c8e3f494 PackageInstaller changes based on feedback.
Mostly cosmetic changes from API council feedback.

Bug: 16543552
Change-Id: Ic926829b3f77c31f50a899c59b779353daf00d59
2014-07-25 11:59:48 -07:00
Christopher Tate
b9583c9d93 Turn on debugging override of idle time
'adb shell am idle-maintenance' has traditionally been used to force
the system to consider itself to be in an "idle" state.  Unfortunately
the new Job Manager hadn't yet been aware of this.  Rectify the situation.

Also fixes a bug in debug logging that would cause a system server
crash under certain race circumstances.

Change-Id: I8a29bd7757924f8e464865235c344233fc03d8c3
2014-07-25 00:30:07 +00:00
Svet Ganov
be19c3a91a Adding shell commands for grant/revoke of bind app widget permisison.
Testing the app widget APIs requires binding of widgets which is guarded
by a system signature permission or white listing. Since CTS tests can
not be signed with the platform certificate, they should be able to
temporariliy white list their package. This command adds the ability to
grant and revoke the provilege to bind app widgets to a given package.

Change-Id: I6de1bbf27ac684ec47e61157f19ec6d29e2db979
2014-07-23 02:25:25 +00:00
Amith Yamasani
e5bcff624f Rename setApplicationBlocked to setApplicationHidden
This corrects the expected behavior of the app state. Hidden apps
can be installed by the store to be brought out of hidden state.

Bug: 16191518
Change-Id: Id128ce971ceee99ba1dea14ba07ce03bd8d77335
2014-07-21 22:18:40 +00:00
Jeff Sharkey
9a445771f5 Install sessions only inherit APK files.
Also track historical install sessions for debugging purposes.  Hide
signature verification API for now.  Clear code cache only after
killing the app being upgraded.

Bug: 14975160
Change-Id: I52fc7f11d2506f792236d8a365c8cfed21b46c30
2014-07-16 13:38:09 -07:00
RoboErik
8b4bffcac9 Make MediaSession and MediaController constructors public
This makes the MediaSession/Controller constructors public and registers
with the system behind the scenes.

This also adds a bit about needing to call setActive(true) to start receiving
commands in MediaSession's docs.

Change-Id: If882d229b54c36bf0831aca0255052dda667a2bc
2014-07-16 12:03:45 -07:00
Jeff Sharkey
69ea974f17 Merge "Public API for PackageInstaller!" into lmp-dev 2014-07-15 00:41:06 +00:00
Jeff Sharkey
6c833e07a0 Public API for PackageInstaller!
Flesh out documentation and finalize first cut of API.  Also surface
installLocation and splitNames through PackageInfo.

Bug: 14975160, 15348430
Change-Id: Ic27696d20ed06e508aa3526218e9cb20835af6a0
2014-07-14 23:06:52 -07:00
Jeff Sharkey
ad11eb52fe Pass install result message; path selection.
Oops, forgot to include message argument to invoke the new-style
callback.  Also use more robust way of generating cluster APK
directory names, and add more logging details on rename failure.

Change-Id: Ifa8abdd1db58b73e13b9a8077ec126cf20a0d90e
2014-07-14 10:57:04 -07:00
Jeff Brown
01a500ed1c Delete first draft of media routing APIs.
The new APIs will not be as tightly integrated into MediaSession.

Change-Id: I5cfd37d9d8d0c5d46c55edb5cf0772a8f1ef13ab
2014-07-14 04:06:44 -07:00
Jeff Sharkey
a103114347 Package installation listener events.
Flesh out implementation of install session observers.  Carve out 20%
of published install progress for final system operations such as
dexopt, etc.

Add dumpsys output for active install sessions.  Create explicit
fsync() instead of overriding meaning of flush().  Hack to throw
IOExceptions over Binder calls.

Bug: 14975160, 15348430
Change-Id: I874457e40c45d2661bc0a526df9285ffea4bb77c
2014-07-12 21:12:25 -07:00
Jeff Sharkey
bb58067035 Progress toward installer public API: callbacks.
Instead of surfacing all the existing cryptic error codes, we're
going to classify them into broad categories when surfacing through
public API.  This change introduces InstallResultCallback and
UninstallResultCallback, and wires them up to existing AIDL
interfaces.

Also start defining general SessionObserver for apps interested
in general progress details, such as Launcher apps.  Details about
active sessions are returned through new InstallSessionInfo objects.

Bug: 14975160
Change-Id: I068e2b0c30135f6340f59ae0fff93c321047f8f9
2014-07-11 16:54:49 -07:00
Jeff Sharkey
ec55ef0934 Extend pm to support sessions and split APKs.
Separate commands to create an install session, stream files into the
staging area, and then commit the install.  Streaming can accept data
from stdin across adb, avoiding extra copy from push.

Extend FileBridge to support blocking close().  Always destroy
session regardless of result.

Bug: 14975160
Change-Id: Ic3f462e7d1901079b785e210228950cdfa676466
2014-07-09 16:55:56 -07:00