Commit Graph

1377 Commits

Author SHA1 Message Date
Mike Ma
cc7c338c48 Merge "Make ProtoOutputStream public"
am: 566f8f0195

Change-Id: Id322686c850a1aa273d31c60c86e4fe052390d21
2020-01-22 10:33:00 -08:00
Mike Ma
566f8f0195 Merge "Make ProtoOutputStream public" 2020-01-22 18:14:00 +00:00
Neil Fuller
876c59823e Merge "Add new module-lib APIs for MTS testing"
am: b9e3e9e34c

Change-Id: I3acc8118e444ba3255f393a622ea8405c03ffe03
2020-01-22 07:09:25 -08:00
Mike Ma
5f0652fc07 Make ProtoOutputStream public
Bug: 142279786
Test: atest ProtoInputStreamTests
Change-Id: I1f6eeb09898277a0975c2081630bfa849afc13ab
Merged-In: I1f6eeb09898277a0975c2081630bfa849afc13ab
2020-01-21 21:02:43 -08:00
Neil Fuller
2551c033df Add new module-lib APIs for MTS testing
Several android.timezone classes have already been exposed for the
telephony module work, so these tests provide coverage for those.
Additional APIs have been exposed for MTS testing, i.e. to provide
greater confidence that the tzdata module data is correct / is
being read correctly.

Also, small changes to existing code to make them consistent with new
classes. Small docs improvements.

Bug: 147884233
Test: see system/timezone change
Change-Id: I047b29f17a41993f859947a6d6c3685896fe4cb6
2020-01-21 17:17:31 +00:00
Xin Li
e13851556b DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp-without-vendor (6129114) into stage-aosp-master
Bug: 146167222
Change-Id: Ifeb003ec9b3bf824f04d31a117aea65d517241fb
2020-01-15 16:15:41 -08:00
Neil Fuller
845146b012 Make NtpTrustedTime safer / expand docs
This commit makes a number of changes:
1) Documents / enforces thread safety, removes or deprecates unsafe
check-then-do methods / adds a way to get the NTP query result
atomically.
2) Delays configuration lookup until point of use: the config can change
due to various possible config overlays, e.g. MCC-based config.

(1) is because the threading model is currently unclear / possibly
unsafe - it looks like NtpTrustedTime is supposed to be single threaded
but it's also a singleton so could be accessed from multiple threads.
If NtpTrustedTime were not a singleton things might be easier but the
@UnsupportedAppUsage makes it difficult to change now.
(2) is to address the same issue as https://r.android.com/1182530,
contributed by Luca Stefani.

Bug: 140712361
Test: build only
Merged-In: Ie09da9db5d853b59829886a020de21a88da5dd51
Change-Id: Ie09da9db5d853b59829886a020de21a88da5dd51
(cherry picked from commit 65f0f31bde)
2020-01-13 16:54:14 +00:00
Treehugger Robot
9938c70fb5 Merge "Use new UnsupportedAppUsage annotation." 2020-01-13 13:05:17 +00:00
Automerger Merge Worker
00f335412b Merge changes I978ac321,I5675a80c,I56ef3cc4,I1cdaf002 am: 2ff0a7bd58 am: 3bb4823ce5
Change-Id: Iccbb591430093ac42fa813648fa4ece4b17a0ea3
2020-01-11 01:17:27 +00:00
Automerger Merge Worker
a6f8a96d6d Merge "Add JNI call for writing StatsEvent to statsd." am: 9e52462c48 am: a4bba9adf8
Change-Id: I22294b7a9a0eb15b82b865d6ad271b59af9ef9ba
2020-01-11 01:17:04 +00:00
Treehugger Robot
2ff0a7bd58 Merge changes I978ac321,I5675a80c,I56ef3cc4,I1cdaf002
* changes:
  Add --supportQ flag to java StatsLog codegen
  Support new socket schema in native codegen
  Move statsd metadata from statslog to atoms_info
  Fix StatsEvent memory usage for pulled events
2020-01-11 00:42:14 +00:00
Treehugger Robot
9e52462c48 Merge "Add JNI call for writing StatsEvent to statsd." 2020-01-11 00:41:30 +00:00
Automerger Merge Worker
874930a65d Merge changes I2159bf13,I93146faa am: baa778df4d am: 62dfd98234
Change-Id: Ifac52f18ce8e2bfa78b91d35d776a91324e44d44
2020-01-10 23:01:57 +00:00
Treehugger Robot
baa778df4d Merge changes I2159bf13,I93146faa
* changes:
  Fix error handling in StatsEvent
  Handle nulls in Java autogeneration
