diff options
Diffstat (limited to 'core/java')
11 files changed, 100 insertions, 61 deletions
diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java index 3b41359..a7ea89c 100644 --- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java +++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java @@ -328,6 +328,7 @@ public class RequestThreadManager { resetJpegSurfaceFormats(mCallbackOutputs); mPreviewOutputs.clear(); mCallbackOutputs.clear(); + mJpegSurfaceIds.clear(); mPreviewTexture = null; int facing = mCharacteristics.get(CameraCharacteristics.LENS_FACING); diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index ba71605..362afba 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -17,6 +17,7 @@ package android.os; import android.util.Log; +import android.util.Slog; import com.android.internal.util.FastPrintWriter; import java.io.FileDescriptor; @@ -48,7 +49,7 @@ public class Binder implements IBinder { * of classes can potentially create leaks. */ private static final boolean FIND_POTENTIAL_LEAKS = false; - private static final String TAG = "Binder"; + static final String TAG = "Binder"; /** * Control whether dump() calls are allowed. @@ -385,7 +386,14 @@ public class Binder implements IBinder { super.finalize(); } } - + + static void checkParcel(Parcel parcel, String msg) { + if (parcel.dataSize() >= 800*1024) { + // Trying to send > 800k, this is way too much + Slog.wtfStack(TAG, msg + parcel.dataSize()); + } + } + private native final void init(); private native final void destroy(); @@ -424,6 +432,7 @@ public class Binder implements IBinder { reply.writeException(re); res = true; } + checkParcel(reply, "Unreasonably large binder reply buffer: "); reply.recycle(); data.recycle(); return res; @@ -433,13 +442,18 @@ public class Binder implements IBinder { final class BinderProxy implements IBinder { public native boolean pingBinder(); public native boolean isBinderAlive(); - + public IInterface queryLocalInterface(String descriptor) { return null; } - + + public boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { + Binder.checkParcel(data, "Unreasonably large binder buffer: "); + return transactNative(code, data, reply, flags); + } + public native String getInterfaceDescriptor() throws RemoteException; - public native boolean transact(int code, Parcel data, Parcel reply, + public native boolean transactNative(int code, Parcel data, Parcel reply, int flags) throws RemoteException; public native void linkToDeath(DeathRecipient recipient, int flags) throws RemoteException; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 440b1ec..ec4a53e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -978,6 +978,19 @@ public final class Settings { public static final String EXTRA_INPUT_METHOD_ID = "input_method_id"; /** + * Activity Extra: The device identifier to act upon. + * <p> + * This can be passed as an extra field in an Activity Intent with a single + * InputDeviceIdentifier. This field is used by some activities to jump straight into the + * settings for the given device. + * <p> + * Example: The {@link #INPUT_METHOD_SETTINGS} intent opens the keyboard layout dialog for the + * given device. + * @hide + */ + public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier"; + + /** * @hide * Activity Extra: Enable or disable Airplane Mode. * <p> diff --git a/core/java/android/speech/tts/SynthesisRequest.java b/core/java/android/speech/tts/SynthesisRequest.java index d41aa67..6262fcb 100644 --- a/core/java/android/speech/tts/SynthesisRequest.java +++ b/core/java/android/speech/tts/SynthesisRequest.java @@ -61,7 +61,7 @@ public final class SynthesisRequest { /** * Gets the text which should be synthesized. - * @deprecated As of API level 20, replaced by {@link #getCharSequenceText}. + * @deprecated As of API level 21, replaced by {@link #getCharSequenceText}. */ @Deprecated public String getText() { diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 120c9e3..c59ca8a 100644 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -575,7 +575,7 @@ public class TextToSpeech { * @see TextToSpeech#synthesizeToFile(String, java.util.HashMap, String) * @see TextToSpeech#getFeatures(java.util.Locale) * - * @deprecated Starting from API level 20, to select network synthesis, call + * @deprecated Starting from API level 21, to select network synthesis, call * ({@link TextToSpeech#getVoices()}, find a suitable network voice * ({@link Voice#isNetworkConnectionRequired()}) and pass it * to {@link TextToSpeech#setVoice(Voice)}). @@ -593,7 +593,7 @@ public class TextToSpeech { * @see TextToSpeech#synthesizeToFile(String, java.util.HashMap, String) * @see TextToSpeech#getFeatures(java.util.Locale) - * @deprecated Starting from API level 20, to select embedded synthesis, call + * @deprecated Starting from API level 21, to select embedded synthesis, call * ({@link TextToSpeech#getVoices()}, find a suitable embedded voice * ({@link Voice#isNetworkConnectionRequired()}) and pass it * to {@link TextToSpeech#setVoice(Voice)}). @@ -1015,7 +1015,7 @@ public class TextToSpeech { * * @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}. * - * @deprecated As of API level 20, replaced by + * @deprecated As of API level 21, replaced by * {@link #addEarcon(String, File)}. */ @Deprecated @@ -1124,7 +1124,7 @@ public class TextToSpeech { * engine named "com.svox.pico" if it is being used. * * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the speak operation. - * @deprecated As of API level 20, replaced by + * @deprecated As of API level 21, replaced by * {@link #speak(CharSequence, int, Bundle, String)}. */ @Deprecated @@ -1194,7 +1194,7 @@ public class TextToSpeech { * engine named "com.svox.pico" if it is being used. * * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playEarcon operation. - * @deprecated As of API level 20, replaced by + * @deprecated As of API level 21, replaced by * {@link #playEarcon(String, int, Bundle, String)}. */ @Deprecated @@ -1218,9 +1218,9 @@ public class TextToSpeech { * @param queueMode {@link #QUEUE_ADD} or {@link #QUEUE_FLUSH}. * @param utteranceId An unique identifier for this request. * - * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playSilence operation. + * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playSilentUtterance operation. */ - public int playSilence(final long durationInMs, final int queueMode, + public int playSilentUtterance(final long durationInMs, final int queueMode, final String utteranceId) { return runAction(new Action<Integer>() { @Override @@ -1228,7 +1228,7 @@ public class TextToSpeech { return service.playSilence(getCallerIdentity(), durationInMs, queueMode, utteranceId); } - }, ERROR, "playSilence"); + }, ERROR, "playSilentUtterance"); } /** @@ -1252,13 +1252,13 @@ public class TextToSpeech { * engine named "com.svox.pico" if it is being used. * * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playSilence operation. - * @deprecated As of API level 20, replaced by - * {@link #playSilence(long, int, String)}. + * @deprecated As of API level 21, replaced by + * {@link #playSilentUtterance(long, int, String)}. */ @Deprecated public int playSilence(final long durationInMs, final int queueMode, final HashMap<String, String> params) { - return playSilence(durationInMs, queueMode, + return playSilentUtterance(durationInMs, queueMode, params == null ? null : params.get(Engine.KEY_PARAM_UTTERANCE_ID)); } @@ -1276,7 +1276,7 @@ public class TextToSpeech { * * @param locale The locale to query features for. * @return Set instance. May return {@code null} on error. - * @deprecated As of API level 20, please use voices. In order to query features of the voice, + * @deprecated As of API level 21, please use voices. In order to query features of the voice, * call {@link #getVoices()} to retrieve the list of available voices and * {@link Voice#getFeatures()} to retrieve the set of features. */ @@ -1421,7 +1421,7 @@ public class TextToSpeech { * * @return language, country (if any) and variant (if any) used by the client stored in a * Locale instance, or {@code null} on error. - * @deprecated As of API Level 20, use <code>getDefaultVoice().getLocale()</code> ({@link + * @deprecated As of API level 21, use <code>getDefaultVoice().getLocale()</code> ({@link * #getDefaultVoice()}) */ @Deprecated @@ -1476,7 +1476,7 @@ public class TextToSpeech { String variant = loc.getVariant(); - // As of API level 20, setLanguage is implemented using setVoice. + // As of API level 21, setLanguage is implemented using setVoice. // (which, in the default implementation, will call loadLanguage on the service // interface). @@ -1535,7 +1535,7 @@ public class TextToSpeech { * @return language, country (if any) and variant (if any) used by the client stored in a * Locale instance, or {@code null} on error. * - * @deprecated As of API level 20, please use <code>getVoice().getLocale()</code> + * @deprecated As of API level 21, please use <code>getVoice().getLocale()</code> * ({@link #getVoice()}). */ @Deprecated @@ -1831,7 +1831,7 @@ public class TextToSpeech { * something like "/sdcard/myappsounds/mysound.wav". * * @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the synthesizeToFile operation. - * @deprecated As of API level 20, replaced by + * @deprecated As of API level 21, replaced by * {@link #synthesizeToFile(CharSequence, Bundle, File, String)}. */ @Deprecated diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index 079467a..9bb7f02 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -91,7 +91,7 @@ import java.util.Set; * The first three methods are siblings of the {@link #onGetLanguage}, * {@link #onIsLanguageAvailable} and {@link #onLoadLanguage} methods. The last one, * {@link #onGetDefaultVoiceNameFor(String, String, String)} is a link between locale and voice - * based methods. Since API level 20 {@link TextToSpeech#setLanguage} is implemented by + * based methods. Since API level 21 {@link TextToSpeech#setLanguage} is implemented by * calling {@link TextToSpeech#setVoice} with the voice returned by * {@link #onGetDefaultVoiceNameFor(String, String, String)}. * diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index 946a3f7..c855e57 100644 --- a/core/java/android/util/DisplayMetrics.java +++ b/core/java/android/util/DisplayMetrics.java @@ -81,7 +81,7 @@ public class DisplayMetrics { /** * Intermediate density for screens that sit somewhere between - * {@link #DENSITY_XXHIGH} (480 dpi) and {@link #DENSITY_XXXHIGH} (560 dpi). + * {@link #DENSITY_XXHIGH} (480 dpi) and {@link #DENSITY_XXXHIGH} (640 dpi). * This is not a density that applications should target, instead relying * on the system to scale their {@link #DENSITY_XXXHIGH} assets for them. */ diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java index a283b91..baa133d 100644 --- a/core/java/android/view/AccessibilityInteractionController.java +++ b/core/java/android/view/AccessibilityInteractionController.java @@ -889,7 +889,13 @@ final class AccessibilityInteractionController { } } } else { - AccessibilityNodeInfo root = provider.createAccessibilityNodeInfo(virtualViewId); + final AccessibilityNodeInfo root; + if (virtualViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) { + root = provider.createAccessibilityNodeInfo(virtualViewId); + } else { + root = provider.createAccessibilityNodeInfo( + AccessibilityNodeProvider.HOST_VIEW_ID); + } if (root != null) { outInfos.add(root); if ((fetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS) != 0) { diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 2b8b4dc..0439168 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1493,11 +1493,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te super.onInitializeAccessibilityNodeInfo(info); info.setClassName(AbsListView.class.getName()); if (isEnabled()) { - if (getFirstVisiblePosition() > 0) { + if (canScrollUp()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); info.setScrollable(true); } - if (getLastVisiblePosition() < getCount() - 1) { + if (canScrollDown()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.setScrollable(true); } @@ -2203,36 +2203,44 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te void updateScrollIndicators() { if (mScrollUp != null) { - boolean canScrollUp; - // 0th element is not visible - canScrollUp = mFirstPosition > 0; - - // ... Or top of 0th element is not visible - if (!canScrollUp) { - if (getChildCount() > 0) { - View child = getChildAt(0); - canScrollUp = child.getTop() < mListPadding.top; - } - } - - mScrollUp.setVisibility(canScrollUp ? View.VISIBLE : View.INVISIBLE); + mScrollUp.setVisibility(canScrollUp() ? View.VISIBLE : View.INVISIBLE); } if (mScrollDown != null) { - boolean canScrollDown; - int count = getChildCount(); + mScrollDown.setVisibility(canScrollDown() ? View.VISIBLE : View.INVISIBLE); + } + } - // Last item is not visible - canScrollDown = (mFirstPosition + count) < mItemCount; + private boolean canScrollUp() { + boolean canScrollUp; + // 0th element is not visible + canScrollUp = mFirstPosition > 0; - // ... Or bottom of the last element is not visible - if (!canScrollDown && count > 0) { - View child = getChildAt(count - 1); - canScrollDown = child.getBottom() > mBottom - mListPadding.bottom; + // ... Or top of 0th element is not visible + if (!canScrollUp) { + if (getChildCount() > 0) { + View child = getChildAt(0); + canScrollUp = child.getTop() < mListPadding.top; } + } + + return canScrollUp; + } - mScrollDown.setVisibility(canScrollDown ? View.VISIBLE : View.INVISIBLE); + private boolean canScrollDown() { + boolean canScrollDown; + int count = getChildCount(); + + // Last item is not visible + canScrollDown = (mFirstPosition + count) < mItemCount; + + // ... Or bottom of the last element is not visible + if (!canScrollDown && count > 0) { + View child = getChildAt(count - 1); + canScrollDown = child.getBottom() > mBottom - mListPadding.bottom; } + + return canScrollDown; } @Override diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java index 22600de..5685ad7 100644 --- a/core/java/com/android/internal/app/ResolverActivity.java +++ b/core/java/com/android/internal/app/ResolverActivity.java @@ -128,7 +128,10 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic com.android.internal.R.string.whichSendApplicationNamed), DEFAULT(null, com.android.internal.R.string.whichApplication, - com.android.internal.R.string.whichApplicationNamed); + com.android.internal.R.string.whichApplicationNamed), + HOME(Intent.ACTION_MAIN, + com.android.internal.R.string.whichHomeApplication, + com.android.internal.R.string.whichHomeApplicationNamed); public final String action; public final int titleRes; @@ -142,7 +145,7 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic public static ActionTitle forAction(String action) { for (ActionTitle title : values()) { - if (action != null && action.equals(title.action)) { + if (title != HOME && action != null && action.equals(title.action)) { return title; } } @@ -165,26 +168,19 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic @Override protected void onCreate(Bundle savedInstanceState) { // Use a specialized prompt when we're handling the 'Home' app startActivity() - final int titleResource; final Intent intent = makeMyIntent(); final Set<String> categories = intent.getCategories(); if (Intent.ACTION_MAIN.equals(intent.getAction()) && categories != null && categories.size() == 1 && categories.contains(Intent.CATEGORY_HOME)) { - titleResource = com.android.internal.R.string.whichHomeApplication; - // Note: this field is not set to true in the compatibility version. mResolvingHome = true; - } else { - titleResource = 0; } setSafeForwardingMode(true); - onCreate(savedInstanceState, intent, - titleResource != 0 ? getResources().getText(titleResource) : null, titleResource, - null, null, true); + onCreate(savedInstanceState, intent, null, 0, null, null, true); } /** @@ -336,7 +332,7 @@ public class ResolverActivity extends Activity implements AdapterView.OnItemClic } protected CharSequence getTitleForAction(String action, int defaultTitleRes) { - final ActionTitle title = ActionTitle.forAction(action); + final ActionTitle title = mResolvingHome ? ActionTitle.HOME : ActionTitle.forAction(action); final boolean named = mAdapter.hasFilteredItem(); if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) { return getString(defaultTitleRes); diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 1a2d6ce..85b58aa 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -780,9 +780,9 @@ public class LockPatternUtils { */ public void saveLockPassword(String password, int quality, boolean isFallback, int userHandle) { try { - getLockSettings().setLockPassword(password, userHandle); DevicePolicyManager dpm = getDevicePolicyManager(); if (!TextUtils.isEmpty(password)) { + getLockSettings().setLockPassword(password, userHandle); int computedQuality = computePasswordQuality(password); if (userHandle == UserHandle.USER_OWNER) { @@ -860,6 +860,7 @@ public class LockPatternUtils { setString(PASSWORD_HISTORY_KEY, passwordHistory, userHandle); } else { // Empty password + getLockSettings().setLockPassword(null, userHandle); if (userHandle == UserHandle.USER_OWNER) { // Set the encryption password to default. updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null); |
