Commit Graph

1455 Commits

Author SHA1 Message Date
Neil Fuller
540f003086 Merge "Rename android.util.TimestampedValue to android.os" 2020-01-08 19:35:27 +00:00
Makoto Onuki
f257d0141a Merge "Add a copy of Rlog for the telephony mainline module" 2020-01-08 18:40:43 +00:00
Neil Fuller
d159015e54 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
Change-Id: I4b84db03c8ad24bbef63e45d6d15fb306a10364e
2020-01-08 17:00:34 +00:00
Makoto Onuki
57e56f2d3c Add a copy of Rlog for the telephony mainline module
We can't expose android.telephony.Rlog directly to the telephony
module as @SystemApi because we can't protect it from app code.

So instead, expose a lower level API from the Log class to the
telephony module with client=SystemApi.Client.MODULE_LIBRARIES so
it can only be accessed by boot classpath code, and then create
a copy of Rlog in the telephony module, which internally use the
aforementioned API.

Note:
- Support for MODULE_LIBRARIES is not fully in yet, so for now
the Log.logToRadioBuffer() API is still hidden.
- Once all the infra is in, we can expose logToRadioBuffer.
- Once we mark it with MODULE_LIBRARIES, ART will protect it
against app code, so no further protection will be needed.

Bug: 144374158
Test: boot
Change-Id: I5be0497a17d00152286fe3351bf58e75b675ceb6
2020-01-07 16:40:35 -08:00
Automerger Merge Worker
cb8823d980 Merge "Fix annotation / debugging" am: 69bbb1904f am: 1d866c0bf3 am: 39d6ba888d
Change-Id: I81c9b247f854d8b5d75fdd232f46979a9f5ed9d3
2020-01-07 16:51:33 +00: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
Artur Satayev
df4395991f 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
2020-01-07 13:29:50 +00:00
Automerger Merge Worker
8303c9def2 Merge "Change NetworkTimeUpdateServiceImpl behavior" am: 48247d9223 am: f11a45b756 am: ef100e45fe
Change-Id: Ie4ab2ecaa0778fa6ff7d75e5677dfb4bed1d443d
2020-01-07 10:45:04 +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
Jeffrey Huang
fc33255d9c Merge "Make ProtoOutputStream public" 2019-12-19 20:59: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
Jeffrey Huang
80900f249f Make ProtoOutputStream public
Bug: 142279786
Test: atest CtsProtoTestCases ProtoInputStreamTests
Change-Id: I1f6eeb09898277a0975c2081630bfa849afc13ab
2019-12-18 22:49:33 -08:00
Automerger Merge Worker
f0fcf8c85a Merge "Fix android.util.CloseGuard sample usage" am: 7381525076 am: 66b0e7d150 am: 16257918c9
Change-Id: I23ca1a8ca61e62b20c5b5eff0c7e9ef10c2e6711
2019-12-18 18:37:18 +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
Kweku Adams
96e641788a Merge "Overriding toString method." 2019-12-16 23:05:39 +00:00
Kweku Adams
5ea42287ed Overriding toString method.
LongArrayQueue wasn't overriding the toString method, so it couldn't be used
in dumps.

Bug: 135764360
Test: atest CountQuotaTrackerTest
Change-Id: I02b1d22f8cf0fca96d0fdaff3becaa07e46ddb06
2019-12-16 13:27:32 -08:00
Kweku Adams
211ac27eab Merge "Fix documentation in SparseSetArray." 2019-12-16 21:08:29 +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
Muhammad Qureshi
237c774468 Create framework-statsd
Create framework-statsd jar in statsd apex.
Move StatsEvent to framework-statsd.jar.
Right now, frameworks jar links against framework-statsd directly. This
should be changed to link against framework-statsd-stubs.

Bug: 145923096
Bug: 145923116
Bug: 142810493

Test: m
Test: flashes successfully
Test: adb shell cmd stats print-logs && adb logcat "*:S statsd:*"

Change-Id: Ife224abd5c9b9b0eeab681dc4b7f71c0bdb856b1
2019-12-16 10:17:03 -08:00
Kweku Adams
79cbc340b2 Fix documentation in SparseSetArray.
"n" in SparseSetArray is actually the key, not the index. "index" is used
as a parameter name in this class wherever it actually is the index.
Using index in documentation in the wrong places gives users the wrong
understanding.

Bug: N/A
Test: N/A
Change-Id: I239a653347dab4ea1a00c6d709aac06a98012a46
2019-12-13 18:03:49 -08:00
Yi-Ling Chuang
afc4d88a96 Add a feature flag for Settings conditionals removal.
Bug: 142927361
Test: rebuild and manual
Change-Id: I4cfce774f717ae15af1ea321dbb645561d77c4aa
2019-12-13 12:06:53 +08:00
Jeffrey Huang
cd5c5990d2 Merge "Rename IStatsManager to IStatsd" 2019-12-12 21:47:47 +00:00
Automerger Merge Worker
876469ea3a Merge "Expose CloseGuard as a public API" am: 4314616565 am: 37f8e04de9 am: 58745b4dcc
Change-Id: I40a7e24b9e77c27a954ab4394b47ac75a4681760
2019-12-12 19:12:27 +00: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
TreeHugger Robot
25c621b432 Merge "Remove deadcode in VerityBuilder" 2019-12-12 05:32:30 +00:00
Jeffrey Huang
161c075d99 Rename IStatsManager to IStatsd
Bug: 146075178
Test: CTS/GTS tests
Change-Id: I235944758b8cc24a0df85b54d7441e7e8d0a8bbc
2019-12-11 15:49:03 -08:00
Ruchir Rastogi
25e2b42a6b Remove StatsEvent.h/cpp and StatsEvent.aidl
As of ag/9820253, Binder communication between pull atom clients and
statsd uses the structured StatsEventParcel. The custom parcelable
StatsEvent class is not needed anymore.

