Commit Graph

16 Commits

Author SHA1 Message Date
Jeff DeCew
c7be05d8ed Add Compile.IS_DEBUG to systemui
This is meant to replace Build.IS_DEBUGGABLE and allow compile-time optimizations

Fixes: 214238812
Test: manual builds
Change-Id: Id4b3c48a0c88f1e4cff7752907cf72d19295571d
2022-01-12 16:20:02 +00:00
Jeff DeCew
3b6176a6bd Generalize some flag manager methods by flag type.
Bug: 209081785
Test: atest FeatureFlagsDebugTest FlagManagerTest
Change-Id: Ie92667e33e7c086258cdd03e7b9ebccdefef5938
2021-12-08 15:48:53 +00:00
Dave Mankoff
02e42be6ec Convert FeatureFlags to interface.
Rename FeatureFlagManager version to
FeatureFlagsDebug and FeatureFlagsRelease, implementing
the FeatureFlags interface.

Bug: 203548827
Test: manual
Change-Id: I4b78757a5e7ee3d5ee06f9124e2b8f670e611d4f
2021-11-17 17:13:25 -05:00
Dave Mankoff
5346e090f5 Move contents of FeatureFlags into FeatureFlagManager.
The meaningful contents of FeatureFlags only relates to debug
builds and has been moved into the debug version of
FeatureFlagManager.

Bug: 203548872
Test: atest SystemUITests && manual
Change-Id: Ifcef0cfe4e2d07daec34dfc7a6cbe2d305b312b5
2021-11-10 09:46:04 -05:00
Dave Mankoff
d1d488687b Communicate flags from systemui async
Flags are no longer statically compiled into the shared library.

A "GET_FLAGS" api has been added to SystemUI that returns a list
of Flag objects, as defined in SystemUI.

Communication happens via a simple "ordered" broadcast.

FlagManager#getFlagsFuture() returns a ListenableFuture pointing at
the list of flags. Be sure not to call Future#get on the main
thread - the call will block indefinitely as the broadcast receiver
is handled on the main thread.

Instead, add a listener to the future or call #get on a separate
thread.

Bug: 203548827
Test: manual
Change-Id: I8720e0905662a6371e7aabf04341df46b8943a9c
2021-11-05 15:27:09 -04:00
Dave Mankoff
72a5002956 Add support for flag change listeners library.
Bug: 203548827
Test: manual
Change-Id: I6f989e89a98c7c6643af762eb0263f81ce584dfa
2021-11-03 11:20:11 -04:00
Dave Mankoff
1a934e9aee Add ability to read flag values to Flag Library.
The FlagManager now partially implements the FlagReader interface.

The FeatureFlagManager, part of SystemUI proper, now uses the
FlagManager to read flag values, helping to ensure consistency between
the two separate systems.

Bug: 203548827
Test: manual
Change-Id: Ia3b103f783a846cfe9437cd8e6b987962cebabde
2021-11-03 10:28:22 -04:00
Dave Mankoff
93c9d9d665 Add a shared library for setting flags in SysUI.
This adds the FlagManager class which currently has 3 methods:
- #getFlagsFuture
- #setFlagValue
- #eraseFlag

The first makes an async call to SystemUI to retrieve the flags
it knows about. It returns a collection of Flag objects from which
one can get the id, type, and default values.

The other two are fairly self-explanatory, sending intents to
SystemUI telling to set or erase flags. Any app calling these
methods must have the FLAGS_PERMISSION defined in the FlagManager
library.

Only boolean flags are supported at the moment.

Bug: 203548827
Test: manual
Change-Id: Id15ff481edcb83c67ce4cdad6cdda27d28a40652
2021-11-02 11:27:55 -04:00
Jeff DeCew
86b8e77bbf Make gradle build use debuggable FeatureFlagManager
Fixes: 204129347
Test: gradle build & dump
Change-Id: I06ba95f4cc21b06519e676afee4bb6ae9c44c03e
2021-10-30 14:08:45 -04:00
Jeff DeCew
4d9465b028 Make FeatureFlagManager Dumpable
Also direct developers who find FeatureFlagManager in the src/ tree to the src-debug/ version

Fixes: 204127880
Bug: 203904245
Test: adb shell dumpsys activity service com.android.systemui
Test: FeatureFlagManagerTest
Merged-In: I6a42a697120179048e848f7f432fd753db514b9c
Change-Id: I5bec46e60befaa1890b9ff4d4bb5e89b0ebba256
2021-10-29 16:10:51 -04:00
Dave Mankoff
c9d778dbfb Cache flag values when they are read.
Bug: 202860494
Test: manual
Change-Id: Icde45251feb344b36bddf5717b9b21c28cb85eb0
2021-10-15 11:38:43 -04:00
Dave Mankoff
38180dfa04 Restart SystemUI when a flag changes.
Bug: 202860494
Test: manual
Change-Id: Ic5356aa093db8afc9f57e724603472efa5473a2f
2021-10-15 11:38:43 -04:00
Dave Mankoff
f6db05e59f Add ability to set/erase flags via intents.
A flag can be set with a command like the following:
adb shell am broadcast -a com.android.systemui.action.SET_FLAG \
--ei id 1 --ez value 1

A flag can be "erased" with the same command, but leaving the value
unset.

Bug: 202860494
Test: manual
Change-Id: If1097e230692df49a6de7cbbb71ed37b0499c663
2021-10-14 17:39:09 -04:00
Dave Mankoff
898026515a Add ability to read and write flags to sysprops.
Bug: 202860494
Test: manual
Change-Id: I660931492e8a2ffd1373162aab60e4abd4566db6
2021-10-14 12:24:45 -04:00
Jay Aliomer
5eac15cf85 Remove flag plugin with flag manager with DI
Test: FeatureFlagsTest
Bug: 196602427
Change-Id: I43961a091f0f10ebd1a168f40703f0067d9f8a18
Merged-In: I43961a091f0f10ebd1a168f40703f0067d9f8a18
2021-10-14 12:24:45 -04:00
Jay Aliomer
722473e7ff Added a debug and release version of flag reader
Bug: 196602427
Test: manually tested with log statements
Change-Id: Ie01af22ef51504db5aadc0da1d367961b6aa42d4
Merged-In: Ie01af22ef51504db5aadc0da1d367961b6aa42d4
(cherry picked from commit 97d4fc7d15)
2021-10-12 19:01:53 +00:00