Commit Graph

9961 Commits

Author SHA1 Message Date
Jeff Sharkey
9727f22fc0 Merge "Introduce RecoverableSecurityException." 2017-01-24 03:19:18 +00:00
Jason Parks
7a190b08fe Merge "Allow the profile owner to enforce auto time." 2017-01-24 02:46:29 +00:00
TreeHugger Robot
24454ca4b8 Merge "Add an 'am crash' shell command" 2017-01-24 01:25:12 +00:00
Jeff Sharkey
56f0368fb7 Introduce RecoverableSecurityException.
This takes advantage of the recently added behavior that offers to
send Parcelable exception types across Binder calls.

Certain SecurityException can be resolved if we involve the end user,
such as when a password has expired, or a user challenge is required
to proceed.  This new subclass of SecurityException provides
user-visible messaging and convenience methods for quickly rendering
that messaging as a notification or dialog.

Test: builds, boots, throws, shows as notification and dialog
Bug: 33749182
Change-Id: Iba66c7466b8fabca9e3f83c60db5a4ab849a256f
2017-01-23 17:23:17 -07:00
Dmitri Plotnikov
d11b9e77e4 Merge "Adding TvExtender channel override" 2017-01-24 00:07:42 +00:00
Dianne Hackborn
5f1a2a34d9 Merge "Optimize bg check flow." 2017-01-24 00:05:38 +00:00
Jason Parks
841cb0a37f Allow the profile owner to enforce auto time.
Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services

Change-Id: I1cb04cce5d232fba668535dd391459a050d62dd7
2017-01-23 17:32:53 -06:00
Adrian Roos
5304e89dfd Merge "KeyguardManager: Fix user resolution of isDeviceSecure/Locked" 2017-01-23 22:21:07 +00:00
Dianne Hackborn
c3af19a87d Optimize bg check flow.
No longer need to look up the application info, target SDK is
explicitly passed in to the check.  For the external method, we
change this to just checked to see if background is completely
disabled, which doesn't need a target SDK check (and is the only
thing any of the current clients care about).

Now allow SystemUI to put targets of notification pending intents
on the temporary whitelist when they fire, so developers can avoid
dealing with background restrictions in this case (if the user
interacts with their notification, they will temporarily be
considered in the foreground).

Remove any thoughts of enforing restrictions on registerReceiver(),
so we don't need to deal with target SDK versions there (which can't
be done all that efficiently).

Also bring back the old "allow starts coming from foreground apps"
only for the MODE_IGNORE app op, since it should provide some
better compatibility.

Test: ran them.

Change-Id: Id4ea7f992d12ce4bd8e54f1dbaeb4a460a3dee59
2017-01-23 14:18:33 -08:00
Adrian Roos
0b1853f997 KeyguardManager: Fix user resolution of isDeviceSecure/Locked
Fixes isDeviceSecure and isDeviceLocked APIs to use
the user id of the app that executes the code rather
than that of any incoming binder call.

Change-Id: Ib7772b60c35a3ebf96830f9b013c539021e1f063
Fixes: 34592592
Test: manual
2017-01-23 12:40:30 -08:00
TreeHugger Robot
1f42d9a6ec Merge "Fix recent checkPermission() bug." 2017-01-23 20:27:32 +00:00
Christopher Tate
8aa8fe1289 Add an 'am crash' shell command
Induce a normal VM crash via adb, because it's quite different from the
effects of 'am kill'.

Test: induced crashes via adb shell using both pid & pkg

Change-Id: I79654afa7c4a70364cfd7d3af3e80a7b0e59b882
2017-01-23 20:18:45 +00:00
TreeHugger Robot
4a65687b85 Merge "Expose fonts.xml via public API with a service" 2017-01-23 19:57:23 +00:00
Jeff Sharkey
d69b083bc3 Fix recent checkPermission() bug.
It should be checking if the UID argument passed in has the requested
permission; not the calling UID.

Test: builds, boots
Bug: 34528367
Change-Id: Ie1828f571d9f143ce9f5bdca2eedcf2fa6ccfd79
2017-01-23 11:37:27 -07:00
Clara Bayarri
04d72abde1 Expose fonts.xml via public API with a service
This change creates a new FontManagerService, in charge of providing
font management data. It exposes a public API to retrieve the
information in fonts.xml without accessing it directly. To do this,
it also refactors FontListParser's internal classes into a new public
FontConfig class holding all the font data.