2020-01-10 22:46:51 +00:00
Automerger Merge Worker
ccb530f58f Merge changes Ied6a13be,Ia4818f62,I660a4384 am: c7483ff8bf am: fca0df0215
Change-Id: I190062aae1e366f3e522ee01b5e6027a375074fd
2020-01-10 22:41:08 +00:00
Treehugger Robot
c7483ff8bf Merge changes Ied6a13be,Ia4818f62,I660a4384
* changes:
  StatsEvent unit tests
  Change visibility of members in StatsEvent
  Make StatsEvent.newBuilder() static
2020-01-10 22:24:13 +00:00
Automerger Merge Worker
df1499d027 Merge "Add a copy of Rlog for the telephony mainline module" am: 00fe08f5bf am: 9fc52ab1fc
Change-Id: I6cb1ffe87de13320e7ac166e9392ecdc59f8027c
2020-01-10 22:20:16 +00:00
Automerger Merge Worker
900cf22e7d Merge changes Icaa2d90b,Ief489088 am: ec3e77e1d0 am: 8c517b7d1f
Change-Id: I3ccdf6338c2ef6f9e781e4e9c5380445548e5b85
2020-01-10 22:19:17 +00:00
Meng Wang
00fe08f5bf Merge "Add a copy of Rlog for the telephony mainline module" 2020-01-10 22:05:03 +00:00
Treehugger Robot
ec3e77e1d0 Merge changes Icaa2d90b,Ief489088
* changes:
  Add KeyValuePairs support to StatsEvent.
  Add StatsEvent.Builder
2020-01-10 21:34:35 +00:00
Automerger Merge Worker
9886a9c50b Merge "First draft of StatsEvent.java" am: 4e2e5a96b8 am: 2a6214ca33
Change-Id: I073a67675ec82623cdcfda7cbfaf0fb9ca3ee80d
2020-01-10 20:05:12 +00:00
Treehugger Robot
4e2e5a96b8 Merge "First draft of StatsEvent.java" 2020-01-10 19:32:27 +00:00
Makoto Onuki
eba9902300 Add a copy of Rlog for the telephony mainline module
Bug: 144374158
Test: boot
Merged-In: I5be0497a17d00152286fe3351bf58e75b675ceb6
Change-Id: I5be0497a17d00152286fe3351bf58e75b675ceb6
(cherry picked from commit 57e56f2d3c)
2020-01-10 11:05:43 -08:00
Automerger Merge Worker
aa58c0d5c3 Merge "Rename android.util.TimestampedValue to android.os" am: 641fa6730a am: fee904a5fb
Change-Id: Ib439759dbee692a624491267d07f72b0d754779d
2020-01-10 09:18:38 +00:00
Neil Fuller
35cc296228 Rename android.util.TimestampedValue to android.os
Rename android.util.TimestampedValue to android.os to avoid dependency
from android.util onto android.os, which is disallowed by lint.

Bug: 147012511
Test: boot
Merged-In: I4b84db03c8ad24bbef63e45d6d15fb306a10364e
Change-Id: I4b84db03c8ad24bbef63e45d6d15fb306a10364e
(cherry picked from commit d159015e54)
2020-01-09 15:34:43 +00:00
Artur Satayev
2d330f6fa8 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
Merged-In: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-09 15:08:18 +00:00
Muhammad Qureshi
2a4c0782b5 Fix StatsEvent memory usage for pulled events
Add usePooledBuffer flag to the Builder which determines whether to reuse
the Buffer's byte array in StatsEvent or use a copy.
The build() function also calls release() on the Buffer
if a copy of the Buffer's byte array is passed to StatsEvent.

Also, for pushed events, release the StatsEvent object and consequently,
the Buffer in StatsLog.write(StatsEvent)

Fixes: 145026572
Fixes: 144126444
Test: bit FrameworksCoreTests:android.util.StatsEventTest
Change-Id: I1cdaf0027b69281cb7cb6f3c8ca923d03829b4dd
Merged-In: I1cdaf0027b69281cb7cb6f3c8ca923d03829b4dd
2020-01-08 17:04:27 -08:00
Muhammad Qureshi
80e3e7a435 Add JNI call for writing StatsEvent to statsd.
Bug: 143978873
Test: m -j
Test: flashes successfully
Test: DocumentsUI(a Mainline module) is able to successfully log to statsd
Change-Id: I9cdc6151d8feb29a712532e50f143af9d52c8d94
Merged-In: I9cdc6151d8feb29a712532e50f143af9d52c8d94
2020-01-08 17:03:31 -08:00
Muhammad Qureshi
2dfca163ab Fix error handling in StatsEvent
Bug: 143286399
Test: bit FrameworksCoreTests:android.util.StatsEventTest
Change-Id: I2159bf138a307e45c44102a8feb7a69d0c793843
Merged-In: I2159bf138a307e45c44102a8feb7a69d0c793843
2020-01-08 17:02:52 -08:00
Muhammad Qureshi
771119546c Change visibility of members in StatsEvent
- Rename writeAttributionNode to writeAttributionChain
- Make Type Id, size limit constants public and @hide for testing
- Change visibility of StatsEvent package protected functions to public

