Commit Graph

4819 Commits

Author SHA1 Message Date
John Reck
f32adf4475 Clean up ApplyStyle JNI
Bug: 32573798

Mark input uint32_t[] as const. Use Read-only JNI
array access for input as it's faster than critical access.

Use non-movable arrays for TypedArray so that the address can
be resolved and stored, avoiding the need to do JNI array
access for the output.

Indicies is always non-null, so remove the optional checks.

Eliminate unused return value.

Benchmark results:
twelveKeyInflate 4963us -> 4713us
simpleViewInflate 73us -> 60us

Test: Device boots, benchmarks show faster

Change-Id: Ic3bde5aee31407d8903913f97f2218daf074499a
2016-12-02 12:49:20 -08:00
Makoto Onuki
5436546589 Merge "ShortcutManager: Floating shortcuts shouldn't have target activities." 2016-12-02 16:34:59 +00:00
TreeHugger Robot
e8c963984f Merge "Disallow sharedUserId in Ephemeral apps" 2016-12-02 02:01:16 +00:00
Chad Brubaker
32d07dce7a Disallow sharedUserId in Ephemeral apps
Test: adb install --ephemeral apk fails with a shareduid defined
Change-Id: I2e03d89b983b99e35ea799618f6830b309c09b49
2016-12-01 16:17:40 -08:00
Makoto Onuki
106ff7a0a1 ShortcutManager: Floating shortcuts shouldn't have target activities.
Previously, even floating shortcuts (pinned but not dynamic nor
manifest) had target activities.  Now we're going to allow headless
apps to have pinned shortcuts, in which cases shortcuts won't have
target activities, let's just always remove target activities
from floating shortcuts.

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to Test8.

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutManagerTestCases
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases

Change-Id: I10e5b87338cafb90e6566b3526f892c5330c73e9
2016-12-01 23:09:52 +00:00
Jeff Sharkey
fb833f38a0 Detect content:// leaving apps without grants.
Developers regularly put content:// Uris into Intents, but they can
easily forget to add FLAG_GRANT_READ_URI_PERMISSION to actually
extend a permission grant to the receiving app.

Also fix NPE when path is missing.

Test: builds, boots, common actions work without triggering
Bug: 32447617, 31900890
Change-Id: Ic6054b1d73de50967cf7fe66abc293c60a41b97e
2016-12-01 15:01:19 -07:00
Amith Yamasani
0d1fd8d091 Secure MATCH_UNINSTALLED_PACKAGES across users
Introduce a new internal flag MATCH_ANY_USER for genuine uses
of searching through all apps on the device.

Some temporary accommodations for Launchers that reach across
to the work profile until we have a new LauncherApps API to do
that officially.

Bug: 31000380
Test: CTS tests added
Change-Id: I2e43dc49d6c2e11814a8f8d1eb07ef557f31af34
2016-11-30 13:24:53 -08:00
Kenny Guy
02c8990bd6 Allow overriding max profile in debugable builds.
Support a system property on debugable builds to
override the max number of managed profiles to
allow easier dogfooding of multiple profiles.
Support 3 different badge colours for managed profiles.

Bug: 30473760
Test: runtest -c com.android.server.pm.UserManagerServiceCreateProfileTest frameworks-services
Test: runtest -c com.android.server.pm.UserManagerServiceUserInfoTest frameworks-services
Test: manual - attempting to create 2 profiles with adb fails, passes once I set the property.
Change-Id: Ie7fb19048a04a01572666f229283152254d0ffc3
2016-11-29 14:09:37 +00:00
Neil Fuller
3dfca02da4 Merge "Change EXTRA_TIME_PREF_24_HOUR_FORMAT from boolean to int" 2016-11-22 11:55:27 +00:00
Ian Pedowitz
4fe2517732 Revert "Lists returned from OS aren't mutable."
This reverts commit 97449fa389.

Bug: 33034458
Bug: 33032977
Bug: 27856974
Change-Id: If913e587ce4a48b9ed1c7c0a811bc39ce4e31d3c
2016-11-21 15:09:54 +00:00
Neil Fuller
b7146fec0d Change EXTRA_TIME_PREF_24_HOUR_FORMAT from boolean to int
... on Intent.ACTION_TIME_CHANGED.

This is to better represent the possible settings values for
the "use 24 hour format" setting. These are "12" (use 12 hour
formatting), "24" (use 24 hour formatting), unset
(use locale default formatting).

The EXTRA_TIME_PREF_24_HOUR_FORMAT for the ACTION_TIME_CHANGED
is now an int, not a boolean. 0 means "12", 1 means "24" and
2 means "use locale default". This is not a backwards compatible
change but the EXTRA_TIME_PREF_24_HOUR_FORMAT is not public
and so should only affect platform code that generates or
consumes the intent like settings code.

