14126 Commits

Author SHA1 Message Date
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
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
Vitalii Tomkiv
4887e67c0b Add granular profiling to every SystemServer step.
In attempt to speed up Android Boot time we need better understand parts
that are taking long time during boot phase. SystemServer accounts to
~30-40% of boot time, so profiling and monitoring it should help
identify problematic parts.

Along with systrace logcat messages were added to simplify on the glance
check of boot process timing without the need to collect systrace.

Change-Id: Ice203eb3e6aa662d1a7cefc8bcd76f372347f4a0
2016-08-25 13:11:04 -07:00
Jeff Sharkey
d79d203b35 Bring back wtf() for missing services.
Publish DropBox extremely early during boot process so that it can
pick up wtf() calls while booting.

Bug: 28634953
Change-Id: Ie71d53fc125ebc47fa08ef59a8b7e4f66f2e805c
2016-08-23 15:19:18 -06:00
Felipe Leme
bb10d26ba6 Removed screen on/off callbacks from NPMS. am: f8dd7b4e8d
am: 6a3706a08c

Change-Id: I025326d7b89a60920c0db3aa6e363541974cd204
2016-08-19 23:01:27 +00:00
Janis Danisevskis
8ff1e193ac Add KeyAttestationApplicationIdProviderService to SystemServer
Add getKeyAttestationApplicationId and the Parcelables
KeyAttestationPackageInfo and KeyAttestationApplicationId,
needed by keystore.

Bug: 22914603
Change-Id: I89a88cd9cd80e9b132ca67fc452e9cae8b8ad241
2016-08-19 13:50:55 +01:00
Felipe Leme
f8dd7b4e8d Removed screen on/off callbacks from NPMS.
NetworkPolicyManagerService (NPMS) used to depend on screen on/off
changes to determine if a foreground activity should have network
restrictions, but such check is now redundant since ActivityManager
already changes the proper UID state (like going from TOP to
TOP_SLEEPING) when the screen status is changed.

Removing such code decreases the NPMS lock contention when the screen is
turned on in about 3-5ms.

Change-Id: I2853443efedbf14961ae9a5b2e72689d4d1a646c
BUG: 30785671
(cherry picked from commit 88f40ad9a721ee30708be82f66fb58c64f1d36b5)
2016-08-18 09:57:11 -07:00
Jeff Sharkey
4d24cfe6ce Merge "Fix bugs around manager fetching." 2016-08-11 18:52:44 +00:00
Felipe Leme
88f40ad9a7 Removed screen on/off callbacks from NPMS.
NetworkPolicyManagerService (NPMS) used to depend on screen on/off
changes to determine if a foreground activity should have network
restrictions, but such check is now redundant since ActivityManager
already changes the proper UID state (like going from TOP to
TOP_SLEEPING) when the screen status is changed.

Removing such code decreases the NPMS lock contention when the screen is
turned on in about 3-5ms.

Change-Id: I2853443efedbf14961ae9a5b2e72689d4d1a646c
BUG: 30785671
2016-08-11 16:43:54 +00:00
Jeff Sharkey
73ea0ae15f Fix bugs around manager fetching.
A recent patch started returning "null" when a Binder service
required to provide a manager wasn't yet registered.

This fixes four locations where that new logging was triggered: in
two cases by adjusting the fetching ordering, and in two other cases
by only fetching when the device supports the manager.

Bug: 28634953
Change-Id: I84dbccffa4ac760c10a2bbcb234f21272bfecb91
2016-08-11 09:44:34 -06:00