OSDN Git Service

Revert "Add utility for toggling settings from the cmd line."
authorBrett Chabot <brettchabot@android.com>
Thu, 14 Oct 2010 21:15:33 +0000 (14:15 -0700)
committerBrett Chabot <brettchabot@android.com>
Thu, 14 Oct 2010 21:15:33 +0000 (14:15 -0700)
This reverts commit a2e81242e01af6619310003a6a035ce82b6f7e09.

apps/SettingsCmd/Android.mk [deleted file]
apps/SettingsCmd/AndroidManifest.xml [deleted file]
apps/SettingsCmd/src/com/android/settingscmd/SettingsInstrument.java [deleted file]

diff --git a/apps/SettingsCmd/Android.mk b/apps/SettingsCmd/Android.mk
deleted file mode 100644 (file)
index 282b89b..0000000
+++ /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 (file)
index 63553fa..0000000
+++ /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 (file)
index 1f8d9ec..0000000
+++ /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);
-    }
-}