There are associated changes to Settings code to update the source
of the Intent.

The related underlying code that is triggered in response to the
intent and previously assumed a boolean now takes a Boolean.

Other changes:

The ActivityManagerService now only sends a binder notification
to running services if the EXTRA_TIME_PREF_24_HOUR_FORMAT
is present. There is an example of ACTION_TIME_CHANGED
being sent from the platform (AlarmManagerService, when the system
clock is noticed to have changed independently of the RTC) that
does not set the extra and would previously have misinterpreted
to mean "user wants 12 hour formatting", which would have been a
bug.

i.e. the code from ActivityManagerService that would interpret the
missing extra as false:

final int is24Hour =
        intent.getBooleanExtra(
                Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 : 0;

Some methods and constants have be renamed to better reflect their
use.

Bug: 32761619
Bug: 32933009
Test: Manual testing
Change-Id: Ie7e9c62ce65e7e3a056b2751b45fe6cb9de86498
2016-11-21 12:22:32 +00:00
Jeff Sharkey
97449fa389 Lists returned from OS aren't mutable.
Data returned via ParceledListSlice is a snapshot of data from the
system, and should not be mutated directly.

In particular, this can cause developer confusion if they call
Collection.remove(), which doesn't actually mutate the value in the
system.  There are other mutation APIs that developers should be
using instead, such as JobScheduler.cancel().

Test: builds, boots, common operations work
Bug: 27856974
Change-Id: I72528dee4d79e483aa295bd91d1ed80d0d72d21c
2016-11-18 11:06:06 -07:00
Bartosz Fabianowski
1133424c2b Wire up PM.getInstalledApplicationsAsUser(flags, userId) as hidden API
Settings needs to access a variant of getInstalledApplications() which
takes a |userId| argument. Since this is not currently exposed by
PackageManager, Settings calls into PackageManagerService directly. This
is ugly and breaks the regular abstraction layer hierarchy.

The CL fixes the problem by exposing the required variant of
getInstalledApplications() as a hidden API, analogously to what was done
before with getInstalledPackages().

Bug: 32692748
Test: Will be CTS-verifier-tested together with Settings
Change-Id: Id9c4e8e18524d312159821f1a4d5527263c7e950
2016-11-17 20:49:16 +01:00
Todd Kennedy
3e12f413d4 Merge "Implement 2-phase resolution" 2016-11-16 23:05:34 +00:00
TreeHugger Robot
2eb0a8b4d5 Merge "Fixing typo in method comment." 2016-11-16 22:31:56 +00:00
Chad Brubaker
da153f5af4 Merge "Shift ApplicationInfo private flags" 2016-11-16 21:46:23 +00:00
Kweku Adams
86f39a4287 Fixing typo in method comment.
Test: none

Change-Id: I5583e4de17da0ddd28b12ee879b27a24734906fb
2016-11-16 21:01:27 +00:00
Jeff Sharkey
f2f406cade Merge "Treat everyone the same, redux." 2016-11-16 17:58:24 +00:00
TreeHugger Robot
26c48fac73 Merge changes I99813278,I6285042b
* changes:
  Fix copypasta error.
  Aggressively clear cached data when forgetting.
2016-11-16 03:21:17 +00:00
Jeff Sharkey
13deeafe46 Treat everyone the same, redux.
Test: builds
Bug: 29746499
Change-Id: Id2a9aacf0db40cdd053d203897e792662c6d3cd0
2016-11-16 01:12:13 +00:00
Jeff Sharkey
a3a43b09fe Fix copypasta error.
Test: builds
Bug: 29087651
Change-Id: I99813278bc37fa332730144f821b33ae6bd35650
2016-11-15 17:54:23 -07:00
Sudheer Shanka
bae5ca1490 Merge "Rename MountService to StorageManagerService." 2016-11-15 23:34:15 +00:00
TreeHugger Robot
c67b49af3f Merge "Javadoc and un@hide ContentResolver#refresh and ContentProvider#refresh." 2016-11-15 21:11:07 +00:00
Sudheer Shanka
2250d56a0b Rename MountService to StorageManagerService.
Bug: 30977067
Test: Existing tests pass
Change-Id: Ieac0f11c2b249dcd60441b14c1f391e6f8131d42
2016-11-15 12:43:37 -08:00
Todd Kennedy
01ad0c7e40 Implement 2-phase resolution
Bug: 25119046
Test: build & install the sample resolver and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: I624b9028061aad35db80e0d51bfe0a39fb81806c
2016-11-14 15:05:21 -08:00
Ben Lin
2b64a88274 Javadoc and un@hide ContentResolver#refresh and ContentProvider#refresh.
Test: CTS Tests part of same topic.

Bug: 31647485
Change-Id: Iad7f19b6b54f72736fbb7e477f67cf541d838903
2016-11-14 14:30:59 -08:00
Sudheer Shanka
dc589ac82b Update usage of ActivityManagerNative.
- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
      adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
          -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
2016-11-14 11:27:12 -08:00
Tony Mak
46aabe5ef4 Allow cross profile call between DO and PO
Allow DO to bind service of PO in managed profile and vice versa.
DO and PO must be the same package.

Bug: 31895999

Change-Id: I3ce2943aebd1249401d5814757a0ce25b9f85279
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.CorpOwnedManagedProfileTest
2016-11-14 14:20:11 +00:00
Makoto Onuki
890a14d399 App Shortcut: Clarify which attributes must be resources am: 104f805337 am: 2a3fe7d979 am: b0fd5ba122
am: 7e1b835a4e

Change-Id: I767dcbe980a60af1a3076acdf9234f4241ab7ca1
2016-11-11 23:54:51 +00:00
Makoto Onuki
7e1b835a4e App Shortcut: Clarify which attributes must be resources am: 104f805337 am: 2a3fe7d979
am: b0fd5ba122

Change-Id: I4780d09f8b692dbe76f1726a436f9693281fd488
2016-11-11 23:36:04 +00:00
Ben Lin
1cf454fcb6 Adding ContentProvider#refresh and ContentResolver#refresh.
Original CL is from ag/1568530.

Bug: 31647485
Change-Id: Ib45fc995a361b8c75cd3600f638910b18a263d51
2016-11-10 13:53:27 -08:00
Dianne Hackborn
e07641d4fb Start implementing background restrictions for eph apps.
This implements the additional intended path for checking
allowed background operations, APP_START_MODE_DISABLED, which
doesn't allow an app to launch in the background at all.

Also change the semantics of delivering broadcasts to manifest
receivers to always restrict those, not changing based on
whether the app is currently idle.  This is the desired intended
behavior for apps as they explicitly update to work with
bg check.

And now that we have ephemerality associated with the uid state
in the activity manager, we can propagate this through the
relevant callbacks in IUidObserver so things watching these
changes can immediately determine whether they should do their
more aggressive shut down work for the uid rather than having
to walk through all their state looking for package associated
with that uid and whether they should be shut down.

Also remove the "lenient" bg check mode, since that was
just an early experiment that we won't actually use.

Add a new "make-idle" activity manager command to immediately
put a uid into the idle state (if possible) to make it easier
to test.

Test: manually against an eph app
Change-Id: I43a138ff281f69a9251d3f29ab6e13f48cff8ad6
2016-11-10 12:01:20 -08:00
TreeHugger Robot
00f42c3b28 Merge "Initial implementation of the Auto-Fill Framework classes." 2016-11-09 19:19:32 +00:00
Jeff Sharkey
d0ac9d3bac Merge "Detect non-oneway calls leaving system_server." 2016-11-09 16:51:41 +00:00
Felipe Leme
5381aa4b58 Initial implementation of the Auto-Fill Framework classes.
This CL provides the initial, skeleton implementation of the Auto-Fill
Framework classes:

- Defines the system service and app-based
  AIDL (IAutoFillManagerService.aidl and IAutoFillService.aidl respectively).
- Defines the 'adb shell cmd' interface.
- Defines the permission required to access the service.
- Registers the service on SystemServer.
- Adds the code to bind the app-specified service to system_server.
- Defines the service class (AutoFillService) required by providers.
- Implements the initial startSession() method.

This is still a very early, "work-in-progress" change:
- It has many TODOs.
- It does not have unit or CTS tests yet.
- It does not provide a callback method to auto-fill the fields.
- In fact, it has a lot of TODOs.

Despite these adversities, it can be tested by following the steps
below:

1.Create an app with a service extending AutoFillService

2.Implement the onNewSession() method

3.In the manifest:
 - Listen to android.service.autofill.AutoFillService intents.
 - Require the android.permission.BIND_AUTO_FILL permission.

4.Explicitly set the app as an autofill-service by running:
  adb shell settings put secure auto_fill_service MY_APP/.MY_SERVICE

5.Start a session against the top activity:
  adb shell cmd autofill start session

BUG: 31001899
Test: manually built and ran it

Change-Id: I00f4822159b31ddddba8f513e57c4474bc74eb89
2016-11-08 14:40:56 -08:00
Todd Kennedy
e5195dd17c Implement new API
This is the first swack at the new, 2-phase API. Adds the new methods
to the resolver service and makes the split name explicit on the
installer intent.

The 2nd phase will not yet be invoked; that's coming in a follow-on
change.

Bug: 25119046
Test: build & install the sample resolver and run 'adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.tripadvisor.com/Tourism-g33020-San_Jose_California-Vacations.html"'
Change-Id: I2df6fa64d46f17a86a2e32b19417632c594fb10f
2016-11-08 13:47:28 -08:00
TreeHugger Robot
00c2ed26f6 Merge "Add an extra to pass initial location URI for file choosers." 2016-11-08 21:24:55 +00:00
TreeHugger Robot
af4fac5b77 Merge "Always propagate changingConfigurations to newly-created drawables" 2016-11-08 16:22:50 +00:00
Garfield Tan
b44ae61e01 Add an extra to pass initial location URI for file choosers.
Test: It builds.

Bug: 30031881
Change-Id: I64e9392b0aec75baee13039642316f7e50494567
2016-11-07 17:22:57 -08:00
Jeff Sharkey
0a17db1cc5 Detect non-oneway calls leaving system_server.
To protect system stability, any Binder calls leaving the
system_server must carefully be performed using FLAG_ONEWAY (or
the 'oneway' verb in AIDL) which prevents the call from blocking
indefinitely on the remote process.

In this CL, the system_server uses the new Binder.setWarnOnBlocking()
method to enable detection by default for all remote Binder
interfaces.  It can also use Binder.allowBlocking() to allow
blocking calls on certain remote interfaces that have been
determined to be safe.

This CL adds the 'oneway' verb to several interfaces and methods
where it should have been added, and marks a handful of system
ContentProviders as being safe to call into.  Also, we assume that
any services obtained from ServiceManager are part of the core
OS, and are okay to make blocking calls to.

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088
Change-Id: Ide476e120cb40436a94b7faf7615c943d691f4c0
2016-11-07 17:03:37 -07:00
Etan Cohen
a99a05982e Merge "[NAN-AWARE] Rename NAN to Aware" am: 74b1131cc8
am: 6571007101

Change-Id: Ief54b313dc5ca5d30645b55ed2ad0333036a1671
2016-11-06 03:21:37 +00:00
Etan Cohen
6571007101 Merge "[NAN-AWARE] Rename NAN to Aware"
am: 74b1131cc8

Change-Id: I2e788e19a11f2709f2e542dbdc4b58433a3574bf
2016-11-06 03:13:31 +00:00
Etan Cohen
0849ded008 [NAN-AWARE] Rename NAN to Aware
~Rename only (and any reformatting needed to pass lint) - no
functional changes!

Remove android.net.wifi.nan.STATE_CHANGED from manifest:
redundant/remnant of an older configuration.

(cherry-pick of commit a61b9fb569)

Bug: 32263750
Test: All unit tests and integration (sl4a) tests pass.
Merged-In: Ie4ff675fa61041e8fcf6a9bf9900ea835d0a7614
Change-Id: I4206d2fd722dc7dec9df4aee5c818101d7f9dccc
2016-11-05 09:41:38 -07:00
Etan Cohen
3a1dd86ce4 Merge "[NAN-AWARE] Rename NAN to Aware" 2016-11-05 16:19:43 +00:00
Etan Cohen
0413327d74 [NAN-AWARE] Rename NAN to Aware
~Rename only (and any reformatting needed to pass lint) - no
functional changes!

Remove android.net.wifi.nan.STATE_CHANGED from manifest:
redundant/remnant of an older configuration.

(cherry-pick of commit a61b9fb569)
(cherry-pick of commit b061f21e7e59a99834e163e2baa1c82229e419a6)

Bug: 32263750
Test: All unit tests and integration (sl4a) tests pass.
Change-Id: Ie4ff675fa61041e8fcf6a9bf9900ea835d0a7614
2016-11-04 15:42:08 -07:00
TreeHugger Robot
3e8431f1f2 Merge "Move IActivityManager to aidl." 2016-11-04 22:24:12 +00:00
Chad Brubaker
4389c23b35 Shift ApplicationInfo private flags
Move FLAG_EPHEMERAL (new in O) to the gap where the old unused
FLAG_AUTPLAY was and then shift the remaining flags down.

Test: Builds
Change-Id: I9a159dd82a3eb104adc1e3985a15115e866fbda5
2016-11-04 14:57:53 -07:00
Chad Brubaker
cbc59b8aa6 Merge "Move ephemeral apps into the ephemeral SELinux domain" 2016-11-04 21:46:16 +00:00
Sudheer Shanka
fc46e9b643 Move IActivityManager to aidl.
Bug: 30977067
Test: Existing tests are passing, dump commands still working.
Change-Id: I9cf81c4d381ebce14a6c701e409cbb269f2ff1fb
2016-11-04 10:43:25 -07:00
Garfield Tan
0b3cf666d0 Unhide findPath() API. Add JavaDoc to related features.
Also remove comments that disallow folders in search results.

Test: It builds.

Bug: 30948740
Bug: 32512923
Change-Id: I72706b69163aa98ee9568939e09e5048b6e8f9f8
2016-11-03 15:42:18 -07:00