Reconcile native and Java parcel code for WorkSource.
Prior to this change, native work sources didn't read or write any
information concerning WorkChains, but Java ones did. This lead to a
mismatch when Java code, such as PowerManagerService, unparceled the
WorkSource as it read the whatever the next 4 bytes happened to be as
the WorkChain count, but it was actually reading whatever the next item
in the transaction happened to have written.
Note that this change does _not_ attempt to add a WorkChain
implementation to native. It instead makes it so that WorkSources
written from native to Java, or Java to native with no WorkChains, are
correctly and symmetrically parceled. In addition, if a Java WorkSource
is sent to native with a non-zero amount of WorkChains associated, then
it will return an error when unparceling rather than continuing but
leaving in the Parcel in an undefined state.
Bug: 234429395
Test: atest WorkSourceTest.cpp
Test: Write sample native app that grabs wakelock, validate display ID
Change-Id: Id1a5f29f4ccf2996e37ec99014ce392599b6b725
3 files changed