14048 Commits

Author SHA1 Message Date
Abodunrinwa Toki
67024f1b8f Merge "Implement TextClassification system service." 2017-01-30 19:12:50 +00:00
TreeHugger Robot
4a65687b85 Merge "Expose fonts.xml via public API with a service" 2017-01-23 19:57:23 +00:00
TreeHugger Robot
360da34205 Merge "Do not log boot times for secondary users and upgrades" 2017-01-23 19:18:48 +00: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
Fyodor Kupolov
4ba91b9a87 Do not log boot times for secondary users and upgrades
Do not log framework_boot_completed/framework_locked_boot_completed
for secondary users, runtime restarts or first boot/upgrade.

First boot/upgrade also applies to boot_system_server_ready/
boot_package_manager_init_ready

Test: Manual update with fingerprint change
Test: runtime restart - not logged

Bug: 34516002
Bug: 32807863
Change-Id: I2e4237bf49e82101f483df6190111f4541328d19
2017-01-20 18:12:35 -08: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
Abodunrinwa Toki
c565e1d3ce Implement TextClassification system service.
- This service provides the TextClassificationManager access to the
  classification model file.
  See: Icb82b707c9c1b4dcb739f44d888bbc43bc3b03bb
- This service is started at boot time.
  See: Ie4a597bc5c6c4140afbcf7feaa9dd237a3fd5fef

Test: Manually tested. Also see: Ic2a5eceeaec4cd2943c6c753084df46d30511fee
Bug: 32503402
Change-Id: Ic428d00f291e268211866b3fc6b7acbc3eb04e1e
2017-01-20 20:22:16 +00:00
TreeHugger Robot
6c4c1119f4 Merge "Log excessive boot times" 2017-01-19 01:44:15 +00:00
TreeHugger Robot
12d1bedfa9 Merge "SystemServer: Remove logging boot_android_init." 2017-01-19 00:53:59 +00:00
James Hawkins
fa3fd615b0 SystemServer: Remove logging boot_android_init.
This is now logged by the bootstat command.

Bug: 34391732
Test: none
Change-Id: I8bbc22e3c7b0268876c4819ed48b7e4b31d6fb3e
2017-01-18 15:14:29 -08:00
Fyodor Kupolov
24e12dc59d Log excessive boot times
This should help to identify devices that report unusually long
boot_completed timings.

Test: manual
Bug: 32807863
Change-Id: Ic6c7103d43b3e395accb38ec418094bc580c7c40
2017-01-18 14:54:59 -08:00
Rebecca Silberstein
9e40b804b9 SystemServer: reorder wifi services start
Start WifiService before other wifi-related services.
This is now possible since service dependencies were
removed from the WifiStateMachine constructor.

Bug: 34137732
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: frameworks/base/wifi/tests/runtests.sh
Test: manually tested wifi connection
Test: manually checked for Wifi Direct peers
Change-Id: Iad4eb7053e60542d0be72208db53cf0f83004ae2
2017-01-17 13:32:50 -08:00
Zach Johnson
b82f3b09f3 resolve merge conflicts of 989b267015b9 to master
Change-Id: I0c967e85eb73664e236c0b7286ed14facdb327fa
2017-01-16 15:15:25 -08:00
Wei Liu
989b267015 Add WearCellularMediatorService to the system server. am: d741f3de81
am: 6760890c38

Change-Id: I30d792533da4051300d15ee0567e4c09da68e21e
2017-01-14 03:56:52 +00:00
Wei Liu
d741f3de81 Add WearCellularMediatorService to the system server.
Bug: 33589216
Change-Id: Icfee08b27c03567ed45e136fc407b51c768515c2
2017-01-13 17:51:07 -08:00
Fyodor Kupolov
1d87e40d42 Do not report boot timings on first boot or runtime restart
During first boot after OTA, additional dexopting has to be done
during PM initialization. Timings for OTA are reported separately,
so we should ignore first boot to avoid skewing the metrics.

The following metrics were updated:
 - boot_system_server_init - check added for consistency with other
   metrics in SystemServer. The metric is actually unaffected by first boot,
   because dexopt will start later
 - boot_package_manager_init_ready
 - boot_system_server_init
 - framework_locked_boot_completed
 - framework_boot_completed

