14038 Commits

Author SHA1 Message Date
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
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
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
Selim Cinek
0e1f78da65 Added Emergency affordance feature
am: 705442fa7d

Change-Id: I03ebb84119f9cb310882ba9ea90ee1e1d7118d03
2016-09-23 22:00:42 +00:00
Vitalii Tomkiv
ca68aca2b7 Fix traceEnd call for KeyAttestationApplicationIdProviderService phase
in System Server.

Change code to use traceEnd() instead
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER); to generate accurate
measurements.

Test: 1-line change. 0-risk change.
bug: 31654120
Change-Id: I24d1468ccf934dbe912822996174eb780a46994c
2016-09-23 11:01:41 -07:00
Ivan Podogov
b8fdf0aa16 Add property to disable camera service proxy.
am: 8adaec07f0

Change-Id: I9477a39ae23c346437f9eb37bd0bbeaf946dbbd4
2016-09-23 11:10:22 +00:00
Ivan Podogov
fa10c2869b Merge "Add property to disable camera service proxy." into cw-f-dev 2016-09-23 11:04:09 +00:00
Hugo Benichi
0daeac5dd4 New IpConnectivityMetrics service am: eab511b582
am: 3a353a2044

Change-Id: I5cf485edd3ab1ebb81a2a9d35dfb8bd6d8bcc305
2016-09-23 03:54:06 +00:00
Hugo Benichi
3a353a2044 New IpConnectivityMetrics service
am: eab511b582

Change-Id: Iad65f10f079be13570e1f687dacb30f4f657a163
2016-09-23 03:49:04 +00:00
Selim Cinek
705442fa7d 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
Fixes: 30404490
Change-Id: Ib96a15da2ef4b568a8d77140ebca6aa6f20f5ddb
2016-09-22 12:25:57 -07:00
Hugo Benichi
eab511b582 New IpConnectivityMetrics service
This patch defines a new metrics service for IpConnectivity events
defined in android.net.metrics, separate from currently existing
MetricsLoggerService.

Similarly to MetricsLoggerService, the new service has an event buffer.
It also implements a dumpsys interface that can be used to flush events
and output a serialized proto.

Bug: 31254800
Change-Id: I0c3faeb4008b283f85d9ba9460371fa68956ea3b
2016-09-22 22:25:27 +09:00
Ivan Podogov
8adaec07f0 Add property to disable camera service proxy.
This service proxy (together with the native server) are not needed on
Android Wear, as we don't have any watches with cameras.

Bug: 28560707
Change-Id: Ie4a830a3ba48c90d3e968fc5cdf57ccafcc1f5d8
2016-09-22 09:59:05 +01:00
Svetoslav Ganov
8b6456bc88 Merge "Move device serial behing a permission" 2016-09-21 03:32:47 +00:00
Wei Liu
03d0a367cf resolve merge conflicts of 82d5fc1 to master
Test: device boots

Change-Id: I78e5667577e413763b6be3b06a2feda99ef0d739
2016-09-20 10:25:51 -07:00
Wei Liu
82d5fc17b5 Make VrManager service optional.
am: ef89d21a1b

Change-Id: Ia0a194d34b19ca89e5acdb110a87479187fa4d85
2016-09-20 01:01:18 +00:00
Wei Liu
ef89d21a1b Make VrManager service optional.
b/31244699

Change-Id: I7d276e6945f19b575f880df16f140b84b03052a9
2016-09-19 15:18:53 -07:00
Colin Cross
7af8c2a8b9 resolve merge conflicts of 15de376 to master
Change-Id: Id76c6ef0a592fde8ee0f6fef0d1e9352aa21c9fe
2016-09-12 21:12:49 -07:00
Svet Ganov
37e43275ee Move device serial behing a permission
Build serial is non-user resettable freely available deivice
identifier. It can be used by ad-netowrks to track the user
across apps which violates the user's privacy.

This change deprecates Build.SERIAL and adds a new Build.getSerial()
API which requires holding the read_phone_state permission.
The Build.SERIAL value is set to "undefined" for apps targeting
high enough SDK and for legacy app the value is still available.

bug:31402365

Change-Id: Iddd13430b2bd1d9ab4966e31038ecabdbdcec06d
2016-09-11 18:44:38 +00:00
Wei Liu
15de376b90 Make consumer_ir an optional service.
am: 09de41950c

Change-Id: Idf3f97ed6615b130318442c81fed74cb4eefce59
2016-09-09 17:32:35 +00:00
Wei Liu
09de41950c Make consumer_ir an optional service.
b/31244699

Change-Id: Id851b0139d476a829097399374bb196cbfe96cf0
2016-09-07 13:33:49 -07:00
TreeHugger Robot
357773aa62 Merge "Add KeyAttestationApplicationIdProviderService to SystemServer" 2016-08-29 16:18:51 +00:00