am dd67be56: am 7e056ae8: AI 148870: Pinging Ryan for Dr No approval. --- Cloned from CL 147240 by \'g4 patch\'. Original change by dwarren@dwarren-pdk on 2009/04/21 14:59:50. "Making PDK work in SDK environment." This CL should be pretty straight forward and should be touching only PDK related templates, etc. Turns out we no longer need to touch the highlightNav code.
Merge commit 'dd67be5657b61cb46940550072437471a3d8c993'
* commit 'dd67be5657b61cb46940550072437471a3d8c993':
AI 148870: Pinging Ryan for Dr No approval.
diff --git a/apps/Term/Android.mk b/apps/Term/Android.mk
index 843aec5..9ff6c0d 100644
--- a/apps/Term/Android.mk
+++ b/apps/Term/Android.mk
@@ -1,3 +1,26 @@
+#
+# Copyright (C) 2008 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.
+#
+
+# This makefile shows how to build a shared library and an activity that
+# bundles the shared library and calls it using JNI.
+
+TOP_LOCAL_PATH:= $(call my-dir)
+
+# Build activity
+
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -7,4 +30,11 @@
LOCAL_PACKAGE_NAME := Term
+LOCAL_JNI_SHARED_LIBRARIES := libterm
+
include $(BUILD_PACKAGE)
+
+# ============================================================
+
+# Also build all of the sub-targets under this one: the shared library.
+include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/apps/Term/jni/Android.mk b/apps/Term/jni/Android.mk
new file mode 100644
index 0000000..2fe4a75
--- /dev/null
+++ b/apps/Term/jni/Android.mk
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008 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.
+#
+
+# This makefile supplies the rules for building a library of JNI code for
+# use by our example of how to bundle a shared library with an APK.
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := eng
+
+# This is the target being built.
+LOCAL_MODULE:= libterm
+
+
+# All of the source files that we will compile.
+LOCAL_SRC_FILES:= \
+ termExec.cpp
+
+# All of the shared libraries we link against.
+LOCAL_SHARED_LIBRARIES := \
+ libutils
+
+# No static libraries.
+LOCAL_STATIC_LIBRARIES :=
+
+# Also need the JNI headers.
+LOCAL_C_INCLUDES += \
+ $(JNI_H_INCLUDE)
+
+# No special compiler flags.
+LOCAL_CFLAGS +=
+
+# Don't prelink this library. For more efficient code, you may want
+# to add this library to the prelink map and set this to true. However,
+# it's difficult to do this for applications that are not supplied as
+# part of a system image.
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/Term/jni/termExec.cpp b/apps/Term/jni/termExec.cpp
new file mode 100644
index 0000000..d0666cc
--- /dev/null
+++ b/apps/Term/jni/termExec.cpp
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2008 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.
+ */
+
+/*
+ * Copyright (C) 2007 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.
+ */
+
+#define LOG_TAG "Exec"
+
+#include "jni.h"
+#include "utils/Log.h"
+#include "utils/misc.h"
+#include "android_runtime/AndroidRuntime.h"
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+
+static jclass class_fileDescriptor;
+static jfieldID field_fileDescriptor_descriptor;
+static jmethodID method_fileDescriptor_init;
+
+
+class String8 {
+public:
+ String8() {
+ mString = 0;
+ }
+
+ ~String8() {
+ if (mString) {
+ free(mString);
+ }
+ }
+
+ void set(const char16_t* o, size_t numChars) {
+ mString = (char*) malloc(numChars + 1);
+ for (size_t i = 0; i < numChars; i++) {
+ mString[i] = (char) o[i];
+ }
+ mString[numChars] = '\0';
+ }
+
+ const char* string() {
+ return mString;
+ }
+private:
+ char* mString;
+};
+
+static int create_subprocess(const char *cmd, const char *arg0, const char *arg1,
+ int* pProcessId)
+{
+ char *devname;
+ int ptm;
+ pid_t pid;
+
+ ptm = open("/dev/ptmx", O_RDWR); // | O_NOCTTY);
+ if(ptm < 0){
+ LOGE("[ cannot open /dev/ptmx - %s ]\n",strerror(errno));
+ return -1;
+ }
+ fcntl(ptm, F_SETFD, FD_CLOEXEC);
+
+ if(grantpt(ptm) || unlockpt(ptm) ||
+ ((devname = (char*) ptsname(ptm)) == 0)){
+ LOGE("[ trouble with /dev/ptmx - %s ]\n", strerror(errno));
+ return -1;
+ }
+
+ pid = fork();
+ if(pid < 0) {
+ LOGE("- fork failed: %s -\n", strerror(errno));
+ return -1;
+ }
+
+ if(pid == 0){
+ close(ptm);
+
+ int pts;
+
+ setsid();
+
+ pts = open(devname, O_RDWR);
+ if(pts < 0) exit(-1);
+
+ dup2(pts, 0);
+ dup2(pts, 1);
+ dup2(pts, 2);
+
+ execl(cmd, cmd, arg0, arg1, NULL);
+ exit(-1);
+ } else {
+ *pProcessId = (int) pid;
+ return ptm;
+ }
+}
+
+
+static jobject android_os_Exec_createSubProcess(JNIEnv *env, jobject clazz,
+ jstring cmd, jstring arg0, jstring arg1, jintArray processIdArray)
+{
+ const jchar* str = cmd ? env->GetStringCritical(cmd, 0) : 0;
+ String8 cmd_8;
+ if (str) {
+ cmd_8.set(str, env->GetStringLength(cmd));
+ env->ReleaseStringCritical(cmd, str);
+ }
+
+ str = arg0 ? env->GetStringCritical(arg0, 0) : 0;
+ const char* arg0Str = 0;
+ String8 arg0_8;
+ if (str) {
+ arg0_8.set(str, env->GetStringLength(arg0));
+ env->ReleaseStringCritical(arg0, str);
+ arg0Str = arg0_8.string();
+ }
+
+ str = arg1 ? env->GetStringCritical(arg1, 0) : 0;
+ const char* arg1Str = 0;
+ String8 arg1_8;
+ if (str) {
+ arg1_8.set(str, env->GetStringLength(arg1));
+ env->ReleaseStringCritical(arg1, str);
+ arg1Str = arg1_8.string();
+ }
+
+ int procId;
+ int ptm = create_subprocess(cmd_8.string(), arg0Str, arg1Str, &procId);
+
+ if (processIdArray) {
+ int procIdLen = env->GetArrayLength(processIdArray);
+ if (procIdLen > 0) {
+ jboolean isCopy;
+
+ int* pProcId = (int*) env->GetPrimitiveArrayCritical(processIdArray, &isCopy);
+ if (pProcId) {
+ *pProcId = procId;
+ env->ReleasePrimitiveArrayCritical(processIdArray, pProcId, 0);
+ }
+ }
+ }
+
+ jobject result = env->NewObject(class_fileDescriptor, method_fileDescriptor_init);
+
+ if (!result) {
+ LOGE("Couldn't create a FileDescriptor.");
+ }
+ else {
+ env->SetIntField(result, field_fileDescriptor_descriptor, ptm);
+ }
+
+ return result;
+}
+
+
+static void android_os_Exec_setPtyWindowSize(JNIEnv *env, jobject clazz,
+ jobject fileDescriptor, jint row, jint col, jint xpixel, jint ypixel)
+{
+ int fd;
+ struct winsize sz;
+
+ fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor);
+
+ if (env->ExceptionOccurred() != NULL) {
+ return;
+ }
+
+ sz.ws_row = row;
+ sz.ws_col = col;
+ sz.ws_xpixel = xpixel;
+ sz.ws_ypixel = ypixel;
+
+ ioctl(fd, TIOCSWINSZ, &sz);
+}
+
+static int android_os_Exec_waitFor(JNIEnv *env, jobject clazz,
+ jint procId) {
+ int status;
+ waitpid(procId, &status, 0);
+ int result = 0;
+ if (WIFEXITED(status)) {
+ result = WEXITSTATUS(status);
+ }
+ return result;
+}
+
+static void android_os_Exec_close(JNIEnv *env, jobject clazz, jobject fileDescriptor)
+{
+ int fd;
+ struct winsize sz;
+
+ fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor);
+
+ if (env->ExceptionOccurred() != NULL) {
+ return;
+ }
+
+ close(fd);
+}
+
+
+static int register_FileDescriptor(JNIEnv *env)
+{
+ class_fileDescriptor = env->FindClass("java/io/FileDescriptor");
+
+ if (class_fileDescriptor == NULL) {
+ LOGE("Can't find java/io/FileDescriptor");
+ return -1;
+ }
+
+ field_fileDescriptor_descriptor = env->GetFieldID(class_fileDescriptor, "descriptor", "I");
+
+ if (field_fileDescriptor_descriptor == NULL) {
+ LOGE("Can't find FileDescriptor.descriptor");
+ return -1;
+ }
+
+ method_fileDescriptor_init = env->GetMethodID(class_fileDescriptor, "<init>", "()V");
+ if (method_fileDescriptor_init == NULL) {
+ LOGE("Can't find FileDescriptor.init");
+ return -1;
+ }
+ return 0;
+}
+
+
+static const char *classPathName = "com/android/term/Exec";
+
+static JNINativeMethod method_table[] = {
+ { "createSubprocess", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/io/FileDescriptor;",
+ (void*) android_os_Exec_createSubProcess },
+ { "setPtyWindowSize", "(Ljava/io/FileDescriptor;IIII)V",
+ (void*) android_os_Exec_setPtyWindowSize},
+ { "waitFor", "(I)I",
+ (void*) android_os_Exec_waitFor},
+ { "close", "(Ljava/io/FileDescriptor;)V",
+ (void*) android_os_Exec_close}
+};
+
+/*
+ * Register several native methods for one class.
+ */
+static int registerNativeMethods(JNIEnv* env, const char* className,
+ JNINativeMethod* gMethods, int numMethods)
+{
+ jclass clazz;
+
+ clazz = env->FindClass(className);
+ if (clazz == NULL) {
+ LOGE("Native registration unable to find class '%s'", className);
+ return JNI_FALSE;
+ }
+ if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
+ LOGE("RegisterNatives failed for '%s'", className);
+ return JNI_FALSE;
+ }
+
+ return JNI_TRUE;
+}
+
+/*
+ * Register native methods for all classes we know about.
+ *
+ * returns JNI_TRUE on success.
+ */
+static int registerNatives(JNIEnv* env)
+{
+ if (!registerNativeMethods(env, classPathName, method_table,
+ sizeof(method_table) / sizeof(method_table[0]))) {
+ return JNI_FALSE;
+ }
+
+ return JNI_TRUE;
+}
+
+
+// ----------------------------------------------------------------------------
+
+/*
+ * This is called by the VM when the shared library is first loaded.
+ */
+
+typedef union {
+ JNIEnv* env;
+ void* venv;
+} UnionJNIEnvToVoid;
+
+jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+ UnionJNIEnvToVoid uenv;
+ uenv.venv = NULL;
+ jint result = -1;
+ JNIEnv* env = NULL;
+
+ LOGI("JNI_OnLoad");
+
+ if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
+ LOGE("ERROR: GetEnv failed");
+ goto bail;
+ }
+ env = uenv.env;
+
+ if ((result = register_FileDescriptor(env)) < 0) {
+ LOGE("ERROR: registerFileDescriptor failed");
+ goto bail;
+ }
+
+ if (registerNatives(env) != JNI_TRUE) {
+ LOGE("ERROR: registerNatives failed");
+ goto bail;
+ }
+
+ result = JNI_VERSION_1_4;
+
+bail:
+ return result;
+}
diff --git a/apps/Term/src/com/android/term/Exec.java b/apps/Term/src/com/android/term/Exec.java
new file mode 100644
index 0000000..b53acfc
--- /dev/null
+++ b/apps/Term/src/com/android/term/Exec.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007 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.term;
+
+import java.io.FileDescriptor;
+
+/**
+ * Utility methods for creating and managing a subprocess.
+ * <p>
+ * Note: The native methods access a package-private
+ * java.io.FileDescriptor field to get and set the raw Linux
+ * file descriptor. This might break if the implementation of
+ * java.io.FileDescriptor is changed.
+ */
+
+public class Exec
+{
+ static {
+ System.loadLibrary("term");
+ }
+
+ /**
+ * Create a subprocess. Differs from java.lang.ProcessBuilder in
+ * that a pty is used to communicate with the subprocess.
+ * <p>
+ * Callers are responsible for calling Exec.close() on the returned
+ * file descriptor.
+ *
+ * @param cmd The command to execute
+ * @param arg0 The first argument to the command, may be null
+ * @param arg1 the second argument to the command, may be null
+ * @param processId A one-element array to which the process ID of the
+ * started process will be written.
+ * @return the file descriptor of the started process.
+ *
+ */
+ public static native FileDescriptor createSubprocess(
+ String cmd, String arg0, String arg1, int[] processId);
+
+ /**
+ * Set the widow size for a given pty. Allows programs
+ * connected to the pty learn how large their screen is.
+ */
+ public static native void setPtyWindowSize(FileDescriptor fd,
+ int row, int col, int xpixel, int ypixel);
+
+ /**
+ * Causes the calling thread to wait for the process associated with the
+ * receiver to finish executing.
+ *
+ * @return The exit value of the Process being waited on
+ *
+ */
+ public static native int waitFor(int processId);
+
+ /**
+ * Close a given file descriptor.
+ */
+ public static native void close(FileDescriptor fd);
+}
+
diff --git a/apps/Term/src/com/android/term/Term.java b/apps/Term/src/com/android/term/Term.java
index 1f43843..82aa0d3 100644
--- a/apps/Term/src/com/android/term/Term.java
+++ b/apps/Term/src/com/android/term/Term.java
@@ -16,6 +16,12 @@
package com.android.term;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
@@ -35,10 +41,8 @@
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Exec;
import android.os.Handler;
import android.os.Message;
-import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.util.Log;
@@ -54,13 +58,6 @@
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection;
-import android.view.inputmethod.InputMethodManager;
-
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
/**
* A terminal emulator activity.
@@ -98,10 +95,7 @@
/**
* The pseudo-teletype (pty) file descriptor that we use to communicate with
- * another process, typically a shell. Currently we just use this to get the
- * mTermIn / mTermOut file descriptors, but when we implement resizing of
- * the terminal we will need it to issue the ioctl to inform the other
- * process that we've changed the terminal size.
+ * another process, typically a shell.
*/
private FileDescriptor mTermFd;
@@ -190,6 +184,15 @@
updatePrefs();
}
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mTermFd != null) {
+ Exec.close(mTermFd);
+ mTermFd = null;
+ }
+ }
+
private void startListening() {
int[] processId = new int[1];
diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh
index de26705..08a2c10 100755
--- a/build/tools/make_windows_sdk.sh
+++ b/build/tools/make_windows_sdk.sh
@@ -1,11 +1,17 @@
#!/bin/bash
# Quick semi-auto file to build Windows SDK tools.
#
-# Limitations:
+# Limitations and requirements:
# - Expects the emulator has been built first, will pick it up from prebuilt.
# - Run in Cygwin
-# - Needs Cygwin package zip
# - Expects to have one of the existing SDK (Darwin or Linux) to build the Windows one
+# - Needs Cygwin packages: autoconf, bison, curl, flex, gcc, g++, git,
+# gnupg, make, mingw-zlib, python, zip, unzip
+# - Must NOT have cygwin package readline (its GPL license might taint the SDK if
+# it gets compiled in)
+# - Does not need a Java Development Kit or any other tools outside of cygwin.
+# - If you think you may have Windows versions of tools (e.g. make) installed, it may
+# reduce confusion levels to 'export PATH=/usr/bin'
set -e # Fail this script as soon as a command fails -- fail early, fail fast
@@ -41,6 +47,10 @@
# SDK number if you want, but not after, e.g these are valid:
# android_sdk_4242_platform.zip or blah_42_.zip
#
+ # Note that the root directory name in the zip must match the zip
+ # name, too, so there's no point just changing the zip name to match
+ # the above format.
+ #
# SDK_NUMBER will be empty if nothing matched.
filename=`basename "$SDK_ZIP"`
SDK_NUMBER=`echo $filename | sed -n 's/^.*_\([^_./]\+\)_[^_.]*\..*$/\1/p'`
diff --git a/emulator/qtools/dmtrace.cpp b/emulator/qtools/dmtrace.cpp
index 6d9250a..c486c5f 100644
--- a/emulator/qtools/dmtrace.cpp
+++ b/emulator/qtools/dmtrace.cpp
@@ -5,6 +5,7 @@
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
+#include <unistd.h>
#include "dmtrace.h"
static const short kVersion = 2;
@@ -163,7 +164,7 @@
// sig = "()I"
// Find the first parenthesis, the start of the signature.
- char *paren = strchr(name, '(');
+ char *paren = (char*)strchr(name, '(');
// If not found, then add the original name.
if (paren == NULL) {
@@ -180,7 +181,7 @@
*paren = 0;
// Search for the last period, the start of the method name
- char *dot = strrchr(name, '.');
+ char *dot = (char*)strrchr(name, '.');
// If not found, then add the original name.
if (dot == NULL || dot == name) {
diff --git a/emulator/qtools/trace_reader.cpp b/emulator/qtools/trace_reader.cpp
index d2af64f..47b5d93 100644
--- a/emulator/qtools/trace_reader.cpp
+++ b/emulator/qtools/trace_reader.cpp
@@ -1009,10 +1009,10 @@
// be freed by the caller after it is no longer needed.
static char *ExtractDexPathFromMmap(const char *mmap_path)
{
- char *end = rindex(mmap_path, '@');
+ const char *end = rindex(mmap_path, '@');
if (end == NULL)
return NULL;
- char *start = rindex(mmap_path, '/');
+ const char *start = rindex(mmap_path, '/');
if (start == NULL)
return NULL;
int len = end - start;
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index f4d2cee..e4f289b 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -28,8 +28,6 @@
<classpathentry kind="src" path="packages/providers/ImProvider/src"/>
<classpathentry kind="src" path="packages/providers/MediaProvider/src"/>
<classpathentry kind="src" path="packages/providers/TelephonyProvider/src"/>
- <classpathentry kind="src" path="vendor/google/apps/Street/src"/>
- <classpathentry kind="src" path="vendor/google/apps/YouTube/src"/>
<classpathentry kind="src" path="frameworks/base/awt"/>
<classpathentry kind="src" path="frameworks/base/cmds/am/src"/>
<classpathentry kind="src" path="frameworks/base/cmds/input/src"/>
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index af06e0f..1565945 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -100,6 +100,12 @@
coverage_target="framework"
continuous="true" />
+<test name="account"
+ build_path="frameworks/base/tests/AndroidTests"
+ package="com.android.unit_tests"
+ class="com.android.unit_tests.accounts.AccountManagerServiceTest"
+ coverage_target="framework" />
+
<test name="smoke"
build_path="frameworks/base/tests/SmokeTest"
package="com.android.smoketest.tests"
@@ -242,7 +248,6 @@
<test name="mms"
build_path="packages/apps/Mms"
package="com.android.mms.tests"
- runner="com.android.mms.ui.MMSInstrumentationTestRunner"
coverage_target="Mms" />
<test name="mmslaunch"
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
index e8e8103..0789655 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
@@ -73,11 +73,14 @@
/**
* Send a MPRS (Method PRofiling Start) request to the client.
*
+ * The arguments to this method will eventually be passed to
+ * android.os.Debug.startMethodTracing() on the device.
+ *
* @param fileName is the name of the file to which profiling data
* will be written (on the device); it will have ".trace"
* appended if necessary
* @param bufferSize is the desired buffer size in bytes (8MB is good)
- * @param flags should be zero
+ * @param flags see startMethodTracing() docs; use 0 for default behavior
*/
public static void sendMPRS(Client client, String fileName, int bufferSize,
int flags) throws IOException {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.common/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.common/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.common/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore
new file mode 100644
index 0000000..f432e88
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore
@@ -0,0 +1,31 @@
+add.png
+backward.png
+clear.png
+d.png
+debug-attach.png
+debug-error.png
+debug-wait.png
+delete.png
+device.png
+down.png
+e.png
+edit.png
+empty.png
+emulator.png
+forward.png
+gc.png
+halt.png
+heap.png
+i.png
+importBug.png
+load.png
+pause.png
+play.png
+pull.png
+push.png
+save.png
+thread.png
+up.png
+v.png
+w.png
+warning.png
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore
new file mode 100644
index 0000000..76d9981
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore
@@ -0,0 +1,2 @@
+ddmlib
+ddmuilib
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.editors/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.editors/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.editors/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/scripts/app_engine_server/gae_shell/shell.py~ b/tools/scripts/app_engine_server/gae_shell/shell.py~
deleted file mode 100755
index dee9fdb..0000000
--- a/tools/scripts/app_engine_server/gae_shell/shell.py~
+++ /dev/null
@@ -1,308 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2007 Google Inc.
-#
-# 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.
-
-"""
-An interactive, stateful AJAX shell that runs Python code on the server.
-
-Part of http://code.google.com/p/google-app-engine-samples/.
-
-May be run as a standalone app or in an existing app as an admin-only handler.
-Can be used for system administration tasks, as an interactive way to try out
-APIs, or as a debugging aid during development.
-
-The logging, os, sys, db, and users modules are imported automatically.
-
-Interpreter state is stored in the datastore so that variables, function
-definitions, and other values in the global and local namespaces can be used
-across commands.
-
-To use the shell in your app, copy shell.py, static/*, and templates/* into
-your app's source directory. Then, copy the URL handlers from app.yaml into
-your app.yaml.
-
-TODO: unit tests!
-"""
-
-import logging
-import new
-import os
-import pickle
-import sys
-import traceback
-import types
-import wsgiref.handlers
-
-from google.appengine.api import users
-from google.appengine.ext import db
-from google.appengine.ext import webapp
-from google.appengine.ext.webapp import template
-
-
-# Set to True if stack traces should be shown in the browser, etc.
-_DEBUG = True
-
-# The entity kind for shell sessions. Feel free to rename to suit your app.
-_SESSION_KIND = '_Shell_Session'
-
-# Types that can't be pickled.
-UNPICKLABLE_TYPES = (
- types.ModuleType,
- types.TypeType,
- types.ClassType,
- types.FunctionType,
- )
-
-# Unpicklable statements to seed new sessions with.
-INITIAL_UNPICKLABLES = [
- 'import logging',
- 'import os',
- 'import sys',
- 'from google.appengine.ext import db',
- 'from google.appengine.api import users',
- ]
-
-
-class Session(db.Model):
- """A shell session. Stores the session's globals.
-
- Each session globals is stored in one of two places:
-
- If the global is picklable, it's stored in the parallel globals and
- global_names list properties. (They're parallel lists to work around the
- unfortunate fact that the datastore can't store dictionaries natively.)
-
- If the global is not picklable (e.g. modules, classes, and functions), or if
- it was created by the same statement that created an unpicklable global,
- it's not stored directly. Instead, the statement is stored in the
- unpicklables list property. On each request, before executing the current
- statement, the unpicklable statements are evaluated to recreate the
- unpicklable globals.
-
- The unpicklable_names property stores all of the names of globals that were
- added by unpicklable statements. When we pickle and store the globals after
- executing a statement, we skip the ones in unpicklable_names.
-
- Using Text instead of string is an optimization. We don't query on any of
- these properties, so they don't need to be indexed.
- """
- global_names = db.ListProperty(db.Text)
- globals = db.ListProperty(db.Blob)
- unpicklable_names = db.ListProperty(db.Text)
- unpicklables = db.ListProperty(db.Text)
-
- def set_global(self, name, value):
- """Adds a global, or updates it if it already exists.
-
- Also removes the global from the list of unpicklable names.
-
- Args:
- name: the name of the global to remove
- value: any picklable value
- """
- blob = db.Blob(pickle.dumps(value))
-
- if name in self.global_names:
- index = self.global_names.index(name)
- self.globals[index] = blob
- else:
- self.global_names.append(db.Text(name))
- self.globals.append(blob)
-
- self.remove_unpicklable_name(name)
-
- def remove_global(self, name):
- """Removes a global, if it exists.
-
- Args:
- name: string, the name of the global to remove
- """
- if name in self.global_names:
- index = self.global_names.index(name)
- del self.global_names[index]
- del self.globals[index]
-
- def globals_dict(self):
- """Returns a dictionary view of the globals.
- """
- return dict((name, pickle.loads(val))
- for name, val in zip(self.global_names, self.globals))
-
- def add_unpicklable(self, statement, names):
- """Adds a statement and list of names to the unpicklables.
-
- Also removes the names from the globals.
-
- Args:
- statement: string, the statement that created new unpicklable global(s).
- names: list of strings; the names of the globals created by the statement.
- """
- self.unpicklables.append(db.Text(statement))
-
- for name in names:
- self.remove_global(name)
- if name not in self.unpicklable_names:
- self.unpicklable_names.append(db.Text(name))
-
- def remove_unpicklable_name(self, name):
- """Removes a name from the list of unpicklable names, if it exists.
-
- Args:
- name: string, the name of the unpicklable global to remove
- """
- if name in self.unpicklable_names:
- self.unpicklable_names.remove(name)
-
-
-class FrontPageHandler(webapp.RequestHandler):
- """Creates a new session and renders the shell.html template.
- """
-
- def get(self):
- # set up the session. TODO: garbage collect old shell sessions
- session_key = self.request.get('session')
- if session_key:
- session = Session.get(session_key)
- else:
- # create a new session
- session = Session()
- session.unpicklables = [db.Text(line) for line in INITIAL_UNPICKLABLES]
- session_key = session.put()
-
- template_file = os.path.join(os.path.dirname(__file__), 'templates',
- 'shell.html')
- session_url = '/?session=%s' % session_key
- vars = { 'server_software': os.environ['SERVER_SOFTWARE'],
- 'python_version': sys.version,
- 'session': str(session_key),
- 'user': users.get_current_user(),
- 'login_url': users.create_login_url(session_url),
- 'logout_url': users.create_logout_url(session_url),
- }
- rendered = webapp.template.render(template_file, vars, debug=_DEBUG)
- self.response.out.write(rendered)
-
-
-class StatementHandler(webapp.RequestHandler):
- """Evaluates a python statement in a given session and returns the result.
- """
-
- def get(self):
- self.response.headers['Content-Type'] = 'text/plain'
-
- # extract the statement to be run
- statement = self.request.get('statement')
- if not statement:
- return
-
- # the python compiler doesn't like network line endings
- statement = statement.replace('\r\n', '\n')
-
- # add a couple newlines at the end of the statement. this makes
- # single-line expressions such as 'class Foo: pass' evaluate happily.
- statement += '\n\n'
-
- # log and compile the statement up front
- try:
- logging.info('Compiling and evaluating:\n%s' % statement)
- compiled = compile(statement, '<string>', 'single')
- except:
- self.response.out.write(traceback.format_exc())
- return
-
- # create a dedicated module to be used as this statement's __main__
- statement_module = new.module('__main__')
-
- # use this request's __builtin__, since it changes on each request.
- # this is needed for import statements, among other things.
- import __builtin__
- statement_module.__builtins__ = __builtin__
-
- # load the session from the datastore
- session = Session.get(self.request.get('session'))
-
- # swap in our custom module for __main__. then unpickle the session
- # globals, run the statement, and re-pickle the session globals, all
- # inside it.
- old_main = sys.modules.get('__main__')
- try:
- sys.modules['__main__'] = statement_module
- statement_module.__name__ = '__main__'
-
- # re-evaluate the unpicklables
- for code in session.unpicklables:
- exec code in statement_module.__dict__
-
- # re-initialize the globals
- for name, val in session.globals_dict().items():
- try:
- statement_module.__dict__[name] = val
- except:
- msg = 'Dropping %s since it could not be unpickled.\n' % name
- self.response.out.write(msg)
- logging.warning(msg + traceback.format_exc())
- session.remove_global(name)
-
- # run!
- old_globals = dict(statement_module.__dict__)
- try:
- old_stdout = sys.stdout
- old_stderr = sys.stderr
- try:
- sys.stdout = self.response.out
- sys.stderr = self.response.out
- exec compiled in statement_module.__dict__
- finally:
- sys.stdout = old_stdout
- sys.stderr = old_stderr
- except:
- self.response.out.write(traceback.format_exc())
- return
-
- # extract the new globals that this statement added
- new_globals = {}
- for name, val in statement_module.__dict__.items():
- if name not in old_globals or val != old_globals[name]:
- new_globals[name] = val
-
- if True in [isinstance(val, UNPICKLABLE_TYPES)
- for val in new_globals.values()]:
- # this statement added an unpicklable global. store the statement and
- # the names of all of the globals it added in the unpicklables.
- session.add_unpicklable(statement, new_globals.keys())
- logging.debug('Storing this statement as an unpicklable.')
-
- else:
- # this statement didn't add any unpicklables. pickle and store the
- # new globals back into the datastore.
- for name, val in new_globals.items():
- if not name.startswith('__'):
- session.set_global(name, val)
-
- finally:
- sys.modules['__main__'] = old_main
-
- session.put()
-
-
-def main():
- application = webapp.WSGIApplication(
- [('/', FrontPageHandler),
- ('/shell.do', StatementHandler)], debug=_DEBUG)
- wsgiref.handlers.CGIHandler().run(application)
-
-
-if __name__ == '__main__':
- main()