Test: manual + UserControllerTest pass
Bug: 32807863
Change-Id: Iff13697b7d4f9ff8439e1e932d7e276f48cd5c37
2017-01-11 14:21:13 -08:00
TreeHugger Robot
29c0a2c93d Merge "Do not report uptime to tron after runtime restart" 2017-01-09 19:56:16 +00:00
Fyodor Kupolov
6733e6c6b6 Do not report uptime to tron after runtime restart
Runtime restart doesn't reset the uptime counter. We shouldn't report
boot timings in that case.

Bug: 32807863
Test: manual
Change-Id: If9510c0d5c633acefe70f241e0823da8f6c248a2
2017-01-09 10:29:42 -08:00
Jeff Sharkey
8d729e8c14 Merge "Initial API shape for storage statistics." 2017-01-07 16:18:38 +00:00
Jeff Sharkey
e8cece9f20 Initial API shape for storage statistics.
This API is designed to provide both UID-level stats and overall
summary data for a given storage device, as identified by UUID.

The use of UID-level granularity might appear a bit clunky, but it
matches other usage statistics (such as network and battery), and it
allows us to implement it using an extremely fast quota kernel
feature.

A future CL will wire up the implementation to installd.

Test: builds, boots
Bug: 32206268
Change-Id: I7b51877682d0370c2402c19346f57809f0e7ac53
2017-01-05 15:39:16 -07:00
Fyodor Kupolov
e29a5a1152 Added SystemServerInitThreadPool
System services can use it during the boot to submit tasks that can be run in
parallel with the main thread.

Switched PersistentDataBlockService and FingerprintService from FgThread to
the new thread pool.

UiModeManagerService: update initial configurations on init thread. They run
while holding the mLock so no extra synchronization barriers are needed at a
later stage.

Test: manual - device boots without errors
Test: ParallelPackageParserTest passes
Change-Id: I548f34b0a18f61924e09a39afb12e085cde35442
2017-01-05 13:12:37 -08:00
Allen Hair
1f556e3ba6 Provide a mechanism for dumping code coverage for the system server.
This service will only be enabled if the platform was built with
EMMA_INSTRUMENT=true

Test: Manual
Bug: 31077138
Change-Id: I4ba98b6568d31ded1b66da996b3c2e5a2ee07c75
2017-01-04 19:44:21 +00:00
Fyodor Kupolov
6dd2ba2866 Tracing for unaccounted parts
Bug: 33199244
Test: manual
Change-Id: Idf71332e8ebd666e5e0defada696414b4550ff23
2017-01-03 17:55:44 -08:00
Joe Onorato
1754d744a7 First checkin of incident reporting.
There are a few major pieces here:

incidentd
---------
This daemon (started by init) runs and accepts incoming requests to take
incident reports.  When prompted, it calls into various system services
and fills in an IncidentProto data structure, and then writes the report
into dropbox.

The next steps for incidentd:
    - Security review of SELinux policies. These will be a subset of
      the dumpstate permissions.  Until this is done, incidentd is
      not started at boot time.

incident
--------
This shell command calls into incidentd, and can initiate an incident
report and either capture the output or leave for dropbox.

incident_report
---------------
This host side tool can call adb shell with the correct parameters
and also format the incident report as text.  This formatting code
was left of the device on purpose.  Right now it's pretty small, but
as the number of fields increases, the metadata and code to do the
formatting will start to grow.

The incident_report command also contains a workaround to let it
work before incidentd is turned on by default.  Right now, it is
implemented to call adb shell dumpsys <service> --proto directly,
whereas in the future it will go through the full incidentd flow.

incident_section_gen
--------------------
A build-time tool that generates a stripped down set of information
about the fields that are available.

libincident
-----------
This library contains the code to connect to incidentd, and the
meta proto definitions that are used by the framework protos.
The basics are here now, but they are not fully fleshed out yet.
The privacy.proto file contains annotations that can go in the
proto file that we will later use to filter which fields are
uploaded, and which are used by local sources.  For example, a
device in a test lab is safe to upload much much more information
than a real user.  These will share the same mechanism, but the
user's output will be filtered according to these annotations.

frameworks/core/proto
---------------------
These .proto files contain the definitions of the system's
output.  There is one master android.os.IncidentProto file that
is the top level of an incident report, but some other services
(notification, fingerprint, batterystats, etc) will have others
that are used directly by the logging mechanism.

Other files which are shared by several of the services also go
here, such as ComponentName, Locale, Configuration, etc.  There
will be many more.

There is also a first iplementation of a dump method handling
--proto in the fingerprint service.

IncidentManager
---------------
The java API to trigger an incident report.

Test: Not written yet
Change-Id: I59568b115ac7fcf73af70c946c95752bf33ae67f
2016-12-15 11:23:05 -08:00
Fyodor Kupolov
7890c2af51 init.start was renamed to ro.boottime.init
Test: manual
Bug: 32780225
Change-Id: I07e593d5c1edab62e937a77916ab207ec17e8639
2016-12-12 12:41:31 -08:00
Fyodor Kupolov
e35aff17e9 Merge "2-phase initialization of NetworkPolicyManagerService" 2016-12-06 21:57:55 +00:00
Fyodor Kupolov
311b9fac00 2-phase initialization of NetworkPolicyManagerService
Split systemReady() into 2 callbacks:
1) networkScoreAndNetworkManagementServiceReady - called when required
    services are ready. NetworkPolicyManagerService starts its initialization
    on the worker thread
2) systemReady - wait for phase (1) to finish so that the service is fully
   initialized

NetworkPolicyManagerService is now prepared in parallel with
ConnectivityService and NetworkStatsService

Test: device boots without errors
Test: HostsideRestrictBackgroundNetworkTests and NetworkPolicyManagerServiceTest pass
Bug: 32315581
Change-Id: Ic9755ed096900247fa0bbb43f396d8bcb97ae6db
2016-12-05 17:02:27 -08:00
Fyodor Kupolov
68f49aea20 Init PersistentDatablockService on the worker thread
Other services do not depend on PersistentDatabalockService in the early
stages of system server initialization.
Initialization is now done on the FgThread. The service also ensures that
init is complete before PHASE_ACTIVITY_MANAGER_READY.

Change-Id: I3b9a1994e37c1e995ed04257f271c425d48c2e7c
Test: Manual, device boots, service is initialized and published
Bug: 33199244
2016-12-05 10:57:03 -08:00
Fyodor Kupolov
3235e0c2ee Additional boot metrics
Extracted duration measurement functionality into BootTimingTraceLog.
It is now shared between system_server and zygote.

Log the following metrics to tron:
- boot_zygote_init - Time in milliseconds to boot into Zygote init stage.
- boot_android_init - Time in milliseconds to boot into Android init stage.

Test: manual - device boots, metrics are logged to system/event log
Bug: 32780225
Bug: 31115337
Change-Id: I600ac7fc83d35fa226ac92c37cc4b19192b25f59
2016-11-21 17:17:34 -08:00
TreeHugger Robot
6bc6b6fe5a Merge "Report boot statistics" 2016-11-17 01:39:12 +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
Fyodor Kupolov
8d3e82bdfc Report boot statistics
Added the following metrics:
- tron_varz_boot_package_manager_init_start
- tron_varz_boot_package_manager_init_ready
- tron_varz_boot_system_server_init
- tron_varz_boot_system_server_ready

