diff options
18 files changed, 331 insertions, 109 deletions
@@ -453,7 +453,7 @@ web_docs_sample_code_flags := \ ## SDK version identifiers used in the published docs # major[.minor] version for current SDK. (full releases only) -framework_docs_SDK_VERSION:=3.0 +framework_docs_SDK_VERSION:=3.1 # release version (ie "Release x") (full releases only) framework_docs_SDK_REL_ID:=1 diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index f116025..3224973 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -154,8 +154,8 @@ does not require auto-restore. --> <!-- the 6th element indicates boot-time dependency-met value. --> <string-array translatable="false" name="networkAttributes"> - <item>"wifi,1,1,1,true"</item> - <item>"mobile,0,0,0,true"</item> + <item>"wifi,1,1,1,-1,true"</item> + <item>"mobile,0,0,0,-1,true"</item> <item>"mobile_mms,2,0,2,60000,true"</item> <item>"mobile_supl,3,0,2,60000,true"</item> <item>"mobile_hipri,5,0,3,60000,true"</item> diff --git a/docs/html/guide/developing/building/building-cmdline.jd b/docs/html/guide/developing/building/building-cmdline.jd index 5f193bc..ec918dc 100644 --- a/docs/html/guide/developing/building/building-cmdline.jd +++ b/docs/html/guide/developing/building/building-cmdline.jd @@ -6,16 +6,27 @@ parent.link=index.html <div id="qv-wrapper"> <div id="qv"> <h2>In this document</h2> - <ol> - <li><a href="#DebugMode">Building in debug mode</a></li> - - <li><a href="#ReleaseMode">Building in release mode</a></li> - - <li><a href="#RunningOnEmulator">Running on an emulator</a></li> - - <li><a href="#RunningOnDevice">Running on a device</a></li> + <li><a href="#DebugMode">Building in Debug Mode</a></li> + <li><a href="#ReleaseMode">Building in Release Mode</a> + <ol> + <li><a href="#ManualReleaseMode">Build unsigned</a></li> + <li><a href="#AutoReleaseMode">Build signed and aligned</a></li> + <li><a href="#OnceBuilt">Once built and signed in release mode</a></li> + </ol> + </li> + <li><a href="#RunningOnEmulator">Running on the Emulator</a></li> + <li><a href="#RunningOnDevice">Running on a Device</a></li> + <li><a href="#Signing">Application Signing</a></li> </ol> + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Managing AVDs from +the Command Line</a></li> + <li><a href="{@docRoot}guide/developing/devices/emulator.html">Using the Android +Emulator</a></li> + <li><a href="{@docRoot}guide/publishing/app-signing.html">Signing Your Applications</a></li> + </ol> </div> </div> @@ -54,7 +65,7 @@ parent.link=index.html <pre>c:\java\jdk1.6.0_02</pre> - <h2 id="DebugMode">Building in debug mode</h2> + <h2 id="DebugMode">Building in Debug Mode</h2> <p>For immediate application testing and debugging, you can build your application in debug mode and immediately install it on an emulator. In debug mode, the build tools automatically sign your @@ -83,7 +94,7 @@ ant debug <p>To install and run your application on an emulator, see the following section about <a href= "#RunningOnEmulator">Running on the Emulator</a>.</p> - <h2 id="ReleaseMode">Building in release mode</h2> + <h2 id="ReleaseMode">Building in Release Mode</h2> <p>When you're ready to release and distribute your application to end-users, you must build your application in release mode. Once you have built in release mode, it's a good idea to perform @@ -172,7 +183,7 @@ ant release been signed with the private key specified in {@code build.properties} and aligned with {@code zipalign}. It's ready for installation and distribution.</p> - <h3>Once built and signed in release mode</h3> + <h3 id="OnceBuilt">Once built and signed in release mode</h3> <p>Once you have signed your application with a private key, you can install and run it on an <a href="#RunningOnEmulator">emulator</a> or <a href="#RunningOnDevice">device</a>. You can @@ -181,7 +192,7 @@ ant release installation. (On your device, be sure you have enabled <em>Settings > Applications > Unknown sources</em>.)</p> - <h2 id="RunningOnEmulator">Running on the emulator</h2> + <h2 id="RunningOnEmulator">Running on the Emulator</h2> <p>Before you can run your application on the Android Emulator, you must <a href= "{@docRoot}guide/developing/devices/managing-avds.html">create an AVD</a>.</p> @@ -243,7 +254,7 @@ adb -s emulator-5554 install <em>path/to/your/app</em>.apk install</code>. This will build your application, sign it with the debug key, and install it on the currently running emulator.</p> - <h2 id="RunningOnDevice">Running on a device</h2> + <h2 id="RunningOnDevice">Running on a Device</h2> <p>Before you can run your application on a device, you must perform some basic setup for your device:</p> @@ -297,7 +308,7 @@ adb -d install <em>path/to/your/app</em>.apk <p>The ADT plugin helps you get started quickly by signing your .apk files with a debug key, prior to installing them on an emulator or development device. This means that you can quickly run your application from Eclipse without having to generate your own private key. No specific - action on your part is needed, provided ADT has access to Keytool.However, please note that if + action on your part is needed, provided ADT has access to Keytool. However, please note that if you intend to publish your application, you <strong>must</strong> sign the application with your own private key, rather than the debug key generated by the SDK tools.</p> diff --git a/docs/html/guide/developing/devices/managing-avds-cmdline.jd b/docs/html/guide/developing/devices/managing-avds-cmdline.jd index 6feeeb6..8674334 100644 --- a/docs/html/guide/developing/devices/managing-avds-cmdline.jd +++ b/docs/html/guide/developing/devices/managing-avds-cmdline.jd @@ -7,12 +7,25 @@ parent.link=index.html <div id="qv"> <h2>In this document</h2> <ol> - <li><a href="#listingtargets">Listing targets</a></li> - <li><a href="#AVDCmdLine">Creating AVDs</a></li> + <li><a href="#listingtargets">Listing Targets</a></li> + <li><a href="#AVDCmdLine">Creating AVDs</a> + <ol> + <li><a href="#CustomDensity">Customize the device resolution or density</a></li> + <li><a href="#DefaultLocation">Default location of AVD files</a></li> + <li><a href="#hardwareopts">Setting hardware emulation options</a></li> + </ol> + </li> <li><a href="#moving">Moving an AVD</a></li> <li><a href="#updating">Updating an AVD</a></li> <li><a href="#deleting">Deleting an AVD</a></li> </ol> + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}guide/developing/building/building-cmdline.html">Building and Running +from the Command Line</a></li> + <li><a href="{@docRoot}guide/developing/devices/emulator.html">Using the Android +Emulator</a></li> + </ol> </div> </div> @@ -23,7 +36,7 @@ of the command line options that you can use, see the reference for the -<h2 id="listingtargets">Listing targets</h2> +<h2 id="listingtargets">Listing Targets</h2> <p>To generate a list of system image targets, use this command: </p> @@ -67,7 +80,10 @@ id: 5 or "android-9" Skins: HVGA (default), WVGA800, WQVGA432, QVGA, WVGA854, WQVGA400 </pre> -<h2 id="AVDCmdLine">Creating AVDs</h2> + + +<h2 id="AVDCmdLine">Creating AVDs</h2> + <p>In addition to creating AVDs with the <a href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">AVD Manager user interface</a>, you can also create them by passing in command line arguments to the <code>android</code> tool. @@ -92,8 +108,9 @@ general characteristics offered by the AVD. The target ID is an integer assigned <code>android</code> tool. The target ID is not derived from the system image name, version, or API Level, or other attribute, so you need to run the <code>android list targets</code> command to list the target ID of each system image. You should do this <em>before</em> you run -the <code>android create avd</code> command. See the <a href="{@docRoot}guide/developing/tools/android.html">android</a></p> -tool documentation for more information on the command line options. +the <code>android create avd</code> command. See the <a +href="{@docRoot}guide/developing/tools/android.html">android</a> +tool documentation for more information on the command line options.</p> <p>When you've selected the target you want to use and made a note of its ID, @@ -124,7 +141,45 @@ appropriately for the device that the add-on is modeling, and so prevents you from resetting the options. </p> -<h3>Default location of AVD files</h3> +<h3 id="CustomDensity">Customize the device resolution or density</h3> + +<p>When testing your application, we recommend that you test your application in several different +AVDs, using different screen configurations (different combinations of size and density). In +addition, you should set up the AVDs to run at a physical size that closely matches an actual +device.</p> + +<p>To set up your AVDs for a specific resolution or density, follow these steps:</p> + +<ol> + <li>Use the <code>create avd</code> command to create a new AVD, specifying +the <code>--skin</code> option with a value that references either a default +skin name (such as "WVGA800") or a custom skin resolution (such as 240x432). +Here's an example: + <pre>android create avd -n <name> -t <targetID> --skin WVGA800</pre> + </li> + <li>To specify a custom density for the skin, answer "yes" when asked whether +you want to create a custom hardware profile for the new AVD.</li> + <li>Continue through the various profile settings until the tool asks you to +specify "Abstracted LCD density" (<em>hw.lcd.density</em>). Enter an appropriate +value, such as "120" for a low-density screen, "160" for a medium density screen, +or "240" for a high-density screen.</li> + <li>Set any other hardware options and complete the AVD creation.</li> +</ol> + +<p>In the example above (WVGA medium density), the new AVD will emulate a 5.8" +WVGA screen.</p> + +<p>As an alternative to adjusting the emulator skin configuration, you can use +the emulator skin's default density and add the <code>-dpi-device</code> option +to the <a href="{@docRoot}guide/developing/tools/emulator.html">emulator</a> command line when +starting the AVD. For example:</p> + +<pre>emulator -avd WVGA800 -scale 96dpi -dpi-device 160</pre> + + + +<h3 id="DefaultLocation">Default location of AVD files</h3> + <p>When you create an AVD, the <code>android</code> tool creates a dedicated directory for it on your development computer. The directory contains the AVD configuration file, the user data image and SD card image (if available), and any other files @@ -153,7 +208,7 @@ The AVD's .ini file remains in the .android directory on the network drive, regardless of the location of the AVD directory. -<h3 id="hardwareopts">Setting Hardware Emulation Options</h3> +<h3 id="hardwareopts">Setting hardware emulation options</h3> <p>When you are creating a new AVD that uses a standard Android system image ("Type: platform"), the <code>android</code> tool lets you set hardware emulation diff --git a/docs/html/guide/developing/projects/projects-cmdline.jd b/docs/html/guide/developing/projects/projects-cmdline.jd index 7c3e40e..90f88fb 100644 --- a/docs/html/guide/developing/projects/projects-cmdline.jd +++ b/docs/html/guide/developing/projects/projects-cmdline.jd @@ -9,13 +9,20 @@ parent.link=index.html <ol> <li><a href="#CreatingAProject">Creating an Android Project</a></li> - <li><a href="#UpdatingAProject">Updating a Project</a></li> - - <li><a href="#SettingUpLibraryProject">Setting up a Library Project</a></li> - - <li><a href="#ReferencingLibraryProject">Referencing a Library Project from an - Application</a></li> + <li><a href="#SettingUpLibraryProject">Setting up a Library Project</a> + <ol> + <li><a href="#CreatingManifestFile">Creating the manifest file</a></li> + <li><a href="#UpdatingLibraryProject">Updating a library project</a></li> + </ol> + </li> + <li><a href="#ReferencingLibraryProject">Referencing a Library Project</a> + <ol> + <li><a href="#DeclaringLibrary">Declaring library components in the manifest +file</a></li> + <li><a href="#depAppBuild">Building a dependent application</a></li> + </ol> + </li> </ol> <h2>See also</h2> @@ -108,7 +115,7 @@ android create project \ SDK directory, because this will break the build scripts. (They will need to be manually updated to reflect the new SDK location before they will work again.)</p> - <h2 id="UpdatingAProject">Updating a project</h2> + <h2 id="UpdatingAProject">Updating a Project</h2> <p>If you're upgrading a project from an older version of the Android SDK or want to create a new project from existing code, use the <code>android update project</code> command to update the @@ -142,7 +149,7 @@ android update project --name <project_name> --target <target_ID> android update project --name MyApp --target 2 --path ./MyAppProject </pre> - <h2 id="SettingUpLibraryProject">Setting up a library project</h2> + <h2 id="SettingUpLibraryProject">Setting up a Library Project</h2> <p>A library project is a standard Android project, so you can create a new one in the same way as you would a new application project. Specifically, you can use the <code>android</code> tool @@ -171,7 +178,7 @@ android.library=true applications can use it, you can do so by adding a the <code>android.library=true</code> property to the application's <code>default.properties</code> file.</p> - <h4>Creating the manifest file</h4> + <h3 id="CreatingManifestFile">Creating the manifest file</h3> <p>A library project's manifest file must declare all of the shared components that it includes, just as would a standard Android application. For more information, see the documentation for @@ -191,7 +198,7 @@ android.library=true </manifest> </pre> - <h4>Updating a library project</h4> + <h3 id="UpdatingLibraryProject">Updating a library project</h3> <p>If you want to update the build properties (build target, location) of the library project, use this command:</p> @@ -249,7 +256,7 @@ android.library.reference.1=path/to/library_projectC that, at build time, libraries are not merged with each other before being merged with the application.</p> - <h3>Declaring library components in the the manifest file</h3> + <h3 id="DeclaringLibrary">Declaring library components in the manifest file</h3> <p>In the manifest file of the application project, you must add declarations of all components that the application will use that are imported from a library project. For example, you must diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index 5b8aa7a..35acdd7 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -60,14 +60,14 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/fundamentals/activities.html"> <span class="en">Activities</span> - </a> <span class="new-child">new!</span></div> + </a></div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/fundamentals/fragments.html"> <span class="en">Fragments</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/fundamentals/loaders.html"> <span class="en">Loaders</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/fundamentals/tasks-and-back-stack.html"> <span class="en">Tasks and Back Stack</span></a></li> </ul> @@ -98,8 +98,7 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/ui/index.html"> <span class="en">User Interface</span> - </a> - <span class="new-child">new!</span></div> + </a></div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/ui/declaring-layout.html"> <span class="en">Declaring Layout</span> @@ -109,7 +108,7 @@ </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <span class="en">Using the Action Bar</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html"> <span class="en">Creating Dialogs</span> </a></li> @@ -131,8 +130,7 @@ </li> <li><a href="<?cs var:toroot ?>guide/topics/ui/drag-drop.html"> <span class="en">Dragging and Dropping</span> - </a> <span class="new">new!</span> - </li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/themes.html"> <span class="en">Applying Styles and Themes</span> </a></li> @@ -238,8 +236,7 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/graphics/index.html"> <span class="en">Graphics</span> - </a> - <span class="new-child">new!</span></div> + </a></div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/graphics/2d-graphics.html"> <span class="en">2D Graphics</span> @@ -249,10 +246,10 @@ </a></li> <li><a href="<?cs var:toroot ?>guide/topics/graphics/renderscript.html"> <span class="en">3D with Renderscript</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/graphics/animation.html"> <span class="en">Property Animation</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/graphics/view-animation.html"> <span class="en">View Animation</span> </a></li> @@ -264,9 +261,7 @@ <li> <a href="<?cs var:toroot ?>guide/topics/clipboard/copy-paste.html"> <span class="en">Copy and Paste</span> - </a> - <span class="new">new!</span> - </li> + </a></li> <!--<li class="toggle-list"> <div><a style="color:gray;">Sensors</a></div> <ul> @@ -299,8 +294,8 @@ <span class="en">Bluetooth</span> </a></li> <li><a href="<?cs var:toroot?>guide/topics/nfc/index.html"> - <span class="en">Near Field Communication</span></a> - <span class="new">new!</span></li> + <span class="en">Near Field Communication</span> + </a></li> <li class="toggle-list"> <div><a href="<?cs var:toroot?>guide/topics/usb/index.html"> <span class="en">USB</span></a> @@ -313,9 +308,8 @@ </li> <li><a href="<?cs var:toroot?>guide/topics/network/sip.html"> - <span class="en">Session Initiation Protocol</span></a> - <span class="new">new!</span> - </li> + <span class="en">Session Initiation Protocol</span> + </a></li> <li class="toggle-list"> <div><a href="<?cs var:toroot?>guide/topics/search/index.html"> <span class="en">Search</span> @@ -374,7 +368,6 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot?>guide/market/billing/index.html"> <span class="en">In-app Billing</span></a> - <span class="new">updated</span> </div> <ul> <li><a href="<?cs var:toroot?>guide/market/billing/billing_about.html"> @@ -664,7 +657,7 @@ </a></li> <li><a href="<?cs var:toroot ?>guide/practices/optimizing-for-3.0.html"> <span class="en">Optimizing Apps for Android 3.0</span> - </a> <span class="new">new!</span></li> + </a></li> <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/index.html"> <span class="en">UI Guidelines</span> @@ -710,7 +703,7 @@ <ul> <li><a href="<?cs var:toroot ?>guide/practices/design/accessibility.html"> <span class="en">Designing for Accessibility</span> - </a> <span class="new">new!</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/practices/design/performance.html"> <span class="en">Designing for Performance</span> </a></li> @@ -764,7 +757,7 @@ </a></li> <li><a href="<?cs var:toroot ?>guide/appendix/media-formats.html"> <span class="en">Supported Media Formats</span> - </a> <span class="new">updated</span></li> + </a></li> <li><a href="<?cs var:toroot ?>guide/appendix/g-app-intents.html"> <span class="en">Intents List: Google Apps</span> </a></li> diff --git a/docs/html/guide/market/billing/billing_integrate.jd b/docs/html/guide/market/billing/billing_integrate.jd index 59344ba..1a1f02a 100755 --- a/docs/html/guide/market/billing/billing_integrate.jd +++ b/docs/html/guide/market/billing/billing_integrate.jd @@ -299,7 +299,9 @@ onto a device to run it. To run the sample application, do the following:</p> purchases will show up as actual payouts to your merchant account.</p> </ol> -<p class="note"><strong>Note</strong>: Debug log messages are turned off by default in the sample application. You can turn them on by setting the variable <code>DEBUG</code> to <code>true</code> in the <code>Consts.java</code> file.</p> +<p class="note"><strong>Note</strong>: Debug log messages are turned off by default in the +sample application. You can turn them on by setting the variable <code>DEBUG</code> +to <code>true</code> in the <code>Consts.java</code> file.</p> <h2 id="billing-add-aidl">Adding the AIDL file to your project</h2> @@ -598,7 +600,7 @@ to the Bundle prior to invoking the <code>sendBillingRequest()</code> method.</p <code>PURCHASE_INTENT</code> key provides you with a {@link android.app.PendingIntent}, which you can use to launch the checkout UI.</p> -<h5>Launching the pending intent</h5> +<h5>Using the pending intent</h5> <p>How you use the pending intent depends on which version of Android a device is running. On Android 1.6, you must use the pending intent to launch the checkout UI in its own separate task @@ -649,16 +651,58 @@ application.</p> <p>A <code>REQUEST_PURCHASE</code> request also triggers two asynchronous responses (broadcast intents). First, the Android Market application sends a <code>RESPONSE_CODE</code> broadcast intent, -which provides error information about the request. Next, if the request was successful, the Android -Market application sends an <code>IN_APP_NOTIFY</code> broadcast intent. This message contains a -notification ID, which you can use to retrieve the transaction details for the -<code>REQUEST_PURCHASE</code> request.</p> - -<p>Keep in mind, the Android Market application also sends an <code>IN_APP_NOTIFY</code> for -refunds. For more information, see <a +which provides error information about the request. If the request does not generate an +error, the <code>RESPONSE_CODE</code> broadcast intent returns <code>RESULT_OK</code>, which +indicates that the request was successfully sent. (To be clear, a <code>RESULT_OK</code> response +does not indicate that the requested purchase was successful; it indicates that the request was sent +successfully to Android Market.)</p> + +<p>Next, when the requested transaction changes state (for example, the purchase is successfully +charged to a credit card or the user cancels the purchase), the Android Market application sends an +<code>IN_APP_NOTIFY</code> broadcast intent. This message contains a notification ID, which you can +use to retrieve the transaction details for the <code>REQUEST_PURCHASE</code> request.</p> + +<p class="note"><strong>Note:</strong> The Android Market application also sends +an <code>IN_APP_NOTIFY</code> for refunds. For more information, see <a href="{@docRoot}guide/market/billing/billing_overview.html#billing-action-notify">Handling IN_APP_NOTIFY messages</a>.</p> +<p>Because the purchase process is not instantaneous and can take several seconds (or more), you +must assume that a purchase request is pending from the time you receive a <code>RESULT_OK</code> +message until you receive an <code>IN_APP_NOTIFY</code> message for the transaction. While the +transaction is pending, the Android Market checkout UI displays an "Authorizing purchase..." +notification; however, this notification is dismissed after 60 seconds and you should not rely on +this notification as your primary means of conveying transaction status to users. Instead, we +recommend that you do the following:</p> + +<ul> + <li>Add an {@link android.app.Activity} to your application that shows users the status of pending +and completed in-app purchases.</li> + <li>Use a <a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">status +bar notification</a> to keep users informed about the progress of a purchase.</li> +</ul> + +<p>To use these two UI elements, you could invoke a status bar notification with a ticker-text +message that says "Purchase pending" when your application receives a <code>RESULT_OK</code> +message. Then, when your application receives an <code>IN_APP_NOTIFY</code> message, you could +update the notification with a new message that says "Purchase succeeded" or "Purchase failed." When +a user touches the expanded status bar notification, you could launch the activity that shows the +status of pending and completed in-app purchases.</p> + +<p>If you use some other UI technique to inform users about the state of a pending transaction, +be sure that your pending status UI does not block your application. For example, you should avoid +using a hovering progress wheel to convey the status of a pending transaction because a pending +transaction could last a long time, particularly if a device loses network connectivity and cannot +receive transaction updates from Android Market.</p> + +<p class="caution"><strong>Important:</strong> If a user purchases a managed item, you must prevent +the user from purchasing the item again while the original transaction is pending. If a user +attempts to purchase a managed item twice, and the first transaction is still pending, Android +Market will display an error to the user; however, Android Market will not send an error to your +application notifying you that the second purchase request was canceled. This might cause your +application to get stuck in a pending state while it waits for an <code>IN_APP_NOTIFY</code> message +for the second purchase request.</p> + <h4>Retrieving transaction information for a purchase or refund (GET_PURCHASE_INFORMATION)</h4> <p>You retrieve transaction information in response to an <code>IN_APP_NOTIFY</code> broadcast diff --git a/docs/html/guide/topics/usb/accessory.jd b/docs/html/guide/topics/usb/accessory.jd index 7638e30..b0f4881 100644 --- a/docs/html/guide/topics/usb/accessory.jd +++ b/docs/html/guide/topics/usb/accessory.jd @@ -50,9 +50,9 @@ page.title=USB Accessory </div> </div> - <p><a href="http://accessories.android.com/demokit">USB accessory mode allows users to connect + <p>USB accessory mode allows users to connect USB host hardware specifically designed for Android-powered devices. The accessories must adhere - to the Android accessory protocol outlined in</a> <a href= + to the Android accessory protocol outlined in the <a href= "http://accessories.android.com/demokit">Android Accessory Development Kit</a> documentation. This allows Android-powered devices that cannot act as a USB host to still interact with USB hardware. When an Android-powered device is in USB accessory mode, the attached Android USB @@ -445,7 +445,7 @@ BroadcastReceiver mUsbReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(action)) { + if (UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(action)) { UsbAccessory accessory = (UsbAccessory)intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY); if (accessory != null) { // call your method that cleans up and closes communication with the accessory diff --git a/docs/html/index.jd b/docs/html/index.jd index 78f71ac..d5f19a1 100644 --- a/docs/html/index.jd +++ b/docs/html/index.jd @@ -129,17 +129,20 @@ href="{@docRoot}resources/dashboard/platform-versions.html">Learn more »</ 'sdk': { 'layout':"imgLeft", 'icon':"sdk-small.png", - 'name':"Android 3.0", + 'name':"Android 3.1", 'img':"honeycomb-android.png", - 'title':"Android 3.0 is here!", - 'desc': "<p>Android 3.0 is now available for the Android SDK. It offers a redesigned UI and " -+ "all new developer APIs for an optimized experience on tablets and similar devices. " -+ "For more information about what's in Android 3.0, read the " -+ "<a href='{@docRoot}sdk/android-3.0.html'>version notes</a>.</p>" + 'title':"Android 3.1 now available!", + 'desc': "<p>Android 3.1 includes new developer features such as APIs for USB " ++ "accessories, MTP/PTP, and RTP, as well as new input events from mice, trackballs, joysticks, " ++ "and more.</p>" ++ "<p>For more information about all the new APIs in Android 3.1, read the " ++ "<a href='{@docRoot}sdk/android-3.1.html'>version notes</a>.</p>" +/* + "<p>If you have an existing SDK, add Android 3.0 as an " + "<a href='{@docRoot}sdk/adding-components.html'>SDK " + "component</a>. If you're new to Android, install the " + "<a href='{@docRoot}sdk/index.html'>SDK starter package</a>." +*/ }, 'tv': { @@ -152,8 +155,7 @@ href="{@docRoot}resources/dashboard/platform-versions.html">Learn more »</ + "for television built on Android. Google " + "has partnered with Sony and Logitech to integrate " + "this platform into TVs, blu-ray players, and companion " - + "boxes. An add-on for the Android SDK will be " - + "available early next year. </p>" + + "boxes. </p>" + "<p><a href='http://www.google.com/tv/'>Learn more about " + "Google TV »</a></p>" }, diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs index 6b9a5ce..3240b57 100644 --- a/docs/html/sdk/sdk_toc.cs +++ b/docs/html/sdk/sdk_toc.cs @@ -113,7 +113,8 @@ class="new">new!</span></li> </li> </ul> <ul> - <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r10</a> <span class="new">new!</span></li> + <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r11</a> <span +class="new">new!</span></li> <li><a href="<?cs var:toroot ?>sdk/win-usb.html">Google USB Driver, r4</a></li> </ul> </li> @@ -137,7 +138,7 @@ class="new">new!</span></li> <span style="display:none" class="ja"></span> <span style="display:none" class="zh-CN"></span> <span style="display:none" class="zh-TW"></span></a> - <span class="new">new!</span></li> + <!-- <span class="new">new!</span> --></li> </ul> </li> <li> diff --git a/docs/html/sdk/tools-notes.jd b/docs/html/sdk/tools-notes.jd index 28d8bdd..354fec9 100644 --- a/docs/html/sdk/tools-notes.jd +++ b/docs/html/sdk/tools-notes.jd @@ -70,6 +70,33 @@ SDK Tools, Revision 10</a> <em>(February 2011)</em> <dl> <dt>Dependencies:</dt> <dd> +<p>If you are developing in Eclipse with ADT, note that the SDK Tools r11 is designed for use with +ADT 10.0.1 and later. If you haven't already, we highly recommend updating your <a +href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin</a> to 10.0.1.</p> + +<p>If you are developing outside Eclipse, you must have <a href="http://ant.apache.org/">Apache +Ant</a> 1.8 or later.</p> + +<dt>General notes:</dt> +<dd> + <ul> + <li>Miscellaneous emulator changes to support Android 3.1.</li> + </ul> +</dd> +</dl> +</div> +</div> + + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" +width="9px" /> +SDK Tools, Revision 10</a> <em>(February 2011)</em> + <div class="toggleme"> + <dl> +<dt>Dependencies:</dt> +<dd> <p>If you are developing in Eclipse with ADT, note that the SDK Tools r10 is designed for use with ADT 10.0.0 and later. After installing SDK Tools r10, we highly recommend updating your ADT Plugin to 10.0.0.</p> @@ -80,7 +107,8 @@ Ant</a> 1.8 or later.</p> <dt>General notes:</dt> <dd> <ul> - <li>The tools now automatically generate Java Programming Language source files (in the <code>gen</code> directory) and + <li>The tools now automatically generate Java Programming Language source files (in the +<code>gen</code> directory) and bytecode (in the <code>res/raw</code> directory) from your native <code>.rs</code> files</li> </ul> </dd> @@ -400,7 +428,7 @@ main and test projects.</li> <dt>DDMS:</dt> <dd> <ul> -<li>Adds a button to dump HPROF file for running appplications (app must be able +<li>Adds a button to dump HPROF file for running applications (app must be able to write to the sdcard).</li> <li>Button to start/stop profiling of a running application (app must be able to write to the sdcard). Upon stop, Traceview will automatically be launched to diff --git a/media/java/android/mtp/MtpDevice.java b/media/java/android/mtp/MtpDevice.java index 47bb8c9..3272fed 100644 --- a/media/java/android/mtp/MtpDevice.java +++ b/media/java/android/mtp/MtpDevice.java @@ -22,7 +22,10 @@ import android.os.ParcelFileDescriptor; import android.util.Log; /** - * This class represents an MTP or PTP device connected on the USB host bus. + * This class represents an MTP or PTP device connected on the USB host bus. An application can + * instantiate an object of this type, by referencing an attached {@link + * android.hardware.usb.UsbDevice} and then use methods in this class to get information about the + * device and objects stored on it, as well as open the connection and transfer data. */ public final class MtpDevice { diff --git a/media/java/android/mtp/package.html b/media/java/android/mtp/package.html new file mode 100644 index 0000000..6bd9229 --- /dev/null +++ b/media/java/android/mtp/package.html @@ -0,0 +1,8 @@ +<html> +<body> +<p>Provides APIs that let you interact directly with connected cameras and other devices, using the +PTP (Picture Transfer Protocol) subset of the MTP (Media Transfer Protocol) specification. Your +application can receive notifications when devices are attached and removed, manage files and +storage on those devices, and transfer files and metadata from the devices.</p> +</body> +</html>
\ No newline at end of file diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index 6a5b82c..c4359a9 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -490,6 +490,9 @@ public abstract class DataConnection extends StateMachine { log("BUG: onSetupConnectionCompleted is stale cp.tag=" + cp.tag + ", mtag=" + mTag); } result = DataCallState.SetupResult.ERR_Stale; + } else if (response.status != 0) { + result = DataCallState.SetupResult.ERR_RilError; + result.mFailCause = FailCause.fromInt(response.status); } else { log("onSetupConnectionCompleted received DataCallState: " + response); diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java index ad4e796..244f35e 100644 --- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java @@ -38,6 +38,7 @@ import android.text.TextUtils; import android.util.Log; import com.android.internal.R; +import com.android.internal.telephony.DataConnection.FailCause; import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; @@ -143,6 +144,9 @@ public abstract class DataConnectionTracker extends Handler { public static final String APN_TYPE_KEY = "apnType"; + /** Delay between APN attempts */ + protected static final int APN_DELAY_MILLIS = 5000; + // responds to the setInternalDataEnabled call - used internally to turn off data // for example during emergency calls protected boolean mInternalDataEnabled = true; @@ -202,6 +206,19 @@ public abstract class DataConnectionTracker extends Handler { // getActionIntentReconnectAlarm. protected static final String INTENT_RECONNECT_ALARM_EXTRA_REASON = "reason"; + // Used for debugging. Send the INTENT with an optional counter value with the number + // of times the setup is to fail before succeeding. If the counter isn't passed the + // setup will fail once. Example fail two times with FailCause.SIGNAL_LOST(-3) + // adb shell am broadcast \ + // -a com.android.internal.telephony.dataconnectiontracker.intent_set_fail_data_setup_counter \ + // --ei fail_data_setup_counter 3 --ei fail_data_setup_fail_cause -3 + protected static final String INTENT_SET_FAIL_DATA_SETUP_COUNTER = + "com.android.internal.telephony.dataconnectiontracker.intent_set_fail_data_setup_counter"; + protected static final String FAIL_DATA_SETUP_COUNTER = "fail_data_setup_counter"; + protected int mFailDataSetupCounter = 0; + protected static final String FAIL_DATA_SETUP_FAIL_CAUSE = "fail_data_setup_fail_cause"; + protected FailCause mFailDataSetupFailCause = FailCause.ERROR_UNSPECIFIED; + // member variables protected PhoneBase mPhone; protected Activity mActivity = Activity.NONE; @@ -275,6 +292,7 @@ public abstract class DataConnectionTracker extends Handler { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); + if (DBG) log("onReceive: action=" + action); if (action.equals(Intent.ACTION_SCREEN_ON)) { mIsScreenOn = true; stopNetStatPoll(); @@ -300,10 +318,36 @@ public abstract class DataConnectionTracker extends Handler { // quit and won't report disconnected until next enabling. mIsWifiConnected = false; } + } else if (action.equals(INTENT_SET_FAIL_DATA_SETUP_COUNTER)) { + mFailDataSetupCounter = intent.getIntExtra(FAIL_DATA_SETUP_COUNTER, 1); + mFailDataSetupFailCause = FailCause.fromInt( + intent.getIntExtra(FAIL_DATA_SETUP_FAIL_CAUSE, + FailCause.ERROR_UNSPECIFIED.getErrorCode())); + if (DBG) log("set mFailDataSetupCounter=" + mFailDataSetupCounter + + " mFailDataSetupFailCause=" + mFailDataSetupFailCause); } } }; + protected boolean isDataSetupCompleteOk(AsyncResult ar) { + if (ar.exception != null) { + if (DBG) log("isDataSetupCompleteOk return false, ar.result=" + ar.result); + return false; + } + if (mFailDataSetupCounter <= 0) { + if (DBG) log("isDataSetupCompleteOk return true"); + return true; + } + ar.result = mFailDataSetupFailCause; + if (DBG) { + log("isDataSetupCompleteOk return false" + + " mFailDataSetupCounter=" + mFailDataSetupCounter + + " mFailDataSetupFailCause=" + mFailDataSetupFailCause); + } + mFailDataSetupCounter -= 1; + return false; + } + protected void onActionIntentReconnectAlarm(Intent intent) { String reason = intent.getStringExtra(INTENT_RECONNECT_ALARM_EXTRA_REASON); if (mState == State.FAILED) { @@ -329,6 +373,7 @@ public abstract class DataConnectionTracker extends Handler { filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); + filter.addAction(INTENT_SET_FAIL_DATA_SETUP_COUNTER); mDataEnabled = Settings.Secure.getInt(mPhone.getContext().getContentResolver(), Settings.Secure.MOBILE_DATA, 1) == 1; diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index 4b185a0..f325812 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -54,9 +54,6 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { private CDMAPhone mCdmaPhone; - //useful for debugging - boolean mFailNextConnect = false; - /** The DataConnection being setup */ private CdmaDataConnection mPendingDataConnection; @@ -660,7 +657,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { reason = (String) ar.userObj; } - if (ar.exception == null) { + if (isDataSetupCompleteOk(ar)) { // Everything is setup notifyDefaultData(reason); } else { @@ -704,7 +701,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { notifyDataConnection(reason); mActiveApn = null; if (retryAfterDisconnected(reason)) { - trySetupData(reason); + // Wait a bit before trying, so we're not tying up RIL command channel. + sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, reason), APN_DELAY_MILLIS); } } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index d8e6f5c..21c644d 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -101,11 +101,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // call reRegisterNetwork, or pingTest succeeds. private int mPdpResetCount = 0; - /** Delay between APN attempts */ - protected static final int APN_DELAY_MILLIS = 5000; - - //useful for debugging - boolean mFailNextConnect = false; //***** Constants @@ -1551,13 +1546,14 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } else { throw new RuntimeException("onDataSetupComplete: No apnContext"); } - DataConnectionAc dcac = apnContext.getDataConnectionAc(); - if (dcac == null) { - throw new RuntimeException("onDataSetupCompete: No dcac"); - } - DataConnection dc = apnContext.getDataConnection(); - if (ar.exception == null) { + if (isDataSetupCompleteOk(ar)) { + DataConnectionAc dcac = apnContext.getDataConnectionAc(); + if (dcac == null) { + throw new RuntimeException("onDataSetupCompete: No dcac"); + } + DataConnection dc = apnContext.getDataConnection(); + if (DBG) { log(String.format("onDataSetupComplete: success apn=%s", apnContext.getWaitingApns().get(0).apn) + " refCount=" + dc.getRefCount()); @@ -1589,16 +1585,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } notifyDefaultData(apnContext); } else { - int refCount = releaseApnContext(apnContext, false); - if (DBG) { - log(String.format("onDataSetupComplete: error apn=%s", - apnContext.getWaitingApns().get(0).apn) + " refCount=" + refCount); - } + String apnString; + DataConnection.FailCause cause; - GsmDataConnection.FailCause cause; - cause = (GsmDataConnection.FailCause) (ar.result); + cause = (DataConnection.FailCause) (ar.result); if (DBG) { - String apnString; try { apnString = apnContext.getWaitingApns().get(0).apn; } catch (Exception e) { @@ -1644,6 +1635,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, apnContext), APN_DELAY_MILLIS); } + + int refCount = releaseApnContext(apnContext, false); + if (DBG) { + log("onDataSetupComplete: error apn=%s" + apnString + " refCount=" + refCount); + } } } diff --git a/voip/java/android/net/rtp/package.html b/voip/java/android/net/rtp/package.html new file mode 100644 index 0000000..4506b09 --- /dev/null +++ b/voip/java/android/net/rtp/package.html @@ -0,0 +1,28 @@ +<html> +<body> +<p>Provides APIs for RTP (Real-time Transport Protocol), allowing applications to manage on-demand +or interactive data streaming. In particular, apps that provide VOIP, push-to-talk, conferencing, +and audio streaming can use these APIs to initiate sessions and transmit or receive data streams +over any available network.</p> + +<p>To support audio conferencing and similar usages, you need to instantiate two classes as +endpoints for the stream:</p> + +<ul> +<li>{@link android.net.rtp.AudioStream} specifies a remote endpoint and consists of network mapping +and a configured {@link android.net.rtp.AudioCodec}.</li> + +<li>{@link android.net.rtp.AudioGroup} represents the local endpoint for one or more {@link +android.net.rtp.AudioStream}s. The {@link android.net.rtp.AudioGroup} mixes all the {@link +android.net.rtp.AudioStream}s and optionally interacts with the device speaker and the microphone at +the same time.</li> +</ul> + +<p>The simplest usage involves a single remote endpoint and local endpoint. For more complex usages, +refer to the limitations described for {@link android.net.rtp.AudioGroup}.</p> + +<p class="note"><strong>Note:</strong> To use the RTP APIs, you must request the {@link +android.Manifest.permission#INTERNET} and {@link +android.Manifest.permission#RECORD_AUDIO} permissions in your manifest file.</p> +</body> +</html>
\ No newline at end of file |