summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-11-17 14:40:56 -0500
committerJason Monk <jmonk@google.com>2014-11-17 14:46:11 -0500
commit29f7a7b0ae2264651c176ef50cc21cf9131247e3 (patch)
tree947850df433e5efff293164a2b47c2137f99f728 /packages/SystemUI
parent61a848dd2e095336c341af68ed01564c0f3cb442 (diff)
downloadframeworks_base-29f7a7b0ae2264651c176ef50cc21cf9131247e3.zip
frameworks_base-29f7a7b0ae2264651c176ef50cc21cf9131247e3.tar.gz
frameworks_base-29f7a7b0ae2264651c176ef50cc21cf9131247e3.tar.bz2
SysUI Tests: Make tests not break SysUI
Now you can run the tests without getting the blank broken sysui. The tests instrument themselves so they include all of the source they need to run rather than piggybacking on the sysui process. A couple of changes were needed for this. The xml files cannot reference com.android.systemui, instead they must use res-auto. The tests can no longer make privileged calls, so some restructuring to avoid those calls was needed. Bug: 18222975 Change-Id: I67b794af854f1420583d48960bd6e52ca753b56d
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout-land/status_bar_recent_panel.xml2
-rw-r--r--packages/SystemUI/res/layout-sw600dp/navigation_bar.xml2
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml2
-rw-r--r--packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml2
-rw-r--r--packages/SystemUI/res/layout/status_bar_expanded_header.xml2
-rw-r--r--packages/SystemUI/res/layout/status_bar_recent_panel.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java11
-rw-r--r--packages/SystemUI/tests/Android.mk12
-rw-r--r--packages/SystemUI/tests/AndroidManifest.xml2
l---------packages/SystemUI/tests/src/com/android/systemui/EventLogTags.logtags1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java5
13 files changed, 31 insertions, 17 deletions
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index 0c0be29..b5d2f86 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -20,7 +20,7 @@
<com.android.systemui.recent.RecentsPanelView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/recents_root"
android:layout_height="match_parent"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index c2733fb..5c776e6 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -19,7 +19,7 @@
<!-- navigation bar for sw600dp (small tablets) -->
<com.android.systemui.statusbar.phone.NavigationBarView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/system_bar_background"
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 2e38b20..a62be4d 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -20,7 +20,7 @@
<com.android.systemui.statusbar.phone.NavigationBarView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/system_bar_background"
diff --git a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
index f776a87..a996260 100644
--- a/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
+++ b/packages/SystemUI/res/layout/quick_settings_brightness_dialog.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:paddingLeft="16dp"
android:paddingRight="16dp"
style="@style/BrightnessDialogContainer">
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
index 7ea9145..7a6e77a 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml
@@ -18,7 +18,7 @@
<!-- Extends RelativeLayout -->
<com.android.systemui.statusbar.phone.StatusBarHeaderView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/header"
android:layout_width="@dimen/notification_panel_width"
android:layout_height="@dimen/status_bar_header_height"
diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout/status_bar_recent_panel.xml
index 2f3968d..588873a 100644
--- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout/status_bar_recent_panel.xml
@@ -20,7 +20,7 @@
<com.android.systemui.recent.RecentsPanelView
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/recents_root"
android:layout_height="match_parent"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 0caded5..07762a4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -179,13 +179,16 @@ public class NetworkControllerImpl extends BroadcastReceiver
public NetworkControllerImpl(Context context) {
this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE),
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE),
- (WifiManager) context.getSystemService(Context.WIFI_SERVICE));
+ (WifiManager) context.getSystemService(Context.WIFI_SERVICE),
+ new AccessPointController(context), new MobileDataController(context));
registerListeners();
}
@VisibleForTesting
NetworkControllerImpl(Context context, ConnectivityManager connectivityManager,
- TelephonyManager telephonyManager, WifiManager wifiManager) {
+ TelephonyManager telephonyManager, WifiManager wifiManager,
+ AccessPointController accessPointController,
+ MobileDataController mobileDataController) {
mContext = context;
final Resources res = context.getResources();
@@ -224,8 +227,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
updateAirplaneMode();
mLastLocale = mContext.getResources().getConfiguration().locale;
- mAccessPoints = new AccessPointController(mContext);
- mMobileDataController = new MobileDataController(mContext);
+ mAccessPoints = accessPointController;
+ mMobileDataController = mobileDataController;
mMobileDataController.setCallback(new MobileDataController.Callback() {
@Override
public void onMobileDataEnabled(boolean enabled) {
diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk
index 8b87522..5a90324 100644
--- a/packages/SystemUI/tests/Android.mk
+++ b/packages/SystemUI/tests/Android.mk
@@ -17,14 +17,20 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages com.android.systemui:com.android.keyguard
+LOCAL_SRC_FILES := $(call all-java-files-under, src) \
+ $(call all-java-files-under, ../src) \
+ src/com/android/systemui/EventLogTags.logtags
+
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
+ frameworks/base/packages/SystemUI/res \
+ frameworks/base/packages/Keyguard/res
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
LOCAL_PACKAGE_NAME := SystemUITests
-LOCAL_INSTRUMENTATION_FOR := SystemUI
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-target
+LOCAL_STATIC_JAVA_LIBRARIES := mockito-target Keyguard
# sign this with platform cert, so this test is allowed to inject key events into
# UI it doesn't own. This is necessary to allow screenshots to be taken
diff --git a/packages/SystemUI/tests/AndroidManifest.xml b/packages/SystemUI/tests/AndroidManifest.xml
index 1d319cf..e52806d 100644
--- a/packages/SystemUI/tests/AndroidManifest.xml
+++ b/packages/SystemUI/tests/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.systemui"
+ android:targetPackage="com.android.systemui.tests"
android:label="Tests for SystemUI">
</instrumentation>
</manifest>
diff --git a/packages/SystemUI/tests/src/com/android/systemui/EventLogTags.logtags b/packages/SystemUI/tests/src/com/android/systemui/EventLogTags.logtags
new file mode 120000
index 0000000..2f243d7
--- /dev/null
+++ b/packages/SystemUI/tests/src/com/android/systemui/EventLogTags.logtags
@@ -0,0 +1 @@
+../../../../../src/com/android/systemui/EventLogTags.logtags \ No newline at end of file
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java
index 2935373..784d035 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotStubActivity.java
@@ -15,7 +15,7 @@
*/
package com.android.systemui.screenshot;
-import com.android.systemui.tests.R;
+import com.android.systemui.R;
import android.app.Activity;
import android.os.Bundle;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 97605ea..10cffc4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -62,7 +62,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
mSignalCluster = mock(SignalCluster.class);
mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class);
- mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm);
+ mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
+ mock(AccessPointController.class), mock(MobileDataController.class));
setupNetworkController();
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index ed76ae5..af05309 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -1,5 +1,7 @@
package com.android.systemui.statusbar.policy;
+import static org.mockito.Mockito.mock;
+
import android.net.ConnectivityManager;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -15,7 +17,8 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// Create a new NetworkController as this is currently handled in constructor.
- mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm);
+ mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm,
+ mock(AccessPointController.class), mock(MobileDataController.class));
setupNetworkController();
verifyLastMobileDataIndicators(false, 0, 0);