Commit Graph

468 Commits

Author SHA1 Message Date
Treehugger Robot
112c4886c7 Merge "Don't show staged value if flag is RO" into main 2024-09-16 16:58:33 +00:00
Marybeth Fair
a323229292 Merge "Add ability to manually write to binary files." into main 2024-09-16 15:57:24 +00:00
Ted Bauer
431f44a314 Don't show staged value if flag is RO
Bug: 324436145
Change-Id: I493421f29d6e7f5e844dd47cc6417b3d5fe9cdbb
Test: m aflags && aflags list
2024-09-16 15:50:50 +00:00
Marybeth Fair
45b0438cc0 Add ability to manually write to binary files.
I was updating the format of PackageTableHeader to add an additional
field (and due to that change incremented the file version). This broke
several tests under aconfig_storage_read_api and
aconfig_storage_write_api that were operating on files written in the
old schema. I tried to re-generate them using aconfig create-storage as
explained in aosp/2933375, but was having some trouble. Figure if we can
just update the files directly it will be easier to make updates in the
future anyway. This isn't bypassing logic that's tested - IIUC the tests
cover reading the file correctly (writing is covered in separate tests).

Usage:
$ aconfig-storage print --file=path/to/flag.map --type=flag_map
--format=json > flag_map.json
$ vim flag_map.json // Manually make updates
$ aconfig-storage write-bytes --input-file=flag_map.json
--output-file=path/to/flag.map --type=flag_map

Change-Id: I212bf0b97483740b30130eb121acb895d350da84
Test: manual (adding debug-only tooling) + cargo t
Bug: 316357686
2024-09-16 10:30:04 -04:00
Ted Bauer
83d2a58dd9 Show containers in list new storage
Test: m
Bug: 324436145
Change-Id: I695aa130aee356451aa8196911d31b87d45d745d
2024-09-13 17:08:31 +00:00
Dennis Shen
b3681ad5c6 Treat system_ext as system in container designation
Bug: b/365135457
Test: m
Change-Id: Iece264cdd49d84ef0e5acccdbcf68059c876395f
2024-09-12 23:32:03 +00:00
Treehugger Robot
187e280d3c Merge "Expose DeviceProtos' paths to parse in Framework" into main 2024-09-12 21:33:17 +00:00
Yurii Zubrytskyi
45e02d3c76 Expose DeviceProtos' paths to parse in Framework
Framework currently hardcodes the paths to flags protos, with
this change it will be able to reuse the globally defined ones
and also gets access to all APEX flags

Bug: 301491148
Test: build + boot
Flag: EXEMPT build change
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1e85e40c3ead83585ac3d7c71a712d35cd420a36)
Merged-In: I91dae72c32c47888697914265c90918389aa4c25
Change-Id: I91dae72c32c47888697914265c90918389aa4c25
2024-09-12 05:53:21 +00:00
Jared Duke
f43413c53f aconfig: Don't log matching validated flags
Avoid log spam by skipping log statements for matching validated flag
entries in the Java codegen. Also change any mismatched logs from
info to warning.

Change-Id: Icb8bba38d8594438757d76957c4c0188f6c2758a
Test: atest aconfig.test
Flag: EXEMPT bugfix
2024-09-11 23:15:58 +00:00
Ted Bauer
b1edaae899 Add flag for enabling only new storage and use in aflags
Change-Id: I73218de38d005d77987d5103364a102cec3abc07
Test: m && cargo t
Bug: 324436145
2024-09-11 20:24:47 +00:00
Ted Bauer
c50121613d Don't show container in list new storage
Change-Id: I24263e244d5b86ef066cd2efd511a890b03bf6e7
Test: m
Bug: 324436145
2024-09-04 18:11:59 +00:00
Marybeth Fair
2610f480aa Merge "Add a function to fingerprint flag/offset info." into main 2024-09-04 15:37:59 +00:00
Marybeth Fair
df1b7d1d81 Add a function to fingerprint flag/offset info.
Uses SipHasher implementation added to the project. Ideally the output
would remain consistent between builds (though the worst case of an
updated algorithm would be a string lookup for cross-container reads
only).

Sort the flags first so everything is always added to the hasher in the
same order - note this code is only run at build time, not runtime.

Next step is to write this fingerprint into the package.map file and
introduce a flag to guard this change.

Bug: 316357686
Test: atest aconfig.test
Change-Id: Ie5f34541d982dfa120ffb05fc0790603689d47c0
2024-09-03 16:24:51 -04:00
Treehugger Robot
36a352cd02 Merge "aconfig: Use LazyLock rather than lazy_static" into main 2024-09-03 16:56:06 +00:00
Andrew Walbran
d3878575ac aconfig: Use LazyLock rather than lazy_static
Now that we have Rust 1.80 LazyLock is available in the standard library
so we no longer need to use external crates such as lazy_static.

