Commit Graph

107 Commits

Author SHA1 Message Date
Jason Monk
3713151425 Merge changes I52007c69,I6503947e,Icf677f4a,I2ae7ed61
* changes:
  Unit testing for fragments.
  Plugin fragment support
  Move QS to a fragment
  Fragments in SysUI!
2016-11-11 16:38:57 +00:00
Jason Monk
8852905b0b Unit testing for fragments.
Set up a base class for testing fragments that will generate the host
and run the fragment through some lifecycle checks to make sure it
does ok with standard lifecycle.

Fragment tests will also automatically check for any sort of leaks
related to bindings, receivers, or other callbacks in sysui. This
requires changing the statusbar.policy classes with callbacks to
have a common interface.

Lastly also fixes a few lifecycle bugs in QS found from the above
tests.

Bug: 32609190
Test: runtest systemui
Change-Id: I52007c696c2fd41914bba4ba9d8055f2b564a7d8
2016-11-11 11:20:10 -05:00
Jason Monk
e97892844a android.provider.Setting test utilities
Add a way to fake values for settings in tests. Since the content
provider is cached in the NameValueCache, there is one static
FakeSettingsProvider that passes through all values to the
real SettingsProvider by default. Values that are required for
the test can be acquired and locked for the duration of the test
easily.

Test: runtest systemui
Change-Id: Ibc31ac8509fb31a22c522358a9c1bae6ec63553b
2016-11-11 09:52:17 -05:00
Manu Cornet
c6f261b750 Merge "2-dimensional Recents activity." 2016-11-08 02:24:42 +00:00
Adrian Roos
ff2c4563cd Doze: Refactor v1
Pulls appart UI, state, power, display and trigger management
into individual components controlled by a state machine.

Also adds tests.

Test: runtest -x packages/SystemUI/tests/src/com/android/systemui/doze/DozeMachineTest.java
Change-Id: I6ee7e79d58a5a3ebeb975775af44ad1e5aaccf93
2016-11-07 14:14:30 -08:00
Manu Cornet
1afcea499d 2-dimensional Recents activity.
This is a simple first version in the spirit of small, incremental CLs.
It is fully functional but the following will come in later changes:

* Split screen support
* Potential animations
* Alt-tab behavior
* Relayout on orientation changes

The new activity is only started when a specific system property is set.

Test: Locally on Ryu device. Added tests for layout logic.
Bug: 32101881
Change-Id: I550f6e7ea0de3937dbf80e5f0294676cfe567d47
2016-11-07 10:01:36 -08:00
Adrian Roos
154b9ee638 Fix broken KeyguardMessageArea
Fixes a bug where the keyguard message area would reorder clears
after a new message was set, leading to the bouncer prompt reason
not showing.

Change-Id: I33001300d9175c521809cd4fdae5158269245c00
Fixes: 32306174
Test: runtest -x $T/frameworks/base/packages/SystemUI/tests/src/com/android/keyguard/KeyguardMessageAreaTest.java
2016-10-21 16:48:55 +00:00
TreeHugger Robot
dfa1c6c8ff Merge "SysUI Plugin ClassLoader work" 2016-10-05 03:54:26 +00:00
Geoffrey Pitsch
959ee2278c Add tests for BatteryMeterDrawable
Not meant to be an attempt at full coverage, just an example of
testing a Drawable.
To go farther with this, I would wrap the "logic" of the battery
appearance in a separate class for testing and this class would
reduce to the drawing operations, which are strongly coupled to
design and don't need much testing.

Test: runtest systemui
Change-Id: I5630e25face9a3ab5e30935fb3d7bab8f162d107
2016-10-03 09:37:06 -04:00
Jason Monk
e96fa00e19 SysUI Plugin ClassLoader work
Cache ClassLoader by pkg so that Plugins can talk to each other.

Also add some filtering so that only classes from the plugins package
and sub-packages are included in plugin classloaders.

Test: Manual
Change-Id: I42aabb418168d5a5d0581b8133aa93f07cb7e977
2016-09-30 11:34:25 -04:00
TreeHugger Robot
0ed60b76e1 Merge "Add simple test for StatusBarIconList. Test: runtest --path frameworks/base/packages/SystemUI/tests" 2016-09-29 21:10:24 +00:00
Alison Cichowlas
87d5010dd3 Add simple test for StatusBarIconList.
Test: runtest --path frameworks/base/packages/SystemUI/tests