Test: manual - device boots, adb logcat -b events
Bug: 32780225
Change-Id: I0eeda831e2a13a7cbcef3308d5dad1bfa63919c1
2016-11-10 17:59:01 -08:00
TreeHugger Robot
00f42c3b28 Merge "Initial implementation of the Auto-Fill Framework classes." 2016-11-09 19:19:32 +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
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
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 a61b9fb569153917a650f1d48efa20ba8846a9f3)

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
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 a61b9fb569153917a650f1d48efa20ba8846a9f3)
(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
Andrii Kulian
5406e7ade8 Apply display override config for secondary displays
Now display-specific settings, such as dimensions and orientation,
are stored in display override config. For default display it is
mirroring the global config. Each time when global config is updated,
override of the default display should be updated too and vice versa.

Test: Existing and manual tests still pass.
Change-Id: Ic6c2190092d328820f314a05bed43c875db18170
2016-10-25 13:22:10 -07:00
Keun-young Park
d340d8a135 fix wrong trace from IpConnectivityMetrics
- should use only traceEnd() after traceBeginAndSlog

bug: 32256110
Test: manual log check
Change-Id: If7dcceacd316450990402a1a20877ceb8c85a098
2016-10-18 18:02:03 -07:00
Romain Guy
253f2c213f Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
      feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
  or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
  colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
  to disable linear blending. This is only for GLES 2.0 GPUs
  with no hardware sRGB support. This flag is currently assumed
  to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
  This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
  why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
  of the source pixel. The asumption is that a bright pixel will be
  blended on a dark background and the other way around. The source
  alpha is gamma corrected to thicken dark on bright and thin
  bright on dark to match the intended design of fonts. This also
  matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
  could not be sampled in sRGB without a yet-to-be-defined GL
  extension
- The last column of color matrices is converted to linear space
  because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-11 17:47:58 -07:00
Selim Cinek
e0c3c660a7 DO NOT MERGE - Added Emergency affordance feature
Added a service that listens whether emergency affordances
are necessary.

If the they are needed, it adds an option to the
global actions dialog that directly launches the
emergency call and also adds a long-press listener
to the keyguard emergency button.

Test: adb shell settings put global force_emergency_affordance 1 && adb shell settings put global emergency_affordance_number 111112
Bug: 30404490
Change-Id: Ib96a15da2ef4b568a8d77140ebca6aa6f20f5ddb
2016-10-10 18:58:23 +00:00
TreeHugger Robot
4c4368e813 Merge "Update ClipboardService to extend SystemService." 2016-09-30 21:22:02 +00:00
Sudheer Shanka
ad70bc6c31 Update ClipboardService to extend SystemService.
Test: Existing tests still passing.
      cts-tradefed run singleCommand cts-dev --module CtsTextTestCases -t android.text.cts.ClipboardManagerTest
      cts-tradefed run singleCommand cts-dev --module CtsContentTestCases -t android.content.cts.ClipboardManagerTest
      cts-tradefed run singleCommand cts-dev --module CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.ManagedProfileTest#testCrossProfileCopyPaste
Change-Id: Ibca156a412219f11a53f2a9250954b30b650b1aa
2016-09-30 12:17:37 -07:00
Sudheer Shanka
28537b6ae9 Don't limit RetailDemoModeService to start only during demo mode.
- Update RetailDemoModeService to not do anything outside demo mode.
- Add am command get-started-user-state which is needed for cts tests.
- Update unit tests for RetailDemoModeService.

Bug: 31342350
Test: adb shell am instrument -e class com.android.server.retaildemo.RetailDemoModeServiceTest -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Idf50512facd27d47d7111e75cbc2f7b260f49740
2016-09-30 10:29:26 -07:00
Vitalii Tomkiv
3be72a7f0a Merge "Fix traceEnd call for KeyAttestationApplicationIdProviderService phase in System Server." 2016-09-26 21:24:19 +00:00
Selim Cinek
2cae5760c6 Added Emergency affordance feature am: 705442fa7d am: 0e1f78da65
am: 10691456b8

Change-Id: Ieb3a0da5d5693a186c92ab1c21ba189558207ae3
2016-09-26 08:46:30 +00:00
Andreas Gampe
0dd895901e resolve merge conflicts of b8fdf0a to master
Change-Id: Iee1e2229317084563d22a5cfc6e3a17ccc612bb1
2016-09-25 13:51:50 -07:00
Hugo Benichi
8389d6f0e1 New IpConnectivityMetrics service am: eab511b582 am: 3a353a2044
am: 0daeac5dd4

Change-Id: Id08f9c8426780578c0edde7a69cf118fac232177
2016-09-25 20:09:46 +00:00
Selim Cinek
10691456b8 Added Emergency affordance feature am: 705442fa7d
am: 0e1f78da65

Change-Id: I6f8220b18bce7889e3b9efe1b075a680a0ae7187
2016-09-23 22:12:33 +00:00