As part of getting rid of StatsLogInternal and moving every atom to be
logged from a module, this CL addresses 2 issues:
1. Add WorkSource logging to modules.
2. Gate WorkSource logging via a CLI flag to prevent WorkSource methods
from being included in modules that are Mainline modules and can't have
@hide calls.
Bug: 147541828
Test: m
Test: atest android.cts.statsd.atom.UidAtomTests
Change-Id: Icce2f6ed7298be5e5ceebfb05d87e6fa7cd6bdbb
AssetManager2.cpp expects style attribute IDs to be in sorted order when
applying a style (see AssetManager2::GetBag). Shared libraries have a
package ID of 0x00, which will mean any attribute defined in a shared
library will be put before all other attributes. Once the attribute ID
is looked up in the dynamic ref table, the package ID is no longer 0x00,
which means this ID is no longer in sorted order. This messes up the
logic in AssetManager2::GetBag, and results in some style attributes
getting dropped from shared libraries.
This change modifies how aapt2 sorts the style entries, sorting entries
with dynamic IDs after entries with the android framework ID. This means
the entries will still be in sorted order when the IDs are looked up.
Bug: 147674078
Test: TableFlattenerTest.FlattenSharedLibraryWithStyle
Change-Id: Ic4f4004b6d9cecde9325dcdb37f71138857f8236
Fixes an issue where the thread pool leaks when code generation
throws an exception (for example because of an invalid log string).
When the thread pool leaks, System.exit() no longer works, because
the JVM waits for all threads to exit - which never happens for the
leaked thread pool.
Test: `ProtoLog.w(LOG_GROUP, new String())` -> make droid should not hang
Change-Id: Ibdae0f1e68441c6fe004398d146f496503ccc4cd
This allows apps to specify the minimum versions they need
of extension sdks, and fails install if they aren't met.
There is additional work required to prevent local rollbacks
from triggering a downgrade of SDK versions after an install.
Bug: 137191822
Test: atest PackageParserTest
Exempt-From-Owner-Approval: PS4 was approved
Change-Id: If61ae6c67ceb752bec6876006a29e52b996901e7
API Review requested to remove unneeded allocations so pass null for
arguments that are empty when writing KeyValuePairs
Bug: 146383532
Test: m
Change-Id: Ic1788f65e8c7f837d6800d59c186519a82882bf7
The is_dynamic bit on references was getting lost when converting to
proto and back. This was preventing bundles from being used as shared
libraries, since layout inflation would fail when it hit a dynamic
reference.
Bug: 146491000
Test: Build a shared library with a layout that has a dynamic reference,
and attempt to inflate that layout.
Change-Id: Ia0e615670d2ac52f9266e3eec8813af7687d3323
Overlays targeting shared libraries should be loaded into the
resources of every target that depends on the shared library.
Static shared libraries are currently not supported because overlays
should override all versions of static shared libraries and there is
not currently support for an overlay targeting multiple APKs.
Also created a test instrumentation and host test suite for testing
overlays and packages on the system image.
Bug: 140790224
Test: atest OverlayRemountedTest
Change-Id: I20a217b6368d6cf92b2b9f46908fd58012933f72
Before this CL, classes in the unnamed package, such as
L$r8$backportedMethods$utility$Objects$2$checkIndex
(which looks like it is generated by R8 for Objects.checkIndex() calls)
were breaking the build because extract_package was incorrectly assuming
that there would always be a '/' in the identifier string.
Test: Build that previously broke is now working.
Change-Id: Ice78d6b31c4f38a3c9d529bc6156d625d19bcacf
Don't use Build.VERSION.CODENAME to check for R.
Use Build.VERSION.SDK_INT > Q || (Build.VERSION.SDK_INT == Q &&
Build.VERSION.PREVIEW_SDK_INT > 0)
Bug: 146235828
Test: m DocumentsUIGoogle
Change-Id: I59e327d4e92d41a93b6bea145b8497fd4f85108c
"aapt2 compile" marks styleables as public instead of preserving
information from <public/> or --visibility options. This behavior can
now be disabled via --preserve-visibility-of-styleables.
Bug: 146649511
Change-Id: Ifb8ab396573d1393df737a59625e79e9cf2494a7
Tested: aapt2_tests
Test: CtsAppOpsTestCases (with newly added test for featureIds declared
in manifest)
Bug: 144997947
Change-Id: I5563ae6861318e4cc1d196e3f6aea378a4dcf748
Add support to generate Q schema code generation only for modules that
ship to Q.
Bug: 145606209
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Change-Id: I978ac321415f1e8d76e4ec73445894965845aaea
Right now, Q schema generated code has a dependency on libutils.
Turning on R schema for clients will remove libutils as a required
dependency. Once libutils is removed from clients, turning the flag off
again will be complicated as all clients will need to re-include
libutils. To fix this problem, remove dependency on libutils in Q
schema.
Right now, we only use SystemClock.h from libutils in Q schema autogen.
Use timespec from C standard library instead.
Bug: 146808265
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Test: bit statsd_test:*
Change-Id: I00efeab1be351a95083f3b6e2dbc9067849bee20
Shared libraries are assigned package id 0. Resource ids that start
with 0x00 are not invalid. This change changes is_valid to accept
dynamic resource ids and adds an is_valid_static method for when
an id must have a non-zero package id.
This also fixes an issue that made layouts in shared libraries that
use internal attributes exclude compiled resource ids from the binay
xml output.
Bug: 146491000
Test: Build a shared library with a layout that uses app attributes
as well as android attribute and verify that all attributes
have assigned resource ids using `aapt2 dump xmltree`
Change-Id: Ibc0407c610ffc98d7aaf233c37c065912ab0d516
Clients don't need to know about statsd metadata. Extract out metadata
from statslog.h/cpp into atoms_info.h/cpp which is only used by statsd.
Generated atoms_info.h: https://paste.googleplex.com/6303016724463616
Generated atoms_info.cpp: https://paste.googleplex.com/5717940978581504
Test: m -j
Test: old metadata in statslog matches the metadata in
atoms_info
Test: Flashes successfully
Test: adb logcat "*:S statsd:*"
Change-Id: I56ef3cc4ea1fbd2cd0130d4e9576b242efb9f627
LocaleDataTables.cpp is outdated due to ICU update over the years
Test: ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP
Test: m droid
Change-Id: I21918cc0f50c7347e514dc7b015607e19cffb377
I didn't realize that this was actually a thing, but:
<resources>
<item name="id1" type="id"></item>
<item name="id2" type="id">@id/id1</item>
</resources>
leads to a resource table which 'aapt dump resources' will render as:
resource 0x7f030000 com.pkg:id/id1: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
resource 0x7f030001 com.pkg:id/id2: t=0x01 d=0x7f030000 (s=0x0008 r=0x00)
while 'aapt2 dump resources' printed:
type id id=03 entryCount=2
resource 0x7f030000 id/id1
() (id)
resource 0x7f030001 id/id2
() (id)
After this change, it prints:
type id id=03 entryCount=2
resource 0x7f030000 id/id1
() (id)
resource 0x7f030001 id/id2
() @id/id1
Bug: 69445910
Change-Id: I0001ff09345434577ac4c1d32f96a781f4190d8d
Tested: manual, see above
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
Previous refactor accidentally assumed all attributes would have
resolvable symbols when generating the R class. Restore previous
behavior of calling SkipSymbol before retrieving the attribute
comment.
Bug: 145685954
Test: m TeleService
Change-Id: Ie8e1092556bc0b6a764462ffa0b99a876bcbd70e
The property is currently set by the AIDL compiler to indicate the original
position of the annotation in the AIDL file. Use this position in
preference to the annotation position within Java code if it's present.
Also rework the tests to use the google compile-testing library rather than
my crufty javac library. This makes testing failure conditions much nicer.
Bug: 145120552
Test: atest unsupportedappusage-processor-test
Test: m framework-annotation-proc
Change-Id: Icaac9b40672dce028095b578c19950b688506c0d
On some windows versions (plus wine) std::regex has issues with the
icase flag (making regex case insensitive). Put the responsibility of
the case sensitivity on the caller.
Fixes: 127793905
Test: wine aapt2_tests.exe -> Util_test
Change-Id: I6775514d3ef43c2c47465bf39ceaf2c195909724