Test: m
Change-Id: I33aa975a2cd1b02ba232aadc11e2ac58814de4c3
2019-12-11 15:10:58 -08:00
Victor Hsieh
5f01de427b Remove deadcode in VerityBuilder
generateFsVerityTree is never used now, thus and code path for
skipSigningBlock == false is dead.

Test: build
Bug: N/A
Change-Id: I32a3a0ad50aae6fb47ae4af2f70a5114d832b907
2019-12-11 22:02:29 +00:00
TreeHugger Robot
5e68b5c709 Merge "Fix StatsEvent memory usage for pulled events" 2019-12-10 23:18:07 +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
Muhammad Qureshi
9e829804e1 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
2019-12-10 13:27:38 -08:00
Neil Fuller
7daba13fc0 Merge "Extend LocalLog to enable UTC timestamps" am: 9436134056 am: c74594a2e3
am: 746d69afa5

Change-Id: I167f79a33218c5b6593c165f9185663f965dcdcd
2019-12-10 01:54:49 -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
Neil Fuller
a7453c69b2 Extend LocalLog to enable UTC timestamps
Extend LocalLog to enable UTC timestamps with elapsed realtime clock
info too.

Switch time-related usages over to using UTC timestamps. This will make
debugging a lot easier when the code doing the logging is responsible
for changing the system clock and default time zone.

Test: treehugger only
Bug: 140712361
Change-Id: Ic6b12f9032c0c3ebc48f12a970a7b4dd398e7fec
2019-12-09 17:02:44 +00:00
Gavin Corkery
dd1dabaef7 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: 138782888
Test: atest PackageWatchdogTest
Test: atest StatsdHostTestCases
Change-Id: Ia3e73d955508297004591eac762555665c557b8a
2019-12-09 10:40:01 +00:00
Ruchir Rastogi
cd9dd94fb1 StatsEventParcel impl.; move AIDL files
This implementation continue to uses libbinder, as opposed to
libbinder_ndk.

We also move many (but not all) statsd aidl files from
frameworks/base/core into the apex.

Test: m -j128 && bit statsd_test:*
Change-Id: I95f06e937e50c1e2a638163b13587682402956a7
2019-12-06 14:08:27 -08:00
Muhammad Qureshi
d265088259 Fix error handling in StatsEvent
Bug: 143286399
Test: bit FrameworksCoreTests:android.util.StatsEventTest
Change-Id: I2159bf138a307e45c44102a8feb7a69d0c793843
2019-12-05 18:07:12 -08:00
Muhammad Qureshi
f11130cfa0 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
2019-12-02 23:25:47 -08:00
Abhijeet Kaur
3e4c9c4661 Merge "Add a new persistent FUSE flag in Settings" 2019-12-02 15:48:27 +00:00
Abhijeet Kaur
b984771e99 Add a new persistent FUSE flag in Settings
New system property settings_fuse enables user to switch persist.sys.fuse
flag on/off from Settings UI. New system property is added as the
Settings UI sets system property with a fixed prefix
(persist.sys.fflag.override.) for persistent properties and for
consistency we do not want to rename persist.sys.fuse.

The user needs to restart the device after toggling the flag from
Settings UI. When the device restarts for the first time,
persist.sys.fuse is set from settings_fuse when the
StorageManagerService starts. If the value of persist.sys.fuse is
modified, then the device reboots for it to take effect.

The 2 reboots take almost the same time as 1 reboot and the difference is
not noticeable to the user as the lock screen does not show up in
between the 2 reboots.

This change would also mean that the newly added flag
(persist.sys.fflag.override.settings_fuse) will always override
persist.sys.fuse (as it is always checked on reboot), which implies that
`adb shell setprop persist.sys.fuse [true/false] && adb reboot` will
have no effect.

Bug:144419848
Test: * Enable developer options in Settings.
      * Go to Settings->System->Advanced->Developer Options->Feature Flags.
      * Turn on (off by default) settings_fuse toggle button and
        restart.
      * After reboot run `adb shell getprop persist.sys.fuse` shows
        true.
      * Turn off settings_fuse from Settings UI and reboot
      * After reboot run `adb shell getprop persist.sys.fuse` shows
        false.
Test: Using adb command to change the fuse system property.
      * `adb shell setprop persist.sys.fflag.override.settings_fuse
         true && adb reboot`
      * After reboot run `adb shell getprop persist.sys.fuse` shows true
      * Similarly for false case.
Change-Id: I0093d2b020a9d8ffeec7fca31a44ef2e65b4dfb4
2019-11-29 15:20:11 +00:00
Sudheer Shanka
069e57e0aa Merge "Fix NetworkPolicyManager unit tests." am: da3518bc6b
am: 1381de466a

Change-Id: I474180a603338a1f980b327f183dac8131577330
2019-11-26 19:10:50 -08:00
Sudheer Shanka
2d1ab90aa2 Fix NetworkPolicyManager unit tests.
Bug: 137859686
Test: atest core/tests/coretests/src/android/net/NetworkPolicyManagerTest.java
Test: atest services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
Change-Id: I38a935c71bfb1f78739d508b400e43dc1b52bef5
Merged-In: I38a935c71bfb1f78739d508b400e43dc1b52bef5
(cherry picked from commit 6ec3caf218)
2019-11-27 02:50:03 +00:00