Change-Id: Ic65195624b42504d4f4b366f1c5386ee9b48a07f
2016-09-29 15:07:37 -04:00
Geoffrey Pitsch
c8782c4a17 Merge "Unit tests for TileLayout" 2016-09-21 14:45:00 +00:00
Geoffrey Pitsch
4fb66e3fe6 Unit tests for TileLayout
Change-Id: Ie39b1736a1e89e3744b495e19205d10cd0859471
2016-09-20 15:41:30 -04:00
Jason Monk
fcdcf7f636 Merge "Plugins for sysui" 2016-09-19 16:54:12 +00:00
TreeHugger Robot
d79fb68fd1 Merge "Delete TakeScreenshotTest" 2016-09-16 18:54:34 +00:00
Geoffrey Pitsch
53c1a6a803 Delete TakeScreenshotTest
This test is old, hasn't passed in years, and isn't in the right
location for a functional test.

Change-Id: I581a014588dad81106fa84e46df889150c141e1e
2016-09-16 13:00:53 -04:00
TreeHugger Robot
c86f0e296c Merge "Unit tests for PowerNotificationWarnings" 2016-09-15 18:48:59 +00:00
Geoffrey Pitsch
4a7931dc6d Unit tests for PowerNotificationWarnings
Just a sample - this is a far cry from full coverage. Mostly
exercises the handoff to the NotificationManager. To go further,
I would verify more of the Notification contents.

Modified the constructor to explicitly take a NotificationManager,
mocking out the Context wasn't feasible here.

Change-Id: Ic83ef17f061a20efc52b7e3e8c022afab2deacdb
2016-09-15 13:11:47 -04:00
Geoffrey Pitsch
d80035a750 Only do prints for network tests that fail
There's a lot of variance in the network tests, but this appears
to save ~1 second when running them all.

Change-Id: I4629f8d123313a5acf3ff076f0a5960719e35f13
2016-09-14 10:16:25 -04:00
Geoffrey Pitsch
ebee1a3883 Refactor TileLifecycleManagerTest to eliminate flakes
Changed to be purely a unit test, no inter-system integration.
Context binds are mocked, uses verify to check callbacks directly.
Parameterize the bind retry delay so tests can set to zero.

Change-Id: I798823c7c79978261fceac26002f819e3800c711
2016-09-13 16:15:56 -04:00
Winson
9bf04523b4 Merge commit 'e0b767153ef978a4ca841c9891074717fd979400' into manual_merge_e0b7671
Change-Id: I6b6810db33e4b244cc872abd69d5b18a90547b35
2016-09-08 19:13:24 -07:00
Winson Chung
36f3f0337d Revert "Fixing issue with old tasks being visible in Overview"
Bug: 28908500

This reverts commit b258f6a4bd.

Change-Id: I9b3c04358d6ca693ed3fdcd9220af13f81eb704e
2016-09-09 01:29:18 +00:00
Geoffrey Pitsch
6e23da5cda Merge "Rename SystemUI "Tests" classes to "Test"" 2016-09-06 13:03:19 +00:00
Winson
d3a4301dcb Making test case junit4.
Change-Id: Ibd28b6874982fcd386ec63443310b2db5e087b00
2016-09-02 19:22:04 -07:00
Winson
70f21570bf Fixing issue with old tasks being visible in Overview am: b258f6a4bd am: f4806c80ca
am: 2a4cd1518e

Change-Id: I8a229f3515bebca4cd8456afae963bb97dac96d6
2016-09-02 22:22:43 +00:00
Jason Monk
86bc331889 Plugins for sysui
Why this is safe:
 - To never ever be used in production code, simply for rapid
   prototyping (multiple checks in place)
 - Guarded by signature level permission checks, so only matching
   signed code will be used
 - Any crashing plugins are auto-disabled and sysui is allowed
   to continue in peace

Now on to what it actually does.  Plugins are separate APKs that
are expected to implement interfaces provided by SystemUI.  Their
code is dynamically loaded into the SysUI process which can allow
for multiple prototypes to be created and run on a single android
build.

-------

PluginLifecycle:

plugin.onCreate(Context sysuiContext, Context pluginContext);
 --- This is always called before any other calls

pluginListener.onPluginConnected(Plugin p);
 --- This lets the plugin hook know that a plugin is now connected.

** Any other calls back and forth between sysui/plugin **

pluginListener.onPluginDisconnected(Plugin p);
 --- Lets the plugin hook know that it should stop interacting with
     this plugin and drop all references to it.

plugin.onDestroy();
 --- Finally the plugin can perform any cleanup to ensure that its not
     leaking into the SysUI process.

Any time a plugin APK is updated the plugin is destroyed and recreated
to load the new code/resources.

-------

Creating plugin hooks:

