summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2018-10-08 15:25:50 +0100
committerTobias Thierer <tobiast@google.com>2018-10-15 14:45:06 +0100
commit2b1e10cecbb46bb884a1a273f49bf7b43eb19085 (patch)
tree906b60b9b36ef733e43d1b3c6d10b9ace0554c02 /annotations/generate_annotated_java_files.py
parenta4e3cbbbf6d4cf26726f30a701fac5e1b71ffcf3 (diff)
Add @CorePlatformApi for customization of Libcore.os by frameworks.
Provide a @CorePlatformApi to replace the default implementation of libcore.io.Os, held in the static (internal) field libcore.io.Libcore.os, which should not otherwise be updated. This allows callers to safely update the Os implementation even when there may be concurrent callers: while (true) { Os os = Os.getDefault(); Os wrapper = new ForwardingOs(os) { // ...override/customize some methods... }; if (Os.compareAndSetDefault(os, wrapper)) { break; } } Initially, ForwardingOs is the only Os implementation that can be used from outside libcore, and open() is the only method that can be overridden/customized; the plan is that customization of additional methods will be supported in future. Existing code that directly reads the field Libcore.os continues to be safe / correct. Writing directly to that field continues to be not be supported. Bug: 115503977 Test: CtsLibcoreTestCases Test: OsTest Test: Checked that locally adding code similar to the above to frameworks' ActivityThread.main() compiles. Change-Id: I49d9171fb869664b0e72c4cbc055d168c101c669
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions