Commit Graph

9 Commits

Author SHA1 Message Date
Zhi Dou
ce3f8d4352 add a read only flag for demo
Bug: 298754733
Test: atest AconfigDemoUnitTests
Change-Id: Ib01918b2469ea59091b47d49672800b5716beb88
2023-09-15 14:17:25 +00:00
Zhi Dou
32120e43e1 Run unit test with the prod flag java lib
Bug: 295561701
Test: m AconfigDemoUnitTests
Change-Id: Ib906c285ee6b4ebc04fde0e09555fb3c56453d16
2023-08-31 18:22:19 +00:00
Zhi Dou
3c4cc122eb Add demo code for testing
This change add demo for using test mode flag lib in
self-instrumentation tests.

There are two options.

The option 1 is to create two versions, prod and test, of the library
using flags. The prod version library uses prod flag lib, and the test
version library uses test flag lib.

The option 2 is to dynamically link to the flag lib in the library. The
flag lib is used as a stub lib and is just used for building purpose.
The in the finally binary which uses the library, the binary should
statically link to the right version of the flag lib.

Bug: 295561701
Test: atest AconfigDemoUnitTests1 && atest AconfigDemoUnitTests2

Change-Id: Ie571a260d9042933032c702095808dbf59d1697c
2023-08-18 19:45:14 +00:00
Zhi Dou
d20064a3ad Rename MockFlagsRule
The testing rule MockFlagsRule is not a "Mock". Rename the class name.

Bug: 280833463
Test: presubmit
Change-Id: I644537163e07dcf55cd69af3690e435251149349
2023-08-07 15:37:29 +00:00
Zhi Dou
4a8cecd0f6 Add usage of test mode
Add usage of test mode of java_aconfig_library.

Add local host unit test of contentlibs

Test: atest ContentLibs_test_host --host
Bug: 287644619
Change-Id: Ib99a3f2b692d3251d445a2e188325ee0b0b6b268
2023-07-28 21:39:45 +00:00
Guang Zhu
1037f3dc47 Add direct usage of Flags in demo app
So that flags aren't subject to optimization

Bug: 289449667
Test: atest FlagStateComboTests
Change-Id: Idafa571e74448fad3ae3d36c1e00a960abb21f24
2023-06-30 12:34:16 -07:00
Guang Zhu
b6434aae53 add more variantions for flag on/off filtering demo
... also fixed missing copyright headers in 2 existing test files
... also made the instrumentation against the demo activity for real

Bug: 277819423
Test: atest FlagStateComboTests
      adb shell device_config put test \
        com.example.android.aconfig.demo.flags.awesome_flag_1 <true|false>
      adb shell device_config put test \
        com.example.android.aconfig.demo.flags.awesome_flag_2 <true|false>
Change-Id: I6083f11ee743a8b4f0f9bc23ac6945b5d072ab5e
2023-06-29 16:03:24 -07:00
Zhi Dou
52f9498e0e Add Injection use case
Add the Injection use case of Aconfig flag.

Add corresponding tests.

Test: atest AconfigDemo_ContentLibs_Test
Bug: 287644619
Change-Id: I47cea59764b2956644ad0c159945d3cdb3231c09
2023-06-23 22:35:41 +00:00
Zhi Dou
648c081b56 A simple app uses aconfig flag
Add a simple app uses aconfig.

This app can demonstrate

1. declare aconfig flag
2. build aconfig flag in building system
3. generate aconfig java flag
4. use aconfig java flag in java code

Test: atest AconfigDemo_ContentProvide_Test
Bug: 280833426
Change-Id: Ieacbe4b2368a00872254dab1c87dc66c569fc30a
2023-06-23 00:26:04 +00:00