This improves the use of reflection to include all the flags listed
in Flags.kt. One interseting finding: I can't figure out how to
get the value of a field marked with just `@Keep`. It needs to
also have `@JvmField` or not have any annotations at all.
More changes to this code will come in follow up cls, using string
names where appropriate, but this improves existing functionality.
Key takeaways:
- Reflection is terrible
- Reflection in Kotlin is worse
- Reflection on `object` instances is worse still
- Reflection mixing Java with Kotlin follows the trend line
- Reflection on annotated fields is nigh impossible
Bug: 249121873
Test: adb shell cmd statusbar flag
Change-Id: I69a96501876b01570233c3fd80b6bc7334d9fe73
In this changeset topic
- Build WMShell with protolog viewer config
- it's built with SystemUI{,Google} packages and installed as
/system_ext/etc/wmshell.protolog.json.gz
- Deprecated the viewer configuration as a bundled resource
- The `required` keyword in Android.bp does not propagate, need to add
it in individual Android.bp file such as SystemUIGoogle/Android.bp
- Push the generated viewer config file onto device in makepush script
(in a separate CL)
Bug: 244642224
Test: mp sysuig
Change-Id: Ib7f37ec55d12493d6beec3aba66883415966b521
We pipe the component name of the currently active dream into the
overlay service, and when the active dream is lowlight, we hide the
status bar.
Test: atest DreamOverlayStateControllerTest
Test: atest DreamOverlayStatusBarViewControllerTest
Test: manually on device by entering/exiting low light and ensuring the
status bar is hidden
Fixes: 245386662
Change-Id: I22973538bea19ef108360a319c70c878cfd81800
This CL provides most of the implementation of the QS FooterActions
following the modern Android architecture. In particular, this CL
includes:
- repositories in the data layer.
- an interactor in the domain layer.
- a view model in the ui layer.
The ViewBinder is added in ag/19674347, given that it comes together
with changes to the existing XML files.
Note that after this CL, the new implementation will still not be used
as it won't be wired yet. This is done in ag/19674347.
The highest value of the tests is in FooterActionsViewModelTest, which
focuses on testing the *state* (view model) of the footer actions using
the *real implementation* of the repositories, interactor and viewModel
all together. To do so, I implemented a FooterActionsUtils class that
allows to *easily* create real implementations of those repositories,
interactor and view model, without requiring the caller to provide any
parameter. I believe that this is even better than introducing new
fakes, and it should hopefully lead us towards using more and more of
the real implementations in our tests, and less and less of fakes/mocks,
making the tests much more useful. Of course, I still had to use fake &
mocks for the classes I'm calling to and for which instantiating the
actual object is too painful. As you can see, there are no test files
for the repositories: given that we already use the real implementations
in the ViewModel tests, they are defacto already tested.
I still added some tests on *interactions* (not *state*) in
FooterActionsInteractorTest. Even though I believe those tests don't
provide much value (they are merely a copy/paste of the implementation),
I preferred keeping the same coverage as the current tests (some of
which are going to be removed in ag/19674347).
Note that the business logic contained in this CL was mostly copy/pasted
from the current implementation, as I wanted to make sure that this is
going to be a pure refactoring that does not change the logic of this
feature. Still, I left some TODOs in the code for potential
improvements.
Bug: 242040009
Test: atest FooterActionsViewModelTest
Test: atest FooterActionsInteractorTest
Change-Id: Ia0bdf9824e098ad6604709f5db87576437b0a904
Lint warns on usages of @VisibleForTesting methods from
non-test code. Since SystemUI-tests is just a regular
android_library instead of an android_test, it was warning
there. Mark it as a test module so lint knows not to warn.
Fixes: 235339747
Test: Presubmits
Change-Id: Ibf8e94c4f9582740e60e285cc918b2976c1fc19a
This new View extension function replaces WindowAddedViewLifecycleOwner and is
intended for use with views that are not part of an activity.
It is more correct because it properly disposes itself and stops
all previously launched coroutines/jobs when the view is detached from
its view hierarchy.
Test: Extensive unit tests included. Also tested manually making sure that there are no
crashes and that jobs scheduled by a view-binder are properly cleaned up
when the view is detached and replaced by a different view when changing
device configuration using:
$ adb shell wm density 1000
Bug: 235403546
Change-Id: Ied36c9e1735333c482fc82cfbe28e665083795ae
This CL moves all the SystemUI-test-utils files to a separate
SystemUI/tests/utils/ directory. This paves the way towards making this
filegroup a reusable library instead.
The files have been move using a small bash script [1].
[1] https://paste.googleplex.com/5565628199993344
Bug: 240431193
Test: m SystemUI-tests SystemUIGoogleTests SystemUIGoogleScreenshotTests ArcSystemUI-test
Change-Id: I43ff578be211f1ef3f9c5bffd5c65771ef1492dc
This CL makes the PeopleSpaceActivity screenshot testable by extracting
a ViewModel and ViewBinder out of it. See ag/19289788 for the associated
screenshot tests.
Note that I tried to change the code inflating and updating the View as
less as possible, to avoid introducing bugs. Once this CL and the
associated screenshots are submitted, I will go ahead and refactor this
code even more. This CL is meant to be an example of the kind of
refactoring required to make a UI screenshot testable, so I tried to not
make it too big.
Bug: 238993727
Test: atest PeopleSpaceScreenshotTest
Change-Id: Ib792bd5da41c9e8bdab6cba7108a249bab10ebd2
This lets us use View extension functions like isGone, isVisible, etc.
Bug: b/235403546
Test: build still works
Merged-In: I0f1d06ee662f0fbc164ab1712b1e8dc90aac14c3
Change-Id: I0f1d06ee662f0fbc164ab1712b1e8dc90aac14c3
This lint check verifies that BroadcastSender is always used in SystemUI for sending broadcasts. It should prevent main thread jank due to broadcast calls.
Bug: 223606115
Test: Included unit test for the linter.
Change-Id: I16b8b3471389ff2c59053c686c94cb9cb694ec42
MDC was already included in sysui, but it was an implicit dependency,
now it's included in the Android.bp.
All Android dynamic palettes were renamed for clarity, so tones now
follow perceptual luminosity, from 0 to 100.
Test: m -j SystemUIGoogle
Test: make with AndroidStudio
Fixes: 220018210
Change-Id: I23bd9e71e3f2b7d949c04fd8ad78c85e3552b79f
This changelist introduces the DreamOverlayTouchMonitor, a component for observing touches and gestures over the dream overlay and reporting them to a set of consumers. DreamOverlayTouchMonitor is responsible for enabling/disabling touch listening based on the dream overlay service state. It enables listening entities to isolate touches to just their listeners when appropriate and handles resetting listening state across touches.
Bug: 211506329
Test: atest DreamOverlayTouchMonitorTest
Change-Id: I44bcba982dd3a73ebef8cfa52e9ad65216316c08
Use the new `SYSTEMUI_OPTIMIZE_JAVA` build flag instead, decoupling
optimization opt-in from system_server. Note that this remains
opt-in and disabled by default.
Bug: 203472868
Test: SYSTEMUI_OPTIMIZE_JAVA=true m SystemUI (validate SystemUI.apk)
Change-Id: Ib0482324561939da806707aea860d040e9aa81ef
Introduce a set of optional Java optimization settings for
SystemUI, based on the Soong variable added in aosp/1896612.
Opting in to optimizations can be achieved with either:
* Env:
export SYSTEM_OPTIMIZE_JAVA=true
* Make:
$(call add_soong_config_var_value,ANDROID,SYSTEM_OPTIMIZE_JAVA,true)
As these optimizations can change the resulting stack traces, a parallel
effort is working to simplify retracing of stack traces for more
accurate debugging and diagnostics. Additional stabilization and testing
will occur before any effort to enable these optimizations by default
for specific targets. Also note that there are no plans to enable
obfuscation.
Preliminary results (w/ `SYSTEM_OPTIMIZE_JAVA=true`):
* SystemUI.apk (31MB -> 26MB)
Bug: 203472868
Test: SYSTEM_OPTIMIZE_JAVA=true m (validate SystemUI.apk)
Change-Id: Idd8d5ef32c06e992ad35846eb5fab67ecb58830a
Removes the FeatureFlagReader which some "flags" still used because
they were read from resources instead of the flaggin system.
Flags can now specify a resource id where their default value can be
read from (if there is a resource definition for it).
Bug: 203548827
Test: atest SystemUITests && manual
Change-Id: Ifb895fd6c5b40d4adfe2997f4ce1f4d7d2145183
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
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
This library allows outside components to use
the test helper classes surrounding concurrency,
such as FakeExecutor.
Bug: 202301343
Test: manual
Change-Id: I6b75a09bec5a3558d0e365580432d852c5672d49