To create a plugin hook, first create an interface in
frameworks/base/packages/SystemUI/plugin that extends Plugin.
Include in it any hooks you want to be able to call into from
sysui and create callback interfaces for anything you need to
pass through into the plugin.

Then to attach to any plugins simply add a plugin listener and
onPluginConnected will get called whenever new plugins are installed,
updated, or enabled.  Like this example from SystemUIApplication:

PluginManager.getInstance(this).addPluginListener(OverlayPlugin.COMPONENT,
        new PluginListener<OverlayPlugin>() {
    @Override
    public void onPluginConnected(OverlayPlugin plugin) {
        PhoneStatusBar phoneStatusBar = getComponent(PhoneStatusBar.class);
        if (phoneStatusBar != null) {
            plugin.setup(phoneStatusBar.getStatusBarWindow(),
                    phoneStatusBar.getNavigationBarView());
        }
    }
}, OverlayPlugin.VERSION, true /* Allow multiple plugins */);

Note the VERSION included here.  Any time incompatible changes in the
interface are made, this version should be changed to ensure old plugins
aren't accidentally loaded.  Since the plugin library is provided by
SystemUI, default implementations can be added for new methods to avoid
version changes when possible.

-------

Implementing a Plugin:

See the ExamplePlugin for an example Android.mk on how to compile
a plugin.  Note that SystemUILib is not static for plugins, its classes
are provided by SystemUI.

Plugin security is based around a signature permission, so plugins must
hold the following permission in their manifest.

<uses-permission android:name="com.android.systemui.permission.PLUGIN" />

A plugin is found through a querying for services, so to let SysUI know
about it, create a service with a name that points at your implementation
of the plugin interface with the action accompanying it:

<service android:name=".TestOverlayPlugin">
    <intent-filter>
        <action android:name="com.android.systemui.action.PLUGIN_COMPONENT" />
    </intent-filter>
</service>

Change-Id: I42c573a94907ca7a2eaacbb0a44614d49b8fc26f
2016-09-02 11:33:22 -04:00
Geoffrey Pitsch
fc2b64e3e8 Rename SystemUI "Tests" classes to "Test"
Change-Id: Id29e76b7b1854be5dbf2077c809e7d848687cfa8
2016-09-02 09:09:54 -04:00
Geoffrey Pitsch
af2076afb3 Mock PackageManager for TileLifecycleManagerTests
Slices ~10 seconds off the systemui target test time.

Wrapped calls to the different PackageManager APIs with
PackageManagerAdapter, which should change to a cleaner
abstraction as we write more tests.

Change-Id: I91ac9959de05a06ed484e49648203729159a482e
2016-09-01 15:16:06 -04:00
Winson
b258f6a4bd Fixing issue with old tasks being visible in Overview
- This CL does two things, firstly, it ensures that all first & last
  active times are monotonically increasing and independent of the
  current system time.  This allows us to better keep track of which
  tasks are historical and should be hidden, and which are not.
  Secondly, this CL moves the tracking of the last visible active time
  into the system (per user) where it can be adjusted along with the
  task active times when they are loaded.
- Following this CL, all active times in the future will be adjusted on
  boot such that old tasks are made relative to the current boot time.
  It’s not important exactly what time they are, only that they are
  adjusted along with the last visible task active time so that we
  always keep track of what is visible.

Bug: 28908500
Change-Id: I4f789df3a6bd825517cf3a70e26fb60deff89d06
2016-08-30 15:01:49 -07:00
Geoffrey Pitsch
2c403db659 Convert SysUI tests to use JUnit4
Run tests with android.support.test.runner.AndroidJUnitRunner,
modification to runtest target in separate CL.

No longer inherit from TestCase, stripped unneeded code from
SysuiTestCase, which now assigns mContext via
InstrumentationRegistry.getTargetContext().

Can no longer create Handlers with default constructor,
Looper.myLooper() was never able to receive messages in tests
and it is now enforced that you pass the Looper.getMainLooper().

Change-Id: I13f499175a459cef1a554431911f4b21126e126e
2016-08-26 10:43:08 -04:00
Adrian Roos
4ba23f30b5 Merge "Doze: Add config for fine grained proximity checks" into nyc-mr1-dev 2016-07-15 21:09:51 +00:00
Adrian Roos
5753f05e85 Doze: Add config for fine grained proximity checks
Bug: 29619338
Change-Id: Ic9ff7fc78f47873858881c1a4ac14bc2b834ab84
2016-07-13 12:34:23 -07:00
Jason Monk
ee68fd889c QS: Don't use ComponentName to identify tiles
Evidently some apps redirect/obscure tiles in a way that makes
creating a ComponentName from the TileService useless.  Instead
generate a token which will be a much more stable way of identifying
tiles henceforth.