Bug: 141696033
Test: m -j
Change-Id: Ia4818f621672d469390bf7654bdd317f0cd11692
Merged-In: Ia4818f621672d469390bf7654bdd317f0cd11692
2020-01-08 17:00:24 -08:00
Muhammad Qureshi
f340ab6921 Make StatsEvent.newBuilder() static
Bug: 141696033
Test: m -j
Change-Id: I660a4384f037327ba475e3badd7cba7fea7f77a5
Merged-In: I660a4384f037327ba475e3badd7cba7fea7f77a5
2020-01-08 16:59:51 -08:00
Muhammad Qureshi
a0a4cdf760 Add KeyValuePairs support to StatsEvent.
- Expose atom id in StatsEvent.
- Sync constants with native stats_event.

Bug: 143079343
Bug: 143286399
Test: m -j
Change-Id: Icaa2d90b40d5da7571444182ead03b54b7b25867
Merged-In: Icaa2d90b40d5da7571444182ead03b54b7b25867
2020-01-08 16:59:06 -08:00
Muhammad Qureshi
a56a853c9c Add StatsEvent.Builder
Use a builder to construct StatsEvent objects.
Make StatsEvent immutable.
Wrap socket byte array in a Buffer class with write methods for
primitives.
Implement socket schema at go/statsd-socket-doc
StatsEvent.java design doc at go/statsevent-java-doc

Bug: 141696033
Test: m -j
Change-Id: Ief4890882de66d5dcca71b3827ffa1f43ea628a8
Merged-In: Ief4890882de66d5dcca71b3827ffa1f43ea628a8
2020-01-08 16:58:20 -08:00
Muhammad Qureshi
ffca2a3597 First draft of StatsEvent.java
The actual APIs are subject to change once socket encoding is finalized
and StatsEvent needs to be marked as @SystemApi. This will be addressed
in a future CL.

Test: builds successfully
Bug: 141696033
Change-Id: I508fa3d2f84850438562d01c78155590819badca
Merged-In: I508fa3d2f84850438562d01c78155590819badca
2020-01-08 16:44:18 -08:00
Automerger Merge Worker
39d6ba888d Merge "Fix annotation / debugging" am: 69bbb1904f am: 1d866c0bf3
Change-Id: I01e7c1b39e2c1df26f9b64c441136ccfbedcc77f
2020-01-07 16:40:04 +00:00
Neil Fuller
4d10019960 Fix annotation / debugging
Fix copy and paste errors from commit 4ab8a199de -
the API is new so does not need @UnsupportedAppUsage and
the debug log was incorrect.

Bug: 140712361
Test: build only
Change-Id: I123f76d011d7505d3dc053cb48c40353f0579d17
2020-01-07 14:32:29 +00:00
Automerger Merge Worker
ef100e45fe Merge "Change NetworkTimeUpdateServiceImpl behavior" am: 48247d9223 am: f11a45b756
Change-Id: Ie3b6457ba196f7aa00ffb6e2fa77e5acbb926374
2020-01-07 10:30:35 +00:00
Neil Fuller
48247d9223 Merge "Change NetworkTimeUpdateServiceImpl behavior" 2020-01-07 10:07:08 +00:00
Automerger Merge Worker
afc127664e Log watchdog-initiated rollback reason am: 254b0d5a7f
Change-Id: I2487bca4fd0579c2f66de15da727ada54a26cfe1
2019-12-20 08:18:37 +00:00
Automerger Merge Worker
402f7eb3fb Merge "Use write_buffer_to_statsd within StatsLog_write" am: 634f6969c4 am: 4f32e393d0
Change-Id: Ie91b0cceab48051c53f8e7270a5a267c5778a82d
2019-12-20 00:24:50 +00:00
Muhammad Qureshi
bc1002d520 Use write_buffer_to_statsd within StatsLog_write
This CL is a partial cherrypick of ag/9686088. This is needed because new
changes to libstatssocket (that need to be cherrypicked into AOSP) wrap
#write_to_statsd() with #write_buffer_to_statsd().

