1314 Commits

Author SHA1 Message Date
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
Jeff Sharkey
513a074de6 Clean up IPackageManager install surface area.
Also more removal of encryption support.

Change-Id: If525dc5a8422134515f225a8ac4731e968069468
2014-07-08 17:41:29 -07:00
Mike Reed
42a1d08df7 SkBitmap::Config is deprecated, use SkColorType
Change-Id: Ida181d2aac760072cf2d01409edac37699dea216
2014-07-07 18:11:24 -04:00
Christopher Tate
ab225b301b Add 'fullbackup' to bmgr's usage statement
Also make it handle the list of packages to be backed up as a single
multiple-app argument to fullTransportBackup() rather than N calls
each backing up one app.

Change-Id: I9fe4d5caca54fafef70ffe9af4c26e3941dc5d26
2014-06-24 16:52:09 -07:00
Mike Reed
b933055cf3 stop using (deprecated) SkBitmap::Config
Change-Id: Ic75b5fc6996578e9d95bd3a220439ec1541d7c3b
2014-06-20 10:28:37 -04:00
Denver Coneybeare
bf8b57af35 Fix "pm list permissions" crash if resource string missing
The "pm list permissions" command lists detailed information about
each permission on the system, including its label and description,
both of which can be stored as translatable resource strings in APK
files.  However, it is possible that the resource identifiers for
these strings point to non-existent resources.  When this happens, the
loadText() method throws Resources.NotFoundException, causing the "pm"
command to abort prematurely, simply printing "Killed" to stdout and
a stack trace to logcat.

This commit fixes the crash by explicitly catching the
Resources.NotFoundException exception in loadText() and returning null
if it is thrown.  The loadText() method already has the potential to
return null so none of its callers need be modified.  This fixes the
crash and simply shows "label:null" and/or "description:null" in the
output if the string resource is missing.

Change-Id: I92273399e1dac6029163750d004940ee1da67428
2014-06-18 19:50:51 +00:00
RoboErik
d3c8642dae Remove some more old code and fix Media command
Removes some more hidden apis from AudioService/Manager. This also
fixes up Media.java to support commands for the new service to help
with debugging. Also fixes a couple bugs that were found while fixing
up Media.

Change-Id: I68e4aa80a4de430b98236aafc883664b9432c62b
2014-06-19 10:37:00 -07:00
Adam Lesinski
f90f2f8dc3 Support multiple resource tables with same package
In order to support APK split features, the resource
table needs to support loading multiple resource
tables with the same package but potentially new set
of type IDs.

This adds some complexity as the type ID space changes
from dense and ordered to potentially sparse.

A ByteBucketArray is used to store the type IDs in
a memory efficient way that allows for fast retrieval.

In addition, the IDMAP format has changed. We no longer
need random access to the type data, since we store the
types differently. However, random access to entries of
a given type is still required.

Change-Id: If6f5be680b405b368941d9c1f2b5d2ddca964160
2014-06-18 19:20:08 +00:00
Jeff Sharkey
8a4c9721a9 Plumb split APKs into public API.
Introduces new ApplicationInfo fields to surface zero or more split
APKs for an application.  Splice these APKs into both the class
loader and resource system.  Cleaner building of these paths.

Run dexopt() on all split APKs found after a parse, and populate
into ApplicationInfo.

Change-Id: I4a376bf4492d84ea95aafa866e106ea43a43e492
2014-06-17 14:38:44 -07:00
Adam Lesinski
afc00e1c81 Change am get-config command to use ABI string array
There is a list of supported ABIs in android.os.Build which
is ordered by preference. This is a more flexible list to use
instead of 2 fixed ABIs.

Change-Id: I6aa3b39b5ffa888ed83a870b937e18328dd6de39
2014-06-17 20:27:39 +00:00
Adam Lesinski
2c749d2427 New command to get device config
Change-Id: I7172a3a150fd83e2382ca3e4e4a0188758189f14
2014-06-16 23:01:19 +00:00
Umair Khan
cfed2326c7 Broadcast an intent to mediascanner after executing screencap
PS2: Fix for spaces in file names