getSystemFonts() returns all the available information in fonts.xml
as well as file descriptors for all the fonts. This allows us to
share the memory consumed by these files between all clients.

Bug: 34190490
Test: See attached CTS change in topic
Change-Id: I0e922f8bcc9a197a1988d04071eb485328d66fb7
2017-01-23 15:02:23 +00:00
Charles He
dea0c3b654 DPM: Notify DO/PO of security updates.
We add a variant of notifyPendingSystemUpdate method which takes an
additional isSecurityPatch boolean flag. This information, if available,
will be persisted and available to device and profile owners when they
call getPendingSystemUpdate method.

Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.devicepolicy.DeviceOwnerTest#testPendingSystemUpdate
Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.devicepolicy.ManagedProfileTest#testPendingSystemUpdate
Bug: 33102479
Bug: 30961046
Change-Id: If3f1b765bb18a359836ac43ac9a0a9f29e9f8428
2017-01-23 09:38:49 +00:00
Svet Ganov
6788212d17 Platform support for static shared libraries
This change adds support for static shared libraries that
emulate static linking allowing apps that statically link
against the same library version to share a common
implementation. A library is hosed by a package in a standard
APK.

Static shared libraries have a name and a version declared
by a dedicated manifest tag. A client uses also a new tag
to refer to the static library it uses by specifying the
lib name, version, and the hash of the signing certificate.
This allows two apps to rely on two different library versions
and prevents impersonation of the shared library by a side-loaded
app with the same package name.

Internally apps providing static libs use synthetic package
name generated from the manifest package name and the library
version. This allows having different "versions" of the same
package installed at the same time.

An application cannot be installed if a static shared lib it
depends on is missing. A used shared library cannot be uninstalled.
Shared libraries can rotate certificates like normal apps. The
versions of these libs should be ordered similarly to the version
codes of the hosting package. Such libs cannot use shared user
id, cannot be ephemeral, cannot declare other libraries, cannot
rename their package, cannot declare child-packages. They must
target O SDK. Also they cannot be suspended or hidden or their
uninstall blocked. Generally, speaking policy regarding code in
static shared libs should be applied to the packages using the
library as it could have just statically linked the code.

We now have APIs to query information about the shared libraries
on the device in general. To clients static shared libraries are
presented as multiple versions of the same package which is how
they are declared and published. Therefore, one can have two
versions of the same package which means we need way to query
for and uninstall a specific version of a package. Also static
shared libs can depend on other static shared libs which are
versioned packages. To ease representation we add the concept
of a versioned package which should be used in the case of
static shared libs.

A client can see only the static shared libs it depends on and
more specifically only the versions it depends would be retrieved
by using the standard package manager APIs. There is a new
dedicated API to get info about all shared libraries which
would provide data about all static shared lib versions. Also
these libraries must use v2 signing scheme.

Test: CTS tests pass

bug:30974070

Change-Id: I4f3d537ee7a81f880950377b996e1d9d4813da5c
2017-01-22 14:05:15 -08:00
TreeHugger Robot
5feefa54c4 Merge "Introduce RescueParty." 2017-01-21 02:22:43 +00:00
Zac Iqbal
655f908aa6 Merge "Added an onDeviceUnlockLockout callback to TrustAgentService." 2017-01-21 01:35:43 +00:00
Jeff Sharkey
fe6f85cac9 Introduce RescueParty.
When a device gets stuck in a crash loop, it's pretty much unusable
and impossible for users to recover from.

To help rescue devices from this state, this change introduces a new
feature that watches for runtime restart loops and persistent app
crash loops, and escalates through a series of increasingly
aggressive rescue operations.  Currently these rescue levels walk
through clearing any experiments in SettingsProvider before finally
rebooting and prompting the user to wipe data.

Crash loops are detected based on a number of events in a specific
window of time.  App stats can be stored in memory, but boot stats
need to be stored in system properties to be more robust.

Start up RecoveryService much earlier during the boot so we can
reboot into recovery when needed.

Add properties tha push system_server or SystemUI into a crash loops
for testing purposes.

Test: builds, boots, forced crashing walks through modes
Bug: 24872457, 30951331
Change-Id: I6cdd37682973fe18de0f08521e88f70ee7d7728b
2017-01-20 17:36:38 -07:00
TreeHugger Robot
961405613c Merge "Updating picture-in-picture API." 2017-01-21 00:29:23 +00:00
David Ouyang
618fb8b194 Merge "Promote DevicePolicyManager.packageHasActiveAdmins for Play Store" 2017-01-21 00:28:17 +00:00
Zachary Iqbal
327323d2b3 Added an onDeviceUnlockLockout callback to TrustAgentService.
Test: Manually tested onDeviceUnlockLockout being called with an actual
TestAgentService implementation.

