diff options
67 files changed, 674 insertions, 281 deletions
diff --git a/api/current.xml b/api/current.xml index 02e76c707390..d7382ebe3e20 100644 --- a/api/current.xml +++ b/api/current.xml @@ -26295,6 +26295,19 @@ <parameter name="request" type="android.app.DownloadManager.Request"> </parameter> </method> +<method name="getUriForDownloadedFile" + return="android.net.Uri" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="id" type="long"> +</parameter> +</method> <method name="openDownloadedFile" return="android.os.ParcelFileDescriptor" abstract="false" @@ -26809,6 +26822,17 @@ <parameter name="value" type="java.lang.String"> </parameter> </method> +<method name="allowScanningByMediaScanner" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="setAllowedNetworkTypes" return="android.app.DownloadManager.Request" abstract="false" @@ -219166,8 +219190,8 @@ visibility="public" > </method> -<method name="getModeResId" - return="int" +<method name="getMode" + return="java.lang.String" abstract="false" native="false" synchronized="false" @@ -226127,6 +226151,27 @@ </parameter> </method> </interface> +<interface name="AbsListView.SelectionBoundsAdjuster" + abstract="true" + static="true" + final="false" + deprecated="not deprecated" + visibility="public" +> +<method name="adjustListItemSelectionBounds" + return="void" + abstract="true" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="bounds" type="android.graphics.Rect"> +</parameter> +</method> +</interface> <class name="AbsSeekBar" extends="android.widget.ProgressBar" abstract="true" @@ -245824,7 +245869,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="t" type="T"> +<parameter name="arg0" type="T"> </parameter> </method> </interface> diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 47efddb66628..174b6da6bdc7 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -85,6 +85,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.lang.ref.WeakReference; +import java.net.InetAddress; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -585,6 +586,11 @@ public final class ActivityThread { TimeZone.setDefault(null); } + public void clearDnsCache() { + // a non-standard API to get this to libcore + InetAddress.clearDnsCache(); + } + public void processInBackground() { mH.removeMessages(H.GC_WHEN_IDLE); mH.sendMessage(mH.obtainMessage(H.GC_WHEN_IDLE)); diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 95689fc3df42..b19fb5979e1c 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -291,6 +291,12 @@ public abstract class ApplicationThreadNative extends Binder return true; } + case CLEAR_DNS_CACHE_TRANSACTION: { + data.enforceInterface(IApplicationThread.descriptor); + clearDnsCache(); + return true; + } + case PROCESS_IN_BACKGROUND_TRANSACTION: { data.enforceInterface(IApplicationThread.descriptor); processInBackground(); @@ -744,6 +750,14 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } + public void clearDnsCache() throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null, + IBinder.FLAG_ONEWAY); + data.recycle(); + } + public void processInBackground() throws RemoteException { Parcel data = Parcel.obtain(); data.writeInterfaceToken(IApplicationThread.descriptor); @@ -884,4 +898,3 @@ class ApplicationThreadProxy implements IApplicationThread { data.recycle(); } } - diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index 592a63bc5f2c..08ccab6c6e03 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -27,6 +27,7 @@ import android.net.Uri; import android.os.Environment; import android.os.ParcelFileDescriptor; import android.provider.Downloads; +import android.util.Log; import android.util.Pair; import java.io.File; @@ -284,6 +285,7 @@ public class DownloadManager { private static final String[] COLUMNS = new String[] { COLUMN_ID, COLUMN_MEDIAPROVIDER_URI, + Downloads.Impl.COLUMN_DESTINATION, COLUMN_TITLE, COLUMN_DESCRIPTION, COLUMN_URI, @@ -294,13 +296,14 @@ public class DownloadManager { COLUMN_REASON, COLUMN_BYTES_DOWNLOADED_SO_FAR, COLUMN_LAST_MODIFIED_TIMESTAMP, - COLUMN_LOCAL_FILENAME + COLUMN_LOCAL_FILENAME, }; // columns to request from DownloadProvider private static final String[] UNDERLYING_COLUMNS = new String[] { Downloads.Impl._ID, Downloads.Impl.COLUMN_MEDIAPROVIDER_URI, + Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.COLUMN_TITLE, Downloads.Impl.COLUMN_DESCRIPTION, Downloads.Impl.COLUMN_URI, @@ -309,14 +312,14 @@ public class DownloadManager { Downloads.Impl.COLUMN_STATUS, Downloads.Impl.COLUMN_CURRENT_BYTES, Downloads.Impl.COLUMN_LAST_MODIFICATION, - Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.COLUMN_FILE_NAME_HINT, Downloads.Impl._DATA, }; private static final Set<String> LONG_COLUMNS = new HashSet<String>( Arrays.asList(COLUMN_ID, COLUMN_TOTAL_SIZE_BYTES, COLUMN_STATUS, COLUMN_REASON, - COLUMN_BYTES_DOWNLOADED_SO_FAR, COLUMN_LAST_MODIFIED_TIMESTAMP)); + COLUMN_BYTES_DOWNLOADED_SO_FAR, COLUMN_LAST_MODIFIED_TIMESTAMP, + Downloads.Impl.COLUMN_DESTINATION)); /** * This class contains all the information necessary to request a new download. The URI is the @@ -348,6 +351,7 @@ public class DownloadManager { private boolean mRoamingAllowed = true; private int mAllowedNetworkTypes = ~0; // default to all network types allowed private boolean mIsVisibleInDownloadsUi = true; + private boolean mScannable = false; /** * This download is visible but only shows in the notifications @@ -389,7 +393,10 @@ public class DownloadManager { * Set the local destination for the downloaded file. Must be a file URI to a path on * external storage, and the calling application must have the WRITE_EXTERNAL_STORAGE * permission. - * + * <p> + * The downloaded file is not scanned by MediaScanner. + * But it can be made scannable by calling {@link #allowScanningByMediaScanner()}. + * <p> * By default, downloads are saved to a generated filename in the shared download cache and * may be deleted by the system at any time to reclaim space. * @@ -403,6 +410,9 @@ public class DownloadManager { /** * Set the local destination for the downloaded file to a path within the application's * external files directory (as returned by {@link Context#getExternalFilesDir(String)}. + * <p> + * The downloaded file is not scanned by MediaScanner. + * But it can be made scannable by calling {@link #allowScanningByMediaScanner()}. * * @param context the {@link Context} to use in determining the external files directory * @param dirType the directory type to pass to {@link Context#getExternalFilesDir(String)} @@ -419,6 +429,9 @@ public class DownloadManager { * Set the local destination for the downloaded file to a path within the public external * storage directory (as returned by * {@link Environment#getExternalStoragePublicDirectory(String)}. + *<p> + * The downloaded file is not scanned by MediaScanner. + * But it can be made scannable by calling {@link #allowScanningByMediaScanner()}. * * @param dirType the directory type to pass to * {@link Environment#getExternalStoragePublicDirectory(String)} @@ -438,6 +451,14 @@ public class DownloadManager { } /** + * If the file to be downloaded is to be scanned by MediaScanner, this method + * should be called before {@link DownloadManager#enqueue(Request)} is called. + */ + public void allowScanningByMediaScanner() { + mScannable = true; + } + + /** * Add an HTTP header to be included with the download request. The header will be added to * the end of the list. * @param header HTTP header name @@ -583,6 +604,8 @@ public class DownloadManager { values.put(Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE); } + // is the file supposed to be media-scannable? + values.put(Downloads.Impl.COLUMN_MEDIA_SCANNED, (mScannable) ? 0 : 2); if (!mRequestHeaders.isEmpty()) { encodeHttpHeaders(values); @@ -868,6 +891,58 @@ public class DownloadManager { } /** + * Returns {@link Uri} for the given downloaded file id, if the file is + * downloaded successfully. otherwise, null is returned. + *<p> + * If the specified downloaded file is in external storage (for example, /sdcard dir), + * then it is assumed to be safe for anyone to read and the returned {@link Uri} can be used + * by any app to access the downloaded file. + * + * @param id the id of the downloaded file. + * @return the {@link Uri} for the given downloaded file id, if donload was successful. null + * otherwise. + */ + public Uri getUriForDownloadedFile(long id) { + // to check if the file is in cache, get its destination from the database + Query query = new Query().setFilterById(id); + Cursor cursor = null; + try { + cursor = query(query); + if (cursor == null) { + return null; + } + while (cursor.moveToFirst()) { + int status = cursor.getInt(cursor.getColumnIndexOrThrow( + DownloadManager.COLUMN_STATUS)); + if (DownloadManager.STATUS_SUCCESSFUL == status) { + int indx = cursor.getColumnIndexOrThrow( + Downloads.Impl.COLUMN_DESTINATION); + int destination = cursor.getInt(indx); + // TODO: if we ever add API to DownloadManager to let the caller specify + // non-external storage for a donloaded file, then the following code + // should also check for that destination. + if (destination == Downloads.Impl.DESTINATION_CACHE_PARTITION || + destination == Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING || + destination == Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE) { + // return private uri + return ContentUris.withAppendedId(Downloads.Impl.CONTENT_URI, id); + } else { + // return public uri + return ContentUris.withAppendedId( + Downloads.Impl.PUBLICLY_ACCESSIBLE_DOWNLOADS_URI, id); + } + } + } + } finally { + if (cursor != null) { + cursor.close(); + } + } + // downloaded file not found or its status is not 'successfully completed' + return null; + } + + /** * Restart the given downloads, which must have already completed (successfully or not). This * method will only work when called from within the download manager's process. * @param ids the IDs of the downloads @@ -1088,6 +1163,9 @@ public class DownloadManager { if (column.equals(COLUMN_BYTES_DOWNLOADED_SO_FAR)) { return getUnderlyingLong(Downloads.Impl.COLUMN_CURRENT_BYTES); } + if (column.equals(Downloads.Impl.COLUMN_DESTINATION)) { + return getUnderlyingLong(Downloads.Impl.COLUMN_DESTINATION); + } assert column.equals(COLUMN_LAST_MODIFIED_TIMESTAMP); return getUnderlyingLong(Downloads.Impl.COLUMN_LAST_MODIFICATION); } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index 1f8a7c58325f..830c7024b5d2 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -87,6 +87,7 @@ public interface IApplicationThread extends IInterface { void requestThumbnail(IBinder token) throws RemoteException; void scheduleConfigurationChanged(Configuration config) throws RemoteException; void updateTimeZone() throws RemoteException; + void clearDnsCache() throws RemoteException; void processInBackground() throws RemoteException; void dumpService(FileDescriptor fd, IBinder servicetoken, String[] args) throws RemoteException; @@ -146,4 +147,5 @@ public interface IApplicationThread extends IInterface { int SCHEDULE_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; int DUMP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; + int CLEAR_DNS_CACHE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; } diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index ac6b1479fd00..4b6333e3b7e1 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1223,6 +1223,13 @@ public class Intent implements Parcelable, Cloneable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"; /** + * Clear DNS Cache Action: This is broadcast when networks have changed and old + * DNS entries should be tossed. + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_CLEAR_DNS_CACHE = "android.intent.action.CLEAR_DNS_CACHE"; + /** * Alarm Changed Action: This is broadcast when the AlarmClock * application's alarm is set or unset. It is used by the * AlarmClock application and the StatusBar service. diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index a1f2b633347b..8409baa73952 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -2086,10 +2086,10 @@ public class InputMethodService extends AbstractInputMethodService { protected void onCurrentInputMethodSubtypeChanged(InputMethodSubtype newSubtype) { if (DEBUG) { int nameResId = newSubtype.getNameResId(); - int modeResId = newSubtype.getModeResId(); + String mode = newSubtype.getMode(); String output = "changeInputMethodSubtype:" + (nameResId == 0 ? "<none>" : getString(nameResId)) + "," - + (modeResId == 0 ? "<none>" : getString(modeResId)) + "," + + mode + "," + newSubtype.getLocale() + "," + newSubtype.getExtraValue(); Log.v(TAG, "--- " + output); } diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java index 6b1fe99715f0..8a653ddd55e6 100644 --- a/core/java/android/net/NetworkUtils.java +++ b/core/java/android/net/NetworkUtils.java @@ -174,28 +174,6 @@ public class NetworkUtils { return Integer.reverseBytes(value); } - public static boolean isIpAddress(String address) { - //TODO: Add NetworkUtils support for IPv6 configuration and - //remove IPv4 validation and use a generic InetAddress validation - try { - String[] parts = address.split("\\."); - if (parts.length != 4) { - return false; - } - int a = Integer.parseInt(parts[0]); - if (a < 0 || a > 255) return false; - a = Integer.parseInt(parts[1]); - if (a < 0 || a > 255) return false; - a = Integer.parseInt(parts[2]); - if (a < 0 || a > 255) return false; - a = Integer.parseInt(parts[3]); - if (a < 0 || a > 255) return false; - } catch (NumberFormatException ex) { - return false; - } - return true; - } - /** * Add a default route through the specified gateway. * @param interfaceName interface on which the route should be added diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java index 23a3ea85d168..21c485e70e18 100644 --- a/core/java/android/net/Proxy.java +++ b/core/java/android/net/Proxy.java @@ -299,15 +299,18 @@ public final class Proxy { final URI uri = URI.create(url); final String host = uri.getHost(); if (host != null) { - // TODO: InetAddress.isLoopbackAddress should be used to check - // for localhost. However no public factory methods exist which - // can be used without triggering DNS lookup if host is not localhost. - if (host.equalsIgnoreCase("localhost") || - host.equals("127.0.0.1") || - host.equals("[::1]")) { + if (host.equalsIgnoreCase("localhost")) { return true; } + // Check we have a numeric address so we don't cause a DNS lookup in getByName. + if (InetAddress.isNumeric(host)) { + if (InetAddress.getByName(host).isLoopbackAddress()) { + return true; + } + } } + } catch (UnknownHostException ignored) { + // Can't happen for a numeric address (InetAddress.getByName). } catch (IllegalArgumentException iex) { // Ignore (URI.create) } diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index 97c957d60ba1..d3ab844acf0c 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -203,7 +203,9 @@ public abstract class PreferenceActivity extends ListActivity implements ArrayList<Header> oldHeaders = new ArrayList<Header>(mHeaders); mHeaders.clear(); onBuildHeaders(mHeaders); - mAdapter.notifyDataSetChanged(); + if (mAdapter != null) { + mAdapter.notifyDataSetChanged(); + } Header header = onGetNewHeader(); if (header != null && header.fragment != null) { Header mappedHeader = findBestMatchingHeader(header, oldHeaders); diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index 7054888ee1a5..65adef9bbf14 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -87,6 +87,16 @@ public final class Downloads { public static final Uri ALL_DOWNLOADS_CONTENT_URI = Uri.parse("content://downloads/all_downloads"); + /** URI segment to access a publicly accessible downloaded file */ + public static final String PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT = "public_downloads"; + + /** + * The content URI for accessing publicly accessible downloads (i.e., it requires no + * permissions to access this downloaded file) + */ + public static final Uri PUBLICLY_ACCESSIBLE_DOWNLOADS_URI = + Uri.parse("content://downloads/" + PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT); + /** * Broadcast Action: this is sent by the download manager to the app * that had initiated a download when that download completes. The @@ -358,6 +368,13 @@ public final class Downloads { */ public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri"; + /** + * The column that is used to remember whether the media scanner was invoked. + * It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable). + * <P>Type: TEXT</P> + */ + public static final String COLUMN_MEDIA_SCANNED = "scanned"; + /* * Lists the destinations that an application can specify for a download. */ diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index ad343a379d6e..17384c1eaf71 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -4284,6 +4284,16 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + final View[] children = mChildren; + final int count = mChildrenCount; + for (int i = 0; i < count; i++) { + children[i].jumpDrawablesToCurrentState(); + } + } + + @Override protected int[] onCreateDrawableState(int extraSpace) { if ((mGroupFlags & FLAG_ADD_STATES_FROM_CHILDREN) == 0) { return super.onCreateDrawableState(extraSpace); diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java index 54102f6bd34b..defd104510bb 100644 --- a/core/java/android/view/inputmethod/InputMethodInfo.java +++ b/core/java/android/view/inputmethod/InputMethodInfo.java @@ -142,8 +142,8 @@ public final class InputMethodInfo implements Parcelable { .InputMethod_Subtype_icon, 0), a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeLocale), - a.getResourceId(com.android.internal.R.styleable - .InputMethod_Subtype_imeSubtypeMode, 0), + a.getString(com.android.internal.R.styleable + .InputMethod_Subtype_imeSubtypeMode), a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeExtraValue)); mSubtypes.add(subtype); diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java index a1ed0445f455..092594034452 100644 --- a/core/java/android/view/inputmethod/InputMethodSubtype.java +++ b/core/java/android/view/inputmethod/InputMethodSubtype.java @@ -34,7 +34,7 @@ public final class InputMethodSubtype implements Parcelable { private final int mSubtypeNameResId; private final int mSubtypeIconResId; private final String mSubtypeLocale; - private final int mSubtypeModeResId; + private final String mSubtypeMode; private final String mSubtypeExtraValue; private final int mSubtypeHashCode; @@ -46,24 +46,24 @@ public final class InputMethodSubtype implements Parcelable { * @param modeId The mode supported by the subtype * @param extraValue The extra value of the subtype */ - InputMethodSubtype(int nameId, int iconId, String locale, int modeId, String extraValue) { + InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue) { mSubtypeNameResId = nameId; mSubtypeIconResId = iconId; mSubtypeLocale = locale; - mSubtypeModeResId = modeId; + mSubtypeMode = mode; mSubtypeExtraValue = extraValue; mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale, - mSubtypeModeResId, mSubtypeExtraValue); + mSubtypeMode, mSubtypeExtraValue); } InputMethodSubtype(Parcel source) { mSubtypeNameResId = source.readInt(); mSubtypeIconResId = source.readInt(); mSubtypeLocale = source.readString(); - mSubtypeModeResId = source.readInt(); + mSubtypeMode = source.readString(); mSubtypeExtraValue = source.readString(); mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale, - mSubtypeModeResId, mSubtypeExtraValue); + mSubtypeMode, mSubtypeExtraValue); } /** @@ -90,8 +90,8 @@ public final class InputMethodSubtype implements Parcelable { /** * @return the mode of the subtype */ - public int getModeResId() { - return mSubtypeModeResId; + public String getMode() { + return mSubtypeMode; } /** @@ -111,7 +111,7 @@ public final class InputMethodSubtype implements Parcelable { if (o instanceof InputMethodSubtype) { InputMethodSubtype subtype = (InputMethodSubtype) o; return (subtype.getNameResId() == getNameResId()) - && (subtype.getModeResId() == getModeResId()) + && (subtype.getMode() == getMode()) && (subtype.getIconResId() == getIconResId()) && (subtype.getLocale().equals(getLocale())) && (subtype.getExtraValue().equals(getExtraValue())); @@ -127,7 +127,7 @@ public final class InputMethodSubtype implements Parcelable { dest.writeInt(mSubtypeNameResId); dest.writeInt(mSubtypeIconResId); dest.writeString(mSubtypeLocale); - dest.writeInt(mSubtypeModeResId); + dest.writeString(mSubtypeMode); dest.writeString(mSubtypeExtraValue); } @@ -143,7 +143,7 @@ public final class InputMethodSubtype implements Parcelable { }; private static int hashCodeInternal(int nameResId, int iconResId, String locale, - int modeResId, String extraValue) { - return Arrays.hashCode(new Object[] {nameResId, iconResId, locale, modeResId, extraValue}); + String mode, String extraValue) { + return Arrays.hashCode(new Object[] {nameResId, iconResId, locale, mode, extraValue}); } }
\ No newline at end of file diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java index 8c9f266b6d55..0078e7a90a8f 100644 --- a/core/java/android/webkit/CallbackProxy.java +++ b/core/java/android/webkit/CallbackProxy.java @@ -496,10 +496,7 @@ class CallbackProxy extends Handler { String url = msg.getData().getString("url"); if (!mWebChromeClient.onJsAlert(mWebView, url, message, res)) { - // only display the alert dialog if the mContext is - // Activity and its window has the focus. - if (!(mContext instanceof Activity) - || !((Activity) mContext).hasWindowFocus()) { + if (!canShowAlertDialog()) { res.cancel(); res.setReady(); break; @@ -535,10 +532,7 @@ class CallbackProxy extends Handler { String url = msg.getData().getString("url"); if (!mWebChromeClient.onJsConfirm(mWebView, url, message, res)) { - // only display the alert dialog if the mContext is - // Activity and its window has the focus. - if (!(mContext instanceof Activity) - || !((Activity) mContext).hasWindowFocus()) { + if (!canShowAlertDialog()) { res.cancel(); res.setReady(); break; @@ -583,10 +577,7 @@ class CallbackProxy extends Handler { String url = msg.getData().getString("url"); if (!mWebChromeClient.onJsPrompt(mWebView, url, message, defaultVal, res)) { - // only display the alert dialog if the mContext is - // Activity and its window has the focus. - if (!(mContext instanceof Activity) - || !((Activity) mContext).hasWindowFocus()) { + if (!canShowAlertDialog()) { res.cancel(); res.setReady(); break; @@ -642,10 +633,7 @@ class CallbackProxy extends Handler { String url = msg.getData().getString("url"); if (!mWebChromeClient.onJsBeforeUnload(mWebView, url, message, res)) { - // only display the alert dialog if the mContext is - // Activity and its window has the focus. - if (!(mContext instanceof Activity) - || !((Activity) mContext).hasWindowFocus()) { + if (!canShowAlertDialog()) { res.cancel(); res.setReady(); break; @@ -1555,4 +1543,14 @@ class CallbackProxy extends Handler { } sendMessage(obtainMessage(SET_INSTALLABLE_WEBAPP)); } + + boolean canShowAlertDialog() { + // We can only display the alert dialog if mContext is + // an Activity context. + // FIXME: Should we display dialogs if mContext does + // not have the window focus (e.g. if the user is viewing + // another Activity when the alert should be displayed? + // See bug 3166409 + return mContext instanceof Activity; + } } diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index f5affe588180..c8f2acefad35 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -741,7 +741,7 @@ public class WebView extends AbsoluteLayout // for event log private long mLastTouchUpTime = 0; - private int mAutoFillQueryId = WebTextView.FORM_NOT_AUTOFILLABLE; + private WebViewCore.AutoFillData mAutoFillData; /** * URI scheme for telephone number @@ -3911,7 +3911,7 @@ public class WebView extends AbsoluteLayout // At this point, we know we have found an input field, so go ahead // and create the WebTextView if necessary. if (mWebTextView == null) { - mWebTextView = new WebTextView(mContext, WebView.this, mAutoFillQueryId); + mWebTextView = new WebTextView(mContext, WebView.this, mAutoFillData.getQueryId()); // Initialize our generation number. mTextGeneration = 0; } @@ -4042,7 +4042,9 @@ public class WebView extends AbsoluteLayout // on the AutoFill item being at the top of the drop down list. If you change // the order, make sure to do it there too! pastEntries.add(getResources().getText( - com.android.internal.R.string.autofill_this_form).toString()); + com.android.internal.R.string.autofill_this_form).toString() + + " " + + mAutoFillData.getPreviewString()); } pastEntries.addAll(mDatabase.getFormData(mUrl, mName)); @@ -4860,7 +4862,7 @@ public class WebView extends AbsoluteLayout } // If the page disallows zoom, pass multi-pointer events to webkit. - if (ev.getPointerCount() > 1 + if (!skipScaleGesture && ev.getPointerCount() > 1 && (mZoomManager.isZoomScaleFixed() || mDeferMultitouch)) { if (DebugFlags.WEB_VIEW) { Log.v(LOGTAG, "passing " + ev.getPointerCount() + " points to webkit"); @@ -6843,9 +6845,9 @@ public class WebView extends AbsoluteLayout break; case SET_AUTOFILLABLE: - mAutoFillQueryId = msg.arg1; + mAutoFillData = (WebViewCore.AutoFillData) msg.obj; if (mWebTextView != null) { - mWebTextView.setAutoFillable(mAutoFillQueryId); + mWebTextView.setAutoFillable(mAutoFillData.getQueryId()); rebuildWebTextView(); } break; diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 9edb267c95f2..1b7eb2a1d5eb 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -732,6 +732,29 @@ final class WebViewCore { int mSlop; } + static class AutoFillData { + public AutoFillData() { + mQueryId = WebTextView.FORM_NOT_AUTOFILLABLE; + mPreview = ""; + } + + public AutoFillData(int queryId, String preview) { + mQueryId = queryId; + mPreview = preview; + } + + public int getQueryId() { + return mQueryId; + } + + public String getPreviewString() { + return mPreview; + } + + private int mQueryId; + private String mPreview; + } + // mAction of TouchEventData can be MotionEvent.getAction() which uses the // last two bytes or one of the following values static final int ACTION_LONGPRESS = 0x100; @@ -2431,10 +2454,11 @@ final class WebViewCore { } } - private void setWebTextViewAutoFillable(int queryId) { + private void setWebTextViewAutoFillable(int queryId, String preview) { if (mWebView != null) { - Message.obtain(mWebView.mPrivateHandler, WebView.SET_AUTOFILLABLE, queryId, - /* unused */0).sendToTarget(); + Message.obtain(mWebView.mPrivateHandler, WebView.SET_AUTOFILLABLE, + new AutoFillData(queryId, preview)) + .sendToTarget(); } } diff --git a/core/java/android/webkit/ZoomManager.java b/core/java/android/webkit/ZoomManager.java index 2235f0f3fde1..3f6b10ae2410 100644 --- a/core/java/android/webkit/ZoomManager.java +++ b/core/java/android/webkit/ZoomManager.java @@ -811,7 +811,7 @@ class ZoomManager { Math.max((int) (viewWidth * mInvDefaultScale), Math.max(drawData.mMinPrefWidth, drawData.mViewSize.x)))); } else { - final int contentWidth = Math.max(drawData.mContentSize.x, drawData.mViewSize.x); + final int contentWidth = Math.max(drawData.mContentSize.x, drawData.mMinPrefWidth); setZoomOverviewWidth(Math.min(WebView.sMaxViewportWidth, contentWidth)); } } diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 76296735adc9..d4a26cc722d2 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -586,6 +586,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te int totalItemCount); } + /** + * The top-level view of a list item can implement this interface to allow + * itself to modify the bounds of the selection shown for that item. + */ + public interface SelectionBoundsAdjuster { + /** + * Called to allow the list item to adjust the bounds shown for + * its selection. + * + * @param bounds On call, this contains the bounds the list has + * selected for the item (that is the bounds of the entire view). The + * values can be modified as desired. + */ + public void adjustListItemSelectionBounds(Rect bounds); + } + public AbsListView(Context context) { super(context); initAbsListView(); @@ -1194,6 +1210,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te int position; int height; String filter; + int checkedItemCount; SparseBooleanArray checkState; LongSparseArray<Boolean> checkIdState; @@ -1215,6 +1232,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te position = in.readInt(); height = in.readInt(); filter = in.readString(); + checkedItemCount = in.readInt(); checkState = in.readSparseBooleanArray(); long[] idState = in.createLongArray(); @@ -1233,6 +1251,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te out.writeInt(position); out.writeInt(height); out.writeString(filter); + out.writeInt(checkedItemCount); out.writeSparseBooleanArray(checkState); out.writeLongArray(checkIdState != null ? checkIdState.getKeys() : new long[0]); } @@ -1313,6 +1332,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te ss.checkState = mCheckStates; ss.checkIdState = mCheckedIdStates; + ss.checkedItemCount = mCheckedItemCount; return ss; } @@ -1354,6 +1374,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te mCheckedIdStates = ss.checkIdState; } + mCheckedItemCount = ss.checkedItemCount; + requestLayout(); } @@ -1756,6 +1778,9 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final Rect selectorRect = mSelectorRect; selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom()); + if (sel instanceof SelectionBoundsAdjuster) { + ((SelectionBoundsAdjuster)sel).adjustListItemSelectionBounds(selectorRect); + } positionSelector(selectorRect.left, selectorRect.top, selectorRect.right, selectorRect.bottom); @@ -2003,6 +2028,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mSelector != null) mSelector.jumpToCurrentState(); + } + + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index d6dd872304fa..dd71b3f016f9 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -154,6 +154,12 @@ public abstract class AbsSeekBar extends ProgressBar { } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mThumb != null) mThumb.jumpToCurrentState(); + } + + @Override protected void drawableStateChanged() { super.drawableStateChanged(); diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index bf02ad3bfd7b..0df45cca6a65 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -279,6 +279,12 @@ public abstract class CompoundButton extends Button implements Checkable { return super.verifyDrawable(who) || who == mButtonDrawable; } + @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mButtonDrawable != null) mButtonDrawable.jumpToCurrentState(); + } + static class SavedState extends BaseSavedState { boolean checked; diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 559a5fe61517..bcab7a9e0d31 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -156,6 +156,12 @@ public class FrameLayout extends ViewGroup { return super.verifyDrawable(who) || (who == mForeground); } + @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mForeground != null) mForeground.jumpToCurrentState(); + } + /** * {@inheritDoc} */ diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index 936a97d5d60f..b963536076e3 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -107,26 +107,6 @@ public class GridView extends AbsListView { a.recycle(); } - /** - * Set how the user may select items from the grid. - * - * <p>GridView only supports {@link AbsListView#CHOICE_MODE_NONE} and - * {@link AbsListView#CHOICE_MODE_MULTIPLE_MODAL}. Attempting to set an unsupported choice - * mode will throw an UnsupportedOperationException. - */ - @Override - public void setChoiceMode(int choiceMode) { - switch (choiceMode) { - case CHOICE_MODE_NONE: - case CHOICE_MODE_MULTIPLE_MODAL: - super.setChoiceMode(choiceMode); - break; - - default: - throw new UnsupportedOperationException("Unsupported choice mode " + choiceMode); - } - } - @Override public ListAdapter getAdapter() { return mAdapter; diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 5c4a15643827..bad74d4e2ac2 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -160,6 +160,12 @@ public class ImageView extends View { } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mDrawable != null) mDrawable.jumpToCurrentState(); + } + + @Override public void invalidateDrawable(Drawable dr) { if (dr == mDrawable) { /* we invalidate the whole view in this case because it's very diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index 3a4487c92351..b7048fc8ea45 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -455,6 +455,13 @@ public class ProgressBar extends View { } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mProgressDrawable != null) mProgressDrawable.jumpToCurrentState(); + if (mIndeterminateDrawable != null) mIndeterminateDrawable.jumpToCurrentState(); + } + + @Override public void postInvalidate() { if (!mNoInvalidate) { super.postInvalidate(); diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 7c129b02d8d7..eb5a09230fde 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -3935,6 +3935,25 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mDrawables != null) { + if (mDrawables.mDrawableLeft != null) { + mDrawables.mDrawableLeft.jumpToCurrentState(); + } + if (mDrawables.mDrawableTop != null) { + mDrawables.mDrawableTop.jumpToCurrentState(); + } + if (mDrawables.mDrawableRight != null) { + mDrawables.mDrawableRight.jumpToCurrentState(); + } + if (mDrawables.mDrawableBottom != null) { + mDrawables.mDrawableBottom.jumpToCurrentState(); + } + } + } + + @Override public void invalidateDrawable(Drawable drawable) { if (verifyDrawable(drawable)) { final Rect dirty = drawable.getBounds(); diff --git a/core/jni/android_database_SQLiteDatabase.cpp b/core/jni/android_database_SQLiteDatabase.cpp index 1b68ba9ea206..7aeed986623d 100644 --- a/core/jni/android_database_SQLiteDatabase.cpp +++ b/core/jni/android_database_SQLiteDatabase.cpp @@ -78,7 +78,8 @@ static char *createStr(const char *path, short extra) { static void sqlLogger(void *databaseName, int iErrCode, const char *zMsg) { // skip printing this message if it is due to certain types of errors if (iErrCode == 0 || iErrCode == SQLITE_CONSTRAINT) return; - LOGI("sqlite returned: error code = %d, msg = %s\n", iErrCode, zMsg); + // print databasename, errorcode and msg + LOGI("sqlite returned: error code = %d, msg = %s, db=%s\n", iErrCode, zMsg, databaseName); } // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called. diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 3331e1bba03c..43f175f894b8 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -91,6 +91,7 @@ <protected-broadcast android:name="android.nfc.action.TAG_DISCOVERED" /> <protected-broadcast android:name="android.nfc.action.LLCP_LINK_STATE_CHANGED" /> <protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" /> + <protected-broadcast android:name="android.intent.action.CLEAR_DNS_CACHE" /> <!-- ====================================== --> <!-- Permissions for things that cost money --> diff --git a/core/res/res/anim/activity_close_enter.xml b/core/res/res/anim/activity_close_enter.xml index f1258e8abb1c..155ad0054ad2 100644 --- a/core/res/res/anim/activity_close_enter.xml +++ b/core/res/res/anim/activity_close_enter.xml @@ -18,8 +18,9 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator" - android:zAdjustment="top"> - <translate android:fromXDelta="-100%" android:toXDelta="0" - android:duration="@android:integer/config_shortAnimTime"/> + android:interpolator="@anim/decelerate_interpolator"> + <!-- Do nothing. --> + <alpha android:fromAlpha="1.0" android:toAlpha="1.0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/activity_close_exit.xml b/core/res/res/anim/activity_close_exit.xml index bf3d8cd34d31..77684d934a3d 100644 --- a/core/res/res/anim/activity_close_exit.xml +++ b/core/res/res/anim/activity_close_exit.xml @@ -19,6 +19,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="0%" android:toXDelta="33%" - android:duration="@android:integer/config_shortAnimTime"/> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale="1.0" android:toYScale="0.9" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/activity_open_enter.xml b/core/res/res/anim/activity_open_enter.xml index a9ea381d1fed..d4140ef589e8 100644 --- a/core/res/res/anim/activity_open_enter.xml +++ b/core/res/res/anim/activity_open_enter.xml @@ -19,6 +19,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="33%" android:toXDelta="0" - android:duration="@android:integer/config_shortAnimTime"/> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale="0.9" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="0" android:toAlpha="1.0" + android:interpolator="@anim/accelerate_decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/activity_open_exit.xml b/core/res/res/anim/activity_open_exit.xml index b04b79eac09b..155ad0054ad2 100644 --- a/core/res/res/anim/activity_open_exit.xml +++ b/core/res/res/anim/activity_open_exit.xml @@ -18,8 +18,9 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator" - android:zAdjustment="top"> - <translate android:fromXDelta="0%" android:toXDelta="-100%" - android:duration="@android:integer/config_shortAnimTime"/> + android:interpolator="@anim/decelerate_interpolator"> + <!-- Do nothing. --> + <alpha android:fromAlpha="1.0" android:toAlpha="1.0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_close_enter.xml b/core/res/res/anim/task_close_enter.xml index c42ad830db90..155ad0054ad2 100644 --- a/core/res/res/anim/task_close_enter.xml +++ b/core/res/res/anim/task_close_enter.xml @@ -18,14 +18,9 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator" - android:zAdjustment="top"> - <!-- For now stay like the normal activity transition. - <scale android:fromXScale="2.0" android:toXScale="1.0" - android:fromYScale="2.0" android:toYScale="1.0" - android:pivotX="100%p" android:pivotY="50%p" - android:duration="@android:integer/config_shortAnimTime" /> - --> - <translate android:fromXDelta="-100%" android:toXDelta="0" - android:duration="@android:integer/config_shortAnimTime"/> + android:interpolator="@anim/decelerate_interpolator"> + <!-- Do nothing. --> + <alpha android:fromAlpha="1.0" android:toAlpha="1.0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_close_exit.xml b/core/res/res/anim/task_close_exit.xml index 66d34808ddcd..77684d934a3d 100644 --- a/core/res/res/anim/task_close_exit.xml +++ b/core/res/res/anim/task_close_exit.xml @@ -19,6 +19,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="0%" android:toXDelta="33%" - android:duration="@android:integer/config_shortAnimTime"/> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale="1.0" android:toYScale="0.9" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_open_enter.xml b/core/res/res/anim/task_open_enter.xml index 66adf9fa6801..d4140ef589e8 100644 --- a/core/res/res/anim/task_open_enter.xml +++ b/core/res/res/anim/task_open_enter.xml @@ -19,6 +19,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator"> - <translate android:fromXDelta="33%" android:toXDelta="0" - android:duration="@android:integer/config_shortAnimTime"/> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale="0.9" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="0" android:toAlpha="1.0" + android:interpolator="@anim/accelerate_decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/task_open_exit.xml b/core/res/res/anim/task_open_exit.xml index 4a2cef431031..155ad0054ad2 100644 --- a/core/res/res/anim/task_open_exit.xml +++ b/core/res/res/anim/task_open_exit.xml @@ -18,14 +18,9 @@ --> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:interpolator="@anim/decelerate_interpolator" - android:zAdjustment="top"> - <!-- For now stay like the normal activity transition. - <scale android:fromXScale="1.0" android:toXScale="2.0" - android:fromYScale="1.0" android:toYScale="2.0" - android:pivotX="100%p" android:pivotY="50%p" - android:duration="@android:integer/config_shortAnimTime" /> - --> - <translate android:fromXDelta="0%" android:toXDelta="-100%" - android:duration="@android:integer/config_shortAnimTime"/> + android:interpolator="@anim/decelerate_interpolator"> + <!-- Do nothing. --> + <alpha android:fromAlpha="1.0" android:toAlpha="1.0" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> </set> diff --git a/core/res/res/anim/wallpaper_close_enter.xml b/core/res/res/anim/wallpaper_close_enter.xml index 6eb2a89f1e89..ba50d69202b5 100644 --- a/core/res/res/anim/wallpaper_close_enter.xml +++ b/core/res/res/anim/wallpaper_close_enter.xml @@ -17,8 +17,26 @@ */ --> +<!-- New holo animation, zooming contents on top of wallpaper down. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:zAdjustment="top"> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale=".9" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:fillEnabled="true" android:fillBefore="true" + android:interpolator="@anim/decelerate_interpolator" + android:startOffset="@android:integer/config_mediumAnimTime" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="0" android:toAlpha="1.0" + android:fillEnabled="true" android:fillBefore="true" + android:interpolator="@anim/decelerate_interpolator" + android:startOffset="@android:integer/config_mediumAnimTime" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> + <!-- This version zooms the new non-wallpaper up out of the wallpaper, without zooming the wallpaper itself. --> +<!-- <set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="top"> <scale android:fromXScale=".5" android:toXScale="1.0" @@ -30,6 +48,7 @@ android:interpolator="@anim/accelerate_decelerate_interpolator" android:duration="@android:integer/config_mediumAnimTime"/> </set> +--> <!-- This version zooms the new non-wallpaper down on top of the wallpaper, without zooming the wallpaper itself. --> diff --git a/core/res/res/anim/wallpaper_close_exit.xml b/core/res/res/anim/wallpaper_close_exit.xml index eccce81ee8bd..5af1d118da67 100644 --- a/core/res/res/anim/wallpaper_close_exit.xml +++ b/core/res/res/anim/wallpaper_close_exit.xml @@ -17,8 +17,29 @@ */ --> +<!-- New holo animation, zooming contents on top of wallpaper down. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:detachWallpaper="true"> + <scale android:fromXScale="1.0" android:toXScale="0.8" + android:fromYScale="1.0" android:toYScale="0.8" + android:pivotX="50%p" android:pivotY="50%p" + android:fillEnabled="true" android:fillAfter="true" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:fillEnabled="true" android:fillAfter="true" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> + <!-- This is just to keep the animation running for the entire duration. --> + <alpha android:fromAlpha="1.0" android:toAlpha="1.0" + android:startOffset="@android:integer/config_mediumAnimTime" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> + <!-- This version zooms the new non-wallpaper up out of the wallpaper, without zooming the wallpaper itself. --> +<!-- <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator" android:detachWallpaper="true"> @@ -27,6 +48,7 @@ android:pivotX="50%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> </set> +--> <!-- This version zooms the new non-wallpaper down on top of the wallpaper, without zooming the wallpaper itself. --> diff --git a/core/res/res/anim/wallpaper_open_enter.xml b/core/res/res/anim/wallpaper_open_enter.xml index a32c39e4a557..879d84a31489 100644 --- a/core/res/res/anim/wallpaper_open_enter.xml +++ b/core/res/res/anim/wallpaper_open_enter.xml @@ -17,8 +17,25 @@ */ --> +<!-- New holo animation, zooming contents on top of wallpaper back up. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@anim/decelerate_interpolator" + android:detachWallpaper="true"> + <scale android:fromXScale="0.8" android:toXScale="1.0" + android:fromYScale="0.8" android:toYScale="1.0" + android:pivotX="50%p" android:pivotY="50%p" + android:startOffset="@android:integer/config_mediumAnimTime" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="0" android:toAlpha="1.0" + android:interpolator="@anim/accelerate_decelerate_interpolator" + android:startOffset="@android:integer/config_mediumAnimTime" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> + + <!-- This version zooms the exiting non-wallpaper down in to the wallpaper, without zooming the wallpaper itself. --> +<!-- <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/decelerate_interpolator" android:detachWallpaper="true"> @@ -27,6 +44,7 @@ android:pivotX="50%p" android:pivotY="50%p" android:duration="@android:integer/config_mediumAnimTime" /> </set> +--> <!-- This version zooms the new non-wallpaper down on top of the wallpaper, without zooming the wallpaper itself. --> diff --git a/core/res/res/anim/wallpaper_open_exit.xml b/core/res/res/anim/wallpaper_open_exit.xml index 8f0e01277636..89fff8259762 100644 --- a/core/res/res/anim/wallpaper_open_exit.xml +++ b/core/res/res/anim/wallpaper_open_exit.xml @@ -16,8 +16,23 @@ ** limitations under the License. */ --> + +<!-- New holo animation, zooming contents on top of wallpaper back up. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:zAdjustment="top"> + <scale android:fromXScale="1.0" android:toXScale="1.0" + android:fromYScale="1.0" android:toYScale=".9" + android:pivotX="50%p" android:pivotY="50%p" + android:interpolator="@anim/decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime" /> + <alpha android:fromAlpha="1.0" android:toAlpha="0" + android:interpolator="@anim/accelerate_decelerate_interpolator" + android:duration="@android:integer/config_mediumAnimTime"/> +</set> + <!-- This version zooms the exiting non-wallpaper down in to the wallpaper, without zooming the wallpaper itself. --> +<!-- <set xmlns:android="http://schemas.android.com/apk/res/android" android:zAdjustment="top"> <scale android:fromXScale="1.0" android:toXScale=".5" @@ -29,6 +44,7 @@ android:interpolator="@anim/accelerate_decelerate_interpolator" android:duration="@android:integer/config_mediumAnimTime"/> </set> +--> <!-- This version zooms the new non-wallpaper down on top of the wallpaper, without zooming the wallpaper itself. --> diff --git a/core/res/res/drawable-xlarge/default_wallpaper.jpg b/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg Binary files differindex 5acad947cc83..5acad947cc83 100644 --- a/core/res/res/drawable-xlarge/default_wallpaper.jpg +++ b/core/res/res/drawable-xlarge-nodpi/default_wallpaper.jpg diff --git a/core/res/res/drawable-xlarge/ic_lock_idle_alarm.png b/core/res/res/drawable-xlarge/ic_lock_idle_alarm.png Binary files differdeleted file mode 100644 index 336a82068ad3..000000000000 --- a/core/res/res/drawable-xlarge/ic_lock_idle_alarm.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/ic_lock_idle_charging.png b/core/res/res/drawable-xlarge/ic_lock_idle_charging.png Binary files differdeleted file mode 100644 index ebef53189a18..000000000000 --- a/core/res/res/drawable-xlarge/ic_lock_idle_charging.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/ic_lock_idle_lock.png b/core/res/res/drawable-xlarge/ic_lock_idle_lock.png Binary files differdeleted file mode 100644 index 405e21862123..000000000000 --- a/core/res/res/drawable-xlarge/ic_lock_idle_lock.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/ic_lock_idle_low_battery.png b/core/res/res/drawable-xlarge/ic_lock_idle_low_battery.png Binary files differdeleted file mode 100644 index f349b633498d..000000000000 --- a/core/res/res/drawable-xlarge/ic_lock_idle_low_battery.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/unlock_default.png b/core/res/res/drawable-xlarge/unlock_default.png Binary files differdeleted file mode 100644 index 0a441c094a45..000000000000 --- a/core/res/res/drawable-xlarge/unlock_default.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/unlock_halo.png b/core/res/res/drawable-xlarge/unlock_halo.png Binary files differdeleted file mode 100644 index 09b05262db0c..000000000000 --- a/core/res/res/drawable-xlarge/unlock_halo.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/unlock_ring.png b/core/res/res/drawable-xlarge/unlock_ring.png Binary files differdeleted file mode 100644 index 1ac6d547f390..000000000000 --- a/core/res/res/drawable-xlarge/unlock_ring.png +++ /dev/null diff --git a/core/res/res/drawable-xlarge/unlock_wave.png b/core/res/res/drawable-xlarge/unlock_wave.png Binary files differdeleted file mode 100644 index 21bfa24ddbce..000000000000 --- a/core/res/res/drawable-xlarge/unlock_wave.png +++ /dev/null diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index a6953d43a910..6c3eaac86e7d 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -58,13 +58,13 @@ <bool name="config_sf_slowBlur">false</bool> <!-- The duration (in milliseconds) of a short animation. --> - <integer name="config_shortAnimTime">150</integer> + <integer name="config_shortAnimTime">200</integer> <!-- The duration (in milliseconds) of a medium-length animation. --> - <integer name="config_mediumAnimTime">300</integer> + <integer name="config_mediumAnimTime">400</integer> <!-- The duration (in milliseconds) of a long animation. --> - <integer name="config_longAnimTime">400</integer> + <integer name="config_longAnimTime">500</integer> <!-- The duration (in milliseconds) that the radio will scan for a signal when there's no network connection. If the scan doesn't timeout, use zero --> diff --git a/graphics/java/android/renderscript/BaseObj.java b/graphics/java/android/renderscript/BaseObj.java index 715e3fbcbdc7..69907d988dde 100644 --- a/graphics/java/android/renderscript/BaseObj.java +++ b/graphics/java/android/renderscript/BaseObj.java @@ -33,7 +33,7 @@ class BaseObj { public int getID() { if (mDestroyed) { - throw new IllegalStateException("using a destroyed object."); + throw new RSInvalidStateException("using a destroyed object."); } return mID; } @@ -43,13 +43,12 @@ class BaseObj { String mName; RenderScript mRS; - public void setName(String s) throws IllegalStateException, IllegalArgumentException - { + public void setName(String s) { if(s.length() < 1) { - throw new IllegalArgumentException("setName does not accept a zero length string."); + throw new RSIllegalArgumentException("setName does not accept a zero length string."); } if(mName != null) { - throw new IllegalArgumentException("setName object already has a name."); + throw new RSIllegalArgumentException("setName object already has a name."); } try { @@ -61,8 +60,7 @@ class BaseObj { } } - protected void finalize() throws Throwable - { + protected void finalize() throws Throwable { if (!mDestroyed) { if(mID != 0 && mRS.isAlive()) { mRS.nObjDestroy(mID); @@ -78,7 +76,7 @@ class BaseObj { public void destroy() { if(mDestroyed) { - throw new IllegalStateException("Object already destroyed."); + throw new RSInvalidStateException("Object already destroyed."); } mDestroyed = true; mRS.nObjDestroy(mID); diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java index d013886abe60..f844b7eb07f6 100644 --- a/graphics/java/android/renderscript/Element.java +++ b/graphics/java/android/renderscript/Element.java @@ -93,6 +93,18 @@ public class Element extends BaseObj { } } + public boolean isComplex() { + if (mElements == null) { + return false; + } + for (int ct=0; ct < mElements.length; ct++) { + if (mElements[ct].mElements != null) { + return true; + } + } + return false; + } + public static Element BOOLEAN(RenderScript rs) { if(rs.mElement_BOOLEAN == null) { rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN); @@ -397,7 +409,7 @@ public class Element extends BaseObj { } - public void destroy() throws IllegalStateException { + public void destroy() { super.destroy(); } @@ -412,7 +424,7 @@ public class Element extends BaseObj { public static Element createVector(RenderScript rs, DataType dt, int size) { if (size < 2 || size > 4) { - throw new IllegalArgumentException("Bad size"); + throw new RSIllegalArgumentException("Vector size out of rance 2-4."); } DataKind dk = DataKind.USER; boolean norm = false; @@ -426,22 +438,22 @@ public class Element extends BaseObj { dk == DataKind.PIXEL_LA || dk == DataKind.PIXEL_RGB || dk == DataKind.PIXEL_RGBA)) { - throw new IllegalArgumentException("Unsupported DataKind"); + throw new RSIllegalArgumentException("Unsupported DataKind"); } if (!(dt == DataType.UNSIGNED_8 || dt == DataType.UNSIGNED_5_6_5 || dt == DataType.UNSIGNED_4_4_4_4 || dt == DataType.UNSIGNED_5_5_5_1)) { - throw new IllegalArgumentException("Unsupported DataType"); + throw new RSIllegalArgumentException("Unsupported DataType"); } if (dt == DataType.UNSIGNED_5_6_5 && dk != DataKind.PIXEL_RGB) { - throw new IllegalArgumentException("Bad kind and type combo"); + throw new RSIllegalArgumentException("Bad kind and type combo"); } if (dt == DataType.UNSIGNED_5_5_5_1 && dk != DataKind.PIXEL_RGBA) { - throw new IllegalArgumentException("Bad kind and type combo"); + throw new RSIllegalArgumentException("Bad kind and type combo"); } if (dt == DataType.UNSIGNED_4_4_4_4 && dk != DataKind.PIXEL_RGBA) { - throw new IllegalArgumentException("Bad kind and type combo"); + throw new RSIllegalArgumentException("Bad kind and type combo"); } int size = 1; @@ -477,7 +489,7 @@ public class Element extends BaseObj { public void add(Element element, String name, int arraySize) { if (arraySize < 1) { - throw new IllegalArgumentException("Array size cannot be less than 1."); + throw new RSIllegalArgumentException("Array size cannot be less than 1."); } if(mCount == mElements.length) { Element[] e = new Element[mCount + 8]; diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java index ffcdbbc5a818..35236ca14225 100644 --- a/graphics/java/android/renderscript/Program.java +++ b/graphics/java/android/renderscript/Program.java @@ -47,6 +47,13 @@ public class Program extends BaseObj { } public void bindConstants(Allocation a, int slot) { + if (slot < 0 || slot >= mConstants.length) { + throw new IllegalArgumentException("Slot ID out of range."); + } + if (a != null && + a.getType().getID() != mConstants[slot].getID()) { + throw new IllegalArgumentException("Allocation type does not match slot type."); + } mRS.nProgramBindConstants(mID, slot, a.mID); } @@ -141,7 +148,10 @@ public class Program extends BaseObj { public void addInput(Element e) throws IllegalStateException { // Should check for consistant and non-conflicting names... if(mInputCount >= MAX_INPUT) { - throw new IllegalArgumentException("Max input count exceeded."); + throw new RSIllegalArgumentException("Max input count exceeded."); + } + if (e.isComplex()) { + throw new RSIllegalArgumentException("Complex elements not allowed."); } mInputs[mInputCount++] = e; } @@ -149,7 +159,10 @@ public class Program extends BaseObj { public void addOutput(Element e) throws IllegalStateException { // Should check for consistant and non-conflicting names... if(mOutputCount >= MAX_OUTPUT) { - throw new IllegalArgumentException("Max output count exceeded."); + throw new RSIllegalArgumentException("Max output count exceeded."); + } + if (e.isComplex()) { + throw new RSIllegalArgumentException("Complex elements not allowed."); } mOutputs[mOutputCount++] = e; } @@ -164,7 +177,10 @@ public class Program extends BaseObj { public int addConstant(Type t) throws IllegalStateException { // Should check for consistant and non-conflicting names... if(mConstantCount >= MAX_CONSTANT) { - throw new IllegalArgumentException("Max input count exceeded."); + throw new RSIllegalArgumentException("Max input count exceeded."); + } + if (t.getElement().isComplex()) { + throw new RSIllegalArgumentException("Complex elements not allowed."); } mConstants[mConstantCount] = t; return mConstantCount++; diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 8f1f2739ccca..21efa39ead37 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -156,10 +156,6 @@ public class RenderScript { synchronized void nObjDestroy(int id) { rsnObjDestroy(mContext, id); } - native int rsnFileOpen(int con, byte[] name); - synchronized int nFileOpen(byte[] name) { - return rsnFileOpen(mContext, name); - } native int rsnElementCreate(int con, int type, int kind, boolean norm, int vecSize); synchronized int nElementCreate(int type, int kind, boolean norm, int vecSize) { @@ -599,7 +595,7 @@ public class RenderScript { void validate() { if (mContext == 0) { - throw new IllegalStateException("Calling RS with no Context active."); + throw new RSInvalidStateException("Calling RS with no Context active."); } } diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java index 21cbb9a1cbd8..cace0636ab9c 100644 --- a/graphics/java/android/renderscript/RenderScriptGL.java +++ b/graphics/java/android/renderscript/RenderScriptGL.java @@ -68,10 +68,10 @@ public class RenderScriptGL extends RenderScript { private void validateRange(int umin, int upref, int rmin, int rmax) { if (umin < rmin || umin > rmax) { - throw new IllegalArgumentException("Minimum value provided out of range."); + throw new RSIllegalArgumentException("Minimum value provided out of range."); } if (upref < umin) { - throw new IllegalArgumentException("Prefered must be >= Minimum."); + throw new RSIllegalArgumentException("Prefered must be >= Minimum."); } } @@ -93,7 +93,7 @@ public class RenderScriptGL extends RenderScript { public void setSamples(int minimum, int prefered, float Q) { validateRange(minimum, prefered, 0, 24); if (Q < 0.0f || Q > 1.0f) { - throw new IllegalArgumentException("Quality out of 0-1 range."); + throw new RSIllegalArgumentException("Quality out of 0-1 range."); } mSamplesMin = minimum; mSamplesPref = prefered; @@ -188,33 +188,6 @@ public class RenderScriptGL extends RenderScript { nContextBindProgramVertex(safeID(p)); } - - - - ////////////////////////////////////////////////////////////////////////////////// - // File - - public class File extends BaseObj { - File(int id) { - super(id, RenderScriptGL.this); - } - } - - public File fileOpen(String s) throws IllegalStateException, IllegalArgumentException - { - if(s.length() < 1) { - throw new IllegalArgumentException("fileOpen does not accept a zero length string."); - } - - try { - byte[] bytes = s.getBytes("UTF-8"); - int id = nFileOpen(bytes); - return new File(id); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } - } diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java index 9a40d1fdbb89..0d6573762b42 100644 --- a/graphics/java/android/renderscript/Type.java +++ b/graphics/java/android/renderscript/Type.java @@ -136,7 +136,7 @@ public class Type extends BaseObj { public Builder(RenderScript rs, Element e) { if(e.mID == 0) { - throw new IllegalArgumentException("Invalid element."); + throw new RSIllegalArgumentException("Invalid element."); } mRS = rs; @@ -147,7 +147,7 @@ public class Type extends BaseObj { public void add(Dimension d, int value) { if(value < 1) { - throw new IllegalArgumentException("Values of less than 1 for Dimensions are not valid."); + throw new RSIllegalArgumentException("Values of less than 1 for Dimensions are not valid."); } if(mDimensions.length >= mEntryCount) { Dimension[] dn = new Dimension[mEntryCount + 8]; diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index b0faaccc657a..1cc6dc1b182b 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -118,18 +118,6 @@ nObjDestroy(JNIEnv *_env, jobject _this, RsContext con, jint obj) rsObjDestroy(con, (void *)obj); } - -static jint -nFileOpen(JNIEnv *_env, jobject _this, RsContext con, jbyteArray str) -{ - LOG_API("nFileOpen, con(%p)", con); - jint len = _env->GetArrayLength(str); - jbyte * cptr = (jbyte *) _env->GetPrimitiveArrayCritical(str, 0); - jint ret = (jint)rsFileOpen(con, (const char *)cptr, len); - _env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT); - return ret; -} - // --------------------------------------------------------------------------- static jint @@ -1247,7 +1235,6 @@ static JNINativeMethod methods[] = { {"rsnGetName", "(II)Ljava/lang/String;", (void*)nGetName }, {"rsnObjDestroy", "(II)V", (void*)nObjDestroy }, -{"rsnFileOpen", "(I[B)I", (void*)nFileOpen }, {"rsnFileA3DCreateFromAssetStream", "(II)I", (void*)nFileA3DCreateFromAssetStream }, {"rsnFileA3DGetNumIndexEntries", "(II)I", (void*)nFileA3DGetNumIndexEntries }, {"rsnFileA3DGetIndexEntries", "(III[I[Ljava/lang/String;)V", (void*)nFileA3DGetIndexEntries }, diff --git a/media/java/android/media/videoeditor/VideoEditor.java b/media/java/android/media/videoeditor/VideoEditor.java index aa8f2cb2b538..00143ad572de 100755 --- a/media/java/android/media/videoeditor/VideoEditor.java +++ b/media/java/android/media/videoeditor/VideoEditor.java @@ -130,36 +130,42 @@ public interface VideoEditor { * storyboard items. This method can take a long time to execute and is
* blocking. The application will receive progress notifications via the
* ExportProgressListener. Specific implementations may not support multiple
- * simultaneous export operations.
- *
- * Note that invoking methods which would change the contents of the output
- * movie throw an IllegalStateException while an export operation is
- * pending.
+ * simultaneous export operations. Note that invoking methods which would
+ * change the contents of the output movie throw an IllegalStateException
+ * while an export operation is pending.
*
* @param filename The output file name (including the full path)
* @param height The height of the output video file. The supported values
* for height are described in the MediaProperties class, for
- * example: HEIGHT_480. The width will be automatically
- * computed according to the aspect ratio provided by
+ * example: HEIGHT_480. The width will be automatically computed
+ * according to the aspect ratio provided by
* {@link #setAspectRatio(int)}
* @param bitrate The bitrate of the output video file. This is approximate
* value for the output movie. Supported bitrate values are
* described in the MediaProperties class for example:
* BITRATE_384K
+ * @param audioCodec The audio codec to be used for the export. The audio
+ * codec values are defined in the MediaProperties class (e.g.
+ * ACODEC_AAC_LC). Note that not all audio codec types are
+ * supported for export purposes.
+ * @param videoCodec The video codec to be used for the export. The video
+ * codec values are defined in the MediaProperties class (e.g.
+ * VCODEC_H264BP). Note that not all video codec types are
+ * supported for export purposes.
* @param listener The listener for progress notifications. Use null if
* export progress notifications are not needed.
- *
- * @throws IllegalArgumentException if height or bitrate are not supported.
+ * @throws IllegalArgumentException if height or bitrate are not supported
+ * or if the audio or video codecs are not supported
* @throws IOException if output file cannot be created
* @throws IllegalStateException if a preview or an export is in progress or
* if no MediaItem has been added
* @throws CancellationException if export is canceled by calling
* {@link #cancelExport()}
- * @throws UnsupportOperationException if multiple simultaneous export()
- * are not allowed
+ * @throws UnsupportOperationException if multiple simultaneous export() are
+ * not allowed
*/
- public void export(String filename, int height, int bitrate, ExportProgressListener listener)
- throws IOException;
+ public void export(String filename, int height, int bitrate, int audioCodec, int videoCodec,
+ ExportProgressListener listener) throws IOException;
/**
* Cancel the running export operation. This method blocks until the
diff --git a/media/java/android/media/videoeditor/VideoEditorTestImpl.java b/media/java/android/media/videoeditor/VideoEditorTestImpl.java index ba84f499fb51..60d3f23c9e75 100644 --- a/media/java/android/media/videoeditor/VideoEditorTestImpl.java +++ b/media/java/android/media/videoeditor/VideoEditorTestImpl.java @@ -1025,11 +1025,17 @@ public class VideoEditorTestImpl implements VideoEditor { } } + /* + * {@inheritDoc} + */ public void cancelExport(String filename) { } - public void export(String filename, int height, int bitrate, ExportProgressListener listener) - throws IOException { + /* + * {@inheritDoc} + */ + public void export(String filename, int height, int bitrate, int audioCodec, int videoCodec, + ExportProgressListener listener) throws IOException { } /* diff --git a/policy/src/com/android/internal/policy/impl/RecentApplicationsBackground.java b/policy/src/com/android/internal/policy/impl/RecentApplicationsBackground.java index 7c99e87928b8..8d87728db293 100644 --- a/policy/src/com/android/internal/policy/impl/RecentApplicationsBackground.java +++ b/policy/src/com/android/internal/policy/impl/RecentApplicationsBackground.java @@ -72,6 +72,12 @@ public class RecentApplicationsBackground extends LinearLayout { } @Override + public void jumpDrawablesToCurrentState() { + super.jumpDrawablesToCurrentState(); + if (mBackground != null) mBackground.jumpToCurrentState(); + } + + @Override protected void drawableStateChanged() { Drawable d = mBackground; if (d != null && d.isStateful()) { diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index ee0cc4bd4b82..c18262e1d388 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1596,6 +1596,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { } catch (NumberFormatException e) {} } SystemProperties.set("net.dnschange", "" + (n+1)); + /* + * Tell the VMs to toss their DNS caches + */ + Intent intent = new Intent(Intent.ACTION_CLEAR_DNS_CACHE); + intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); + mContext.sendBroadcast(intent); } private void handleDnsConfigurationChange(int netType) { diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 41471d97f774..d035eb586aad 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -1622,15 +1622,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) { CharSequence title; int nameResId = subtype.getNameResId(); - int modeResId = subtype.getModeResId(); + String mode = subtype.getMode(); if (nameResId != 0) { title = pm.getText(property.getPackageName(), nameResId, property.getServiceInfo().applicationInfo); } else { CharSequence language = subtype.getLocale(); - CharSequence mode = modeResId == 0 ? null - : pm.getText(property.getPackageName(), modeResId, - property.getServiceInfo().applicationInfo); // TODO: Use more friendly Title and UI title = label + "," + (mode == null ? "" : mode) + "," + (language == null ? "" : language); @@ -1869,14 +1866,17 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int applicableSubtypeId = DEFAULT_SUBTYPE_ID; for (int i = 0; i < subtypes.size(); ++i) { final String subtypeLocale = subtypes.get(i).getLocale(); - if (locale.equals(subtypeLocale)) { - // Exact match (e.g. system locale is "en_US" and subtype locale is "en_US") - applicableSubtypeId = i; - break; - } else if (!partialMatchFound && subtypeLocale.startsWith(language)) { - // Partial match (e.g. system locale is "en_US" and subtype locale is "en") - applicableSubtypeId = i; - partialMatchFound = true; + // An applicable subtype should be a keyboard subtype + if (subtypes.get(i).getMode().equalsIgnoreCase("keyboard")) { + if (locale.equals(subtypeLocale)) { + // Exact match (e.g. system locale is "en_US" and subtype locale is "en_US") + applicableSubtypeId = i; + break; + } else if (!partialMatchFound && subtypeLocale.startsWith(language)) { + // Partial match (e.g. system locale is "en_US" and subtype locale is "en") + applicableSubtypeId = i; + partialMatchFound = true; + } } } diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java index 9687aa7e97f5..853e46d975d2 100644 --- a/services/java/com/android/server/WifiService.java +++ b/services/java/com/android/server/WifiService.java @@ -89,10 +89,8 @@ public class WifiService extends IWifiManager.Stub { private AlarmManager mAlarmManager; private PendingIntent mIdleIntent; - private PendingIntent mScanIntent; private BluetoothA2dp mBluetoothA2dp; private static final int IDLE_REQUEST = 0; - private static final int SCAN_REQUEST = 0; private boolean mScreenOff; private boolean mDeviceIdle; private int mPluggedType; @@ -128,18 +126,9 @@ public class WifiService extends IWifiManager.Stub { */ private static final long DEFAULT_IDLE_MS = 15 * 60 * 1000; /* 15 minutes */ - /** - * See {@link Settings.Secure#WIFI_SCAN_INTERVAL_MS}. This is the default value if a - * Settings.Secure value is not present. - */ - private static final long DEFAULT_SCAN_INTERVAL_MS = 60 * 1000; /* 1 minute */ - private static final String ACTION_DEVICE_IDLE = "com.android.server.WifiManager.action.DEVICE_IDLE"; - private static final String ACTION_START_SCAN = - "com.android.server.WifiManager.action.START_SCAN"; - private boolean mIsReceiverRegistered = false; @@ -249,9 +238,6 @@ public class WifiService extends IWifiManager.Stub { Intent idleIntent = new Intent(ACTION_DEVICE_IDLE, null); mIdleIntent = PendingIntent.getBroadcast(mContext, IDLE_REQUEST, idleIntent, 0); - Intent scanIntent = new Intent(ACTION_START_SCAN, null); - mScanIntent = PendingIntent.getBroadcast(mContext, SCAN_REQUEST, scanIntent, 0); - HandlerThread wifiThread = new HandlerThread("WifiService"); wifiThread.start(); mHandler = new WifiServiceHandler(wifiThread.getLooper(), context); @@ -936,8 +922,6 @@ public class WifiService extends IWifiManager.Stub { int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothA2dp.STATE_NOT_PLAYING); mWifiStateMachine.setBluetoothScanMode(state == BluetoothA2dp.STATE_PLAYING); - } else if (action.equals(ACTION_START_SCAN)) { - mWifiStateMachine.startScan(true); } } @@ -1010,10 +994,6 @@ public class WifiService extends IWifiManager.Stub { strongestLockMode = WifiManager.WIFI_MODE_FULL; } - /* Scan interval when driver is started */ - long scanMs = Settings.Secure.getLong(mContext.getContentResolver(), - Settings.Secure.WIFI_SCAN_INTERVAL_MS, DEFAULT_SCAN_INTERVAL_MS); - /* Disable tethering when airplane mode is enabled */ if (airplaneMode) { mWifiStateMachine.setWifiApEnabled(null, false); @@ -1026,14 +1006,11 @@ public class WifiService extends IWifiManager.Stub { mWifiStateMachine.setScanOnlyMode( strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY); mWifiStateMachine.setDriverStart(true); - mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, - System.currentTimeMillis() + scanMs, scanMs, mScanIntent); mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode == WifiManager.WIFI_MODE_FULL_HIGH_PERF); } else { mWifiStateMachine.requestCmWakeLock(); mWifiStateMachine.setDriverStart(false); - mAlarmManager.cancel(mScanIntent); } } else { mWifiStateMachine.setWifiEnabled(false); @@ -1046,7 +1023,6 @@ public class WifiService extends IWifiManager.Stub { intentFilter.addAction(Intent.ACTION_SCREEN_OFF); intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED); intentFilter.addAction(ACTION_DEVICE_IDLE); - intentFilter.addAction(ACTION_START_SCAN); intentFilter.addAction(BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED); mContext.registerReceiver(mReceiver, intentFilter); } diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 41b3da681cf7..817f0b2fa509 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -85,7 +85,6 @@ import android.os.PowerManager; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.TokenWatcher; @@ -500,6 +499,7 @@ public class WindowManagerService extends IWindowManager.Stub IBinder mToken; Surface mSurface; boolean mLocalOnly; + IBinder mLocalWin; ClipData mData; ClipDescription mDataDescription; boolean mDragResult; @@ -512,10 +512,11 @@ public class WindowManagerService extends IWindowManager.Stub private final Rect tmpRect = new Rect(); - DragState(IBinder token, Surface surface, boolean localOnly) { + DragState(IBinder token, Surface surface, boolean localOnly, IBinder localWin) { mToken = token; mSurface = surface; mLocalOnly = localOnly; + mLocalWin = localWin; mNotifiedWindows = new ArrayList<WindowState>(); } @@ -525,6 +526,7 @@ public class WindowManagerService extends IWindowManager.Stub } mSurface = null; mLocalOnly = false; + mLocalWin = null; mToken = null; mData = null; mThumbOffsetX = mThumbOffsetY = 0; @@ -594,6 +596,18 @@ public class WindowManagerService extends IWindowManager.Stub */ private void sendDragStartedLw(WindowState newWin, float touchX, float touchY, ClipDescription desc) { + // Don't actually send the event if the drag is supposed to be pinned + // to the originating window but 'newWin' is not that window. + if (mLocalOnly) { + final IBinder winBinder = newWin.mClient.asBinder(); + if (winBinder != mLocalWin) { + if (DEBUG_DRAG) { + Slog.d(TAG, "Not dispatching local DRAG_STARTED to " + newWin); + } + return; + } + } + if (mDragInProgress && newWin.isPotentialDragTarget()) { DragEvent event = DragEvent.obtain(DragEvent.ACTION_DRAG_STARTED, touchX - newWin.mFrame.left, touchY - newWin.mFrame.top, @@ -672,6 +686,14 @@ public class WindowManagerService extends IWindowManager.Stub // Tell the affected window WindowState touchedWin = getTouchedWinAtPointLw(x, y); + if (mLocalOnly) { + final IBinder touchedBinder = touchedWin.mClient.asBinder(); + if (touchedBinder != mLocalWin) { + // This drag is pinned only to the originating window, but the drag + // point is outside that window. Pretend it's over empty space. + touchedWin = null; + } + } try { // have we dragged over a new window? if ((touchedWin != mTargetWindow) && (mTargetWindow != null)) { @@ -921,11 +943,6 @@ public class WindowManagerService extends IWindowManager.Stub notifyAll(); } - // For debug builds, log event loop stalls to dropbox for analysis. - if (StrictMode.conditionallyEnableDebugLogging()) { - Slog.i(TAG, "Enabled StrictMode logging for WMThread's Looper"); - } - Looper.loop(); } } @@ -963,11 +980,6 @@ public class WindowManagerService extends IWindowManager.Stub notifyAll(); } - // For debug builds, log event loop stalls to dropbox for analysis. - if (StrictMode.conditionallyEnableDebugLogging()) { - Slog.i(TAG, "Enabled StrictMode for PolicyThread's Looper"); - } - Looper.loop(); } } @@ -5465,15 +5477,16 @@ public class WindowManagerService extends IWindowManager.Stub Surface surface = new Surface(session, callerPid, "drag surface", 0, width, height, PixelFormat.TRANSLUCENT, Surface.HIDDEN); outSurface.copyFrom(surface); + final IBinder winBinder = window.asBinder(); token = new Binder(); - mDragState = new DragState(token, surface, localOnly); + mDragState = new DragState(token, surface, localOnly, winBinder); mDragState.mSurface = surface; mDragState.mLocalOnly = localOnly; token = mDragState.mToken = new Binder(); // 5 second timeout for this window to actually begin the drag - mH.removeMessages(H.DRAG_START_TIMEOUT, window); - Message msg = mH.obtainMessage(H.DRAG_START_TIMEOUT, window.asBinder()); + mH.removeMessages(H.DRAG_START_TIMEOUT, winBinder); + Message msg = mH.obtainMessage(H.DRAG_START_TIMEOUT, winBinder); mH.sendMessageDelayed(msg, 5000); } else { Slog.w(TAG, "Drag already in progress"); diff --git a/services/java/com/android/server/WiredAccessoryObserver.java b/services/java/com/android/server/WiredAccessoryObserver.java index d97d41c9f5ab..4a85afffb4e9 100644 --- a/services/java/com/android/server/WiredAccessoryObserver.java +++ b/services/java/com/android/server/WiredAccessoryObserver.java @@ -124,10 +124,12 @@ class WiredAccessoryObserver extends UEventObserver { try { FileReader file = new FileReader(uEventInfo[i][1]); int len = file.read(buffer, 0, 1024); + file.close(); newState = Integer.valueOf((new String(buffer, 0, len)).trim()); file = new FileReader(uEventInfo[i][2]); len = file.read(buffer, 0, 1024); + file.close(); newName = new String(buffer, 0, len).trim(); } catch (FileNotFoundException e) { diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 84839b650457..7905dc6399e6 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -959,6 +959,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final int CANCEL_HEAVY_NOTIFICATION_MSG = 25; static final int SHOW_STRICT_MODE_VIOLATION_MSG = 26; static final int CHECK_EXCESSIVE_WAKE_LOCKS_MSG = 27; + static final int CLEAR_DNS_CACHE = 28; AlertDialog mUidAlert; @@ -1110,6 +1111,20 @@ public final class ActivityManagerService extends ActivityManagerNative } } } break; + case CLEAR_DNS_CACHE: { + synchronized (ActivityManagerService.this) { + for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) { + ProcessRecord r = mLruProcesses.get(i); + if (r.thread != null) { + try { + r.thread.clearDnsCache(); + } catch (RemoteException ex) { + Slog.w(TAG, "Failed to clear dns cache for: " + r.info.processName); + } + } + } + } + } break; case SHOW_UID_ERROR_MSG: { // XXX This is a temporary dialog, no need to localize. AlertDialog d = new BaseErrorDialog(mContext); @@ -1334,11 +1349,6 @@ public final class ActivityManagerService extends ActivityManagerNative } } - // For debug builds, log event loop stalls to dropbox for analysis. - if (StrictMode.conditionallyEnableDebugLogging()) { - Slog.i(TAG, "Enabled StrictMode logging for AThread's Looper"); - } - Looper.loop(); } } @@ -10378,6 +10388,10 @@ public final class ActivityManagerService extends ActivityManagerNative mHandler.sendEmptyMessage(UPDATE_TIME_ZONE); } + if (intent.ACTION_CLEAR_DNS_CACHE.equals(intent.getAction())) { + mHandler.sendEmptyMessage(CLEAR_DNS_CACHE); + } + /* * Prevent non-system code (defined here to be non-persistent * processes) from sending protected broadcasts. diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index fdb50e25f71f..93c38cd85fa0 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -38,6 +38,8 @@ import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLING; import static android.net.wifi.WifiManager.WIFI_AP_STATE_FAILED; import android.app.ActivityManagerNative; +import android.app.AlarmManager; +import android.app.PendingIntent; import android.net.LinkAddress; import android.net.NetworkInfo; import android.net.DhcpInfo; @@ -67,8 +69,11 @@ import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothProfile; +import android.content.BroadcastReceiver; import android.content.Intent; import android.content.Context; +import android.content.IntentFilter; + import com.android.internal.app.IBatteryStats; import com.android.internal.util.AsyncChannel; import com.android.internal.util.HierarchicalState; @@ -147,6 +152,9 @@ public class WifiStateMachine extends HierarchicalStateMachine { * and load configuration afterwards */ private boolean mWpsStarted = false; + private AlarmManager mAlarmManager; + private PendingIntent mScanIntent; + // Channel for sending replies. private AsyncChannel mReplyChannel = new AsyncChannel(); @@ -344,6 +352,12 @@ public class WifiStateMachine extends HierarchicalStateMachine { private static final int POWER_MODE_ACTIVE = 1; private static final int POWER_MODE_AUTO = 0; + /** + * See {@link Settings.Secure#WIFI_SCAN_INTERVAL_MS}. This is the default value if a + * Settings.Secure value is not present. + */ + private static final long DEFAULT_SCAN_INTERVAL_MS = 60 * 1000; /* 1 minute */ + /* Default parent state */ private HierarchicalState mDefaultState = new DefaultState(); /* Temporary initial state */ @@ -411,6 +425,10 @@ public class WifiStateMachine extends HierarchicalStateMachine { private final AtomicInteger mLastEnableUid = new AtomicInteger(Process.myUid()); private final AtomicInteger mLastApEnableUid = new AtomicInteger(Process.myUid()); + private static final int SCAN_REQUEST = 0; + private static final String ACTION_START_SCAN = + "com.android.server.WifiManager.action.START_SCAN"; + /** * Keep track of whether WIFI is running. */ @@ -465,6 +483,19 @@ public class WifiStateMachine extends HierarchicalStateMachine { mLastNetworkId = -1; mLastSignalLevel = -1; + mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE); + Intent scanIntent = new Intent(ACTION_START_SCAN, null); + mScanIntent = PendingIntent.getBroadcast(mContext, SCAN_REQUEST, scanIntent, 0); + + mContext.registerReceiver( + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + startScan(false); + } + }, + new IntentFilter(ACTION_START_SCAN)); + mScanResultCache = new LinkedHashMap<String, ScanResult>( SCAN_RESULT_CACHE_SIZE, 0.75f, true) { /* @@ -1130,7 +1161,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { if (scanResult != null) { scanList.add(scanResult); } else { - Log.w(TAG, "misformatted scan result for: " + line); + //TODO: hidden network handling } } lineBeg = lineEnd + 1; @@ -2057,7 +2088,7 @@ public class WifiStateMachine extends HierarchicalStateMachine { } else { WifiNative.setScanResultHandlingCommand(CONNECT_MODE); WifiNative.reconnectCommand(); - transitionTo(mConnectModeState); + transitionTo(mDisconnectedState); } } @Override @@ -2631,6 +2662,17 @@ public class WifiStateMachine extends HierarchicalStateMachine { public void enter() { if (DBG) Log.d(TAG, getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); + + /** + * In a disconnected state, an infrequent scan that wakes + * up the device is needed to ensure a user connects to + * an access point on the move + */ + long scanMs = Settings.Secure.getLong(mContext.getContentResolver(), + Settings.Secure.WIFI_SCAN_INTERVAL_MS, DEFAULT_SCAN_INTERVAL_MS); + + mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, + System.currentTimeMillis() + scanMs, scanMs, mScanIntent); } @Override public boolean processMessage(Message message) { @@ -2654,6 +2696,11 @@ public class WifiStateMachine extends HierarchicalStateMachine { EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what); return HANDLED; } + + @Override + public void exit() { + mAlarmManager.cancel(mScanIntent); + } } class SoftApStartedState extends HierarchicalState { |