diff --git a/apps/SettingsCmd/Android.mk b/apps/SettingsCmd/Android.mk
new file mode 100644
index 000000000..282b89b74
--- /dev/null
+++ b/apps/SettingsCmd/Android.mk
@@ -0,0 +1,29 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := SettingsCmd
+LOCAL_CERTIFICATE := platform
+
+LOCAL_SDK_VERSION := 4
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+include $(BUILD_PACKAGE)
diff --git a/apps/SettingsCmd/AndroidManifest.xml b/apps/SettingsCmd/AndroidManifest.xml
new file mode 100644
index 000000000..63553faf8
--- /dev/null
+++ b/apps/SettingsCmd/AndroidManifest.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java b/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java
new file mode 100644
index 000000000..1f8d9ecb2
--- /dev/null
+++ b/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingscmd;
+
+import android.app.Activity;
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.provider.Settings;
+
+/**
+ * Utility for modifying system settings.
+ *
+ * Usage:
+ *
+ * adb shell am instrument -w [-e secure true/false] -e name
+ * -e value -w com.android.settingscmd/.SettingsInstrument
+ *
+ * This apk must be signed with the platform certificate to modify secure settings.
+ */
+public class SettingsInstrument extends Instrumentation {
+
+ private boolean mSecure;
+ private String mName;
+ private String mValue;
+
+ public SettingsInstrument() {
+ super();
+ }
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ mSecure = getBooleanArgument(arguments, "secure");
+ mName = arguments.getString("name");
+ mValue = arguments.getString("value");
+ start();
+ }
+
+ private boolean getBooleanArgument(Bundle arguments, String tag) {
+ String tagString = arguments.getString(tag);
+ return tagString != null && Boolean.parseBoolean(tagString);
+ }
+
+ @Override
+ public void onStart() {
+ if (mName == null || mValue == null) {
+ reportError("Missing arguments. Usage:\n [-e secure true] "
+ + "-e name -e value ");
+ return;
+ }
+ boolean status = false;
+ if (mSecure) {
+ status = Settings.Secure.putString(getTargetContext().getContentResolver(), mName,
+ mValue);
+ } else {
+ status = Settings.System.putString(getTargetContext().getContentResolver(), mName,
+ mValue);
+ }
+ Bundle bundleResponse = new Bundle();
+ bundleResponse.putBoolean("result", status);
+ finish(Activity.RESULT_OK, bundleResponse);
+ }
+
+ private void reportError(String msg) {
+ Bundle bundleResponse = new Bundle();
+ bundleResponse.putString("error", msg);
+ finish(Activity.RESULT_CANCELED, bundleResponse);
+ }
+}