After doing screencap /sdcard/test.png in shell the screenshot is captured
but the gallery is not updated.
So we should broadcast the intent android.intent.action.MEDIA_SCANNER_SCAN_FILE
for the image to show up in gallery.

Change-Id: I8e384865082c717842d70d376d5828d74a2ad780
Signed-off-by: Umair Khan <omerjerk@gmail.com>
2014-06-12 17:44:12 +05:30
Christopher Tate
9ff53a7100 Implement full data backup through transport
Currently no timed/scheduled full-data backup operations are
performed by the OS, but the plumbing is now in place and can
be tested using 'adb shell bmgr fullbackup pkg [pkg2 pkg3 ...]'.

The LocalTransport test transport implementation has been augmented
to support the new full-data backup API as well.

In addition, 'adb backup' now takes the -compress/-nocompress
command line options to control whether the resulting archive is
compressed before leaving the device.  Previously the archive was
always compressed.  (The default is still to compress, as it will
usually reduce the archive size considerably.)

Internally, the core implementation of gathering the full backup
data stream from the target application has been refactored into
an "engine" component that is shared by both 'adb backup' and the
transport-oriented full backup task.  The archive file header
generation, encryption, and compression logic are now factored out
of the engine itself instead of being hardwired into the data
handling.

Bug 15329632

Change-Id: I4a044faa4070d684ef457bd3e11771198cdf557c
2014-06-15 17:35:33 -07:00
Dianne Hackborn
439688cf39 am 6d758619: Merge "Implement control of auto power save mode." into lmp-preview-dev
* commit '6d758619d90a0dda7f1136dcd44d0ac02cdada7e':
  Implement control of auto power save mode.
2014-06-12 00:03:55 +00:00
Dianne Hackborn
14272302a8 Implement control of auto power save mode.
Follow the setting for auto power save mode in both
battery service and battery UI.  Default level is 15 when
setting is not set; otherwise it is whatever the setting
gives, with 0 meaning auto battery save is off.

Change how we define the "turn off warn" level to be
an adjustment from the warn level, so we can have a good
value for whatever auto setting is set.

Fix power manager to never go in to power save mode when
plugged in, even if the user has manually turned it on.

Add new delete option to settings command, because I needed
it for testing.

Change-Id: I512b691df84399d50b8e751fd50732c6093ebe85
2014-06-11 10:34:26 -07:00
Narayan Kamath
dad8f819a7 Merge "Add an --abi argument to "pm install"" 2014-06-03 12:01:53 +00:00
Narayan Kamath
116bdbd823 Add an --abi argument to "pm install"
This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

bug: 14453227

(cherry picked from commit 6431d11cd420536aaa9d93ae510a3151ccc4df1d)

Change-Id: I85d4f8785deea02a6a4d3cb0b05e6ef8bf64826b
2014-06-03 11:35:49 +01:00
Narayan Kamath
6431d11cd4 Add an --abi argument to "pm install"
This allows callers to force an install to a particular
ABI. This is intended only for testing (and CTS) and is
not meant for usage by the installer package.

Change-Id: Icb1528c0cd35b1aa9323386cb35ff4aaba374fcb
2014-06-03 11:11:47 +01:00
Jeff Sharkey
d8e9050e22 Merge "Read data from stdin/stdout to follow adb change." 2014-06-02 17:44:47 +00:00
Narayan Kamath
dfed4bc99f am f7871c31: am b9b31f4b: am bd4d3203: Merge "Support an ABI flag for instrumentation."
* commit 'f7871c31469c6245c1b232a15104704f7481103c':
  Support an ABI flag for instrumentation.
2014-05-30 11:51:03 +00:00