Change-Id: Id68550bcdcdc3e3987f09380f258610e7a5aca85
Fixes: 29121793
2016-06-30 14:49:50 -04:00
Jason Monk
a3453b8bd9 QS API: Fix mService and mTile being null once and for all
Change-Id: Idd82e4c2f6cfc2b30432e15e23963c1d7a959e43
Fixes: 29121793
2016-06-17 13:04:05 -04:00
Jason Monk
fd57ea730e Don't show data disabled icon when user isn't setup
Change-Id: I2d540b8c0cb613cbf120ffadc404ee03d0447a8b
Fixes: 28246388
2016-04-29 13:37:58 -04:00
Jason Monk
aa336f8926 Merge "Allow mode of TileService to be changed" into nyc-dev 2016-04-08 19:37:55 +00:00
Jason Monk
97d2272be0 Allow mode of TileService to be changed
Since the mode of a tile service was set in onTileAdded, it couldn't
be controlled by developers if they updated their tile.  To handle
the mode has been moved to a boolean meta-data flag to indicate
a tile should be an active tile.

Bug: 28043969
Change-Id: I6403d34f8cb70809edc07769389d5a1f835c1ab3
2016-04-08 11:42:57 -04:00
Jason Monk
f30b5ca1b1 Make QS tile lifecycle tests less flaky (hopefully)
Change-Id: I387c774267c076cf244d2870b051ad6d586d3564
2016-04-06 12:54:26 -04:00
Jason Monk
0c6e099482 Fix tests and tag them for continuous testage
Change-Id: I25d7d34ff8c12308755be6567aae1db009b59a4d
2016-03-29 15:49:02 -04:00
Jason Monk
e06b065f6e Fix QS edit state being out of sync
Do this by making SignalCallbacks send out initial state immediately
rather than posting this state.  This requires a little refactoring
to how SignalControllers work.

Bug: 27061469
Change-Id: Iba6b91a4a5d1d13cce0f0d308b6f85f0340bff39
2016-03-02 16:35:27 -05:00
Jason Monk
46dbfb475f Handle density changes in QS
Bug: 26845796
Change-Id: Icc783c9d706382e553df49f699aaf44aac943d18
2016-03-01 11:08:19 -05:00
Jason Monk
f6a3cf9291 Add tests for TouchAnimator
Also fix existing tests

Bug: 27392084
Change-Id: I70299512e8fa3e0cb86c868b47df7703e04d6084
2016-02-29 13:01:08 -05:00
Adrian Roos
4cc2a58ed2 Fix duplicate eventlogtags warnings
Moves the protos and event log tags into a library,
so the build system doesn't think they're duplicates.

Bug: 27151225
Change-Id: Ic96b6b811d4813a4c48940081ea77b12fb23f0bc
2016-02-25 09:28:13 -08:00
Jason Monk
34a5cef629 Let SysUI watch TileService's dialog lifecycle
That way it can better handle tokens and service binding.

Change-Id: I9b882181ecbe52a65e731a2c45f1d296315884b4
2016-02-01 15:04:29 +00:00
Xiaohui Chen
e9dab0dade DO NOT MERGE sysui: remove shelf
Bug: 26742568
Change-Id: I36bd013c4adb62b76b6f2789aa490c1484a535d7
2016-01-26 11:31:51 -08:00
Jason Monk
f668d7cceb Support data usage changes in Settings
Change-Id: I78c6a3956e7136c3ed64d9323d3fe74df2898c5d
2016-01-16 11:18:59 -05:00
Jason Monk
561e219033 Merge "Round out the QS API" 2016-01-13 19:07:33 +00:00
Jason Monk
5bdfd8c126 Get data type from service state as well am: 67b2c16a9a am: 05130f3f23
am: 8ced692e44

* commit '8ced692e445526a74d51391f2c7c30bd43322d46':
  Get data type from service state as well
2016-01-13 18:46:13 +00:00
Jason Monk
9429513cc3 Round out the QS API
- Add startActivityAndCollapse, to make collapsing the shade easy
 - Add isSecure()
 - Add isLocked()
 - Add unlockandRun(Runnable)
 - Add unavailable, active, and inactive states

The states are added to allow consistent UI across OEM devices, by
allowing UI tweaking and tinting to match system tiles with custom
ones.

The combination of isSecure() and isLocked() and unlockAndRun(Runnable)
allows all combinations of launching show when lockend and triggering
an unlock when needed for sensitive tiles.

Change-Id: Iade98ad9f2c22aa174e62090d8ccd44c86f3bb3c
2016-01-12 17:27:52 -05:00