Notes:
- Active Trust Agents are no longer killed/unbinded from when a temporary
  device lockout occurs. Instead, the onDeviceUnlockLockout callback of
  the agent is called.

Change-Id: Ifa0984d1d7e5153568334d736e9ebd5a00ef1297
Bug: 34198873
2017-01-20 15:55:07 -08:00
Dmitri Plotnikov
b8a04eee40 Adding TvExtender channel override
The rationale is that the notification importance on TV doesn't
always align with their importance on other devices.
Thus we need the ability to post notification to different
channels just on TV.

Test: ag/1808384
Change-Id: I90a84e3f74d59ca45dac3c6414285bed26482008
2017-01-20 15:45:09 -08:00
Dianne Hackborn
85e35643ba Improve behavior of bg check.
There is a new APP_START_MODE_DELAYED_RIGID which means that
things discovering something is not allowed to start should
report a clear error back to the caller.  This is how apps
that opt in to bg check should behave, and will now
be used if the app op mode is set to ERRORED.

This (for now?) removes the code that allows services to
be started if the request is coming from a foreground process.
That behavior isn't in the current bg check spec, and
probably not what we want as the standard platform model (since
it makes knowing when a service can start even harder to
determine).  It was originally done for the experimental
bg check work in N to see how much we could avoid
breaking existing apps, so not relevant when apps need to
explicitly opt in.

Also report temporary whitelist changes to activity manager for
it to lift background restrictions temporarily for apps.  Being
on the whitelist is now part of UidRecord, preventing a uid from
going idle.

Test: Initial CTS test added.

Change-Id: I36fd906fa69de8b7ff360605ae17c088f182e172
2017-01-20 15:03:41 -08:00
Michal Karpinski
61238c2d13 Merge "Unhide enabling backup service in DO APIs" 2017-01-20 17:12:21 +00:00
Julia Reynolds
99695b0fc9 Merge "Save deleted channels." 2017-01-20 14:30:20 +00:00
Suprabh Shukla
2f34b1a678 Adding app op and intent action for external sources
Added an app op to control which package and uid can install apps on the
device and an intent action to launch the settings fragment.

Test: Will include in follow up CL, tracked in b/33792674

Bug: 31002700
Change-Id: Ic073495759d9867f8001a6c712e402398c53dfc9
2017-01-20 02:39:08 -08:00
TreeHugger Robot
4c0659f531 Merge "Enable background restrictions" 2017-01-20 02:55:30 +00:00
Winson Chung
c2baac059c Updating picture-in-picture API.
- Consolidating to enterPictureInPictureMode(), the new method will
  attempt to put the activity into picture-in-picture mode if the
  activity is visible or pausing in a state that would allow us to
  pip it.  Also consolidate the setting of the PiP aspect ratio and
  actions into setPictureInPictureArgs().
- Fixing issue with onPause not completing when moving the
  paused activity between stacks while dispatching onPause

Bug: 33692987
Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: I3af2365f31a9b95de4a92eae46b77108947b2a49
2017-01-19 18:07:46 -08:00
TreeHugger Robot
5bb4c96d43 Merge "ActivityThread: Only update code paths that have been added" 2017-01-20 01:59:18 +00:00
TreeHugger Robot
d48fed9b55 Merge "Rename View.setTooltip/getTooltip to setTooltipText/getTooltipText" 2017-01-20 01:07:20 +00:00
TreeHugger Robot
54df14956e Merge "Disable moving 3rd party apps to internal if not allowed." 2017-01-20 00:57:36 +00:00
Christopher Tate
42a386b771 Enable background restrictions
Apps that target O+ are always subject to background restrictions.
Legacy apps' background restriction is subject to the OP_RUN_IN_BACKGROUND
app op.

Apps with these properties are exempted from background restrictions:
  - persistent process
  - currently on the idle battery whitelist
  - global whitelist for things like bluetooth services

Bug 30953212

