summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorTsu Chiang Chuang <tsu@google.com>2012-09-19 17:07:14 -0700
committerTsu Chiang Chuang <tsu@google.com>2012-09-20 14:58:48 -0700
commit35fae68cc3eb21c15069c58d275a46537cc04f4a (patch)
tree461fe5831202b9820d56ec6cea796cd912088359 /core
parent7b6ec1f6fd4f2858063d2d441b6118ac22da5569 (diff)
downloadframeworks_base-35fae68cc3eb21c15069c58d275a46537cc04f4a.zip
frameworks_base-35fae68cc3eb21c15069c58d275a46537cc04f4a.tar.gz
frameworks_base-35fae68cc3eb21c15069c58d275a46537cc04f4a.tar.bz2
Change the way how airplane mode is set, since it has been moved to
Settings.Global namespace. Also run as a system app, since only system apps can change airplane mode. Change-Id: I317f9c94361cfca182356fd292e5b0b41553d1ab
Diffstat (limited to 'core')
-rw-r--r--core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk7
-rw-r--r--core/tests/hosttests/test-apps/DownloadManagerTestApp/AndroidManifest.xml4
-rw-r--r--core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerBaseTest.java4
3 files changed, 12 insertions, 3 deletions
diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
index 09dcac5..c0d3d60 100644
--- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
+++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/Android.mk
@@ -25,4 +25,11 @@ LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := DownloadManagerTestApp
+ifneq ($(TARGET_BUILD_VARIANT),user)
+# Need to run as system app to get access to Settings.
+LOCAL_CERTIFICATE := platform
+else
+$(error "This test app will fail to run unless it is built in non-user mode.")
+endif
+
include $(BUILD_PACKAGE)
diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/AndroidManifest.xml b/core/tests/hosttests/test-apps/DownloadManagerTestApp/AndroidManifest.xml
index 3f2be3c..c8d66ce 100644
--- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/AndroidManifest.xml
+++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/AndroidManifest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.frameworks.downloadmanagertests">
+ package="com.android.frameworks.downloadmanagertests"
+ android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
@@ -22,6 +23,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<application android:label="DownloadManagerTestApp">
<uses-library android:name="android.test.runner" />
diff --git a/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerBaseTest.java b/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerBaseTest.java
index 8e935f8..f493e9a 100644
--- a/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerBaseTest.java
+++ b/core/tests/hosttests/test-apps/DownloadManagerTestApp/src/com/android/frameworks/downloadmanagertests/DownloadManagerBaseTest.java
@@ -262,7 +262,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase {
int state = enable ? 1 : 0;
// Change the system setting
- Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON,
+ Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON,
state);
String timeoutMessage = "Timed out waiting for airplane mode to be " +
@@ -271,7 +271,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase {
// wait for airplane mode to change state
int currentWaitTime = 0;
while (Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.AIRPLANE_MODE_ON, -1) != state) {
+ Settings.Global.AIRPLANE_MODE_ON, -1) != state) {
timeoutWait(currentWaitTime, DEFAULT_WAIT_POLL_TIME, DEFAULT_MAX_WAIT_TIME,
timeoutMessage);
}