Bug: 364211748
Test: atest aconfig.test
Test: atest aconfig.prod_mode.test.rust
Test: atest aconfig.test_mode.test.rust
Test: atest aconfig.force_read_only_mode.test.rust
Change-Id: If2862eaf20065c118daa9fc51e9fb403b99dada3
2024-09-03 17:01:49 +01:00
Zhi Dou
9c85770aa4 java reader reads directly from map
This commit changes java reader to directly read the flag value from the
map file instead of load the entire file.

Change-Id: Icee42d99506894da1e3e32a31c6554895719de7b
Test: atest aconfig_storage_read_api.test.java aconfig_storage_file.test.java
Bug: 352078117
2024-08-30 18:49:07 +00:00
Treehugger Robot
d713353ab8 Merge "aconfig Rust: Support huge list of flags" into main 2024-08-29 14:46:45 +00:00
William Escande
a8454c30ed aconfig Rust: Support huge list of flags
Test: m libbluetooth_aconfig_flags_rust
Test: atest aconfig.prod_mode.test.rust
Test: atest aconfig.test_mode.test.rust
Test: atest aconfig.force_read_only_mode.test.rust
Test: atest aconfig.test
Bug: 311772251
Bug: 362773105
Change-Id: I48e268fc783e491a045d1bb6298c2b3c87045722
2024-08-28 16:52:56 -07:00
Zhi Dou
bca30dd13f Implement SipHasher
This change implements SipHasher in rust and java to make sure same
bytes array will be hashed into the same u64.

The implementation is needed, thus when rust, and java code read the
same flag file, they can find the same entry based on the same key.

Test: atest aconfig_storage_file.test.java aconfig_storage_file.test.cpp
Bug: 352078117
Change-Id: I2ce470039213a09a1df7637e60f4649b053fb2ea
2024-08-28 16:02:42 +00:00
Zhi Dou
99023d6160 Remove local copy of the flag file
This change removes the local copy of the flag file in PackageTable, and
FlagValueList.

PackageTable copied the entire flag file into memory, and the
FlagValueList copied the entire flag value list into memory. In this
change FlagValueList directly access the flag value list in the memory.
PackageTable will iterate the file, and find the target package node.

Change-Id: Id766c28b71a54290b266cc5f3f404f5c82590da2
Test: atest aconfig_storage_file.test.java aconfig_storage_read_api.test.java
Bug: 352078117
2024-08-22 19:56:48 +00:00
Ted Bauer
91458b4cd4 Merge "Parse protos in library" into main 2024-08-15 22:15:19 +00:00
Ted Bauer
6f12acb0da Parse protos in library
Bug: 342636474
Test: m
Change-Id: I4934fa2332b00084f73453945d6b4743566f6e48
2024-08-15 21:04:28 +00:00
Jihoon Kang
0c26850dba Merge "Specify is_stubs_module property in selected aconfig library modules" into main 2024-08-15 16:45:16 +00:00
Jihoon Kang
48f2b22b45 Specify is_stubs_module property in selected aconfig library modules
"fake_device_config" and "strict_mode_stub" provide stubs and do not
contain any implementation details. Specifying the property
"is_stubs_module" to these modules allow inter-container dependency on
these modules.

Test: m nothing
Bug: 354029496
Change-Id: Ia65ad36ca02c0594fc753935f9cc7c0af6caa20d
2024-08-14 22:23:08 +00:00
Ted Bauer
f51e1dd28d Only read the use_new_storage_value flag once per process.
Change-Id: Ib088fbcc2283718a309097c7c45fb01d5a983a25
Test: m
Bug: 312235596
2024-08-13 17:16:04 +00:00
Zhi Dou
8ee1a5b785 DO NOT MERGE: manually cherry pick
Change-Id: I47b6d783f32b7c260dd806898ed880901b5f784b
Test: presubmit
Bug: n/a
2024-08-07 18:51:23 +00:00
Treehugger Robot
70270692d0 Merge "Read from new storage in Java codegen" into main 2024-08-06 21:16:42 +00:00
Ted Bauer
06560bed93 Read from new storage in Java codegen
Change-Id: I8baa089f37dcc496096e124d605f08727647053c
Test: m
Bug: 312235596
2024-08-06 19:34:33 +00:00
Zhi Dou
f5f5992893 change thread policy to allow read disk
Bug: 356614910
Test: presubmit
Change-Id: I65cc2cbd5e17b1ee93e64d8b20e53c42547c985a
2024-08-06 18:58:45 +00:00
Zhi Dou
8af83ccd50 change fileinputstream to filechannel
The restrict mode doesn't allow to have disk read from main thread. Some
apps enabled this check. The code in the dependencies of the
fileinputstream. This chagne switch to filechannel.

Test: presubmit
Bug: 356614910
Change-Id: Icf2175fe75ed1bfad4a048ead680b08e57d6c2ca
2024-08-03 00:08:40 +00:00
Zhi Dou
3d960c5638 Merge "aconfig: make java cached indicator volatile" into main 2024-07-30 23:35:45 +00:00
Zhi Dou
97d02148b9 close file stream
Close file stream, since the in the restrict mode the runtime will check
whether all the resource is closed when it is out of scope.

