diff --git a/apps/Development/res/layout/development_settings.xml b/apps/Development/res/layout/development_settings.xml index 16c2cdf58..fbb6a404f 100644 --- a/apps/Development/res/layout/development_settings.xml +++ b/apps/Development/res/layout/development_settings.xml @@ -74,10 +74,16 @@ android:layout_alignParentLeft="true" android:text="@string/development_settings_show_updates_text" /> + + diff --git a/apps/Development/src/com/android/development/DevelopmentSettings.java b/apps/Development/src/com/android/development/DevelopmentSettings.java index c01ea59d6..4cc1c911b 100644 --- a/apps/Development/src/com/android/development/DevelopmentSettings.java +++ b/apps/Development/src/com/android/development/DevelopmentSettings.java @@ -23,23 +23,26 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager.NameNotFoundException; -import android.os.RemoteException; +import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; +import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManagerNative; +import android.os.StrictMode; +import android.os.SystemProperties; import android.provider.Settings; -import android.os.Bundle; +import android.text.TextUtils; import android.util.Log; import android.view.IWindowManager; import android.view.View; +import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.Spinner; import android.widget.Toast; -import android.widget.AdapterView.OnItemSelectedListener; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -53,6 +56,7 @@ public class DevelopmentSettings extends Activity { private CheckBox mWaitForDebuggerCB; private CheckBox mAlwaysFinishCB; private Spinner mPointerLocationSpinner; + private Spinner mStrictModeVisualSpinner; private CheckBox mShowLoadCB; private CheckBox mShowCpuCB; private CheckBox mEnableGLCB; @@ -106,6 +110,17 @@ public class DevelopmentSettings extends Activity { "Pointer Location" }); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mPointerLocationSpinner.setAdapter(adapter); + mStrictModeVisualSpinner = (Spinner)findViewById(R.id.strictmode_visual); + adapter = new ArrayAdapter( + this, + android.R.layout.simple_spinner_item, + new String[] { + "StrictMode visual indicator: build variant default", + "StrictMode visual indicator: on", + "StrictMode visual indicator: off" }); + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + mStrictModeVisualSpinner.setAdapter(adapter); + mStrictModeVisualSpinner.setOnItemSelectedListener(mStrictModeVisualChanged); mShowLoadCB = (CheckBox)findViewById(R.id.show_load); mShowLoadCB.setOnClickListener(mShowLoadClicked); mShowCpuCB = (CheckBox)findViewById(R.id.show_cpu); @@ -182,6 +197,7 @@ public class DevelopmentSettings extends Activity { updateDebugOptions(); updateFinishOptions(); updatePointerLocationOptions(); + updateStrictModeVisualOptions(); updateProcessLimitOptions(); updateSharedOptions(); updateFlingerOptions(); @@ -245,6 +261,24 @@ public class DevelopmentSettings extends Activity { mPointerLocationSpinner.setSelection(mPointerLocation); } + // Returns the current state of the system property that controls + // strictmode flashes. One of: + // 0: not explicitly set one way or another + // 1: on + // 2: off + // These are the indices in the Spinner's ArrayAdapter. + private int currentStrictModeActiveIndex() { + if (TextUtils.isEmpty(SystemProperties.get(StrictMode.VISUAL_PROPERTY))) { + return 0; + } + boolean enabled = SystemProperties.getBoolean(StrictMode.VISUAL_PROPERTY, false); + return enabled ? 1 : 2; + } + + private void updateStrictModeVisualOptions() { + mStrictModeVisualSpinner.setSelection(currentStrictModeActiveIndex()); + } + private void writeProcessLimitOptions() { try { ActivityManagerNative.getDefault().setProcessLimit(mProcessLimit); @@ -456,6 +490,41 @@ public class DevelopmentSettings extends Activity { } }; + private Spinner.OnItemSelectedListener mStrictModeVisualChanged + = new Spinner.OnItemSelectedListener() { + public void onItemSelected(android.widget.AdapterView av, View v, + int position, long id) { + if (position == currentStrictModeActiveIndex()) { + // at the existing position, so don't show a Toast. + return; + } + + try { + switch (position) { + case 0: // default + mWindowManager.setStrictModeVisualIndicatorPreference(""); + break; + case 1: // on + mWindowManager.setStrictModeVisualIndicatorPreference("1"); + break; + case 2: // off + mWindowManager.setStrictModeVisualIndicatorPreference("0"); + break; + } + } catch (RemoteException e) { + Log.w(TAG, "Error calling setStrictModeVisualIndicatorPreference", e); + } + + Toast.makeText( + DevelopmentSettings.this, + "Setting changed; will take effect per-app next launch, or on reboot", + Toast.LENGTH_LONG).show(); + } + + public void onNothingSelected(android.widget.AdapterView av) { + } + }; + private Spinner.OnItemSelectedListener mMaxProcsChanged = new Spinner.OnItemSelectedListener() { public void onItemSelected(android.widget.AdapterView av, View v, diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh deleted file mode 100755 index 9a61baf54..000000000 --- a/build/tools/make_windows_sdk.sh +++ /dev/null @@ -1,261 +0,0 @@ -#!/bin/bash -# Quick semi-auto file to build Windows SDK tools. -# -# Limitations and requirements: -# - Expects the emulator has been built first, will pick it up from prebuilt. -# - Run in Cygwin -# - 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' - -PROG_NAME="$0" -SDK_ZIP="$1"; shift -DIST_DIR="$1"; shift -TEMP_DIR="$1"; shift -[ -z "$TEMP_DIR" ] && TEMP_DIR=${TMP:-/tmp} - -set -e # Fail this script as soon as a command fails -- fail early, fail fast - -function die() { - echo "Error:" $* - echo "Aborting" - exit 1 -} - -function usage() { - local NAME - NAME=`basename ${PROG_NAME}` - echo "Usage: ${NAME} linux_or_mac_sdk.zip output_dir [temp_dir]" - echo "If temp_dir is not given, \$TMP is used. If that's missing, /tmp is used." - status - exit 2 -} - -function status() { - echo "Current values:" - echo "- Input SDK: ${SDK_ZIP:-missing}" - echo "- Output dir: ${DIST_DIR:-missing}" - echo "- Temp dir: ${TEMP_DIR:-missing}" -} - -function check() { - [ -f "$SDK_ZIP" ] || usage - [ -d "$DIST_DIR" ] || usage - - - # We need mgwz.dll in the SDK when compiling with Cygwin 1.5 - # Right now we don't support building with Cygwin 1.7 yet, as it lacks this DLL. - NEED_MGWZ=1 - # We can skip this check for debug purposes. - echo $* - [[ "$1" == "-no-mgwz" ]] && NEED_MGWZ="" - CYG_MGWZ_PATH=/cygdrive/c/cygwin/bin/mgwz.dll - [[ -n $NEED_MGWZ && ! -f $CYG_MGWZ_PATH ]] && \ - die "Cygwin is missing $CYG_MGWZ_PATH. Use -no-mgwz to override." - - - # Use the BUILD_ID as SDK_NUMBER if defined, otherwise try to get it from the - # provided zip filename. - if [ -f config/build_id.make ]; then - BUILD_ID=`cat config/build_id.make | sed -n '/BUILD_ID=/s/^[^=]\+=\(.*\)$/\1/p'` - [ -n "$BUILD_ID" ] && SDK_NUMBER="$BUILD_ID" - fi - if [ -z "$SDK_NUMBER" ]; then - # Look for a pattern like "anything_sdknumber.extension" - # The pattern is now "any-thing_sdknumber_anything-else.extension" - # - # The bottom line is that the SDK number is whatever is enclosed by - # the LAST couple of underscores. You can have underscores *before* the - # 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'` - fi - - [ -n "$SDK_NUMBER" ] || die "Failed to extract the SDK number from $SDK_ZIP. Check its format." - - [ $OSTYPE == "cygwin" ] || die "This expects to run under Cygwin" - [ -e `which zip` ] || die "Please install 'zip' package in Cygwin" - [ -f "build/envsetup.sh" ] || die "Please run this from the 'android' directory" - - echo "Using SDK ${SDK_NUMBER}" -} - -function build() { - - # IMPORTANT: For Cygwin to be able to build Android targets here, - # you will generally need to edit build/core/main.mk and add directories - # where Android.mk makefiles are to be found to the SDK_ONLY==true section. - - echo - echo "Building..." - [ -n "$MAKE_OPT" ] && echo "Make options: $MAKE_OPT" - - . build/envsetup.sh - - # Disable parallel build: it generates "permission denied" issues when - # multiple "ar.exe" are running in parallel. - make \ - aapt adb aidl \ - etc1tool \ - prebuilt \ - dexdump dmtracedump \ - fastboot \ - hprof-conv \ - mksdcard \ - sdklauncher sqlite3 \ - zipalign \ - || die "Build failed" - - # Fix permissions. Git/cygwin may not make this +x as needed. - chmod +x prebuilt/windows/sdl/bin/sdl-config - - # It's worth building the emulator with -j 4 so do it separately - make -j 4 emulator || die "Build failed" -} - -function package() { - echo - echo "Packaging..." - DEST_NAME="android-sdk_${SDK_NUMBER}_windows" - DEST_NAME_ZIP="${DEST_NAME}.zip" - - TEMP_SDK_DIR="$TEMP_DIR/$DEST_NAME" - - # Unzip current linux/mac SDK and rename using the windows name - [ -e "$TEMP_SDK_DIR" ] && rm -rfv "$TEMP_SDK_DIR" # cleanup dest first if exists - UNZIPPED=`basename "$SDK_ZIP"` - UNZIPPED="$TEMP_DIR/${UNZIPPED/.zip/}" - [ -e "$UNZIPPED" ] && rm -rfv "$UNZIPPED" # cleanup unzip dir (if exists) - unzip "$SDK_ZIP" -d "$TEMP_DIR" - mv -v "$UNZIPPED" "$TEMP_SDK_DIR" - - # Assert that the package contains only one platform - PLATFORMS="$TEMP_SDK_DIR/platforms" - THE_PLATFORM=`echo $PLATFORMS/*` - PLATFORM_TOOLS=$THE_PLATFORM/tools - echo "Platform found: " $THE_PLATFORM - [[ -d "$THE_PLATFORM" ]] || die \ - "Error: One platform was expected in $SDK_ZIP. " \ - "Instead found " $THE_PLATFORM - [[ -d "$PLATFORM_TOOLS" ]] || die "Missing folder $PLATFORM_TOOLS." - - # Package USB Driver - if type package_usb_driver 2>&1 | grep -q function ; then - package_usb_driver $TEMP_SDK_DIR - fi - - # Remove obsolete stuff from tools & platform - TOOLS="$TEMP_SDK_DIR/tools" - LIB="$TEMP_SDK_DIR/tools/lib" - rm -v "$TOOLS"/{adb,android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool} - rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign,monkeyrunner} - rm -v "$TOOLS"/proguard/bin/*.sh - rm -v "$LIB"/*/swt.jar - rm -v "$PLATFORM_TOOLS"/{aapt,aidl,dx,dexdump} - - # Copy all the new stuff in tools - # Note: some tools are first copied here and then moved in platforms//tools/ - cp -v out/host/windows-x86/bin/*.{exe,dll} "$TOOLS"/ - mkdir -pv "$LIB"/x86 - cp -v prebuilt/windows/swt/swt.jar "$LIB"/x86/ - mkdir -pv "$LIB"/x86_64 - cp -v prebuilt/windows-x86_64/swt/swt.jar "$LIB"/x86_64/ - - # Copy the SDK Manager (aka sdklauncher) to the root of the SDK (it was copied in tools above) - # and move it also in SDK/tools/lib (so that tools updates can update the root one too) - cp "$TOOLS/sdklauncher.exe" "$TEMP_SDK_DIR/SDK Manager.exe" - mv "$TOOLS/sdklauncher.exe" "$LIB/SDK Manager.exe" - - # If you want the emulator NOTICE in the tools dir, uncomment the following line: - # cp -v external/qemu/NOTICE "$TOOLS"/emulator_NOTICE.txt - - # We currently need libz from MinGW for aapt - [[ -n $NEED_MGWZ ]] && cp -v $CYG_MGWZ_PATH "$TOOLS"/ - - # Update a bunch of bat files - cp -v sdk/files/post_tools_install.bat "$LIB"/ - cp -v sdk/files/find_java.bat "$LIB"/ - cp -v sdk/apkbuilder/etc/apkbuilder.bat "$TOOLS"/ - cp -v sdk/ddms/app/etc/ddms.bat "$TOOLS"/ - cp -v sdk/traceview/etc/traceview.bat "$TOOLS"/ - cp -v sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat "$TOOLS"/ - cp -v sdk/layoutopt/app/etc/layoutopt.bat "$TOOLS"/ - cp -v sdk/draw9patch/etc/draw9patch.bat "$TOOLS"/ - cp -v sdk/sdkmanager/app/etc/android.bat "$TOOLS"/ - cp -v sdk/monkeyrunner/etc/monkeyrunner.bat "$TOOLS"/ - cp -v sdk/files/proguard/bin/*.bat "$TOOLS"/proguard/bin/ - - # Put the JetCreator tools, content and docs (not available in the linux SDK) - JET="$TOOLS/Jet" - JETCREATOR="$JET/JetCreator" - JETDEMOCONTENT="$JET/demo_content" - JETLOGICTEMPLATES="$JET/logic_templates" - JETDOC="$TEMP_SDK_DIR/docs/JetCreator" - - # need to rm these folders since a Mac SDK will have them and it might create a conflict - rm -rfv "$JET" - rm -rfv "$JETDOC" - - # now create fresh folders for JetCreator - mkdir -v "$JET" - mkdir -v "$JETDOC" - - cp -rv external/sonivox/jet_tools/JetCreator "$JETCREATOR"/ - cp -rv external/sonivox/jet_tools/JetCreator_content "$JETDEMOCONTENT"/ - cp -rv external/sonivox/jet_tools/logic_templates "$JETLOGICTEMPLATES"/ - chmod -vR u+w "$JETCREATOR" # fixes an issue where Cygwin might copy the above as u+rx only - cp -v prebuilt/windows/jetcreator/EASDLL.dll "$JETCREATOR"/ - - cp -v external/sonivox/docs/JET_Authoring_Guidelines.html "$JETDOC"/ - cp -rv external/sonivox/docs/JET_Authoring_Guidelines_files "$JETDOC"/ - cp -v external/sonivox/docs/JET_Creator_User_Manual.html "$JETDOC"/ - cp -rv external/sonivox/docs/JET_Creator_User_Manual_files "$JETDOC"/ - - # Copy or move platform specific tools to the default platform. - cp -v dalvik/dx/etc/dx.bat "$PLATFORM_TOOLS"/ - mv -v "$TOOLS"/{aapt.exe,aidl.exe,dexdump.exe} "$PLATFORM_TOOLS"/ - # Note: mgwz.dll must be both in SDK/tools for zipalign and in SDK/platform/XYZ/tools/ for aapt - [[ -n $NEED_MGWZ ]] && cp -v "$TOOLS"/mgwz.dll "$PLATFORM_TOOLS"/ - - # Fix EOL chars to make window users happy - fix all files at the top level only - # as well as all batch files including those in platforms//tools/ - find "$TEMP_SDK_DIR" -maxdepth 1 -type f -writable -print0 | xargs -0 unix2dos -D - find "$TEMP_SDK_DIR" -maxdepth 3 -name "*.bat" -type f -writable -print0 | xargs -0 unix2dos -D - - # Done.. Zip it. Clean the temp folder ONLY if the zip worked (to ease debugging) - pushd "$TEMP_DIR" > /dev/null - [ -e "$DEST_NAME_ZIP" ] && rm -rfv "$DEST_NAME_ZIP" - zip -9r "$DEST_NAME_ZIP" "$DEST_NAME" && rm -rfv "$DEST_NAME" - popd > /dev/null - - # Now move the final zip from the temp dest to the final dist dir - mv -v "$TEMP_DIR/$DEST_NAME_ZIP" "$DIST_DIR/$DEST_NAME_ZIP" - - # We want fastboot and adb (and its DLLs) next to the new SDK - for i in fastboot.exe adb.exe AdbWinApi.dll AdbWinUsbApi.dll; do - cp -vf out/host/windows-x86/bin/$i "$DIST_DIR"/$i - done - - echo "Done" - echo - echo "Resulting SDK is in $DIST_DIR/$DEST_NAME_ZIP" -} - -check $* -status -build -package - -echo "Done" diff --git a/build/tools/patch_windows_sdk.sh b/build/tools/patch_windows_sdk.sh index 05acdc592..3d9277acb 100755 --- a/build/tools/patch_windows_sdk.sh +++ b/build/tools/patch_windows_sdk.sh @@ -1,13 +1,41 @@ #!/bin/bash +# This script takes a Linux SDK, cleans it and injects the necessary Windows +# binaries needed by the SDK. The script has 2 parts: +# - development/tools/build/path_windows_sdk.sh to process the +# platform-dependent folders and files. +# - sdk/build/patch_windows_sdk.sh to process folder and files which +# depend on the sdk.git repo. This file will be invoked by this one. +# +# Input arguments: +# -q = Optional arg to make this silent. Must be given first. +# $1 = Temporary SDK directory, that is the Linux SDK being patched into +# a Windows one. +# $2 = The out/host/windows directory, which contains the new Windows +# binaries to use. +# $3 = An optional replacement for $TOPDIR (inherited from the Android +# build system), which is the top directory where Android is located. + # Verbose by default. Use -q to make more silent. V="-v" -if [[ "$1" == "-q" ]]; then V=""; shift; fi +Q="" +if [[ "$1" == "-q" ]]; then + Q="$1" + V="" + shift +fi TEMP_SDK_DIR=$1 WIN_OUT_DIR=$2 TOPDIR=${TOPDIR:-$3} +# The unix2dos is provided by the APT package "tofrodos". However +# as for ubuntu lucid, the package renamed the command to "todos". +UNIX2DOS=`which unix2dos` +if [[ ! -x $UNIX2DOS ]]; then + UNIX2DOS=`which todos` +fi + PLATFORMS=( $TEMP_SDK_DIR/platforms/* ) if [[ ${#PLATFORMS[@]} != 1 ]]; then echo "Error: Too many platforms found in $TEMP_SDK_DIR" @@ -25,8 +53,7 @@ fi TOOLS=$TEMP_SDK_DIR/tools PLATFORM_TOOLS=$TEMP_SDK_DIR/platform-tools LIB=$TEMP_SDK_DIR/tools/lib -rm $V $TOOLS/{android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool} -rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign,monkeyrunner} +rm $V $TOOLS/{dmtracedump,etc1tool,hprof-conv,sqlite3,zipalign} rm $V $TOOLS/proguard/bin/*.sh rm $V $LIB/*/swt.jar rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump} @@ -39,35 +66,6 @@ cp $V ${TOPDIR}prebuilt/windows/swt/swt.jar $LIB/x86/ mkdir -pv $LIB/x86_64 cp $V ${TOPDIR}prebuilt/windows-x86_64/swt/swt.jar $LIB/x86_64/ -# Copy the SDK Manager (aka sdklauncher) to the root of the SDK (it was copied in tools above) -# and move it also in SDK/tools/lib (so that tools updates can update the root one too) -cp $TOOLS/sdklauncher.exe $TEMP_SDK_DIR/"SDK Manager.exe" -mv $TOOLS/sdklauncher.exe $LIB/"SDK Manager.exe" - -# Copy the emulator NOTICE in the tools dir -cp $V ${TOPDIR}external/qemu/NOTICE $TOOLS/emulator_NOTICE.txt - -# aapt under cygwin needs to have mgwz.dll -[[ -n $NEED_MGWZ ]] && cp $V $CYG_MGWZ_PATH $TOOLS/ - -# Update a bunch of bat files -cp $V ${TOPDIR}sdk/files/post_tools_install.bat $LIB/ -cp $V ${TOPDIR}sdk/files/find_java.bat $LIB/ -cp $V ${TOPDIR}sdk/apkbuilder/etc/apkbuilder.bat $TOOLS/ -cp $V ${TOPDIR}sdk/ddms/app/etc/ddms.bat $TOOLS/ -cp $V ${TOPDIR}sdk/traceview/etc/traceview.bat $TOOLS/ -if [ -f ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat ]; then - cp $V ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat $TOOLS/ -else - # That's ok because currently GB uses Tools_r7 but we'll ship Tools_r8 from master-open. - echo "WARNING: Ignoring ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat [ok for GB+Tools r8]" -fi -cp $V ${TOPDIR}sdk/layoutopt/app/etc/layoutopt.bat $TOOLS/ -cp $V ${TOPDIR}sdk/draw9patch/etc/draw9patch.bat $TOOLS/ -cp $V ${TOPDIR}sdk/sdkmanager/app/etc/android.bat $TOOLS/ -cp $V ${TOPDIR}sdk/monkeyrunner/etc/monkeyrunner.bat $TOOLS/ -cp $V ${TOPDIR}sdk/files/proguard/bin/*.bat $TOOLS/proguard/bin/ - # Put the JetCreator tools, content and docs (not available in the linux SDK) JET=$TOOLS/Jet JETCREATOR=$JET/JetCreator @@ -98,14 +96,15 @@ cp -r $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual_files $JETDOC/ cp $V ${TOPDIR}dalvik/dx/etc/dx.bat $PLATFORM_TOOLS/ mv $V $TOOLS/{adb.exe,aapt.exe,aidl.exe,dexdump.exe} $TOOLS/Adb*.dll $PLATFORM_TOOLS/ -# When building under cygwin, mgwz.dll must be both in SDK/tools for zipalign -# and in SDK/platform/XYZ/tools/ for aapt -[[ -n $NEED_MGWZ ]] && cp $V $TOOLS/mgwz.dll $PLATFORM_TOOLS/ - # Fix EOL chars to make window users happy - fix all files at the top level # as well as all batch files including those in platforms//tools/ -find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 unix2dos -find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat" -type f -print0 | xargs -0 unix2dos +if [[ -x $UNIX2DOS ]]; then + find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 $UNIX2DOS + find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat" -type f -print0 | xargs -0 $UNIX2DOS +fi + +# Execute the packaging script in the sdk directory +${TOPDIR}sdk/build/patch_windows_sdk.sh $Q ${TEMP_SDK_DIR} ${WIN_OUT_DIR} ${TOPDIR} # Just to make it easier on the build servers, we want fastboot and adb (and its DLLs) # next to the new SDK, so up one dir. diff --git a/build/tools/windows_sdk.mk b/build/tools/windows_sdk.mk index 057f1fc6f..7a0443df5 100644 --- a/build/tools/windows_sdk.mk +++ b/build/tools/windows_sdk.mk @@ -18,20 +18,22 @@ endif ifeq ($(strip $(shell which i586-mingw32msvc-gcc 2>/dev/null)),) $(error MinGW is required to build a Windows SDK. Please 'apt-get install mingw32') endif -ifeq ($(strip $(shell which unix2dos 2>/dev/null)),) +ifeq ($(strip $(shell which unix2dos todos 2>/dev/null)),) $(error Need a unix2dos command. Please 'apt-get install tofrodos') endif +include $(TOPDIR)sdk/build/windows_sdk_tools.mk + WIN_TARGETS := \ aapt adb aidl \ - emulator etc1tool \ + etc1tool \ dexdump dmtracedump \ fastboot \ hprof-conv \ - mksdcard \ prebuilt \ - sdklauncher sqlite3 \ - zipalign + sqlite3 \ + zipalign \ + $(WIN_SDK_TARGETS) # LINUX_SDK_NAME/DIR is set in build/core/Makefile WIN_SDK_NAME := $(subst $(HOST_OS)-$(HOST_ARCH),windows,$(LINUX_SDK_NAME)) @@ -75,6 +77,10 @@ $(WIN_SDK_ZIP): winsdk-tools sdk $(TOPDIR)development/build/tools/patch_windows_sdk.sh \ $(subst @,-q,$(hide)) \ $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) + $(hide) \ + $(TOPDIR)sdk/build/patch_windows_sdk.sh \ + $(subst @,-q,$(hide)) \ + $(WIN_SDK_DIR)/$(WIN_SDK_NAME) $(OUT_DIR) $(TOPDIR) $(hide) ( \ cd $(WIN_SDK_DIR) && \ rm -f $(WIN_SDK_NAME).zip && \ diff --git a/ndk/platforms/android-3/include/android/api-level.h b/ndk/platforms/android-3/include/android/api-level.h new file mode 100644 index 000000000..2ff8ed434 --- /dev/null +++ b/ndk/platforms/android-3/include/android/api-level.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef ANDROID_API_LEVEL_H +#define ANDROID_API_LEVEL_H + +#define __ANDROID_API__ 3 + +#endif /* ANDROID_API_LEVEL_H */ diff --git a/ndk/platforms/android-4/include/android/api-level.h b/ndk/platforms/android-4/include/android/api-level.h new file mode 100644 index 000000000..7e085c561 --- /dev/null +++ b/ndk/platforms/android-4/include/android/api-level.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef ANDROID_API_LEVEL_H +#define ANDROID_API_LEVEL_H + +#define __ANDROID_API__ 4 + +#endif /* ANDROID_API_LEVEL_H */ diff --git a/ndk/platforms/android-5/include/android/api-level.h b/ndk/platforms/android-5/include/android/api-level.h new file mode 100644 index 000000000..228014730 --- /dev/null +++ b/ndk/platforms/android-5/include/android/api-level.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef ANDROID_API_LEVEL_H +#define ANDROID_API_LEVEL_H + +#define __ANDROID_API__ 5 + +#endif /* ANDROID_API_LEVEL_H */ diff --git a/ndk/platforms/android-8/include/android/api-level.h b/ndk/platforms/android-8/include/android/api-level.h new file mode 100644 index 000000000..e580d724d --- /dev/null +++ b/ndk/platforms/android-8/include/android/api-level.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef ANDROID_API_LEVEL_H +#define ANDROID_API_LEVEL_H + +#define __ANDROID_API__ 8 + +#endif /* ANDROID_API_LEVEL_H */ diff --git a/ndk/platforms/android-9/include/android/api-level.h b/ndk/platforms/android-9/include/android/api-level.h new file mode 100644 index 000000000..a644a660c --- /dev/null +++ b/ndk/platforms/android-9/include/android/api-level.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef ANDROID_API_LEVEL_H +#define ANDROID_API_LEVEL_H + +#define __ANDROID_API__ 9 + +#endif /* ANDROID_API_LEVEL_H */ diff --git a/pdk/docs/source/download.jd b/pdk/docs/source/download.jd index c786bdc00..4d81460d3 100644 --- a/pdk/docs/source/download.jd +++ b/pdk/docs/source/download.jd @@ -236,11 +236,13 @@ After importing the keys, you can verify any tag with

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----

Building the code

-To build the files, runmakefrom within your working directory: +To build the files, run make from within your working directory:
$ cd ~/mydroid +
$ source build/envsetup.sh
+
$ lunch

$ make

-

If your build fails, complaining about a missing "run-java-tool", try setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making.E.g.,

+

If your build fails, complaining about a missing "run-java-tool", try setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making. E.g.,

$ export ANDROID_JAVA_HOME=$JAVA_HOME

Using an IDE

diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java index 48294a7b3..8a7bf5176 100644 --- a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java +++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.java @@ -86,17 +86,14 @@ public class ActionBarTabs extends Activity { mFragment = fragment; } - @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.add(R.id.fragment_content, mFragment, mFragment.getText()); } - @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.remove(mFragment); } - @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { Toast.makeText(ActionBarTabs.this, "Reselected!", Toast.LENGTH_SHORT).show(); } diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java b/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java index fcfd28f79..321eb08c4 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java @@ -68,8 +68,6 @@ public class FingerPaint extends GraphicsActivity public MyView(Context c) { super(c); - mBitmap = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888); - mCanvas = new Canvas(mBitmap); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); } @@ -77,6 +75,8 @@ public class FingerPaint extends GraphicsActivity @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); + mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + mCanvas = new Canvas(mBitmap); } @Override