diff options
31 files changed, 443 insertions, 147 deletions
diff --git a/api/current.xml b/api/current.xml index f45b68f..9deab57 100644 --- a/api/current.xml +++ b/api/current.xml @@ -28358,6 +28358,28 @@ visibility="public" > </field> +<field name="ACTION_POWER_CONNECTED" + type="java.lang.String" + transient="false" + volatile="false" + value=""android.intent.action.POWER_CONNECTED"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="ACTION_POWER_DISCONNECTED" + type="java.lang.String" + transient="false" + volatile="false" + value=""android.intent.action.POWER_DISCONNECTED"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="ACTION_PROVIDER_CHANGED" type="java.lang.String" transient="false" @@ -140192,7 +140214,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > </method> @@ -140613,7 +140635,7 @@ synchronized="true" static="false" final="false" - deprecated="not deprecated" + deprecated="deprecated" visibility="public" > <parameter name="use" type="boolean"> diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 90ff78a..c47b72f 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -508,6 +508,8 @@ import java.util.Set; * <li> {@link #ACTION_PACKAGE_DATA_CLEARED} * <li> {@link #ACTION_UID_REMOVED} * <li> {@link #ACTION_BATTERY_CHANGED} + * <li> {@link #ACTION_POWER_CONNECTED} + * <li> {@link #ACTION_POWER_DISCONNECTED} * </ul> * * <h3>Standard Categories</h3> @@ -1226,6 +1228,25 @@ public class Intent implements Parcelable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"; /** + * Broadcast Action: External power has been connected to the device. + * This is intended for applications that wish to register specifically to this notification. + * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to + * stay active to receive this notification. This action can be used to implement actions + * that wait until power is available to trigger. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_POWER_CONNECTED = "android.intent.action.POWER_CONNECTED"; + /** + * Broadcast Action: External power has been removed from the device. + * This is intended for applications that wish to register specifically to this notification. + * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to + * stay active to receive this notification. This action can be used to implement actions + * that wait until power is available to trigger. + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_POWER_DISCONNECTED = + "android.intent.action.POWER_DISCONNECTED"; + /** * Broadcast Action: Indicates low memory condition on the device */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index e81bc86..b151de5 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -351,6 +351,7 @@ public class IntentFilter implements Parcelable { throws MalformedMimeTypeException { mPriority = 0; mActions = new ArrayList<String>(); + addAction(action); addDataType(dataType); } diff --git a/core/java/android/database/sqlite/SQLiteQueryBuilder.java b/core/java/android/database/sqlite/SQLiteQueryBuilder.java index 519a81c..139fcba 100644 --- a/core/java/android/database/sqlite/SQLiteQueryBuilder.java +++ b/core/java/android/database/sqlite/SQLiteQueryBuilder.java @@ -351,23 +351,26 @@ public class SQLiteQueryBuilder String groupBy, String having, String sortOrder, String limit) { String[] projection = computeProjection(projectionIn); + StringBuilder where = new StringBuilder(); + if (mWhereClause.length() > 0) { - mWhereClause.append(')'); + where.append(mWhereClause.toString()); + where.append(')'); } // Tack on the user's selection, if present. if (selection != null && selection.length() > 0) { if (mWhereClause.length() > 0) { - mWhereClause.append(" AND "); + where.append(" AND "); } - mWhereClause.append('('); - mWhereClause.append(selection); - mWhereClause.append(')'); + where.append('('); + where.append(selection); + where.append(')'); } return buildQueryString( - mDistinct, mTables, projection, mWhereClause.toString(), + mDistinct, mTables, projection, where.toString(), groupBy, having, sortOrder, limit); } diff --git a/core/java/android/provider/Contacts.java b/core/java/android/provider/Contacts.java index 2aa77ea..e132bee 100644 --- a/core/java/android/provider/Contacts.java +++ b/core/java/android/provider/Contacts.java @@ -1192,7 +1192,7 @@ public class Contacts { */ public interface OrganizationColumns { /** - * The type of the the phone number. + * The type of the organizations. * <P>Type: INTEGER (one of the constants below)</P> */ public static final String TYPE = "type"; diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index 4c58e0d..790fe5c 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -63,7 +63,7 @@ public final class Downloads implements BaseColumns { * that had initiated a download when that download completes. The * download's content: uri is specified in the intent's data. */ - public static final String DOWNLOAD_COMPLETED_ACTION = + public static final String ACTION_DOWNLOAD_COMPLETED = "android.intent.action.DOWNLOAD_COMPLETED"; /** @@ -76,7 +76,7 @@ public final class Downloads implements BaseColumns { * Note: this is not currently sent for downloads that have completed * successfully. */ - public static final String NOTIFICATION_CLICKED_ACTION = + public static final String ACTION_NOTIFICATION_CLICKED = "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"; /** @@ -84,14 +84,14 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read</P> */ - public static final String URI = "uri"; + public static final String COLUMN_URI = "uri"; /** * The name of the column containing application-specific data. * <P>Type: TEXT</P> * <P>Owner can Init/Read/Write</P> */ - public static final String APP_DATA = "entity"; + public static final String COLUMN_APP_DATA = "entity"; /** * The name of the column containing the flags that indicates whether @@ -104,7 +104,7 @@ public final class Downloads implements BaseColumns { * <P>Type: BOOLEAN</P> * <P>Owner can Init</P> */ - public static final String NO_INTEGRITY = "no_integrity"; + public static final String COLUMN_NO_INTEGRITY = "no_integrity"; /** * The name of the column containing the filename that the initiating @@ -113,7 +113,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init</P> */ - public static final String FILENAME_HINT = "hint"; + public static final String COLUMN_FILE_NAME_HINT = "hint"; /** * The name of the column containing the filename where the downloaded data @@ -128,7 +128,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read</P> */ - public static final String MIMETYPE = "mimetype"; + public static final String COLUMN_MIME_TYPE = "mimetype"; /** * The name of the column containing the flag that controls the destination @@ -136,7 +136,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Init</P> */ - public static final String DESTINATION = "destination"; + public static final String COLUMN_DESTINATION = "destination"; /** * The name of the column containing the flags that controls whether the @@ -145,7 +145,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Init/Read/Write</P> */ - public static final String VISIBILITY = "visibility"; + public static final String COLUMN_VISIBILITY = "visibility"; /** * The name of the column containing the current control state of the download. @@ -154,7 +154,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Read</P> */ - public static final String CONTROL = "control"; + public static final String COLUMN_CONTROL = "control"; /** * The name of the column containing the current status of the download. @@ -163,7 +163,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Read</P> */ - public static final String STATUS = "status"; + public static final String COLUMN_STATUS = "status"; /** * The name of the column containing the date at which some interesting @@ -172,7 +172,7 @@ public final class Downloads implements BaseColumns { * <P>Type: BIGINT</P> * <P>Owner can Read</P> */ - public static final String LAST_MODIFICATION = "lastmod"; + public static final String COLUMN_LAST_MODIFICATION = "lastmod"; /** * The name of the column containing the package name of the application @@ -181,7 +181,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read</P> */ - public static final String NOTIFICATION_PACKAGE = "notificationpackage"; + public static final String COLUMN_NOTIFICATION_PACKAGE = "notificationpackage"; /** * The name of the column containing the component name of the class that @@ -191,7 +191,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read</P> */ - public static final String NOTIFICATION_CLASS = "notificationclass"; + public static final String COLUMN_NOTIFICATION_CLASS = "notificationclass"; /** * If extras are specified when requesting a download they will be provided in the intent that @@ -199,7 +199,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init</P> */ - public static final String NOTIFICATION_EXTRAS = "notificationextras"; + public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras"; /** * The name of the column contain the values of the cookie to be used for @@ -208,7 +208,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init</P> */ - public static final String COOKIE_DATA = "cookiedata"; + public static final String COLUMN_COOKIE_DATA = "cookiedata"; /** * The name of the column containing the user agent that the initiating @@ -216,7 +216,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init</P> */ - public static final String USER_AGENT = "useragent"; + public static final String COLUMN_USER_AGENT = "useragent"; /** * The name of the column containing the referer (sic) that the initiating @@ -224,7 +224,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init</P> */ - public static final String REFERER = "referer"; + public static final String COLUMN_REFERER = "referer"; /** * The name of the column containing the total size of the file being @@ -232,7 +232,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Read</P> */ - public static final String TOTAL_BYTES = "total_bytes"; + public static final String COLUMN_TOTAL_BYTES = "total_bytes"; /** * The name of the column containing the size of the part of the file that @@ -240,7 +240,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Read</P> */ - public static final String CURRENT_BYTES = "current_bytes"; + public static final String COLUMN_CURRENT_BYTES = "current_bytes"; /** * The name of the column where the initiating application can provide the @@ -252,7 +252,7 @@ public final class Downloads implements BaseColumns { * <P>Type: INTEGER</P> * <P>Owner can Init</P> */ - public static final String OTHER_UID = "otheruid"; + public static final String COLUMN_OTHER_UID = "otheruid"; /** * The name of the column where the initiating application can provided the @@ -261,7 +261,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read/Write</P> */ - public static final String TITLE = "title"; + public static final String COLUMN_TITLE = "title"; /** * The name of the column where the initiating application can provide the @@ -270,7 +270,7 @@ public final class Downloads implements BaseColumns { * <P>Type: TEXT</P> * <P>Owner can Init/Read/Write</P> */ - public static final String DESCRIPTION = "description"; + public static final String COLUMN_DESCRIPTION = "description"; /* * Lists the destinations that an application can specify for a download. diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index e928998..03ae6dc 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -30,8 +30,9 @@ import android.os.ParcelFileDescriptor; import android.util.AttributeSet; import android.util.Config; import android.util.Log; -import java.util.ArrayList; +import java.lang.ref.WeakReference; +import java.util.ArrayList; import java.util.concurrent.locks.ReentrantLock; import java.lang.ref.WeakReference; diff --git a/core/java/android/webkit/CookieSyncManager.java b/core/java/android/webkit/CookieSyncManager.java index f2511d8..e37dc56 100644 --- a/core/java/android/webkit/CookieSyncManager.java +++ b/core/java/android/webkit/CookieSyncManager.java @@ -25,30 +25,39 @@ import java.util.ArrayList; import java.util.Iterator; /** - * The class CookieSyncManager is used to synchronize the browser cookies - * between RAM and FLASH. To get the best performance, browser cookie is saved - * in RAM. We use a separate thread to sync the cookies between RAM and FLASH on - * a timer base. + * The CookieSyncManager is used to synchronize the browser cookie store + * between RAM and permanent storage. To get the best performance, browser cookies are + * saved in RAM. A separate thread saves the cookies between, driven by a timer. * <p> + * * To use the CookieSyncManager, the host application has to call the following - * when the application starts. - * <p> - * CookieSyncManager.createInstance(context) - * <p> - * To set up for sync, the host application has to call - * <p> - * CookieSyncManager.getInstance().startSync() + * when the application starts: * <p> - * in its Activity.onResume(), and call + * + * <pre class="prettyprint">CookieSyncManager.createInstance(context)</pre><p> + * + * To set up for sync, the host application has to call<p> + * <pre class="prettyprint">CookieSyncManager.getInstance().startSync()</pre><p> + * + * in Activity.onResume(), and call * <p> + * + * <pre class="prettyprint"> * CookieSyncManager.getInstance().stopSync() - * <p> - * in its Activity.onStop(). - * <p> + * </pre><p> + * + * in Activity.onPause().<p> + * * To get instant sync instead of waiting for the timer to trigger, the host can * call * <p> - * CookieSyncManager.getInstance().sync() + * <pre class="prettyprint">CookieSyncManager.getInstance().sync()</pre><p> + * + * The sync interval is 5 minutes, so you will want to force syncs + * manually anyway, for instance in {@link + * WebViewClient#onPageFinished}. Note that even sync() happens + * asynchronously, so don't do it just as your activity is shutting + * down. */ public final class CookieSyncManager extends WebSyncManager { @@ -91,7 +100,7 @@ public final class CookieSyncManager extends WebSyncManager { } /** - * Package level api, called from CookieManager Get all the cookies which + * Package level api, called from CookieManager. Get all the cookies which * matches a given base domain. * @param domain * @return A list of Cookie diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 65544d4..44f382c 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -111,9 +111,13 @@ public class WebSettings { private boolean mSyncPending = false; // Custom handler that queues messages until the WebCore thread is active. private final EventHandler mEventHandler; + // Private settings so we don't have to go into native code to // retrieve the values. After setXXX, postSync() needs to be called. - // XXX: The default values need to match those in WebSettings.cpp + // + // The default values need to match those in WebSettings.cpp + // If the defaults change, please also update the JavaDocs so developers + // know what they are. private LayoutAlgorithm mLayoutAlgorithm = LayoutAlgorithm.NARROW_COLUMNS; private Context mContext; private TextSize mTextSize = TextSize.NORMAL; @@ -444,24 +448,21 @@ public class WebSettings { } /** - * Tell the WebView to use the double tree rendering algorithm. - * @param use True if the WebView is to use double tree rendering, false - * otherwise. + * @deprecated This setting controlled a rendering optimization + * that is no longer present. Setting it now has no effect. */ + @Deprecated public synchronized void setUseDoubleTree(boolean use) { - if (mUseDoubleTree != use) { - mUseDoubleTree = use; - postSync(); - } + return; } /** - * Return true if the WebView is using the double tree rendering algorithm. - * @return True if the WebView is using the double tree rendering - * algorithm. + * @deprecated This setting controlled a rendering optimization + * that is no longer present. Setting it now has no effect. */ + @Deprecated public synchronized boolean getUseDoubleTree() { - return mUseDoubleTree; + return false; } /** @@ -566,7 +567,7 @@ public class WebSettings { } /** - * Return the current layout algorithm. + * Return the current layout algorithm. The default is NARROW_COLUMNS. * @return LayoutAlgorithm enum value describing the layout algorithm * being used. * @see WebSettings.LayoutAlgorithm @@ -587,7 +588,7 @@ public class WebSettings { } /** - * Get the standard font family name. + * Get the standard font family name. The default is "sans-serif". * @return The standard font family name as a string. */ public synchronized String getStandardFontFamily() { @@ -606,7 +607,7 @@ public class WebSettings { } /** - * Get the fixed font family name. + * Get the fixed font family name. The default is "monospace". * @return The fixed font family name as a string. */ public synchronized String getFixedFontFamily() { @@ -633,7 +634,7 @@ public class WebSettings { } /** - * Set the serif font family name. + * Set the serif font family name. The default is "sans-serif". * @param font A font family name. */ public synchronized void setSerifFontFamily(String font) { @@ -644,7 +645,7 @@ public class WebSettings { } /** - * Get the serif font family name. + * Get the serif font family name. The default is "serif". * @return The serif font family name as a string. */ public synchronized String getSerifFontFamily() { @@ -663,7 +664,7 @@ public class WebSettings { } /** - * Get the cursive font family name. + * Get the cursive font family name. The default is "cursive". * @return The cursive font family name as a string. */ public synchronized String getCursiveFontFamily() { @@ -682,7 +683,7 @@ public class WebSettings { } /** - * Get the fantasy font family name. + * Get the fantasy font family name. The default is "fantasy". * @return The fantasy font family name as a string. */ public synchronized String getFantasyFontFamily() { @@ -703,7 +704,7 @@ public class WebSettings { } /** - * Get the minimum font size. + * Get the minimum font size. The default is 8. * @return A non-negative integer between 1 and 72. */ public synchronized int getMinimumFontSize() { @@ -724,7 +725,7 @@ public class WebSettings { } /** - * Get the minimum logical font size. + * Get the minimum logical font size. The default is 8. * @return A non-negative integer between 1 and 72. */ public synchronized int getMinimumLogicalFontSize() { @@ -745,7 +746,7 @@ public class WebSettings { } /** - * Get the default font size. + * Get the default font size. The default is 16. * @return A non-negative integer between 1 and 72. */ public synchronized int getDefaultFontSize() { @@ -766,7 +767,7 @@ public class WebSettings { } /** - * Get the default fixed font size. + * Get the default fixed font size. The default is 16. * @return A non-negative integer between 1 and 72. */ public synchronized int getDefaultFixedFontSize() { @@ -786,6 +787,7 @@ public class WebSettings { /** * Return true if the WebView will load image resources automatically. + * The default is true. * @return True if the WebView loads images automatically. */ public synchronized boolean getLoadsImagesAutomatically() { @@ -805,16 +807,16 @@ public class WebSettings { } /** - * Return true if the WebView will block network image. + * Return true if the WebView will block network image. The default is false. * @return True if the WebView blocks network image. */ public synchronized boolean getBlockNetworkImage() { return mBlockNetworkImage; } - + /** * @hide - * Tell the WebView to block all network load requests. + * Tell the WebView to block all network load requests. * @param flag True if the WebView should block all network loads */ public synchronized void setBlockNetworkLoads(boolean flag) { @@ -827,13 +829,14 @@ public class WebSettings { /** * @hide * Return true if the WebView will block all network loads. + * The default is false. * @return True if the WebView blocks all network loads. */ public synchronized boolean getBlockNetworkLoads() { return mBlockNetworkLoads; } - - + + private void verifyNetworkAccess() { if (!mBlockNetworkLoads) { if (mContext.checkPermission("android.permission.INTERNET", @@ -881,7 +884,7 @@ public class WebSettings { } /** - * Return true if javascript is enabled. + * Return true if javascript is enabled. <b>Note: The default is false.</b> * @return True if javascript is enabled. */ public synchronized boolean getJavaScriptEnabled() { @@ -918,7 +921,8 @@ public class WebSettings { } /** - * Return true if javascript can open windows automatically. + * Return true if javascript can open windows automatically. The default + * is false. * @return True if javascript can open windows automatically during * window.open(). */ @@ -938,7 +942,7 @@ public class WebSettings { } /** - * Get the default text encoding name. + * Get the default text encoding name. The default is "Latin-1". * @return The default text encoding name as a string. */ public synchronized String getDefaultTextEncodingName() { @@ -1027,8 +1031,8 @@ public class WebSettings { /** * Set the priority of the Render thread. Unlike the other settings, this - * one only needs to be called once per process. - * + * one only needs to be called once per process. The default is NORMAL. + * * @param priority RenderPriority, can be normal, high or low. */ public synchronized void setRenderPriority(RenderPriority priority) { diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 753267f..d404040 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -80,16 +80,116 @@ import java.util.HashMap; import java.util.List; /** - * <p>A View that displays web pages. This class is the basis upon which you - * can roll your own web browser or simply display some online content within your Activity. - * It uses the WebKit rendering engine to display - * web pages and includes methods to navigate forward and backward - * through a history, zoom in and out, perform text searches and more.</p> - * <p>Note that, in order for your Activity to access the Internet and load web pages - * in a WebView, you must add the <var>INTERNET</var> permissions to your - * Android Manifest file:</p> + * <p>A View that displays web pages. This class is the basis upon + * which you can roll your own web browser or simply display some + * online content within your Activity. It uses the WebKit rendering + * engine to display web pages and includes methods to navigate + * forward and backward through a history, zoom in and out, perform + * text searches and more.</p> + * + * <p>Note that, in order for your Activity to access the Internet and + * load web pages in a WebView, you must add the <var>INTERNET</var> + * permissions to your Android Manifest file:</p> + * * <pre><uses-permission android:name="android.permission.INTERNET" /></pre> + * * <p>This must be a child of the <code><manifest></code> element.</p> + * + * <h3>Basic usage</h3> + * + * <p>By default, a WebView provides no browser-like widgets, does not + * enable JavaScript and errors will be ignored. If your goal is only + * to display some HTML as a part of your UI, this is probably fine; + * the user won't need to interact with the web page beyond reading + * it, and the web page won't need to interact with the user. If you + * actually want a fully blown web browser, then you probably want to + * invoke the Browser application with your URL rather than show it + * with a WebView. See {@link android.content.Intent} for more information.</p> + * + * <pre class="prettyprint"> + * WebView webview = new WebView(this); + * setContentView(webview); + * + * // Simplest usage: note that an exception will NOT be thrown + * // if there is an error loading this page (see below). + * webview.loadUrl("http://slashdot.org/"); + * + * // Of course you can also load from any string: + * String summary = "<html><body>You scored <b>192</b> points.</body></html>"; + * webview.loadData(summary, "text/html", "utf-8"); + * // ... although note that there are restrictions on what this HTML can do. + * // See the JavaDocs for loadData and loadDataWithBaseUrl for more info. + * </pre> + * + * <p>A WebView has several customization points where you can add your + * own behavior. These are:</p> + * + * <ul> + * <li>Creating and setting a {@link android.webkit.WebChromeClient} subclass. + * This class is called when something that might impact a + * browser UI happens, for instance, progress updates and + * JavaScript alerts are sent here. + * </li> + * <li>Creating and setting a {@link android.webkit.WebViewClient} subclass. + * It will be called when things happen that impact the + * rendering of the content, eg, errors or form submissions. You + * can also intercept URL loading here.</li> + * <li>Via the {@link android.webkit.WebSettings} class, which contains + * miscellaneous configuration. </li> + * <li>With the {@link android.webkit.WebView#addJavascriptInterface} method. + * This lets you bind Java objects into the WebView so they can be + * controlled from the web pages JavaScript.</li> + * </ul> + * + * <p>Here's a more complicated example, showing error handling, + * settings, and progress notification:</p> + * + * <pre class="prettyprint"> + * // Let's display the progress in the activity title bar, like the + * // browser app does. + * getWindow().requestFeature(Window.FEATURE_PROGRESS); + * + * webview.getSettings().setJavaScriptEnabled(true); + * + * final Activity activity = this; + * webview.setWebChromeClient(new WebChromeClient() { + * public void onProgressChanged(WebView view, int progress) { + * // Activities and WebViews measure progress with different scales. + * // The progress meter will automatically disappear when we reach 100% + * activity.setProgress(progress * 1000); + * } + * }); + * webview.setWebViewClient(new WebViewClient() { + * public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { + * Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show(); + * } + * }); + * + * webview.loadUrl("http://slashdot.org/"); + * </pre> + * + * <h3>Cookie and window management</h3> + * + * <p>For obvious security reasons, your application has its own + * cache, cookie store etc - it does not share the Browser + * applications data. Cookies are managed on a separate thread, so + * operations like index building don't block the UI + * thread. Follow the instructions in {@link android.webkit.CookieSyncManager} + * if you want to use cookies in your application. + * </p> + * + * <p>By default, requests by the HTML to open new windows are + * ignored. This is true whether they be opened by JavaScript or by + * the target attribute on a link. You can customize your + * WebChromeClient to provide your own behaviour for opening multiple windows, + * and render them in whatever manner you want.</p> + * + * <p>Standard behavior for an Activity is to be destroyed and + * recreated when the devices orientation is changed. This will cause + * the WebView to reload the current page. If you don't want that, you + * can set your Activity to handle the orientation and keyboardHidden + * changes, and then just leave the WebView alone. It'll automatically + * re-orient itself as appropriate.</p> */ public class WebView extends AbsoluteLayout implements ViewTreeObserver.OnGlobalFocusChangeListener, @@ -1754,14 +1854,15 @@ public class WebView extends AbsoluteLayout } /** - * Clear the resource cache. This will cause resources to be re-downloaded - * if accessed again. - * <p> - * Note: this really needs to be a static method as it clears cache for all - * WebView. But we need mWebViewCore to send message to WebCore thread, so - * we can't make this static. + * Clear the resource cache. Note that the cache is per-application, so + * this will clear the cache for all WebViews used. + * + * @param includeDiskFiles If false, only the RAM cache is cleared. */ public void clearCache(boolean includeDiskFiles) { + // Note: this really needs to be a static method as it clears cache for all + // WebView. But we need mWebViewCore to send message to WebCore thread, so + // we can't make this static. mWebViewCore.sendMessage(EventHub.CLEAR_CACHE, includeDiskFiles ? 1 : 0, 0); } diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 1d553f1..37d5bfe 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -321,11 +321,6 @@ public abstract class AbsSeekBar extends ProgressBar { final int max = getMax(); progress += scale * max; - if (progress < 0) { - progress = 0; - } else if (progress > max) { - progress = max; - } setProgress((int) progress, true); } diff --git a/core/java/android/widget/TwoLineListItem.java b/core/java/android/widget/TwoLineListItem.java index 77ea645..9a72980 100644 --- a/core/java/android/widget/TwoLineListItem.java +++ b/core/java/android/widget/TwoLineListItem.java @@ -36,8 +36,8 @@ import android.widget.RelativeLayout; * that can be displayed when a TwoLineListItem has focus. Android supplies a * {@link android.R.layout#two_line_list_item standard layout resource for TwoLineListView} * (which does not include a selected item icon), but you can design your own custom XML - * layout for this object as shown here:</p> - * {@sample packages/apps/Phone/res/layout/dialer_list_item.xml} + * layout for this object as shown in the Phone Application. + * (packages/apps/Phone/res/layout/dialer_list_item.xml) * * @attr ref android.R.styleable#TwoLineListItem_mode */ diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 761cedd..340cd40 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -749,7 +749,7 @@ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_readFrameBuffer">read frame buffer</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permdesc_readFrameBuffer">Allows application to use + <string name="permdesc_readFrameBuffer">Allows application to read the content of the frame buffer.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 5652b28..3c81a47 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -623,26 +623,35 @@ status_t AudioFlinger::setStreamVolume(int stream, float value) return BAD_VALUE; } - mHardwareMixerThread->setStreamVolume(stream, value); -#ifdef WITH_A2DP - mA2dpMixerThread->setStreamVolume(stream, value); -#endif - status_t ret = NO_ERROR; + if (stream == AudioSystem::VOICE_CALL || stream == AudioSystem::BLUETOOTH_SCO) { - + float hwValue = value; if (stream == AudioSystem::VOICE_CALL) { - value = (float)AudioSystem::logToLinear(value)/100.0f; + hwValue = (float)AudioSystem::logToLinear(value)/100.0f; + // FIXME: This is a temporary fix to re-base the internally + // generated in-call audio so that it is never muted, which is + // already the case for the hardware routed in-call audio. + // When audio stream handling is reworked, this should be + // addressed more cleanly. Fixes #1324; see discussion at + // http://review.source.android.com/8224 + value = value * 0.99 + 0.01; } else { // (type == AudioSystem::BLUETOOTH_SCO) - value = 1.0f; + hwValue = 1.0f; } AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_SET_VOICE_VOLUME; - ret = mAudioHardware->setVoiceVolume(value); + ret = mAudioHardware->setVoiceVolume(hwValue); mHardwareStatus = AUDIO_HW_IDLE; + } + + mHardwareMixerThread->setStreamVolume(stream, value); +#ifdef WITH_A2DP + mA2dpMixerThread->setStreamVolume(stream, value); +#endif return ret; } @@ -682,7 +691,15 @@ float AudioFlinger::streamVolume(int stream) const if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) { return 0.0f; } - return mHardwareMixerThread->streamVolume(stream); + float value = mHardwareMixerThread->streamVolume(stream); + + if (stream == AudioSystem::VOICE_CALL) { + // FIXME: Re-base internally generated in-call audio, + // reverse of above in setStreamVolume. + value = (value - 0.01) / 0.99; + } + + return value; } bool AudioFlinger::streamMute(int stream) const diff --git a/libs/surfaceflinger/LayerScreenshot.cpp b/libs/surfaceflinger/LayerScreenshot.cpp new file mode 100644 index 0000000..fb7b585 --- /dev/null +++ b/libs/surfaceflinger/LayerScreenshot.cpp @@ -0,0 +1,110 @@ +/* + * 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 "SurfaceFlinger" + +#include <stdlib.h> +#include <stdint.h> +#include <sys/types.h> + +#include <utils/Errors.h> +#include <utils/Log.h> + +#include <core/SkBitmap.h> + +#include <ui/EGLDisplaySurface.h> + +#include "LayerBase.h" +#include "LayerScreenshot.h" +#include "SurfaceFlinger.h" +#include "DisplayHardware/DisplayHardware.h" + +namespace android { +// --------------------------------------------------------------------------- + +const uint32_t LayerScreenshot::typeInfo = LayerBase::typeInfo | 0x20; +const char* const LayerScreenshot::typeID = "LayerScreenshot"; + +// --------------------------------------------------------------------------- + +LayerScreenshot::LayerScreenshot(SurfaceFlinger* flinger, DisplayID display) + : LayerBase(flinger, display), mReply(0) +{ +} + +LayerScreenshot::~LayerScreenshot() +{ +} + +void LayerScreenshot::onDraw(const Region& clip) const +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + copybit_image_t dst; + hw.getDisplaySurface(&dst); + if (dst.base != 0) { + uint8_t const* src = (uint8_t const*)(intptr_t(dst.base) + dst.offset); + const int fbWidth = dst.w; + const int fbHeight = dst.h; + const int fbFormat = dst.format; + + int x = mTransformedBounds.left; + int y = mTransformedBounds.top; + int w = mTransformedBounds.width(); + int h = mTransformedBounds.height(); + Parcel* const reply = mReply; + if (reply) { + const size_t Bpp = bytesPerPixel(fbFormat); + const size_t size = w * h * Bpp; + int32_t cfg = SkBitmap::kNo_Config; + switch (fbFormat) { + case PIXEL_FORMAT_RGBA_4444: cfg = SkBitmap::kARGB_4444_Config; break; + case PIXEL_FORMAT_RGBA_8888: cfg = SkBitmap::kARGB_8888_Config; break; + case PIXEL_FORMAT_RGB_565: cfg = SkBitmap::kRGB_565_Config; break; + case PIXEL_FORMAT_A_8: cfg = SkBitmap::kA8_Config; break; + } + reply->writeInt32(0); + reply->writeInt32(cfg); + reply->writeInt32(w); + reply->writeInt32(h); + reply->writeInt32(w * Bpp); + void* data = reply->writeInplace(size); + if (data) { + uint8_t* d = (uint8_t*)data; + uint8_t const* s = src + (x + y*fbWidth) * Bpp; + if (w == fbWidth) { + memcpy(d, s, w*h*Bpp); + } else { + for (int y=0 ; y<h ; y++) { + memcpy(d, s, w*Bpp); + d += w*Bpp; + s += fbWidth*Bpp; + } + } + } + } + } + mCV.broadcast(); +} + +void LayerScreenshot::takeScreenshot(Mutex& lock, Parcel* reply) +{ + mReply = reply; + mCV.wait(lock); +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp index d915a84..242d026 100644 --- a/libs/surfaceflinger/SurfaceFlinger.cpp +++ b/libs/surfaceflinger/SurfaceFlinger.cpp @@ -23,6 +23,7 @@ #include <fcntl.h> #include <errno.h> #include <math.h> +#include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> diff --git a/libs/utils/Parcel.cpp b/libs/utils/Parcel.cpp index 0f4b647..4225e67 100644 --- a/libs/utils/Parcel.cpp +++ b/libs/utils/Parcel.cpp @@ -950,14 +950,13 @@ native_handle* Parcel::readNativeHandle(native_handle* (*alloc)(void*, int, int) return 0; } } - for (int i=0 ; err==NO_ERROR && i<numFds ; i++) { h->data[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; } - + err = read(h->data + numFds, sizeof(int)*numInts); - + if (err != NO_ERROR) { if (alloc == 0) { free(h); diff --git a/media/jni/Android.mk b/media/jni/Android.mk index 3620494..0a8d1f3 100644 --- a/media/jni/Android.mk +++ b/media/jni/Android.mk @@ -11,15 +11,16 @@ LOCAL_SRC_FILES:= \ android_media_ResampleInputStream.cpp LOCAL_SHARED_LIBRARIES := \ - libopencoreplayer \ - libopencoreauthor \ + libopencore_player \ + libopencore_author \ libandroid_runtime \ libnativehelper \ libcutils \ libutils \ libmedia \ libsgl \ - libui + libui \ + libomx_amrenc_sharedlibrary LOCAL_STATIC_LIBRARIES := diff --git a/media/jni/android_media_AmrInputStream.cpp b/media/jni/android_media_AmrInputStream.cpp index 978c110..51cb6c7 100644 --- a/media/jni/android_media_AmrInputStream.cpp +++ b/media/jni/android_media_AmrInputStream.cpp @@ -74,7 +74,7 @@ static void android_media_AmrInputStream_GsmAmrEncoderInitialize encodeProps.iInNumChannels = 1; encodeProps.iInInterleaveMode = TEncodeProperties::EINTERLEAVE_LR; encodeProps.iMode = CPvGsmAmrEncoder::GSM_AMR_12_2; - encodeProps.iBitStreamFormatIf2 = false; + encodeProps.iBitStreamFormat = false; encodeProps.iAudioObjectType = 0; encodeProps.iOutSamplingRate = encodeProps.iInSamplingRate; encodeProps.iOutNumChannels = encodeProps.iInNumChannels; diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index f710921..922df43 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -22,8 +22,8 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ libvorbisidec \ libsonivox \ - libopencoreplayer \ - libopencoreauthor \ + libopencore_player \ + libopencore_author \ libmedia \ libandroid_runtime diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index d39934b..c6f54a3 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -55,7 +55,7 @@ import java.util.List; * Database helper class for {@link SettingsProvider}. * Mostly just has a bit {@link #onCreate} to initialize the database. */ -class DatabaseHelper extends SQLiteOpenHelper { +public class DatabaseHelper extends SQLiteOpenHelper { /** * Path to file containing default bookmarks, relative to ANDROID_ROOT. */ diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 333a450..8d52070 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -43,7 +43,7 @@ public class SettingsProvider extends ContentProvider { private static final String TABLE_FAVORITES = "favorites"; private static final String TABLE_OLD_FAVORITES = "old_favorites"; - private DatabaseHelper mOpenHelper; + protected DatabaseHelper mOpenHelper; /** * Decode a content URL into the table, projection, and arguments diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java index 3a9a59f..618b317 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -234,6 +234,16 @@ class BatteryService extends Binder { logOutlier(SystemClock.elapsedRealtime() - mDischargeStartTime); } + // Separate broadcast is sent for power connected / not connected + // since the standard intent will not wake any applications and some + // applications may want to have smart behavior based on this. + if (mPlugType != 0 && mLastPlugType == 0) { + mContext.sendBroadcast(new Intent(Intent.ACTION_POWER_CONNECTED)); + } + else if (mPlugType == 0 && mLastPlugType != 0) { + mContext.sendBroadcast(new Intent(Intent.ACTION_POWER_DISCONNECTED)); + } + mLastBatteryStatus = mBatteryStatus; mLastBatteryHealth = mBatteryHealth; mLastBatteryPresent = mBatteryPresent; diff --git a/telephony/java/com/android/internal/telephony/gsm/RIL.java b/telephony/java/com/android/internal/telephony/gsm/RIL.java index 7622560..8b10ed2 100644 --- a/telephony/java/com/android/internal/telephony/gsm/RIL.java +++ b/telephony/java/com/android/internal/telephony/gsm/RIL.java @@ -1577,12 +1577,22 @@ public final class RIL extends BaseCommands implements CommandsInterface * {@inheritDoc} */ public void getNeighboringCids(Message response) { - RILRequest rr = RILRequest.obtain( + /* TODO: Remove this hack when backward compatibility issue is fixed. + * RIL_REQUEST_GET_NEIGHBORING_CELL_IDS currently returns REQUEST_NOT_SUPPORTED + */ + + AsyncResult.forMessage(response).exception = + new CommandException(CommandException.Error.REQUEST_NOT_SUPPORTED); + response.sendToTarget(); + response = null; + + /* RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); + */ } /** diff --git a/tools/aidl/AST.cpp b/tools/aidl/AST.cpp index 91802a9..1856cb9 100755 --- a/tools/aidl/AST.cpp +++ b/tools/aidl/AST.cpp @@ -841,23 +841,6 @@ Document::Write(FILE* to) fprintf(to, "package %s;\n", this->package.c_str()); } - // gather the types for the import statements - set<Type*> types; - N = this->classes.size(); - for (i=0; i<N; i++) { - Class* c = this->classes[i]; - c->GatherTypes(&types); - } - - set<Type*>::iterator it; - for (it=types.begin(); it!=types.end(); it++) { - Type* t = *it; - string pkg = t->Package(); - if (pkg.length() != 0 && pkg != this->package) { - fprintf(to, "import %s;\n", t->ImportType().c_str()); - } - } - N = this->classes.size(); for (i=0; i<N; i++) { Class* c = this->classes[i]; diff --git a/tools/aidl/generate_java.cpp b/tools/aidl/generate_java.cpp index e3c0af0..da20d1f 100644 --- a/tools/aidl/generate_java.cpp +++ b/tools/aidl/generate_java.cpp @@ -1,6 +1,7 @@ #include "generate_java.h" #include "AST.h" #include "Type.h" +#include <string.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -133,7 +134,7 @@ StubClass::make_as_interface(Type *interfaceType) Method* m = new Method; m->comment = "/**\n * Cast an IBinder object into an "; - m->comment += interfaceType->Name(); + m->comment += interfaceType->QualifiedName(); m->comment += " interface,\n"; m->comment += " * generating a proxy if needed.\n */"; m->modifiers = PUBLIC | STATIC; @@ -323,7 +324,7 @@ generate_method(const method_type* method, Class* interface, transactCodeName += method->name.data; char transactCodeValue[50]; - sprintf(transactCodeValue, "(IBinder.FIRST_CALL_TRANSACTION + %d)", index); + sprintf(transactCodeValue, "(android.os.IBinder.FIRST_CALL_TRANSACTION + %d)", index); Field* transactCode = new Field(STATIC | FINAL, new Variable(INT_TYPE, transactCodeName)); @@ -517,7 +518,7 @@ generate_method(const method_type* method, Class* interface, new LiteralExpression("Stub." + transactCodeName), _data, _reply ? _reply : NULL_VALUE, new LiteralExpression( - oneway ? "IBinder.FLAG_ONEWAY" : "0")); + oneway ? "android.os.IBinder.FLAG_ONEWAY" : "0")); tryStatement->statements->Add(call); // throw back exceptions. diff --git a/tools/aidl/options.h b/tools/aidl/options.h index e9bf0f7..d88d988 100644 --- a/tools/aidl/options.h +++ b/tools/aidl/options.h @@ -1,6 +1,7 @@ #ifndef DEVICE_TOOLS_AIDL_H #define DEVICE_TOOLS_AIDL_H +#include <string.h> #include <string> #include <vector> diff --git a/tools/localize/Perforce.cpp b/tools/localize/Perforce.cpp index 3425668..25c336c 100644 --- a/tools/localize/Perforce.cpp +++ b/tools/localize/Perforce.cpp @@ -5,6 +5,8 @@ #include <sstream> #include <sys/types.h> #include <unistd.h> +#include <stdlib.h> +#include <string.h> #include <sys/wait.h> using namespace std; diff --git a/tools/localize/XMLHandler.h b/tools/localize/XMLHandler.h index 1130710..324385f 100644 --- a/tools/localize/XMLHandler.h +++ b/tools/localize/XMLHandler.h @@ -3,6 +3,7 @@ #include "SourcePos.h" +#include <algorithm> #include <string> #include <vector> #include <map> diff --git a/tools/localize/file_utils.cpp b/tools/localize/file_utils.cpp index bb82a9c..dc8e86b 100644 --- a/tools/localize/file_utils.cpp +++ b/tools/localize/file_utils.cpp @@ -6,6 +6,8 @@ #include <sys/fcntl.h> #include <sys/stat.h> #include <errno.h> +#include <string.h> +#include <stdlib.h> #include <host/Directories.h> #include "log.h" diff --git a/tools/localize/localize.cpp b/tools/localize/localize.cpp index c0d84cc..68c03b6 100644 --- a/tools/localize/localize.cpp +++ b/tools/localize/localize.cpp @@ -15,6 +15,7 @@ #include <sstream> #include <stdio.h> #include <string.h> +#include <stdlib.h> using namespace std; |