Change-Id: Icc19b2fbc05f40dcf8c3fc4abf718c373dc8d4f6
2017-01-19 16:23:02 -08:00
Adam Lesinski
d33ef56651 ActivityThread: Only update code paths that have been added
When an ApplicationInfo object is updated and we want to update
code paths without restarting the app's process, we need to make
sure that we only update the paths that have changed. This means
diffing between the old paths and the new paths.

Test: watch /proc/<pid>/maps for dex entries before and after
      running adb exec-out am update-appinfos all <package>
Change-Id: I6855d860478ade3184bbb578a5483d8548396daa
2017-01-19 16:17:46 -08:00
Sudheer Shanka
513dc5417f Merge "Add new api Instrumentation.ActivityMonitor.onMatchIntent." 2017-01-20 00:15:14 +00:00
Shreyas Basarge
6fbd65aa1a Merge "Non incremental backup flag for requestBackup" 2017-01-19 23:44:18 +00:00
Yao Chen
022b8eaa1d Disable moving 3rd party apps to internal if not allowed.
ag/1633903 added config_allow3rdPartyAppOnInternal flag to specify
whether 3rd party apps are allowed on internal storage. We need to
respect the flag when moving apps between storages.

Bug: 30980219

Test: Added ApplicationPackageManagertest

Change-Id: I0f8e76467b5071d70f40da28c2087e689c049c06
2017-01-19 15:32:41 -08:00
Shreyas Basarge
38e7486d38 Non incremental backup flag for requestBackup
This cl adds a new requestBackup API to
BackupManager that takes in an int flag
to indicate whether the caller wants the
entire key value set to be passed to the
transport and not just a diff.

Change-Id: Ia225797a58c4431fe742f2f116b257d006b30cd1

Bug: 33749084
Ref: go/request-backup-api-changes
Test: GTS Test at ag/1774002
2017-01-19 22:13:01 +00:00
Winson Chung
a0ad738594 Merge changes Iabb33606,I3c364ebe
* changes:
  Falling back to media session controls.
  Move activity to fullscreen stack when it is relaunched in PIP.
2017-01-19 20:50:48 +00:00
Vladislav Kaznacheev
6a944ca175 Rename View.setTooltip/getTooltip to setTooltipText/getTooltipText
Bug: 34454987
Test: android.view.cts.TooltipTest
Change-Id: I7203d5c61804b79584ba8449643c6c0f27a90747
2017-01-19 11:12:53 -08:00
Adam Lesinski
8f3b174d90 Merge "Teach apps to refresh AppInfos without restarting" 2017-01-19 18:30:43 +00:00
Michal Karpinski
b71fedc494 Unhide enabling backup service in DO APIs
Bug: 28628532
Change-Id: I5940735994c7e63fae86549fedcf138ad12151cd
2017-01-19 17:49:51 +00:00
Winson Chung
3535df26e3 Move activity to fullscreen stack when it is relaunched in PIP.
- Only happens when the caller is not from the same package.

Bug: 33754261
Test: Open a PIP activity, try to launch it again from launcher
Change-Id: I3c364ebe31a7626b9133d9c4c1fafc718c2eecf9
2017-01-19 09:12:30 -08:00
Pavel Grafov
b271f34625 Merge "Store pending OTA state and make it accessible via polling api." 2017-01-19 11:09:32 +00:00
Felipe Leme
dfd119615e Fixed enhanced for loop.
It was trying to interact through null, which could throw an exception. Example:

01-18 18:28:12.609   862  2038 W Binder  : Binder call failed.
01-18 18:28:12.609   862  2038 W Binder  : java.lang.NullPointerException: Attempt to get length of null array
01-18 18:28:12.609   862  2038 W Binder  : 	at android.app.Notification$Action$Builder.build(Notification.java:1289)

Test: manual verification
Change-Id: I84fda80ebd12df7d90730b17fa77d4b9ce5f58d2
2017-01-18 18:38:46 -08:00
Chris Tate
9e83cbbc10 Revert "Enable background restrictions"
This reverts commit 21f778060b.

Change-Id: I65586f9739da84fb32b51b0ea166b8288c41d1b3
2017-01-19 01:12:19 +00:00
Shane Brennan
57bf4ea479 Merge "Add support for audio-focused notifications." 2017-01-19 00:12:09 +00:00
Jason Monk
9cfbe9573e Merge "Allow FragmentContainer to play a role in fragment construction" 2017-01-18 23:58:38 +00:00
TreeHugger Robot
155873057f Merge "Enable background restrictions" 2017-01-18 22:32:17 +00:00