diff options
| author | Brett Chabot <brettchabot@android.com> | 2010-10-14 14:15:33 -0700 |
|---|---|---|
| committer | Brett Chabot <brettchabot@android.com> | 2010-10-14 14:15:33 -0700 |
| commit | 4f3dcc857e002d1b5611d0b00bb787eec6318967 (patch) | |
| tree | 5aaa79ba088e82ce618f1674f75c80f193405157 | |
| parent | 85122d2605a22c8e7bcde868c2b7a7d8d744e613 (diff) | |
| download | android_development-4f3dcc857e002d1b5611d0b00bb787eec6318967.tar.gz android_development-4f3dcc857e002d1b5611d0b00bb787eec6318967.tar.bz2 android_development-4f3dcc857e002d1b5611d0b00bb787eec6318967.zip | |
Revert "Add utility for toggling settings from the cmd line."
This reverts commit a2e81242e01af6619310003a6a035ce82b6f7e09.
| -rw-r--r-- | apps/SettingsCmd/Android.mk | 29 | ||||
| -rw-r--r-- | apps/SettingsCmd/AndroidManifest.xml | 32 | ||||
| -rw-r--r-- | apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java | 82 |
3 files changed, 0 insertions, 143 deletions
diff --git a/apps/SettingsCmd/Android.mk b/apps/SettingsCmd/Android.mk deleted file mode 100644 index 282b89b74..000000000 --- a/apps/SettingsCmd/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -# 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 deleted file mode 100644 index 63553faf8..000000000 --- a/apps/SettingsCmd/AndroidManifest.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. - --> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.settingscmd"> - - <uses-permission android:name="android.permission.WRITE_SETTINGS" /> - <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> - - <application> - </application> - - <instrumentation android:name=".SettingsInstrument" - android:targetPackage="com.android.settingscmd" - android:label="instrumentation utility to modify system settings"/> - - <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" /> - -</manifest> diff --git a/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java b/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java deleted file mode 100644 index 1f8d9ecb2..000000000 --- a/apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - * <p/> - * Usage: - * <p/> - * adb shell am instrument -w [-e secure true/false] -e name <setting name> - * -e value <setting value> -w com.android.settingscmd/.SettingsInstrument - * <p/> - * 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 <setting name> -e value <setting 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); - } -} |
