OSDN Git Service

Structure StrictMode violations as Throwables
authorKurt Nelson <kurtn@google.com>
Fri, 27 Oct 2017 01:06:12 +0000 (18:06 -0700)
committerKurt Nelson <kurtn@google.com>
Fri, 3 Nov 2017 18:14:30 +0000 (11:14 -0700)
commit1bb93bf77c9dfb901682fe0185ec4bbae59bfe63
tree008ad66101619668f81f392dfab6444a65e39dd9
parent0075dda8254ce4e1d7a3d1c32aa22ae1aee42990
Structure StrictMode violations as Throwables

All violations of StrictMode now inherit from one central Violation
class. This unlocks adding penaltyCallback(Violation).
Parsing strings is no longer required to infer what type of violation
something is.
Violation classes have no need to be loaded in Zygote as only developers
opt-in to this feature and will see violations.

Cross-binder thread violation perf test:
before
2872331
2574093
2481208
after
1938227
1742714
2654538

Bug: 64258734
Test: cts-tradefed run cts-dev --module CtsOsTestCases --test
android.os.cts.StrictModeTest
Change-Id: I1971feb03ff77cf297c940cacee62fadb5b8422c
22 files changed:
api/test-current.txt
config/compiled-classes-phone
config/preloaded-classes
core/java/android/os/StrictMode.java
core/java/android/os/strictmode/CleartextNetworkViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/ContentUriWithoutPermissionViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/CustomViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/DiskReadViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/DiskWriteViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/FileUriExposedViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/InstanceCountViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/IntentReceiverLeakedViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/LeakedClosableViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/NetworkViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/ResourceMismatchViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/ServiceConnectionLeakedViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/SqliteObjectLeakedViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/UnbufferedIOViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/UntaggedSocketViolation.java [new file with mode: 0644]
core/java/android/os/strictmode/Violation.java [new file with mode: 0644]
core/java/android/os/strictmode/WebViewMethodCalledOnWrongThreadViolation.java [new file with mode: 0644]
services/core/java/com/android/server/am/ActivityManagerService.java