Test: ABTD ImsStackJavaTests
Bug: 349874828
Change-Id: Ib297622bae730bf99e4d5d1b3adeff3fee805a93
2024-07-30 19:05:14 +00:00
Zhi Dou
36589bc318 aconfig: make java cached indicator volatile
Test: atest aconfig.test.java
Bug: 356201402
Change-Id: I1127a4092536fe199f4a7256dea0c2b289e837da
2024-07-30 18:21:43 +00:00
Zhi Dou
5228a6f4a2 Merge "read new stoarge based on flag value" into main 2024-07-29 13:26:35 +00:00
Zhi Dou
66ff40c08a read new stoarge based on flag value
This change changes the logic to read the flag value from new storage.
Before it check the existence of a file. Not it will directly check the
flag value from DeviceConfig.

Test: m and presubmit
Bug: 349874828
Change-Id: I4a360564a3b48564057eede9bd893899136b3221
2024-07-26 22:46:47 +00:00
Zhi Dou
8add8e0c9b use smart pointer for fd
Test: presubmit
Bug: 348693143
Change-Id: Ibdb1e132a4840d0c3d82aa5f7546a0fc5f5f528b
2024-07-26 22:25:43 +00:00
Zhi Dou
0e5e128034 add sdk none version for core lib usage
Test: m
Bug: 349874828
Change-Id: I412bcf06ca38c862b026715a6a394350eda49b64
2024-07-26 14:03:50 +00:00
Zhi Dou
d6b37c1be7 make aconfig_storage_file.test.java use library from framework
Test: atest aconfig_storage_file.test.java
Bug: 349874828
Change-Id: If6fbf086e889a2c0068a1ca22979db39f5d86448
2024-07-25 19:30:13 +00:00
Zhi Dou
fa988f0a34 add hide and unsupportedadppusage annotation to read library
Test: presubmit
Bug: 349874828
Change-Id: I5b808d87fe7df2ba8a85c8c75ee7baa66ff22d6b
2024-07-25 16:56:48 +00:00
Zhi Dou
8a9a52d140 Merge "make java reader library availiable for mainline" into main 2024-07-22 13:59:28 +00:00
Zhi Dou
b88c3e638b make java reader library availiable for mainline
Test: atest aconfig.test.java
Bug: 349874828
Change-Id: I2cabfa9665e5c474ba64f5969e96e9dae2fdcb9b
2024-07-19 21:01:27 +00:00
Zhi Dou
1edd4485c6 only use new storage for read write
Test: atest aconfig.test.java
Bug: 349874828
Change-Id: I5af9fa6243b8b8a157f03242e6e5a411ced7be44
2024-07-19 20:37:53 +00:00
Ted Bauer
05fea28d9c feat: show if flag is locally overridden
Bug: 324436145
Test: adb shell aflags list
Change-Id: Id239a760e86e469f77d1e99f7a6f27d54cb87206
2024-07-19 13:11:42 +00:00
Ted Bauer
7e272b8bba Merge "Read from new storage in aflags" into main 2024-07-18 13:32:59 +00:00
Ted Bauer
bbbe092496 Read from new storage in aflags
Bug: 324436145
Test: adb shell aflags list --use-new-storage
Change-Id: Ib615e25bc0bc7f2b0362e286a45ce40ebf21f92d
2024-07-17 18:39:25 +00:00
Zhi Dou
9f8ed73934 Change java codegen to read from new storage
This change adds code in java code to read from new storage. However the
generated code won't geneerate code contains code for new storage, since
the build system won't pass `allow-instrumentation` to java codegen.

Test: atest aconfig.test.java
Bug: 349874828
Change-Id: I70983fa97de6633f467d968109d134d46f895a89
2024-07-15 19:08:33 +00:00
Zhi Dou
621323cfda add storage java reader
Test: atest aconfig_storage_read_api.test.java
Bug: 349874828
Change-Id: I4b1d5ccf4d48622a88712b6e8940ffe18e980927
2024-07-12 13:34:12 +00:00
Priyanka Advani
16c8d3c47a Revert "add storage java internal reader"
This reverts commit 70b9ac0ddd.

Reason for revert: Droidmonitor created revert due to build breakages in b/352582602.

Change-Id: I8a8e38ccf3e715e9b4746ac333aed0cc13d11969
2024-07-11 19:59:24 +00:00
Zhi Dou
70b9ac0ddd add storage java internal reader
Test: n/a
Bug: n/a
Change-Id: I852ab4080bee9240549dc4be0c09dbe1f72d06b0
2024-07-11 18:50:46 +00:00
Treehugger Robot
0d18be30ae Merge "fix: make device paths function static" into main 2024-07-11 13:48:51 +00:00