127 Commits

Author SHA1 Message Date
Jason Monk
4f70b9cfd4 Faster plugin updating from UI control
Send a broadcast back and forth to speed up the rate at which plugins
are enabled or disabled.

Also update make files to handle exclude tests better.

Test: Manual
Change-Id: Ic8f45c663c3a5e5fd4b3e9e2f79480e155845c14
2016-10-28 10:13:56 -04: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
Jorim Jaggi
d05651790a Add latency tracking for checking PIN (1/2)
Also move tags to Keyguard as we need it in Keyguard.

Change-Id: I718581cb4081830da1c3a2f4ad9b9f0ec6f09ae5
2016-10-07 16:18:00 +02: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
4a8a09d1ab Revert "Fixing issue with old tasks being visible in Overview"
am: 36f3f0337d

Change-Id: Ic89b6a3b204a6f55667df5c1459449092930d859
2016-09-09 01:54:42 +00:00
Winson Chung
36f3f0337d Revert "Fixing issue with old tasks being visible in Overview"
Bug: 28908500

This reverts commit b258f6a4bd685e5efcb36c02d5817f659e10479b.

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
Winson
f4806c80ca Fixing issue with old tasks being visible in Overview
am: b258f6a4bd

Change-Id: I27ba3d057147b5200ac75b9f079d26423c9d0b05
2016-09-02 22:08:33 +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
Allen Hair
fd61ccfb75 Fine tune code coverage filters for SystemUI tests. am: 8fef05f2c1 am: 2d0504edbf
am: dcb4f1aaaa

Change-Id: Ie817b5126c3d9e18385aa8ea8471fcd629bb7cfa
2016-09-01 01:39:24 +00:00
TreeHugger Robot
a946492d04 Merge "Fix systemui tests on APCT." 2016-08-31 19:14:16 +00:00
Geoffrey Pitsch
33c623677d Fix systemui tests on APCT.
Different mockito library for junit4.
This causes class loading failures for them but not our builds.

Change-Id: Iae4ba584f83e0ab78505fa822a74f5998fbca395
2016-08-31 12:47:29 -04:00
Allen Hair
8fef05f2c1 Fine tune code coverage filters for SystemUI tests.
Bug: 28269038
Change-Id: Iece993a76b39873170c4ae0b2d1cd2dd5445e3c2
2016-08-30 16:55:35 -07: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
Allen Hair
63180a0754 Configure code coverage filters. am: 02fd609460 am: 15b70213a4
am: 8b931e08d0

Change-Id: If94db4d01eb5ff4a9f463200d529b0054899bcd5
2016-08-30 17:13:01 +00: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
Allen Hair
02fd609460 Configure code coverage filters.
Bug: 28269038
Change-Id: If4dfb769d543e70faea7200dc1da15c50a83270f
2016-08-25 17:28:03 -07:00
Adrian Roos
7d7affe313 Merge \\"Doze: Add config for fine grained proximity checks\\" into nyc-mr1-dev am: 4ba23f30b5
am: e0cac111db

Change-Id: Iff1af5e273af306190539a91fed0876f19b38888
2016-07-15 23:25:31 +00: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
Jason Monk
b55c3c60a8 Merge \\"QS: Don\\'t use ComponentName to identify tiles\\" into nyc-mr1-dev am: a0967ebbdf
am: 356d4914b2

Change-Id: I83fad6237edfb9516e1fe40612b820c319f26cc5
2016-07-15 20:16:44 +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
Adam Lesinski
38e89667e3 Build SystemUI and Keyguard with AAPT2
Bug:29462255
Change-Id: I0bd6da7da21927d185ff230c81aac390cfa8029d
2016-07-07 12:23:02 -07:00
Adam Lesinski
8138058a46 Revert "Build SystemUI and Keyguard with AAPT2"
Looks like SystemUI's manifest may be corrupt.

This reverts commit 91f576081fe67f2742980f75c17d11e36f7c60e1.

Bug:29939875
Change-Id: I06e5f3cbc4629a67d254a8fcfcb9749b317aef5f
2016-07-01 19:46:55 +00: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
Adam Lesinski
91f576081f Build SystemUI and Keyguard with AAPT2
Bug:29462255
Change-Id: I9a886b4d17a7dbc4cfd7b4f8d398138f00df04a7
2016-06-29 21:38:34 -07:00
Jason Monk
6831aee5fa Merge \\\"QS API: Fix mService and mTile being null once and for all\\\" into nyc-dev am: fc70b07385 am: c552a36992
am: 6a06372bb9

Change-Id: I8164179f96be4195bcafb3528e8dcbc45946bee2
2016-06-17 21:49:07 +00: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
b3bd312637 Merge "Don\'t show data disabled icon when user isn\'t setup" into nyc-dev am: ede4fcea6b am: a629f50398
am: 6815912e3b

* commit '6815912e3b928faf3113498e4bc3d0b0172abc57':
  Don't show data disabled icon when user isn't setup

Change-Id: I3971a2b524f4c506b9cbe8e474819dfa31019b99
2016-04-29 18:11:30 +00: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
Yao Chen
634acb9712 Add CarVolumeDialogController in SystemUI for Android Auto.
Cars usually have an external audio module. When Android is serving as
the car's headunit, users should be able to adjust the car's volume
through SystemUI. The following changes are made to make it work:

+ Load VolumeDialogController from SystemUIFactory
+ Added CarSystemUIFactory
+ Added CarVolumeDialogController which extends VolumeDialogController
  and it uses CarAudioManager as source of truth for volume controls.
+ Some refactor in VolumeDialogController to make it easier for
subclasses to override volume controls.

Note that CarAudioManager does not completely replace AudioManager.
Majority of code in VolumeDialogController still applies in the car use
case, so I made CarVolumeDialogController a subclass of
VolumeDialogController instead of making them peers.

Bug: 27595951

Change-Id: Id4adec7281e41aa71f3de034e5b88a32a89be305
2016-04-19 14:50:10 -07: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