diff options
| author | Xin Li <delphij@google.com> | 2019-02-14 22:11:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-02-14 22:11:32 +0000 |
| commit | 07ec9dbec5945e5e97c1b2842acdba6f74e6ebbc (patch) | |
| tree | 4da966be25185356ad2186dca8fde9debfeccf8f /core/java | |
| parent | 98e94aee7ca7653b06301de157d0af6ca1df9531 (diff) | |
| parent | 0e71b4f19ba602c8c646744e690ab01c69808b42 (diff) | |
Merge "DO NOT MERGE - Merge pi-platform-release (PPRL.190205.001) into stage-aosp-master" into stage-aosp-master
Diffstat (limited to 'core/java')
87 files changed, 445 insertions, 214 deletions
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index cd0ef6f0e403..28d9a90005a0 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -75,7 +75,7 @@ import java.util.List; * follows the established service life cycle. Starting an accessibility service is triggered * exclusively by the user explicitly turning the service on in device settings. After the system * binds to a service, it calls {@link AccessibilityService#onServiceConnected()}. This method can - * be overriden by clients that want to perform post binding setup. + * be overridden by clients that want to perform post binding setup. * </p> * <p> * An accessibility service stops either when the user turns it off in device settings or when diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index f0a0e88310f9..76c5a4732463 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -200,8 +200,8 @@ public class AccessibilityServiceInfo implements Parcelable { * semantics in the context of the screen content. For example, a three by three * grid can be implemented as three horizontal linear layouts and one vertical, * or three vertical linear layouts and one horizontal, or one grid layout, etc. - * In this context the actual layout mangers used to achieve the grid configuration - * are not important, rather it is important that there are nine evenly distributed + * In this context, the actual layout managers used to achieve the grid configuration + * are not important; rather it is important that there are nine evenly distributed * elements. * </p> */ diff --git a/core/java/android/accounts/AbstractAccountAuthenticator.java b/core/java/android/accounts/AbstractAccountAuthenticator.java index a3b3a9f21954..79d1361192e3 100644 --- a/core/java/android/accounts/AbstractAccountAuthenticator.java +++ b/core/java/android/accounts/AbstractAccountAuthenticator.java @@ -17,7 +17,6 @@ package android.accounts; import android.Manifest; -import android.annotation.SystemApi; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -32,8 +31,8 @@ import java.util.Arrays; /** * Abstract base class for creating AccountAuthenticators. - * In order to be an authenticator one must extend this class, provider implementations for the - * abstract methods and write a service that returns the result of {@link #getIBinder()} + * In order to be an authenticator one must extend this class, provide implementations for the + * abstract methods, and write a service that returns the result of {@link #getIBinder()} * in the service's {@link android.app.Service#onBind(android.content.Intent)} when invoked * with an intent with action {@link AccountManager#ACTION_AUTHENTICATOR_INTENT}. This service * must specify the following intent filter and metadata tags in its AndroidManifest.xml file diff --git a/core/java/android/accounts/AccountAuthenticatorActivity.java b/core/java/android/accounts/AccountAuthenticatorActivity.java index f9284e67f9c3..967aa0424b1d 100644 --- a/core/java/android/accounts/AccountAuthenticatorActivity.java +++ b/core/java/android/accounts/AccountAuthenticatorActivity.java @@ -48,7 +48,7 @@ public class AccountAuthenticatorActivity extends Activity { } /** - * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the + * Retrieves the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero. * @param icicle the save instance data of this Activity, may be null */ diff --git a/core/java/android/animation/Keyframe.java b/core/java/android/animation/Keyframe.java index 5483c49aef54..bcb94d11ea3c 100644 --- a/core/java/android/animation/Keyframe.java +++ b/core/java/android/animation/Keyframe.java @@ -76,7 +76,7 @@ public abstract class Keyframe implements Cloneable { * @param fraction The time, expressed as a value between 0 and 1, representing the fraction * of time elapsed of the overall animation duration. * @param value The value that the object will animate to as the animation time approaches - * the time in this keyframe, and the the value animated from as the time passes the time in + * the time in this keyframe, and the value animated from as the time passes the time in * this keyframe. */ public static Keyframe ofInt(float fraction, int value) { @@ -108,7 +108,7 @@ public abstract class Keyframe implements Cloneable { * @param fraction The time, expressed as a value between 0 and 1, representing the fraction * of time elapsed of the overall animation duration. * @param value The value that the object will animate to as the animation time approaches - * the time in this keyframe, and the the value animated from as the time passes the time in + * the time in this keyframe, and the value animated from as the time passes the time in * this keyframe. */ public static Keyframe ofFloat(float fraction, float value) { @@ -140,7 +140,7 @@ public abstract class Keyframe implements Cloneable { * @param fraction The time, expressed as a value between 0 and 1, representing the fraction * of time elapsed of the overall animation duration. * @param value The value that the object will animate to as the animation time approaches - * the time in this keyframe, and the the value animated from as the time passes the time in + * the time in this keyframe, and the value animated from as the time passes the time in * this keyframe. */ public static Keyframe ofObject(float fraction, Object value) { diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index aeeaa519e2f5..4b4611ee4f84 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -392,7 +392,7 @@ import java.util.List; * <td>The final call you receive before your * activity is destroyed. This can happen either because the * activity is finishing (someone called {@link Activity#finish} on - * it, or because the system is temporarily destroying this + * it), or because the system is temporarily destroying this * instance of the activity to save space. You can distinguish * between these two scenarios with the {@link * Activity#isFinishing} method.</td> @@ -543,12 +543,12 @@ import java.util.List; * <a name="SavingPersistentState"></a> * <h3>Saving Persistent State</h3> * - * <p>There are generally two kinds of persistent state than an activity + * <p>There are generally two kinds of persistent state that an activity * will deal with: shared document-like data (typically stored in a SQLite * database using a {@linkplain android.content.ContentProvider content provider}) * and internal state such as user preferences.</p> * - * <p>For content provider data, we suggest that activities use a + * <p>For content provider data, we suggest that activities use an * "edit in place" user model. That is, any edits a user makes are effectively * made immediately without requiring an additional confirmation step. * Supporting this model is generally a simple matter of following two rules:</p> @@ -1372,6 +1372,7 @@ public class Activity extends ContextThemeWrapper if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this); getApplication().dispatchActivityResumed(this); mActivityTransitionState.onResume(this, isTopOfTask()); + enableAutofillCompatibilityIfNeeded(); if (mAutoFillResetNeeded) { if (!mAutoFillIgnoreFirstResumePause) { View focus = getCurrentFocus(); @@ -1967,7 +1968,7 @@ public class Activity extends ContextThemeWrapper /** * Perform any final cleanup before an activity is destroyed. This can * happen either because the activity is finishing (someone called - * {@link #finish} on it, or because the system is temporarily destroying + * {@link #finish} on it), or because the system is temporarily destroying * this instance of the activity to save space. You can distinguish * between these two scenarios with the {@link #isFinishing} method. * @@ -2933,7 +2934,7 @@ public class Activity extends ContextThemeWrapper /** * Use with {@link #setDefaultKeyMode} to specify that unhandled keystrokes * will start an application-defined search. (If the application or activity does not - * actually define a search, the the keys will be ignored.) + * actually define a search, the keys will be ignored.) * * <p>See {@link android.app.SearchManager android.app.SearchManager} for more details. * @@ -3233,7 +3234,7 @@ public class Activity extends ContextThemeWrapper * interacted with the device in some way while your activity is running. * This callback and {@link #onUserLeaveHint} are intended to help * activities manage status bar notifications intelligently; specifically, - * for helping activities determine the proper time to cancel a notfication. + * for helping activities determine the proper time to cancel a notification. * * <p>All calls to your activity's {@link #onUserLeaveHint} callback will * be accompanied by calls to {@link #onUserInteraction}. This @@ -7148,7 +7149,6 @@ public class Activity extends ContextThemeWrapper mWindow.setColorMode(info.colorMode); setAutofillCompatibilityEnabled(application.isAutofillCompatibilityEnabled()); - enableAutofillCompatibilityIfNeeded(); } private void enableAutofillCompatibilityIfNeeded() { @@ -7848,7 +7848,7 @@ public class Activity extends ContextThemeWrapper } /** - * Specifies whether an {@link Activity} should be shown on top of the the lock screen whenever + * Specifies whether an {@link Activity} should be shown on top of the lock screen whenever * the lockscreen is up and the activity is resumed. Normally an activity will be transitioned * to the stopped state if it is started while the lockscreen is up, but with this flag set the * activity will remain in the resumed state visible on-top of the lock screen. This value can diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index b2b85d442301..d4e17a89c97b 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -960,14 +960,15 @@ public class ActivityOptions { } /** - * Sets the bounds (window size) that the activity should be launched in. + * Sets the bounds (window size and position) that the activity should be launched in. * Rect position should be provided in pixels and in screen coordinates. - * Set to null explicitly for fullscreen. + * Set to {@code null} to explicitly launch fullscreen. * <p> - * <strong>NOTE:<strong/> This value is ignored on devices that don't have + * <strong>NOTE:</strong> This value is ignored on devices that don't have * {@link android.content.pm.PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT} or * {@link android.content.pm.PackageManager#FEATURE_PICTURE_IN_PICTURE} enabled. - * @param screenSpacePixelRect Launch bounds to use for the activity or null for fullscreen. + * @param screenSpacePixelRect launch bounds or {@code null} for fullscreen + * @return {@code this} {@link ActivityOptions} instance */ public ActivityOptions setLaunchBounds(@Nullable Rect screenSpacePixelRect) { mLaunchBounds = screenSpacePixelRect != null ? new Rect(screenSpacePixelRect) : null; @@ -1478,7 +1479,7 @@ public class ActivityOptions { } /** - * Ask the the system track that time the user spends in the app being launched, and + * Ask the system track that time the user spends in the app being launched, and * report it back once done. The report will be sent to the given receiver, with * the extras {@link #EXTRA_USAGE_TIME_REPORT} and {@link #EXTRA_USAGE_TIME_REPORT_PACKAGES} * filled in. diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index dbc8c5d1727b..cf40e067e5b1 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -397,7 +397,7 @@ public class AlertDialog extends Dialog implements DialogInterface { * @param listener The {@link DialogInterface.OnClickListener} to use. * @deprecated Use * {@link #setButton(int, CharSequence, android.content.DialogInterface.OnClickListener)} - * with {@link DialogInterface#BUTTON_POSITIVE} + * with {@link DialogInterface#BUTTON_NEUTRAL} */ @Deprecated public void setButton3(CharSequence text, final OnClickListener listener) { diff --git a/core/java/android/app/DatePickerDialog.java b/core/java/android/app/DatePickerDialog.java index 37a05f0e1d3a..9d82ffa838ca 100644 --- a/core/java/android/app/DatePickerDialog.java +++ b/core/java/android/app/DatePickerDialog.java @@ -239,7 +239,7 @@ public class DatePickerDialog extends AlertDialog implements OnClickListener, * @param year the selected year * @param month the selected month (0-11 for compatibility with * {@link Calendar#MONTH}) - * @param dayOfMonth th selected day of the month (1-31, depending on + * @param dayOfMonth the selected day of the month (1-31, depending on * month) */ void onDateSet(DatePicker view, int year, int month, int dayOfMonth); diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java index 6f3b3a3f9090..4f121aa35f7c 100644 --- a/core/java/android/app/Fragment.java +++ b/core/java/android/app/Fragment.java @@ -2259,7 +2259,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene } /** - * Sets whether the the exit transition and enter transition overlap or not. + * Sets whether the exit transition and enter transition overlap or not. * When true, the enter transition will start as soon as possible. When false, the * enter transition will wait until the exit transition completes before starting. * @@ -2272,7 +2272,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene } /** - * Returns whether the the exit transition and enter transition overlap or not. + * Returns whether the exit transition and enter transition overlap or not. * When true, the enter transition will start as soon as possible. When false, the * enter transition will wait until the exit transition completes before starting. * @@ -2286,7 +2286,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene } /** - * Sets whether the the return transition and reenter transition overlap or not. + * Sets whether the return transition and reenter transition overlap or not. * When true, the reenter transition will start as soon as possible. When false, the * reenter transition will wait until the return transition completes before starting. * @@ -2299,7 +2299,7 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene } /** - * Returns whether the the return transition and reenter transition overlap or not. + * Returns whether the return transition and reenter transition overlap or not. * When true, the reenter transition will start as soon as possible. When false, the * reenter transition will wait until the return transition completes before starting. * diff --git a/core/java/android/app/FragmentHostCallback.java b/core/java/android/app/FragmentHostCallback.java index 1a12fdc40886..26b4a11f4c10 100644 --- a/core/java/android/app/FragmentHostCallback.java +++ b/core/java/android/app/FragmentHostCallback.java @@ -53,7 +53,7 @@ public abstract class FragmentHostCallback<E> extends FragmentContainer { private ArrayMap<String, LoaderManager> mAllLoaderManagers; /** Whether or not fragment loaders should retain their state */ private boolean mRetainLoaders; - /** The loader manger for the fragment host [i.e. Activity#getLoaderManager()] */ + /** The loader manager for the fragment host [i.e. Activity#getLoaderManager()] */ private LoaderManagerImpl mLoaderManager; private boolean mCheckedForLoaderManager; /** Whether or not the fragment host loader manager was started */ diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl index 569c2bd37b6a..b192021f821b 100644 --- a/core/java/android/app/IActivityManager.aidl +++ b/core/java/android/app/IActivityManager.aidl @@ -121,7 +121,7 @@ interface IActivityManager { oneway void activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling); void activityPaused(in IBinder token); - oneway void activityStopped(in IBinder token, in Bundle state, + void activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description); String getCallingPackage(in IBinder token); ComponentName getCallingActivity(in IBinder token); diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 5d2f620310e0..174b94eff5f8 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -1755,7 +1755,7 @@ public class Instrumentation { /** * Like {@link #execStartActivity(android.content.Context, android.os.IBinder, * android.os.IBinder, String, android.content.Intent, int, android.os.Bundle)}, - * but for calls from a {#link Fragment}. + * but for calls from a {@link Fragment}. * * @param who The Context from which the activity is being started. * @param contextThread The main thread of the Context from which the activity diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java index 1db111af0b10..fb933bd980c7 100644 --- a/core/java/android/app/KeyguardManager.java +++ b/core/java/android/app/KeyguardManager.java @@ -35,7 +35,6 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; -import android.os.UserHandle; import android.provider.Settings; import android.service.persistentdata.IPersistentDataBlockService; import android.util.Log; @@ -561,7 +560,7 @@ public class KeyguardManager { * This will, if the keyguard is secure, bring up the unlock screen of * the keyguard. * - * @param callback Let's you know whether the operation was succesful and + * @param callback Lets you know whether the operation was successful and * it is safe to launch anything that would normally be considered safe * once the user has gotten past the keyguard. */ diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index ae59fdf0bd1c..97349fe76a97 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -3494,7 +3494,7 @@ public class Notification implements Parcelable /** * Set the small icon, which will be used to represent the notification in the - * status bar and content view (unless overriden there by a + * status bar and content view (unless overridden there by a * {@link #setLargeIcon(Bitmap) large icon}). * * @param icon An Icon object to use. @@ -6198,7 +6198,7 @@ public class Notification implements Parcelable public abstract boolean areNotificationsVisiblyDifferent(Style other); /** - * @return the the text that should be displayed in the statusBar when heads-upped. + * @return the text that should be displayed in the statusBar when heads-upped. * If {@code null} is returned, the default implementation will be used. * * @hide @@ -6685,7 +6685,7 @@ public class Notification implements Parcelable } /** - * @return the the text that should be displayed in the statusBar when heads upped. + * @return the text that should be displayed in the statusBar when heads upped. * If {@code null} is returned, the default implementation will be used. * * @hide @@ -7341,7 +7341,7 @@ public class Notification implements Parcelable } /** - * Get the the Uri pointing to the content of the message. Can be null, in which case + * Get the Uri pointing to the content of the message. Can be null, in which case * {@see #getText()} is used. */ public Uri getDataUri() { diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index 4fb19084eef6..3d024073fafc 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -169,7 +169,7 @@ public class SearchManager * Intent extra data key: Use this key with Intent.ACTION_SEARCH and * {@link android.content.Intent#getStringExtra content.Intent.getStringExtra()} * to obtain the action message that was defined for a particular search action key and/or - * suggestion. It will be null if the search was launched by typing "enter", touched the the + * suggestion. It will be null if the search was launched by typing "enter", touching the * "GO" button, or other means not involving any action key. */ public final static String ACTION_MSG = "action_msg"; @@ -404,7 +404,7 @@ public class SearchManager * Column name for suggestions cursor. <i>Optional.</i> If your content is rentable, you * should provide this column to specify the displayable string representation of the rental * price of your content including the currency and the amount. If it's free, you should - * provide localized string to specify that it's free. This column can be ommitted if the + * provide localized string to specify that it's free. This column can be omitted if the * content is not applicable to rent. */ public final static String SUGGEST_COLUMN_RENTAL_PRICE = "suggest_rental_price"; @@ -579,7 +579,7 @@ public class SearchManager * * @param initialQuery A search string can be pre-entered here, but this * is typically null or empty. - * @param selectInitialQuery If true, the intial query will be preselected, which means that + * @param selectInitialQuery If true, the initial query will be preselected, which means that * any further typing will replace it. This is useful for cases where an entire pre-formed * query is being inserted. If false, the selection point will be placed at the end of the * inserted query. This is useful when the inserted query is text that the user entered, diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 67acfe906915..16f6bdaa4313 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -21,13 +21,13 @@ import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.content.ComponentCallbacks2; import android.content.ComponentName; -import android.content.Intent; -import android.content.ContextWrapper; import android.content.Context; +import android.content.ContextWrapper; +import android.content.Intent; import android.content.res.Configuration; import android.os.Build; -import android.os.RemoteException; import android.os.IBinder; +import android.os.RemoteException; import android.util.Log; import java.io.FileDescriptor; @@ -391,7 +391,7 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * don't recreate until a future explicit call to * {@link Context#startService Context.startService(Intent)}. The * service will not receive a {@link #onStartCommand(Intent, int, int)} - * call with a null Intent because it will not be re-started if there + * call with a null Intent because it will not be restarted if there * are no pending Intents to deliver. * * <p>This mode makes sense for things that want to do some work as a @@ -416,7 +416,7 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * redelivery until the service calls {@link #stopSelf(int)} with the * start ID provided to {@link #onStartCommand}. The * service will not receive a {@link #onStartCommand(Intent, int, int)} - * call with a null Intent because it will will only be re-started if + * call with a null Intent because it will only be restarted if * it is not finished processing all Intents sent to it (and any such * pending events will be delivered at the point of restart). */ diff --git a/core/java/android/app/UiModeManager.java b/core/java/android/app/UiModeManager.java index 4f172a4251d4..a554882123f1 100644 --- a/core/java/android/app/UiModeManager.java +++ b/core/java/android/app/UiModeManager.java @@ -25,7 +25,6 @@ import android.content.res.Configuration; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager.ServiceNotFoundException; -import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -214,7 +213,7 @@ public class UiModeManager { } /** - * Sets the night mode. + * Sets the system-wide night mode. * <p> * The mode can be one of: * <ul> @@ -231,6 +230,12 @@ public class UiModeManager { * are only effective when the {@link Configuration#UI_MODE_TYPE_CAR car} * or {@link Configuration#UI_MODE_TYPE_DESK desk} mode is enabled on a * device. Starting in API 23, changes to night mode are always effective. + * <p> + * Changes to night mode take effect globally and will result in a configuration change + * (and potentially an Activity lifecycle event) being applied to all running apps. + * Developers interested in an app-local implementation of night mode should consider using + * {@link android.support.v7.app.AppCompatDelegate#setDefaultNightMode(int)} to manage the + * -night qualifier locally. * * @param mode the night mode to set * @see #getNightMode() diff --git a/core/java/android/app/WaitResult.java b/core/java/android/app/WaitResult.java index 898d0cabee3e..5baf2e22bc31 100644 --- a/core/java/android/app/WaitResult.java +++ b/core/java/android/app/WaitResult.java @@ -28,10 +28,10 @@ import java.io.PrintWriter; * @hide */ public class WaitResult implements Parcelable { + public static final int INVALID_DELAY = -1; public int result; public boolean timeout; public ComponentName who; - public long thisTime; public long totalTime; public WaitResult() { @@ -47,7 +47,6 @@ public class WaitResult implements Parcelable { dest.writeInt(result); dest.writeInt(timeout ? 1 : 0); ComponentName.writeToParcel(who, dest); - dest.writeLong(thisTime); dest.writeLong(totalTime); } @@ -68,7 +67,6 @@ public class WaitResult implements Parcelable { result = source.readInt(); timeout = source.readInt() != 0; who = ComponentName.readFromParcel(source); - thisTime = source.readLong(); totalTime = source.readLong(); } @@ -77,7 +75,6 @@ public class WaitResult implements Parcelable { pw.println(prefix + " result=" + result); pw.println(prefix + " timeout=" + timeout); pw.println(prefix + " who=" + who); - pw.println(prefix + " thisTime=" + thisTime); pw.println(prefix + " totalTime=" + totalTime); } }
\ No newline at end of file diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 18a006ffff31..3871d7a2418a 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -3306,7 +3306,7 @@ public class DevicePolicyManager { * restrictions on the parent profile. * * @param admin The name of the admin component to check, or {@code null} to aggregate - * accross all participating admins. + * across all participating admins. * @return The timeout in milliseconds or 0 if not configured for the provided admin. */ public long getRequiredStrongAuthTimeout(@Nullable ComponentName admin) { @@ -3890,6 +3890,11 @@ public class DevicePolicyManager { /** * Installs the given certificate as a user CA. + * <p> + * Inserted user CAs aren't automatically trusted by apps in Android 7.0 (API level 24) and + * higher. App developers can change the default behavior for an app by adding a + * <a href="{@docRoot}training/articles/security-config.html">Security Configuration + * File</a> to the app manifest file. * * The caller must be a profile or device owner on that user, or a delegate package given the * {@link #DELEGATION_CERT_INSTALL} scope via {@link #setDelegatedScopes}; otherwise a diff --git a/core/java/android/app/admin/SystemUpdatePolicy.java b/core/java/android/app/admin/SystemUpdatePolicy.java index 96dbc760278f..dd7284540fef 100644 --- a/core/java/android/app/admin/SystemUpdatePolicy.java +++ b/core/java/android/app/admin/SystemUpdatePolicy.java @@ -76,9 +76,7 @@ import java.util.stream.Collectors; * </code></pre> * * <h3>Developer guide</h3> - * To learn more about managing system updates, read - * <a href="{@docRoot}/work/dpc/security.html#control_remote_software_updates">Control remote - * software updates</a>. + * To learn more, read <a href="{@docRoot}work/dpc/system-updates">Manage system updates</a>. * * @see DevicePolicyManager#setSystemUpdatePolicy * @see DevicePolicyManager#getSystemUpdatePolicy diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java index dd61f286c88e..76ade94272a4 100644 --- a/core/java/android/app/assist/AssistStructure.java +++ b/core/java/android/app/assist/AssistStructure.java @@ -1002,7 +1002,7 @@ public class AssistStructure implements Parcelable { } /** - * Gets the the type of value that can be used to autofill the view contents. + * Gets the type of value that can be used to autofill the view contents. * * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes. * @@ -1028,7 +1028,7 @@ public class AssistStructure implements Parcelable { } /** - * Gets the the value of this view. + * Gets the value of this view. * * <p>It's only relevant when the {@link AssistStructure} is used for autofill purposes, * not for assist purposes. @@ -1350,7 +1350,7 @@ public class AssistStructure implements Parcelable { } /** - * Returns the the list of locales associated with this view. + * Returns the list of locales associated with this view. */ @Nullable public LocaleList getLocaleList() { return mLocaleList; diff --git a/core/java/android/app/backup/package.html b/core/java/android/app/backup/package.html index 8b5e3ba3532f..dd6c2546898c 100644 --- a/core/java/android/app/backup/package.html +++ b/core/java/android/app/backup/package.html @@ -11,7 +11,7 @@ href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p> <p>All backup and restore operations are controlled by the {@link android.app.backup.BackupManager}. Each application that would -like to enable backup and preserve its data on remote strage must implement a +like to enable backup and preserve its data on remote storage must implement a backup agent. A backup agent can be built by extending either {@link android.app.backup.BackupAgent} or {@link android.app.backup.BackupAgentHelper}. The {@link android.app.backup.BackupAgentHelper} class provides a wrapper around {@link diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 4afd520c99c5..ab8c196edccd 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -3044,7 +3044,7 @@ public final class BluetoothAdapter { * socket will be encrypted. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming connections from a listening * {@link BluetoothServerSocket}. - * <p>The system will assign a dynamic PSM value. This PSM value can be read from the {#link + * <p>The system will assign a dynamic PSM value. This PSM value can be read from the {@link * BluetoothServerSocket#getPsm()} and this value will be released when this server socket is * closed, Bluetooth is turned off, or the application exits unexpectedly. * <p>The mechanism of disclosing the assigned dynamic PSM value to the initiating peer is @@ -3102,7 +3102,7 @@ public final class BluetoothAdapter { * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming connections from a listening * {@link BluetoothServerSocket}. * <p>The system will assign a dynamic protocol/service multiplexer (PSM) value. This PSM value - * can be read from the {#link BluetoothServerSocket#getPsm()} and this value will be released + * can be read from the {@link BluetoothServerSocket#getPsm()} and this value will be released * when this server socket is closed, Bluetooth is turned off, or the application exits * unexpectedly. * <p>The mechanism of disclosing the assigned dynamic PSM value to the initiating peer is diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java index 2803856fb3bc..193ff6346aef 100644 --- a/core/java/android/bluetooth/BluetoothDevice.java +++ b/core/java/android/bluetooth/BluetoothDevice.java @@ -793,7 +793,7 @@ public final class BluetoothDevice implements Parcelable { public static final int ACCESS_REJECTED = 2; /** - * No preferrence of physical transport for GATT connections to remote dual-mode devices + * No preference of physical transport for GATT connections to remote dual-mode devices */ public static final int TRANSPORT_AUTO = 0; @@ -1799,7 +1799,7 @@ public final class BluetoothDevice implements Parcelable { * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. - * In such a case, use {#link createInsecureRfcommSocket}. + * In such a case, use {@link createInsecureRfcommSocket}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing @@ -1834,7 +1834,7 @@ public final class BluetoothDevice implements Parcelable { * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. - * In such a case, use {#link createInsecureRfcommSocket}. + * In such a case, use {@link createInsecureRfcommSocket}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing @@ -1891,7 +1891,7 @@ public final class BluetoothDevice implements Parcelable { * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. - * In such a case, use {#link createInsecureRfcommSocketToServiceRecord}. + * In such a case, use {@link #createInsecureRfcommSocketToServiceRecord}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Hint: If you are connecting to a Bluetooth serial board then try @@ -2175,7 +2175,7 @@ public final class BluetoothDevice implements Parcelable { * encrypted. * <p> Use this socket if an authenticated socket link is possible. Authentication refers * to the authentication of the link key to prevent man-in-the-middle type of attacks. When a - * secure socket connection is not possible, use {#link createInsecureLeL2capCocSocket(int, + * secure socket connection is not possible, use {@link createInsecureLeL2capCocSocket(int, * int)}. * * @param psm dynamic PSM value from remote device diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index b248b896cdb0..d616b8f92d3a 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -1293,7 +1293,7 @@ public final class BluetoothGatt implements BluetoothProfile { * <p>After all characteristics have been queued up and verified, * {@link #executeReliableWrite} will execute all writes. If a characteristic * was not written correctly, calling {@link #abortReliableWrite} will - * cancel the current transaction without commiting any values on the + * cancel the current transaction without committing any values on the * remote device. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. diff --git a/core/java/android/bluetooth/BluetoothGattServer.java b/core/java/android/bluetooth/BluetoothGattServer.java index ef1b0bd71885..13b1b4f93cf0 100644 --- a/core/java/android/bluetooth/BluetoothGattServer.java +++ b/core/java/android/bluetooth/BluetoothGattServer.java @@ -522,7 +522,7 @@ public final class BluetoothGattServer implements BluetoothProfile { * {@link BluetoothGattServerCallback#onConnectionStateChange} callback will be * invoked when the connection state changes as a result of this function. * - * <p>The autoConnect paramter determines whether to actively connect to + * <p>The autoConnect parameter determines whether to actively connect to * the remote device, or rather passively scan and finalize the connection * when the remote device is in range/available. Generally, the first ever * connection to a device should be direct (autoConnect set to false) and @@ -695,7 +695,7 @@ public final class BluetoothGattServer implements BluetoothProfile { /** * Add a service to the list of services to be hosted. * - * <p>Once a service has been addded to the the list, the service and its + * <p>Once a service has been addded to the list, the service and its * included characteristics will be provided by the local device. * * <p>If the local device has already exposed services when this function diff --git a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java index 237082e4cb66..2f0b44f76ffb 100644 --- a/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java +++ b/core/java/android/bluetooth/BluetoothHidDeviceAppSdpSettings.java @@ -18,6 +18,7 @@ package android.bluetooth; import android.os.Parcel; import android.os.Parcelable; +import android.util.EventLog; /** @@ -30,6 +31,8 @@ import android.os.Parcelable; */ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable { + private static final int MAX_DESCRIPTOR_SIZE = 2048; + private final String mName; private final String mDescription; private final String mProvider; @@ -55,6 +58,12 @@ public final class BluetoothHidDeviceAppSdpSettings implements Parcelable { mDescription = description; mProvider = provider; mSubclass = subclass; + + if (descriptors == null || descriptors.length > MAX_DESCRIPTOR_SIZE) { + EventLog.writeEvent(0x534e4554, "119819889", -1, ""); + throw new IllegalArgumentException("descriptors must be not null and shorter than " + + MAX_DESCRIPTOR_SIZE); + } mDescriptors = descriptors.clone(); } diff --git a/core/java/android/bluetooth/BluetoothServerSocket.java b/core/java/android/bluetooth/BluetoothServerSocket.java index 5fc344a14f99..4e886250b4fa 100644 --- a/core/java/android/bluetooth/BluetoothServerSocket.java +++ b/core/java/android/bluetooth/BluetoothServerSocket.java @@ -203,8 +203,8 @@ public final class BluetoothServerSocket implements Closeable { /** * Returns the assigned dynamic protocol/service multiplexer (PSM) value for the listening L2CAP * Connection-oriented Channel (CoC) server socket. This server socket must be returned by the - * {#link BluetoothAdapter.listenUsingL2capChannel()} or {#link - * BluetoothAdapter.listenUsingInsecureL2capChannel()}. The returned value is undefined if this + * {@link BluetoothAdapter#listenUsingL2capChannel()} or {@link + * BluetoothAdapter#listenUsingInsecureL2capChannel()}. The returned value is undefined if this * method is called on non-L2CAP server sockets. * * @return the assigned PSM or LE_PSM value depending on transport diff --git a/core/java/android/bluetooth/le/AdvertisingSetCallback.java b/core/java/android/bluetooth/le/AdvertisingSetCallback.java index 58a3696fc092..51324fdb01ff 100644 --- a/core/java/android/bluetooth/le/AdvertisingSetCallback.java +++ b/core/java/android/bluetooth/le/AdvertisingSetCallback.java @@ -56,7 +56,7 @@ public abstract class AdvertisingSetCallback { /** * Callback triggered in response to {@link BluetoothLeAdvertiser#startAdvertisingSet} * indicating result of the operation. If status is ADVERTISE_SUCCESS, then advertisingSet - * contains the started set and it is advertising. If error occured, advertisingSet is + * contains the started set and it is advertising. If error occurred, advertisingSet is * null, and status will be set to proper error code. * * @param advertisingSet The advertising set that was started or null if error. diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java index b528e397906f..a086a308d0d9 100644 --- a/core/java/android/content/AbstractThreadedSyncAdapter.java +++ b/core/java/android/content/AbstractThreadedSyncAdapter.java @@ -95,7 +95,7 @@ import java.util.concurrent.atomic.AtomicInteger; * the SyncManager will wait until the sync adapter is not in use before requesting that * it sync an account's data. * <li><code>android:isAlwaysSyncable</code> defaults to false and if true tells the SyncManager - * to intialize the isSyncable state to 1 for that sync adapter for each account that is added. + * to initialize the isSyncable state to 1 for that sync adapter for each account that is added. * <li><code>android:syncAdapterSettingsAction</code> defaults to null and if supplied it * specifies an Intent action of an activity that can be used to adjust the sync adapter's * sync settings. The activity must live in the same package as the sync adapter. diff --git a/core/java/android/content/ClipData.java b/core/java/android/content/ClipData.java index 089cf1098ffc..ed3d4557061e 100644 --- a/core/java/android/content/ClipData.java +++ b/core/java/android/content/ClipData.java @@ -224,7 +224,7 @@ public class ClipData implements Parcelable { * Create an Item consisting of a single block of (possibly styled) text, * with an alternative HTML formatted representation. You <em>must</em> * supply a plain text representation in addition to HTML text; coercion - * will not be done from HTML formated text into plain text. + * will not be done from HTML formatted text into plain text. */ public Item(CharSequence text, String htmlText) { mText = text; @@ -268,7 +268,7 @@ public class ClipData implements Parcelable { * Create a complex Item, containing multiple representations of * text, HTML text, Intent, and/or URI. If providing HTML text, you * <em>must</em> supply a plain text representation as well; coercion - * will not be done from HTML formated text into plain text. + * will not be done from HTML formatted text into plain text. */ public Item(CharSequence text, String htmlText, Intent intent, Uri uri) { if (htmlText != null && text == null) { diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java index d3393b9193ce..2997e984add4 100644 --- a/core/java/android/content/ContentProvider.java +++ b/core/java/android/content/ContentProvider.java @@ -98,6 +98,7 @@ import java.util.Objects; * <p>For more information about using content providers, read the * <a href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a> * developer guide.</p> + * </div> */ public abstract class ContentProvider implements ComponentCallbacks2 { diff --git a/core/java/android/content/ContentProviderOperation.java b/core/java/android/content/ContentProviderOperation.java index 7dc45776715c..6a3fa6b2f197 100644 --- a/core/java/android/content/ContentProviderOperation.java +++ b/core/java/android/content/ContentProviderOperation.java @@ -637,7 +637,7 @@ public class ContentProviderOperation implements Parcelable { /** * The selection and arguments to use. An occurrence of '?' in the selection will be - * replaced with the corresponding occurence of the selection argument. Any of the + * replaced with the corresponding occurrence of the selection argument. Any of the * selection arguments may be overwritten by a selection argument back reference as * specified by {@link #withSelectionBackReference}. * This can only be used with builders of type update, delete, or assert. diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index ac98e12bda3e..69a3b74640b4 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -1868,7 +1868,7 @@ public abstract class ContentResolver { * that services the content at uri, starting the provider if necessary. Returns * null if there is no provider associated wih the uri. The caller must indicate that they are * done with the provider by calling {@link ContentProviderClient#release} which will allow - * the system to release the provider it it determines that there is no other reason for + * the system to release the provider if it determines that there is no other reason for * keeping it active. * @param uri specifies which provider should be acquired * @return a {@link ContentProviderClient} that is associated with the {@link ContentProvider} @@ -1888,7 +1888,7 @@ public abstract class ContentResolver { * with the authority of name, starting the provider if necessary. Returns * null if there is no provider associated wih the uri. The caller must indicate that they are * done with the provider by calling {@link ContentProviderClient#release} which will allow - * the system to release the provider it it determines that there is no other reason for + * the system to release the provider if it determines that there is no other reason for * keeping it active. * @param name specifies which provider should be acquired * @return a {@link ContentProviderClient} that is associated with the {@link ContentProvider} diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 493aac6e5c40..aaa3879503fa 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -188,7 +188,7 @@ public abstract class Context { * * <p>This was the legacy (but undocumented) behavior in and * before Gingerbread (Android 2.3) and this flag is implied when - * targetting such releases. For applications targetting SDK + * targeting such releases. For applications targeting SDK * versions <em>greater than</em> Android 2.3, this flag must be * explicitly set if desired. * @@ -2841,7 +2841,7 @@ public abstract class Context { * * @param service Description of the service to be stopped. The Intent must be either * fully explicit (supplying a component name) or specify a specific package - * name it is targetted to. + * name it is targeted to. * * @return If there is a service matching the given Intent that is already * running, then it is stopped and {@code true} is returned; else {@code false} is returned. @@ -3396,7 +3396,7 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve a - * {@link android.app.NotificationManager} for controlling keyguard. + * {@link android.app.KeyguardManager} for controlling keyguard. * * @see #getSystemService(String) * @see android.app.KeyguardManager diff --git a/core/java/android/content/CursorLoader.java b/core/java/android/content/CursorLoader.java index 4e46d5716c7b..4ccafab741d8 100644 --- a/core/java/android/content/CursorLoader.java +++ b/core/java/android/content/CursorLoader.java @@ -36,7 +36,7 @@ import java.util.Arrays; * perform, either through the * {@link #CursorLoader(Context, Uri, String[], String, String[], String)} or * creating an empty instance with {@link #CursorLoader(Context)} and filling - * in the desired paramters with {@link #setUri(Uri)}, {@link #setSelection(String)}, + * in the desired parameters with {@link #setUri(Uri)}, {@link #setSelection(String)}, * {@link #setSelectionArgs(String[])}, {@link #setSortOrder(String)}, * and {@link #setProjection(String[])}. * diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 2963947c03c6..b879047f05dc 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -5562,7 +5562,7 @@ public class Intent implements Parcelable, Cloneable { /** * If set and this intent is being used to launch a new activity from an * existing one, then the reply target of the existing activity will be - * transfered to the new activity. This way the new activity can call + * transferred to the new activity. This way, the new activity can call * {@link android.app.Activity#setResult} and have that result sent back to * the reply target of the original activity. */ diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index 0469a9006b25..36d8a3720b5e 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -479,7 +479,7 @@ public class IntentFilter implements Parcelable { /** * Modify priority of this filter. This only affects receiver filters. * The priority of activity filters are set in XML and cannot be changed - * programatically. The default priority is 0. Positive values will be + * programmatically. The default priority is 0. Positive values will be * before the default, lower values will be after it. Applications should * use a value that is larger than {@link #SYSTEM_LOW_PRIORITY} and * smaller than {@link #SYSTEM_HIGH_PRIORITY} . diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index da8811a6f636..3f25959f8e8e 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -237,7 +237,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { /** * Value for {@link #flags}: true when the application knows how to - * accomodate different screen densities. Corresponds to + * accommodate different screen densities. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity * android:anyDensity}. */ diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 8cb6ffb47fb9..cd8dc6338612 100644 --- a/core/java/android/content/pm/PackageInfo.java +++ b/core/java/android/content/pm/PackageInfo.java @@ -236,7 +236,7 @@ public class PackageInfo implements Parcelable { /** * Array of all signatures read from the package file. This is only filled * in if the flag {@link PackageManager#GET_SIGNATURES} was set. A package - * must be singed with at least one certificate which is at position zero. + * must be signed with at least one certificate which is at position zero. * The package can be signed with additional certificates which appear as * subsequent entries. * diff --git a/core/java/android/content/res/package.html b/core/java/android/content/res/package.html index 3d0bac18d7b7..3970b16a57e1 100644 --- a/core/java/android/content/res/package.html +++ b/core/java/android/content/res/package.html @@ -1,7 +1,7 @@ <HTML> <BODY> <p>Contains classes for accessing application resources, -such as raw asset files, colors, drawables, media or other other files +such as raw asset files, colors, drawables, media, or other files in the package, plus important device configuration details (orientation, input types, etc.) that affect how the application may behave.</p> @@ -9,4 +9,4 @@ in the package, plus important device configuration details href="{@docRoot}guide/topics/resources/index.html">Application Resources</a> guide.</p> {@more} </BODY> -</HTML>
\ No newline at end of file +</HTML> diff --git a/core/java/android/database/sqlite/SQLiteCompatibilityWalFlags.java b/core/java/android/database/sqlite/SQLiteCompatibilityWalFlags.java index 5bf3a7c43640..06c069c583b5 100644 --- a/core/java/android/database/sqlite/SQLiteCompatibilityWalFlags.java +++ b/core/java/android/database/sqlite/SQLiteCompatibilityWalFlags.java @@ -41,6 +41,7 @@ public class SQLiteCompatibilityWalFlags { private static volatile boolean sFlagsSet; private static volatile boolean sCompatibilityWalSupported; private static volatile String sWALSyncMode; + private static volatile long sTruncateSize = -1; // This flag is used to avoid recursive initialization due to circular dependency on Settings private static volatile boolean sCallingGlobalSettings; @@ -71,6 +72,19 @@ public class SQLiteCompatibilityWalFlags { return sWALSyncMode; } + /** + * Override {@link com.android.internal.R.integer#db_wal_truncate_size}. + * + * @return the value set in the global setting, or -1 if a value is not set. + * + * @hide + */ + @VisibleForTesting + public static long getTruncateSize() { + initIfNeeded(); + return sTruncateSize; + } + private static void initIfNeeded() { if (sInitialized || sCallingGlobalSettings) { return; @@ -115,6 +129,7 @@ public class SQLiteCompatibilityWalFlags { sCompatibilityWalSupported = parser.getBoolean("compatibility_wal_supported", SQLiteGlobal.isCompatibilityWalSupported()); sWALSyncMode = parser.getString("wal_syncmode", SQLiteGlobal.getWALSyncMode()); + sTruncateSize = parser.getInt("truncate_size", -1); Log.i(TAG, "Read compatibility WAL flags: compatibility_wal_supported=" + sCompatibilityWalSupported + ", wal_syncmode=" + sWALSyncMode); sFlagsSet = true; diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java index 101fb821f4ce..9c639a5a9867 100644 --- a/core/java/android/database/sqlite/SQLiteConnection.java +++ b/core/java/android/database/sqlite/SQLiteConnection.java @@ -32,6 +32,7 @@ import android.util.Printer; import dalvik.system.BlockGuard; import dalvik.system.CloseGuard; +import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -303,6 +304,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen } else { setSyncMode(SQLiteGlobal.getWALSyncMode()); } + maybeTruncateWalFile(); } else { setJournalMode(mConfiguration.journalMode == null ? SQLiteGlobal.getDefaultJournalMode() : mConfiguration.journalMode); @@ -312,6 +314,40 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen } } + /** + * If the WAL file exists and larger than a threshold, truncate it by executing + * PRAGMA wal_checkpoint. + */ + private void maybeTruncateWalFile() { + final long threshold = SQLiteGlobal.getWALTruncateSize(); + if (DEBUG) { + Log.d(TAG, "Truncate threshold=" + threshold); + } + if (threshold == 0) { + return; + } + + final File walFile = new File(mConfiguration.path + "-wal"); + if (!walFile.isFile()) { + return; + } + final long size = walFile.length(); + if (size < threshold) { + if (DEBUG) { + Log.d(TAG, walFile.getAbsolutePath() + " " + size + " bytes: No need to truncate"); + } + return; + } + + Log.i(TAG, walFile.getAbsolutePath() + " " + size + " bytes: Bigger than " + + threshold + "; truncating"); + try { + executeForString("PRAGMA wal_checkpoint(TRUNCATE)", null, null); + } catch (SQLiteException e) { + Log.w(TAG, "Failed to truncate the -wal file", e); + } + } + private void setSyncMode(String newValue) { String value = executeForString("PRAGMA synchronous", null, null); if (!canonicalizeSyncMode(value).equalsIgnoreCase( diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java index 01557c59f8ac..eb5c720d6309 100644 --- a/core/java/android/database/sqlite/SQLiteDatabase.java +++ b/core/java/android/database/sqlite/SQLiteDatabase.java @@ -649,7 +649,7 @@ public final class SQLiteDatabase extends SQLiteClosable { * successful so far. Do not call setTransactionSuccessful before calling this. When this * returns a new transaction will have been created but not marked as successful. * @return true if the transaction was yielded - * @deprecated if the db is locked more than once (becuase of nested transactions) then the lock + * @deprecated if the db is locked more than once (because of nested transactions) then the lock * will not be yielded. Use yieldIfContendedSafely instead. */ @Deprecated diff --git a/core/java/android/database/sqlite/SQLiteGlobal.java b/core/java/android/database/sqlite/SQLiteGlobal.java index e6b6acf7b8ee..67e5f65d5a1f 100644 --- a/core/java/android/database/sqlite/SQLiteGlobal.java +++ b/core/java/android/database/sqlite/SQLiteGlobal.java @@ -164,4 +164,21 @@ public final class SQLiteGlobal { com.android.internal.R.integer.db_default_idle_connection_timeout)); } + /** + * When opening a database, if the WAL file is larger than this size, we'll truncate it. + * + * (If it's 0, we do not truncate.) + * + * @hide + */ + public static long getWALTruncateSize() { + final long setting = SQLiteCompatibilityWalFlags.getTruncateSize(); + if (setting >= 0) { + return setting; + } + return SystemProperties.getInt("debug.sqlite.wal.truncatesize", + Resources.getSystem().getInteger( + com.android.internal.R.integer.db_wal_truncate_size)); + } + } diff --git a/core/java/android/database/sqlite/SQLiteStatement.java b/core/java/android/database/sqlite/SQLiteStatement.java index 8f8f67625a33..42e7ac7e8431 100644 --- a/core/java/android/database/sqlite/SQLiteStatement.java +++ b/core/java/android/database/sqlite/SQLiteStatement.java @@ -53,7 +53,7 @@ public final class SQLiteStatement extends SQLiteProgram { } /** - * Execute this SQL statement, if the the number of rows affected by execution of this SQL + * Execute this SQL statement, if the number of rows affected by execution of this SQL * statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements. * * @return the number of rows affected by this SQL statement execution. diff --git a/core/java/android/hardware/GeomagneticField.java b/core/java/android/hardware/GeomagneticField.java index 94f2ac085965..0d7b695d7f1d 100644 --- a/core/java/android/hardware/GeomagneticField.java +++ b/core/java/android/hardware/GeomagneticField.java @@ -31,7 +31,7 @@ import java.util.GregorianCalendar; * Android may use a newer version of the model. */ public class GeomagneticField { - // The magnetic field at a given point, in nonoteslas in geodetic + // The magnetic field at a given point, in nanoteslas in geodetic // coordinates. private float mX; private float mY; @@ -278,7 +278,7 @@ public class GeomagneticField { } /** - * @return Horizontal component of the field strength in nonoteslas. + * @return Horizontal component of the field strength in nanoteslas. */ public float getHorizontalStrength() { return (float) Math.hypot(mX, mY); diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 35584ae21869..a787d77bc964 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -335,10 +335,10 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri /** * <p>Returns a subset of {@link #getAvailableCaptureRequestKeys} keys that can - * be overriden for physical devices backing a logical multi-camera.</p> + * be overridden for physical devices backing a logical multi-camera.</p> * * <p>This is a subset of android.request.availableRequestKeys which contains a list - * of keys that can be overriden using {@link CaptureRequest.Builder#setPhysicalCameraKey }. + * of keys that can be overridden using {@link CaptureRequest.Builder#setPhysicalCameraKey }. * The respective value of such request key can be obtained by calling * {@link CaptureRequest.Builder#getPhysicalCameraKey }. Capture requests that contain * individual physical device requests must be built via @@ -353,7 +353,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * * <p>Each key is only listed once in the list. The order of the keys is undefined.</p> * - * @return List of keys that can be overriden in individual physical device requests. + * @return List of keys that can be overridden in individual physical device requests. * In case the camera device doesn't support such keys the list can be null. */ @SuppressWarnings({"unchecked"}) @@ -1860,10 +1860,10 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<int[]>("android.request.availableSessionKeys", int[].class); /** - * <p>A subset of the available request keys that can be overriden for + * <p>A subset of the available request keys that can be overridden for * physical devices backing a logical multi-camera.</p> * <p>This is a subset of android.request.availableRequestKeys which contains a list - * of keys that can be overriden using {@link CaptureRequest.Builder#setPhysicalCameraKey }. + * of keys that can be overridden using {@link CaptureRequest.Builder#setPhysicalCameraKey }. * The respective value of such request key can be obtained by calling * {@link CaptureRequest.Builder#getPhysicalCameraKey }. Capture requests that contain * individual physical device requests must be built via diff --git a/core/java/android/hardware/camera2/utils/CloseableLock.java b/core/java/android/hardware/camera2/utils/CloseableLock.java index 9ac89c825430..3b8beaccdcd9 100644 --- a/core/java/android/hardware/camera2/utils/CloseableLock.java +++ b/core/java/android/hardware/camera2/utils/CloseableLock.java @@ -290,7 +290,7 @@ public class CloseableLock implements AutoCloseable { /** * Release a single lock that was acquired. * - * <p>Any other other that is blocked and trying to acquire a lock will get a chance + * <p>Any other thread that is blocked and trying to acquire a lock will get a chance * to acquire the lock.</p> * * @throws IllegalStateException if no locks were acquired, or if the lock was already closed diff --git a/core/java/android/hardware/location/NanoAppInstanceInfo.java b/core/java/android/hardware/location/NanoAppInstanceInfo.java index 75fb915708de..2db6a794fe9c 100644 --- a/core/java/android/hardware/location/NanoAppInstanceInfo.java +++ b/core/java/android/hardware/location/NanoAppInstanceInfo.java @@ -24,7 +24,7 @@ import android.os.Parcelable; import libcore.util.EmptyArray; /** - * Describes an instance of a nanoapp, used by the internal state manged by ContextHubService. + * Describes an instance of a nanoapp, used by the internal state managed by ContextHubService. * * TODO(b/69270990) Remove this class once the old API is deprecated. * diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 364962612e71..049e5af56019 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -2085,7 +2085,7 @@ public class InputMethodService extends AbstractInputMethodService { * Called when the application has reported a new location of its text * cursor. This is only called if explicitly requested by the input method. * The default implementation does nothing. - * @deprecated Use {#link onUpdateCursorAnchorInfo(CursorAnchorInfo)} instead. + * @deprecated Use {@link #onUpdateCursorAnchorInfo(CursorAnchorInfo)} instead. */ @Deprecated public void onUpdateCursor(Rect newCursor) { @@ -2152,7 +2152,7 @@ public class InputMethodService extends AbstractInputMethodService { } /** - * @return {#link ExtractEditText} if it is considered to be visible and active. Otherwise + * @return {@link ExtractEditText} if it is considered to be visible and active. Otherwise * {@code null} is returned. */ private ExtractEditText getExtractEditTextIfVisible() { diff --git a/core/java/android/inputmethodservice/SoftInputWindow.java b/core/java/android/inputmethodservice/SoftInputWindow.java index b4b88871d251..0513feef801f 100644 --- a/core/java/android/inputmethodservice/SoftInputWindow.java +++ b/core/java/android/inputmethodservice/SoftInputWindow.java @@ -162,9 +162,9 @@ public class SoftInputWindow extends Dialog { /** * Set which boundary of the screen the DockWindow sticks to. * - * @param gravity The boundary of the screen to stick. See {#link - * android.view.Gravity.LEFT}, {#link android.view.Gravity.TOP}, - * {#link android.view.Gravity.BOTTOM}, {#link + * @param gravity The boundary of the screen to stick. See {@link + * android.view.Gravity.LEFT}, {@link android.view.Gravity.TOP}, + * {@link android.view.Gravity.BOTTOM}, {@link * android.view.Gravity.RIGHT}. */ public void setGravity(int gravity) { diff --git a/core/java/android/net/NetworkFactory.java b/core/java/android/net/NetworkFactory.java index 7c6ca57ebf9c..181cab41e928 100644 --- a/core/java/android/net/NetworkFactory.java +++ b/core/java/android/net/NetworkFactory.java @@ -212,7 +212,7 @@ public class NetworkFactory extends Handler { * Called for every request every time a new NetworkRequest is seen * and whenever the filterScore or filterNetworkCapabilities change. * - * acceptRequest can be overriden to provide complex filter behavior + * acceptRequest can be overridden to provide complex filter behavior * for the incoming requests * * For output, this class will call {@link #needNetworkFor} and diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java index daa264038529..c0487b521b46 100644 --- a/core/java/android/net/NetworkMisc.java +++ b/core/java/android/net/NetworkMisc.java @@ -46,7 +46,7 @@ public class NetworkMisc implements Parcelable { /** * Set if the user desires to use this network even if it is unvalidated. This field has meaning - * only if {#link explicitlySelected} is true. If it is, this field must also be set to the + * only if {@link explicitlySelected} is true. If it is, this field must also be set to the * appropriate value based on previous user choice. */ public boolean acceptUnvalidated; diff --git a/core/java/android/net/NetworkSpecifier.java b/core/java/android/net/NetworkSpecifier.java index 12cdc342e28e..fcfb72035c19 100644 --- a/core/java/android/net/NetworkSpecifier.java +++ b/core/java/android/net/NetworkSpecifier.java @@ -35,7 +35,7 @@ public abstract class NetworkSpecifier { public abstract boolean satisfiedBy(NetworkSpecifier other); /** - * Optional method which can be overriden by concrete implementations of NetworkSpecifier to + * Optional method which can be overridden by concrete implementations of NetworkSpecifier to * check a self-reported UID. A concrete implementation may contain a UID which would be self- * reported by the caller (since NetworkSpecifier implementations should be non-mutable). This * function is called by ConnectivityService and is passed the actual UID of the caller - diff --git a/core/java/android/net/UrlQuerySanitizer.java b/core/java/android/net/UrlQuerySanitizer.java index d2073b4dfd3a..5b674067192e 100644 --- a/core/java/android/net/UrlQuerySanitizer.java +++ b/core/java/android/net/UrlQuerySanitizer.java @@ -287,7 +287,7 @@ public class UrlQuerySanitizer { /** * Sanitize a value. * <ol> - * <li>If script URLs are not OK, the will be removed. + * <li>If script URLs are not OK, they will be removed. * <li>If neither spaces nor other white space is OK, then * white space will be trimmed from the beginning and end of * the URL. (Just the actual white space characters are trimmed, not @@ -563,7 +563,7 @@ public class UrlQuerySanitizer { } /** - * Constructs a UrlQuerySanitizer and parse a URL. + * Constructs a UrlQuerySanitizer and parses a URL. * This constructor is provided for convenience when the * default parsing behavior is acceptable. * <p> @@ -644,7 +644,7 @@ public class UrlQuerySanitizer { } /** - * An array list of all of the parameter value pairs in the sanitized + * An array list of all of the parameter-value pairs in the sanitized * query, in the order they appeared in the query. May contain duplicate * parameters. * <p class="note"><b>Note:</b> Do not modify this list. Treat it as a read-only list.</p> @@ -656,7 +656,7 @@ public class UrlQuerySanitizer { /** * Check if a parameter exists in the current sanitized query. * @param parameter the unencoded name of a parameter. - * @return true if the paramater exists in the current sanitized queary. + * @return true if the parameter exists in the current sanitized queary. */ public boolean hasParameter(String parameter) { return mEntries.containsKey(parameter); @@ -766,7 +766,7 @@ public class UrlQuerySanitizer { * the value. If all goes well then addSanitizedValue is called with * the unescaped parameter and the sanitized unescaped value. * @param parameter an escaped parameter - * @param value an unsanitzied escaped value + * @param value an unsanitized escaped value */ protected void parseEntry(String parameter, String value) { String unescapedParameter = unescape(parameter); @@ -812,7 +812,7 @@ public class UrlQuerySanitizer { /** * Get the effective value sanitizer for a parameter. Like getValueSanitizer, * except if there is no value sanitizer registered for a parameter, and - * unregistered paramaters are allowed, then the default value sanitizer is + * unregistered parameters are allowed, then the default value sanitizer is * returned. * @param parameter an unescaped parameter * @return the effective value sanitizer for a parameter. diff --git a/core/java/android/nfc/cardemulation/OffHostApduService.java b/core/java/android/nfc/cardemulation/OffHostApduService.java index 6a8aeee1ebee..2286e8476d94 100644 --- a/core/java/android/nfc/cardemulation/OffHostApduService.java +++ b/core/java/android/nfc/cardemulation/OffHostApduService.java @@ -31,7 +31,7 @@ import android.os.IBinder; * <div class="special reference"> * <h3>Developer Guide</h3> * For a general introduction into the topic of card emulation, - * please read the <a href="{@docRoot}guide/topics/nfc/ce.html"> + * please read the <a href="{@docRoot}guide/topics/connectivity/nfc/hce.html"> * NFC card emulation developer guide.</a></p> * </div> * diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java index 8c92288d0047..9b5bda885abd 100644 --- a/core/java/android/nfc/tech/MifareClassic.java +++ b/core/java/android/nfc/tech/MifareClassic.java @@ -38,7 +38,7 @@ import java.nio.ByteOrder; * <li>MIFARE Classic Mini are 320 bytes ({@link #SIZE_MINI}), with 5 sectors each of 4 blocks. * <li>MIFARE Classic 1k are 1024 bytes ({@link #SIZE_1K}), with 16 sectors each of 4 blocks. * <li>MIFARE Classic 2k are 2048 bytes ({@link #SIZE_2K}), with 32 sectors each of 4 blocks. - * <li>MIFARE Classic 4k} are 4096 bytes ({@link #SIZE_4K}). The first 32 sectors contain 4 blocks + * <li>MIFARE Classic 4k are 4096 bytes ({@link #SIZE_4K}). The first 32 sectors contain 4 blocks * and the last 8 sectors contain 16 blocks. * </ul> * diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java index f5bca04ae104..2b5f3da5431e 100644 --- a/core/java/android/os/Handler.java +++ b/core/java/android/os/Handler.java @@ -33,7 +33,7 @@ import java.lang.reflect.Modifier; * them as they come out of the message queue. * * <p>There are two main uses for a Handler: (1) to schedule messages and - * runnables to be executed as some point in the future; and (2) to enqueue + * runnables to be executed at some point in the future; and (2) to enqueue * an action to be performed on a different thread than your own. * * <p>Scheduling messages is accomplished with the diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 61be7f785bb8..51b983e76fa7 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -868,13 +868,21 @@ public final class ContactsContract { */ protected interface ContactOptionsColumns { /** - * The number of times a contact has been contacted + * The number of times a contact has been contacted. + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page.</p> * <P>Type: INTEGER</P> */ public static final String TIMES_CONTACTED = "times_contacted"; /** * The last time a contact was contacted. + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page.</p> * <P>Type: INTEGER</P> */ public static final String LAST_TIME_CONTACTED = "last_time_contacted"; @@ -1694,6 +1702,11 @@ public final class ContactsContract { * TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED * field is populated with the current system time. * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this method is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. + * * @param resolver the ContentResolver to use * @param contactId the person who was contacted * @@ -1730,12 +1743,22 @@ public final class ContactsContract { * The content:// style URI for this table joined with useful data from * {@link ContactsContract.Data}, filtered to include only starred contacts * and the most frequently contacted contacts. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts + * results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_STREQUENT_URI = Uri.withAppendedPath( CONTENT_URI, "strequent"); /** * The content:// style URI for showing a list of frequently contacted people. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts + * results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_FREQUENT_URI = Uri.withAppendedPath( CONTENT_URI, "frequent"); @@ -1745,6 +1768,11 @@ public final class ContactsContract { * {@link #CONTENT_STREQUENT_URI} URI. The filter string will be used to match * various parts of the contact name. The filter argument should be passed * as an additional path segment after this URI. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts + * results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_STREQUENT_FILTER_URI = Uri.withAppendedPath( CONTENT_STREQUENT_URI, "filter"); @@ -4288,10 +4316,27 @@ public final class ContactsContract { * Columns in the Data_Usage_Stat table */ protected interface DataUsageStatColumns { - /** The last time (in milliseconds) this {@link Data} was used. */ + /** + * The last time (in milliseconds) this {@link Data} was used. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. + * + */ public static final String LAST_TIME_USED = "last_time_used"; - /** The number of times the referenced {@link Data} has been used. */ + /** + * The number of times the referenced {@link Data} has been used. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. + * + * + */ public static final String TIMES_USED = "times_used"; /** @hide Raw value. */ @@ -5260,7 +5305,14 @@ public final class ContactsContract { private PhoneLookup() {} /** - * The content:// style URI for this table. Append the phone number you want to lookup + * The content:// style URI for this table. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. + * + * Append the phone number you want to lookup * to this URI and query it to perform a lookup. For example: * <pre> * Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, @@ -5273,6 +5325,11 @@ public final class ContactsContract { /** * <p>URI used for the "enterprise caller-id".</p> * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. + * * <p> * It supports the same semantics as {@link #CONTENT_FILTER_URI} and returns the same * columns. If the device has no corp profile that is linked to the current profile, it @@ -6068,14 +6125,24 @@ public final class ContactsContract { * records of MIME type {@link #CONTENT_ITEM_TYPE}. The filter is applied * to display names as well as phone numbers. The filter argument should be passed * as an additional path segment after this URI. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, "filter"); /** - * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same - * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in + * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the + * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts + * results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( CONTENT_URI, "filter_enterprise"); @@ -6243,7 +6310,7 @@ public final class ContactsContract { */ public static final class Email implements DataColumnsWithJoins, CommonColumns, ContactCounts { - /** + /* * This utility class cannot be instantiated */ private Email() {} @@ -6334,12 +6401,17 @@ public final class ContactsContract { Uri.withAppendedPath(CONTENT_URI, "lookup_enterprise"); /** - * <p> * The content:// style URL for email lookup using a filter. The filter returns * records of MIME type {@link #CONTENT_ITEM_TYPE}. The filter is applied * to display names as well as email addresses. The filter argument should be passed * as an additional path segment after this URI. * </p> + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts + * results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page.</p> + * * <p>The query in the following example will return "Robert Parr (bob@incredibles.com)" * as well as "Bob Parr (incredible@android.com)". * <pre> @@ -6354,9 +6426,14 @@ public final class ContactsContract { "filter"); /** - * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the same - * columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in + * It supports the similar semantics as {@link #CONTENT_FILTER_URI} and returns the + * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( CONTENT_URI, "filter_enterprise"); @@ -7571,6 +7648,11 @@ public final class ContactsContract { /** * Similar to {@link Phone#CONTENT_FILTER_URI}, but allows users to filter callable * data. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI, "filter"); @@ -7579,6 +7661,11 @@ public final class ContactsContract { * Similar to {@link Phone#ENTERPRISE_CONTENT_FILTER_URI}, but allows users to filter * callable data. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page.</p> */ public static final Uri ENTERPRISE_CONTENT_FILTER_URI = Uri.withAppendedPath( CONTENT_URI, "filter_enterprise"); @@ -7603,8 +7690,13 @@ public final class ContactsContract { "contactables"); /** - * The content:// style URI for these data items, which allows for a query parameter to - * be appended onto the end to filter for data items matching the query. + * The content:// style URI for these data items, which allows for a query parameter + * to be appended onto the end to filter for data items matching the query. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer + * sorts results based on contacts frequency. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. */ public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath( Contactables.CONTENT_URI, "filter"); @@ -8253,11 +8345,15 @@ public final class ContactsContract { } /** - * <p> * API allowing applications to send usage information for each {@link Data} row to the * Contacts Provider. Applications can also clear all usage information. + * + * <p class="caution"><b>Caution: </b>As of January 7, 2019, this class is obsolete. For + * more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page. * </p> - * <p> + * * With the feedback, Contacts Provider may return more contextually appropriate results for * Data listing, typically supplied with * {@link ContactsContract.Contacts#CONTENT_FILTER_URI}, diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java index 2b40c12a3a89..acb3fa816bdb 100644 --- a/core/java/android/provider/DocumentsContract.java +++ b/core/java/android/provider/DocumentsContract.java @@ -1556,7 +1556,7 @@ public final class DocumentsContract { * * <p>Note, that due to internal limitations, if there is already a web link * intent created for the specified document but with different options, - * then it may be overriden. + * then it may be overridden. * * <p>Providers are required to show confirmation UI for all new permissions granted * for the linked document. diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java index c7d37add5134..68f8acd8a586 100644 --- a/core/java/android/provider/DocumentsProvider.java +++ b/core/java/android/provider/DocumentsProvider.java @@ -806,7 +806,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #queryRoots(String[]) * @see #queryRecentDocuments(String, String[], Bundle, CancellationSignal) @@ -864,7 +864,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #getDocumentType(String) */ @@ -939,7 +939,7 @@ public abstract class DocumentsProvider extends ContentProvider { /** * Implementation is provided by the parent class. Throws by default, and - * cannot be overriden. + * cannot be overridden. * * @see #createDocument(String, String, String) */ @@ -950,7 +950,7 @@ public abstract class DocumentsProvider extends ContentProvider { /** * Implementation is provided by the parent class. Throws by default, and - * cannot be overriden. + * cannot be overridden. * * @see #deleteDocument(String) */ @@ -961,7 +961,7 @@ public abstract class DocumentsProvider extends ContentProvider { /** * Implementation is provided by the parent class. Throws by default, and - * cannot be overriden. + * cannot be overridden. */ @Override public final int update( @@ -1201,7 +1201,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocument(String, String, CancellationSignal) */ @@ -1212,7 +1212,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocument(String, String, CancellationSignal) */ @@ -1224,7 +1224,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocument(String, String, CancellationSignal) */ @@ -1238,7 +1238,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocument(String, String, CancellationSignal) */ @@ -1252,7 +1252,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocumentThumbnail(String, Point, CancellationSignal) * @see #openTypedDocument(String, String, Bundle, CancellationSignal) @@ -1265,7 +1265,7 @@ public abstract class DocumentsProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Cannot be overriden. + * Implementation is provided by the parent class. Cannot be overridden. * * @see #openDocumentThumbnail(String, Point, CancellationSignal) * @see #openTypedDocument(String, String, Bundle, CancellationSignal) diff --git a/core/java/android/provider/SearchIndexablesProvider.java b/core/java/android/provider/SearchIndexablesProvider.java index 138e77b69627..02a5e6fd157f 100644 --- a/core/java/android/provider/SearchIndexablesProvider.java +++ b/core/java/android/provider/SearchIndexablesProvider.java @@ -181,7 +181,7 @@ public abstract class SearchIndexablesProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Throws by default, and cannot be overriden. + * Implementation is provided by the parent class. Throws by default, and cannot be overridden. */ @Override public final Uri insert(Uri uri, ContentValues values) { @@ -189,7 +189,7 @@ public abstract class SearchIndexablesProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Throws by default, and cannot be overriden. + * Implementation is provided by the parent class. Throws by default, and cannot be overridden. */ @Override public final int delete(Uri uri, String selection, String[] selectionArgs) { @@ -197,7 +197,7 @@ public abstract class SearchIndexablesProvider extends ContentProvider { } /** - * Implementation is provided by the parent class. Throws by default, and cannot be overriden. + * Implementation is provided by the parent class. Throws by default, and cannot be overridden. */ @Override public final int update( diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index abd7c89a0301..af1a83d0fab7 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4198,7 +4198,8 @@ public final class Settings { SHOW_BATTERY_PERCENT, NOTIFICATION_VIBRATION_INTENSITY, HAPTIC_FEEDBACK_INTENSITY, - DISPLAY_COLOR_MODE + DISPLAY_COLOR_MODE, + NOTIFICATION_LIGHT_PULSE, }; /** @@ -4404,6 +4405,7 @@ public final class Settings { VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR); + VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR); } /** @@ -8290,6 +8292,8 @@ public final class Settings { ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES_VALIDATOR); //legacy restore setting VALIDATORS.put(HUSH_GESTURE_USED, HUSH_GESTURE_USED_VALIDATOR); VALIDATORS.put(MANUAL_RINGER_TOGGLE_COUNT, MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR); + VALIDATORS.put(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, BOOLEAN_VALIDATOR); + VALIDATORS.put(LOCK_SCREEN_SHOW_NOTIFICATIONS, BOOLEAN_VALIDATOR); } /** @@ -13028,6 +13032,7 @@ public final class Settings { * Supported keys: * compatibility_wal_supported (boolean) * wal_syncmode (String) + * truncate_size (int) * * @hide */ diff --git a/core/java/android/service/autofill/FillCallback.java b/core/java/android/service/autofill/FillCallback.java index 1695c1306824..818ffde44297 100644 --- a/core/java/android/service/autofill/FillCallback.java +++ b/core/java/android/service/autofill/FillCallback.java @@ -39,13 +39,20 @@ public final class FillCallback { } /** - * Notifies the Android System that an - * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, - * FillCallback)} was successfully fulfilled by the service. + * Notifies the Android System that a fill request + * ({@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, + * FillCallback)}) was successfully fulfilled by the service. + * + * <p>This method should always be called, even if the service doesn't have the heuristics to + * fulfill the request (in which case it should be called with {@code null}). + * + * <p>See the main {@link AutofillService} documentation for more details and examples. + * + * @param response autofill information for that activity, or {@code null} when the service + * cannot autofill the activity. * - * @param response autofill information for that activity, or {@code null} when the activity - * cannot be autofilled (for example, if it only contains read-only fields). See - * {@link FillResponse} for examples. + * @throws IllegalStateException if this method or {@link #onFailure(CharSequence)} was already + * called. */ public void onSuccess(@Nullable FillResponse response) { assertNotCalled(); @@ -63,11 +70,25 @@ public final class FillCallback { } /** - * Notifies the Android System that an + * Notifies the Android System that a fill request ( * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, - * FillCallback)} could not be fulfilled by the service. + * FillCallback)}) could not be fulfilled by the service (for example, because the user data was + * not available yet), so the request could be retried later. + * + * <p><b>Note: </b>this method should not be used when the service didn't have the heursitics to + * fulfill the request; in this case, the service should call {@link #onSuccess(FillResponse) + * onSuccess(null)} instead. + * + * <p><b>Note: </b>on Android versions up to {@link android.os.Build.VERSION_CODES#P}, this + * method is not working as intended, and the service should call + * {@link #onSuccess(FillResponse) onSuccess(null)} instead. + * + * @param message error message to be displayed to the user. <b>Note: </b> this message is + * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable + * Information, such as username or email address). * - * @param message error message to be displayed to the user. + * @throws IllegalStateException if this method or {@link #onSuccess(FillResponse)} was already + * called. */ public void onFailure(@Nullable CharSequence message) { assertNotCalled(); diff --git a/core/java/android/service/autofill/Sanitizer.java b/core/java/android/service/autofill/Sanitizer.java index 38757ac7408b..8a1310de6e32 100644 --- a/core/java/android/service/autofill/Sanitizer.java +++ b/core/java/android/service/autofill/Sanitizer.java @@ -21,6 +21,9 @@ package android.service.autofill; * <p>Typically used to avoid displaying the save UI for values that are autofilled but reformatted * by the app—for example, if the autofill service sends a credit card number * value as "004815162342108" and the app automatically changes it to "0048 1516 2342 108". + * + * <p><b>Note:</b> This interface is not meant to be implemented by app developers; only + * implementations provided by the Android System can be used in other Autofill APIs. */ public interface Sanitizer { } diff --git a/core/java/android/service/autofill/SaveCallback.java b/core/java/android/service/autofill/SaveCallback.java index 855981a544fd..a98a2492f694 100644 --- a/core/java/android/service/autofill/SaveCallback.java +++ b/core/java/android/service/autofill/SaveCallback.java @@ -41,6 +41,9 @@ public final class SaveCallback { * Notifies the Android System that an * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)} was successfully handled * by the service. + * + * @throws IllegalStateException if this method, {@link #onSuccess(IntentSender)}, or + * {@link #onFailure(CharSequence)} was already called. */ public void onSuccess() { onSuccessInternal(null); @@ -58,6 +61,9 @@ public final class SaveCallback { * * @param intentSender intent that will be launched from the context of activity being * autofilled. + * + * @throws IllegalStateException if this method, {@link #onSuccess()}, + * or {@link #onFailure(CharSequence)} was already called. */ public void onSuccess(@NonNull IntentSender intentSender) { onSuccessInternal(Preconditions.checkNotNull(intentSender)); @@ -86,7 +92,12 @@ public final class SaveCallback { * you prefer to show your own message, call {@link #onSuccess()} or * {@link #onSuccess(IntentSender)} instead. * - * @param message error message to be displayed to the user. + * @param message error message to be displayed to the user. <b>Note: </b> this message is + * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable + * Information, such as username or email address). + * + * @throws IllegalStateException if this method, {@link #onSuccess()}, + * or {@link #onSuccess(IntentSender)} was already called. */ public void onFailure(CharSequence message) { assertNotCalled(); diff --git a/core/java/android/service/autofill/Transformation.java b/core/java/android/service/autofill/Transformation.java index aa8bc9b9500f..de43955e2dc1 100644 --- a/core/java/android/service/autofill/Transformation.java +++ b/core/java/android/service/autofill/Transformation.java @@ -20,6 +20,9 @@ package android.service.autofill; * template} at runtime, using the values of fields contained in the screen. * * <p>Typically used by {@link CustomDescription} to provide a customized autofill save UI. + * + * <p><b>Note:</b> This interface is not meant to be implemented by app developers; only + * implementations provided by the Android System can be used in other Autofill APIs. */ public interface Transformation { } diff --git a/core/java/android/text/TextWatcher.java b/core/java/android/text/TextWatcher.java index bad09f2a0f0e..a0aef690a1b8 100644 --- a/core/java/android/text/TextWatcher.java +++ b/core/java/android/text/TextWatcher.java @@ -17,7 +17,7 @@ package android.text; /** - * When an object of a type is attached to an Editable, its methods will + * When an object of this type is attached to an Editable, its methods will * be called when the text is changed. */ public interface TextWatcher extends NoCopySpan { diff --git a/core/java/android/util/JsonReader.java b/core/java/android/util/JsonReader.java index 7d1c6c4918db..50f63f8db304 100644 --- a/core/java/android/util/JsonReader.java +++ b/core/java/android/util/JsonReader.java @@ -16,13 +16,15 @@ package android.util; +import libcore.internal.StringPool; + import java.io.Closeable; import java.io.EOFException; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.List; -import libcore.internal.StringPool; + /** * Reads a JSON (<a href="http://www.ietf.org/rfc/rfc4627.txt">RFC 4627</a>) @@ -295,7 +297,7 @@ public final class JsonReader implements Closeable { /** * Consumes the next token from the JSON stream and asserts that it is the - * end of the current array. + * end of the current object. */ public void endObject() throws IOException { expect(JsonToken.END_OBJECT); diff --git a/core/java/android/view/KeyCharacterMap.java b/core/java/android/view/KeyCharacterMap.java index 14646f7ee3fa..fae1251c591e 100644 --- a/core/java/android/view/KeyCharacterMap.java +++ b/core/java/android/view/KeyCharacterMap.java @@ -124,7 +124,7 @@ public class KeyCharacterMap implements Parcelable { /** * Modifier keys may be chorded with character keys. * - * @see {#link #getModifierBehavior()} for more details. + * @see {@link #getModifierBehavior()} for more details. */ public static final int MODIFIER_BEHAVIOR_CHORDED = 0; @@ -132,7 +132,7 @@ public class KeyCharacterMap implements Parcelable { * Modifier keys may be chorded with character keys or they may toggle * into latched or locked states when pressed independently. * - * @see {#link #getModifierBehavior()} for more details. + * @see {@link #getModifierBehavior()} for more details. */ public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1; diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 00e0a3a87716..78331a1566c5 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -886,8 +886,8 @@ public class KeyEvent extends InputEvent implements Parcelable { /** * {@link #getAction} value: multiple duplicate key events have * occurred in a row, or a complex string is being delivered. If the - * key code is not {#link {@link #KEYCODE_UNKNOWN} then the - * {#link {@link #getRepeatCount()} method returns the number of times + * key code is not {@link #KEYCODE_UNKNOWN} then the + * {@link #getRepeatCount()} method returns the number of times * the given key code should be executed. * Otherwise, if the key code is {@link #KEYCODE_UNKNOWN}, then * this is a sequence of characters as returned by {@link #getCharacters}. diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index efff6d617376..48aa576c1e91 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -15584,7 +15584,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Sets the visual z position of this view, in pixels. This is equivalent to setting the * {@link #setTranslationZ(float) translationZ} property to be the difference between - * the x value passed in and the current {@link #getElevation() elevation} property. + * the z value passed in and the current {@link #getElevation() elevation} property. * * @param z The visual z position of this view, in pixels. */ diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 81ab4b6b267a..b20a521aca51 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -8114,7 +8114,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager /** * Sets the margins, in pixels. A call to {@link android.view.View#requestLayout()} needs * to be done so that the new margins are taken into account. Left and right margins may be - * overriden by {@link android.view.View#requestLayout()} depending on layout direction. + * overridden by {@link android.view.View#requestLayout()} depending on layout direction. * Margin values should be positive. * * @param left the left margin size @@ -8144,8 +8144,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager /** * Sets the relative margins, in pixels. A call to {@link android.view.View#requestLayout()} * needs to be done so that the new relative margins are taken into account. Left and right - * margins may be overriden by {@link android.view.View#requestLayout()} depending on layout - * direction. Margin values should be positive. + * margins may be overridden by {@link android.view.View#requestLayout()} depending on + * layout direction. Margin values should be positive. * * @param start the start margin size * @param top the top margin size diff --git a/core/java/android/view/accessibility/AccessibilityCache.java b/core/java/android/view/accessibility/AccessibilityCache.java index da5a1cd67922..0e1e379d610a 100644 --- a/core/java/android/view/accessibility/AccessibilityCache.java +++ b/core/java/android/view/accessibility/AccessibilityCache.java @@ -418,20 +418,28 @@ public class AccessibilityCache { * * @param nodes The nodes in the hosting window. * @param rootNodeId The id of the root to evict. + * + * @return {@code true} if the cache was cleared */ - private void clearSubTreeRecursiveLocked(LongSparseArray<AccessibilityNodeInfo> nodes, + private boolean clearSubTreeRecursiveLocked(LongSparseArray<AccessibilityNodeInfo> nodes, long rootNodeId) { AccessibilityNodeInfo current = nodes.get(rootNodeId); if (current == null) { - return; + // The node isn't in the cache, but its descendents might be. + clear(); + return true; } nodes.remove(rootNodeId); final int childCount = current.getChildCount(); for (int i = 0; i < childCount; i++) { final long childNodeId = current.getChildId(i); - clearSubTreeRecursiveLocked(nodes, childNodeId); + if (clearSubTreeRecursiveLocked(nodes, childNodeId)) { + current.recycle(); + return true; + } } current.recycle(); + return false; } /** diff --git a/core/java/android/view/animation/DecelerateInterpolator.java b/core/java/android/view/animation/DecelerateInterpolator.java index f89743c149b1..2d1249df4fb5 100644 --- a/core/java/android/view/animation/DecelerateInterpolator.java +++ b/core/java/android/view/animation/DecelerateInterpolator.java @@ -41,8 +41,8 @@ public class DecelerateInterpolator extends BaseInterpolator implements NativeIn * Constructor * * @param factor Degree to which the animation should be eased. Setting factor to 1.0f produces - * an upside-down y=x^2 parabola. Increasing factor above 1.0f makes exaggerates the - * ease-out effect (i.e., it starts even faster and ends evens slower) + * an upside-down y=x^2 parabola. Increasing factor above 1.0f exaggerates the + * ease-out effect (i.e., it starts even faster and ends evens slower). */ public DecelerateInterpolator(float factor) { mFactor = factor; diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index d21cb3e64b8c..8b3ce42b076b 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -44,6 +44,7 @@ import android.service.autofill.UserData; import android.util.ArrayMap; import android.util.ArraySet; import android.util.Log; +import android.util.Slog; import android.util.SparseArray; import android.view.Choreographer; import android.view.KeyEvent; @@ -548,6 +549,9 @@ public final class AutofillManager { // different bridge based on which activity is currently focused // in the current process. Since compat would be rarely used, just // create and register a new instance every time. + if (sDebug) { + Slog.d(TAG, "creating CompatibilityBridge for " + mContext); + } mCompatibilityBridge = new CompatibilityBridge(); } } diff --git a/core/java/android/webkit/SafeBrowsingResponse.java b/core/java/android/webkit/SafeBrowsingResponse.java index 1d3a617a6bec..7839a00eff69 100644 --- a/core/java/android/webkit/SafeBrowsingResponse.java +++ b/core/java/android/webkit/SafeBrowsingResponse.java @@ -36,14 +36,14 @@ public abstract class SafeBrowsingResponse { public abstract void showInterstitial(boolean allowReporting); /** - * Act as if the user clicked "visit this unsafe site." + * Act as if the user clicked the "visit this unsafe site" button. * * @param report {@code true} to enable Safe Browsing reporting. */ public abstract void proceed(boolean report); /** - * Act as if the user clicked "back to safety." + * Act as if the user clicked the "back to safety" button. * * @param report {@code true} to enable Safe Browsing reporting. */ diff --git a/core/java/android/webkit/TracingController.java b/core/java/android/webkit/TracingController.java index 05c0304e042c..30f465cb42c6 100644 --- a/core/java/android/webkit/TracingController.java +++ b/core/java/android/webkit/TracingController.java @@ -36,7 +36,7 @@ import java.util.concurrent.Executor; * <pre class="prettyprint"> * TracingController tracingController = TracingController.getInstance(); * tracingController.start(new TracingConfig.Builder() - * .addCategories(CATEGORIES_WEB_DEVELOPER).build()); + * .addCategories(TracingConfig.CATEGORIES_WEB_DEVELOPER).build()); * ... * tracingController.stop(new FileOutputStream("trace.json"), * Executors.newSingleThreadExecutor()); diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index dd6c923e7f47..f3fe16e8a675 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -682,7 +682,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { /** * Sets the currently selected item. To support accessibility subclasses that - * override this method must invoke the overriden super method first. + * override this method must invoke the overridden super method first. * * @param position Index (starting at 0) of the data item to be selected. */ diff --git a/core/java/android/widget/CursorAdapter.java b/core/java/android/widget/CursorAdapter.java index cc8b55009316..e250f63bbc65 100644 --- a/core/java/android/widget/CursorAdapter.java +++ b/core/java/android/widget/CursorAdapter.java @@ -365,7 +365,7 @@ public abstract class CursorAdapter extends BaseAdapter implements Filterable, * closed. * * @param newCursor The new cursor to be used. - * @return Returns the previously set Cursor, or null if there wasa not one. + * @return Returns the previously set Cursor, or null if there was not one. * If the given new Cursor is the same instance is the previously set * Cursor, null is also returned. */ diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java index c503ef215ea1..8ebf303136ef 100644 --- a/core/java/android/widget/DigitalClock.java +++ b/core/java/android/widget/DigitalClock.java @@ -27,7 +27,7 @@ import android.util.AttributeSet; import java.util.Calendar; /** - * Like AnalogClock, but digital. Shows seconds. + * Like AnalogClock, but digital. * * @deprecated It is recommended you use {@link TextClock} instead. */ diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index 452e9036cc54..f2e478d0e072 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -653,7 +653,7 @@ public class LinearLayout extends ViewGroup { } /** - * <p>Returns the view at the specified index. This method can be overriden + * <p>Returns the view at the specified index. This method can be overridden * to take into account virtual children. Refer to * {@link android.widget.TableLayout} and {@link android.widget.TableRow} * for an example.</p> @@ -1527,7 +1527,7 @@ public class LinearLayout extends ViewGroup { /** * <p>Measure the child according to the parent's measure specs. This - * method should be overriden by subclasses to force the sizing of + * method should be overridden by subclasses to force the sizing of * children. This method is called by {@link #measureVertical(int, int)} and * {@link #measureHorizontal(int, int)}.</p> * diff --git a/core/java/android/widget/ShareActionProvider.java b/core/java/android/widget/ShareActionProvider.java index 9a24061ba0d6..c78f4ac116ee 100644 --- a/core/java/android/widget/ShareActionProvider.java +++ b/core/java/android/widget/ShareActionProvider.java @@ -268,7 +268,7 @@ public class ShareActionProvider extends ActionProvider { * Intent shareIntent = new Intent(Intent.ACTION_SEND); * shareIntent.setType("image/*"); * Uri uri = Uri.fromFile(new File(getFilesDir(), "foo.jpg")); - * shareIntent.putExtra(Intent.EXTRA_STREAM, uri));</pre> + * shareIntent.putExtra(Intent.EXTRA_STREAM, uri);</pre> * * @param shareIntent The share intent. * diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 4c0163ef89da..8a199275b123 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -3572,7 +3572,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * Read the Text Appearance attributes from a given TypedArray and set its values to the given * set. If the TypedArray contains a value that was already set in the given attributes, that - * will be overriden. + * will be overridden. * * @param context The Context to be used * @param appearance The TypedArray to read properties from diff --git a/core/java/com/android/internal/os/KernelCpuProcReader.java b/core/java/com/android/internal/os/KernelCpuProcReader.java index 396deb4d7a0a..c233ea8e78b7 100644 --- a/core/java/com/android/internal/os/KernelCpuProcReader.java +++ b/core/java/com/android/internal/os/KernelCpuProcReader.java @@ -24,13 +24,14 @@ import com.android.internal.annotations.VisibleForTesting; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.channels.FileChannel; +import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; +import java.util.Arrays; /** * Reads cpu time proc files with throttling (adjustable interval). @@ -55,7 +56,6 @@ public class KernelCpuProcReader { private static final int ERROR_THRESHOLD = 5; // Throttle interval in milliseconds private static final long DEFAULT_THROTTLE_INTERVAL = 3000L; - private static final int INITIAL_BUFFER_SIZE = 8 * 1024; private static final int MAX_BUFFER_SIZE = 1024 * 1024; private static final String PROC_UID_FREQ_TIME = "/proc/uid_cpupower/time_in_state"; private static final String PROC_UID_ACTIVE_TIME = "/proc/uid_cpupower/concurrent_active_time"; @@ -84,13 +84,12 @@ public class KernelCpuProcReader { private long mThrottleInterval = DEFAULT_THROTTLE_INTERVAL; private long mLastReadTime = Long.MIN_VALUE; private final Path mProc; - private ByteBuffer mBuffer; + private byte[] mBuffer = new byte[8 * 1024]; + private int mContentSize; @VisibleForTesting public KernelCpuProcReader(String procFile) { mProc = Paths.get(procFile); - mBuffer = ByteBuffer.allocateDirect(INITIAL_BUFFER_SIZE); - mBuffer.clear(); } /** @@ -108,38 +107,45 @@ public class KernelCpuProcReader { return null; } if (SystemClock.elapsedRealtime() < mLastReadTime + mThrottleInterval) { - if (mBuffer.limit() > 0 && mBuffer.limit() < mBuffer.capacity()) { - // mBuffer has data. - return mBuffer.asReadOnlyBuffer().order(ByteOrder.nativeOrder()); + if (mContentSize > 0) { + return ByteBuffer.wrap(mBuffer, 0, mContentSize).asReadOnlyBuffer() + .order(ByteOrder.nativeOrder()); } return null; } mLastReadTime = SystemClock.elapsedRealtime(); - mBuffer.clear(); + mContentSize = 0; final int oldMask = StrictMode.allowThreadDiskReadsMask(); - try (FileChannel fc = FileChannel.open(mProc, StandardOpenOption.READ)) { - while (fc.read(mBuffer) == mBuffer.capacity()) { - if (!resize()) { - mErrors++; - Slog.e(TAG, "Proc file is too large: " + mProc); - return null; + try (InputStream in = Files.newInputStream(mProc)) { + int numBytes = 0; + int curr; + while ((curr = in.read(mBuffer, numBytes, mBuffer.length - numBytes)) >= 0) { + numBytes += curr; + if (numBytes == mBuffer.length) { + // Hit the limit. Resize mBuffer. + if (mBuffer.length == MAX_BUFFER_SIZE) { + mErrors++; + Slog.e(TAG, "Proc file is too large: " + mProc); + return null; + } + mBuffer = Arrays.copyOf(mBuffer, + Math.min(mBuffer.length << 1, MAX_BUFFER_SIZE)); } - fc.position(0); } + mContentSize = numBytes; + return ByteBuffer.wrap(mBuffer, 0, mContentSize).asReadOnlyBuffer() + .order(ByteOrder.nativeOrder()); } catch (NoSuchFileException | FileNotFoundException e) { // Happens when the kernel does not provide this file. Not a big issue. Just log it. mErrors++; Slog.w(TAG, "File not exist: " + mProc); - return null; } catch (IOException e) { mErrors++; Slog.e(TAG, "Error reading: " + mProc, e); - return null; } finally { StrictMode.setThreadPolicyMask(oldMask); } - mBuffer.flip(); - return mBuffer.asReadOnlyBuffer().order(ByteOrder.nativeOrder()); + return null; } /** @@ -153,14 +159,4 @@ public class KernelCpuProcReader { mThrottleInterval = throttleInterval; } } - - private boolean resize() { - if (mBuffer.capacity() >= MAX_BUFFER_SIZE) { - return false; - } - int newSize = Math.min(mBuffer.capacity() << 1, MAX_BUFFER_SIZE); - // Slog.i(TAG, "Resize buffer " + mBuffer.capacity() + " => " + newSize); - mBuffer = ByteBuffer.allocateDirect(newSize); - return true; - } } |