Bug: 143978873
Test: m -j
Test: flashes successfully
Test: DocumentsUI(a Mainline module) is able to successfully log to statsd
Change-Id: I886331f728ccaa3d281b5683eb89179aa73596b6
Merged-In: I9cdc6151d8feb29a712532e50f143af9d52c8d94
2019-12-19 21:27:18 +00:00
Neil Fuller
4ab8a199de Change NetworkTimeUpdateServiceImpl behavior
This change moves some logic associated with time detection out of the
NetworkTimeUpdateServiceImpl and moves it to the TimeDetectorStrategy
called by the TimeDetectorService.

The TimeDetectorStategy implementation now decides when to use an
NTP-derived time instead. The logic implemented here is effectively the
same as it was: NITZ takes priority over NTP until the latest NITZ
signal becomes "too old".

The motivating reasons for the change:
1) The "what signal is used when several are available?" logic should be
in one place: the TimeDetectoryStrategy not scattered around the
platform. Centralizing will enable different strategies and time sources
to be introduced over time.

2) It will allow removal of the ACTION_NETWORK_SET_TIME intent in a
follow-up commit; this intent was used to coordinate the NTP vs NITZ
logic should no longer be required.

The "bonus" effect of this change is that NetworkTimeUpdateServiceImpl
becomes more general: It can now be the authority for the NTP time on a
device independently of how the system clock should be set. e.g. it
could be used in future to back the
AlarmManager.currentNetworkTimeMillis() API call.  Anything that needs a
"what is the best time according to NTP?" answer could use this service.

Note: The NetworkTimeUpdateServiceImpl still observes the AUTO_TIME
setting and will perform an NTP lookup "on demand" (if required) when
the user enables the setting. This should be a temporary state and
likely to be removed in future; knowledge of AUTO_TIME shouldn't be
required for the NTP info to be correct and if
NetworkTimeUpdateServiceImpl is doing the right thing.

Bug: 140712361
Test: atest com.android.server.timedetector
Test: atest android.app.timedetector
Change-Id: I4b2936a42c552c4dd4cb55010306bb81bca0c712
2019-12-19 19:21:47 +00:00
Automerger Merge Worker
16257918c9 Merge "Fix android.util.CloseGuard sample usage" am: 7381525076 am: 66b0e7d150
Change-Id: Ieec4a553744be7148938ee19cce23371597985e6
2019-12-18 18:35:59 +00:00
David Su
7381525076 Merge "Fix android.util.CloseGuard sample usage" 2019-12-18 18:19:58 +00:00
Gavin Corkery
254b0d5a7f Log watchdog-initiated rollback reason
To help with monitoring Mainline releases, log the reason
for a watchdog-initiated rollback. This may be due to
native crashes, app crashes, ANRs or explicit health check
failures.

Add a mapping from PackageWatchdog failure reason to the
new metrics.

Bug: 146415463
Test: atest PackageWatchdogTest
Test: atest StatsdHostTestCases
Change-Id: Ia3e73d955508297004591eac762555665c557b8a
Merged-In: Ia3e73d955508297004591eac762555665c557b8a
(cherry picked from commit dd1dabaef7)
2019-12-18 14:39:16 +00:00
David Su
0def143e45 Fix android.util.CloseGuard sample usage
Updated first sample with `Reference.reachabilityFence(this)`
to be consistent with the second sample.

Bug: 145831809
Test: none
Change-Id: I8c625de4f36a8cd52a3825021ff631db62f04662
2019-12-16 10:46:46 -08:00
Automerger Merge Worker
58745b4dcc Merge "Expose CloseGuard as a public API" am: 4314616565 am: 37f8e04de9
Change-Id: I42faa5840cb92a7c5c549e41f5cb03660165d9f4
2019-12-12 18:45:43 +00:00
David Su
4314616565 Merge "Expose CloseGuard as a public API" 2019-12-12 18:19:12 +00:00
David Su
0c472adb0d Expose CloseGuard as a public API
Wrap dalvik.system.CloseGuard and expose it as a
public API from android.util.

Bug: 145831809
Test: atest CloseGuardTest
Change-Id: Ia44c84a69a5fb693fb8bb1a075c18a60253cedfc
2019-12-10 13:46:24 -08:00
Neil Fuller
746d69afa5 Merge "Extend LocalLog to enable UTC timestamps" am: 9436134056
am: c74594a2e3

Change-Id: I417bf9581e3fbce9921e7893c1e63e6dd9a7b30b
2019-12-10 01:50:39 -08:00