diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 97f605be6b52f..6f48eb14d79b2 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -57,6 +57,7 @@ import android.os.Looper; import android.os.StatFs; import android.os.UserHandle; import android.os.UserManager; +import android.os.storage.StorageManager; import android.provider.MediaStore; import android.util.AttributeSet; import android.view.Display; @@ -1146,16 +1147,26 @@ public abstract class Context { /** * Returns the absolute path to the application specific cache directory on - * the filesystem. These files will be ones that get deleted first when the - * device runs low on storage. There is no guarantee when these files will - * be deleted. + * the filesystem. *

- * Note: you should not rely on the system deleting these - * files for you; you should always have a reasonable maximum, such as 1 MB, - * for the amount of space you consume with cache files, and prune those - * files when exceeding that space. If your app requires a larger - * cache (larger than 1 MB), you should use {@link #getExternalCacheDir()} - * instead. + * The system will automatically delete files in this directory as disk + * space is needed elsewhere on the device. The system will always delete + * older files first, as reported by {@link File#lastModified()}. If + * desired, you can exert more control over how files are deleted using + * {@link StorageManager#setCacheBehaviorGroup(File, boolean)} and + * {@link StorageManager#setCacheBehaviorTombstone(File, boolean)}. + *

+ * Apps are strongly encouraged to keep their usage of cache space below the + * quota returned by + * {@link StorageManager#getCacheQuotaBytes(java.util.UUID)}. If your app + * goes above this quota, your cached files will be some of the first to be + * deleted when additional disk space is needed. Conversely, if your app + * stays under this quota, your cached files will be some of the last to be + * deleted when additional disk space is needed. + *

+ * Note that your cache quota will change over time depending on how + * frequently the user interacts with your app, and depending on how much + * system-wide disk space is used. *

* The returned path may change over time if the calling app is moved to an * adopted storage device, so only relative paths should be persisted. @@ -1173,9 +1184,11 @@ public abstract class Context { /** * Returns the absolute path to the application specific cache directory on - * the filesystem designed for storing cached code. The system will delete - * any files stored in this location both when your specific application is - * upgraded, and when the entire platform is upgraded. + * the filesystem designed for storing cached code. + *

+ * The system will delete any files stored in this location both when your + * specific application is upgraded, and when the entire platform is + * upgraded. *

* This location is optimal for storing compiled or optimized code generated * by your application at runtime. diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index c39624e1c8e9c..cefc2965a6c17 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -8627,6 +8627,32 @@ public class Intent implements Parcelable, Cloneable { * a single statement. * @see #setFlags(int) * @see #removeFlags(int) + * + * @see #FLAG_GRANT_READ_URI_PERMISSION + * @see #FLAG_GRANT_WRITE_URI_PERMISSION + * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION + * @see #FLAG_GRANT_PREFIX_URI_PERMISSION + * @see #FLAG_DEBUG_LOG_RESOLUTION + * @see #FLAG_FROM_BACKGROUND + * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT + * @see #FLAG_ACTIVITY_CLEAR_TASK + * @see #FLAG_ACTIVITY_CLEAR_TOP + * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET + * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS + * @see #FLAG_ACTIVITY_FORWARD_RESULT + * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY + * @see #FLAG_ACTIVITY_MULTIPLE_TASK + * @see #FLAG_ACTIVITY_NEW_DOCUMENT + * @see #FLAG_ACTIVITY_NEW_TASK + * @see #FLAG_ACTIVITY_NO_ANIMATION + * @see #FLAG_ACTIVITY_NO_HISTORY + * @see #FLAG_ACTIVITY_NO_USER_ACTION + * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP + * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED + * @see #FLAG_ACTIVITY_REORDER_TO_FRONT + * @see #FLAG_ACTIVITY_SINGLE_TOP + * @see #FLAG_ACTIVITY_TASK_ON_HOME + * @see #FLAG_RECEIVER_REGISTERED_ONLY */ public Intent addFlags(int flags) { mFlags |= flags; @@ -8639,6 +8665,32 @@ public class Intent implements Parcelable, Cloneable { * @param flags The flags to remove. * @see #setFlags(int) * @see #addFlags(int) + * + * @see #FLAG_GRANT_READ_URI_PERMISSION + * @see #FLAG_GRANT_WRITE_URI_PERMISSION + * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION + * @see #FLAG_GRANT_PREFIX_URI_PERMISSION + * @see #FLAG_DEBUG_LOG_RESOLUTION + * @see #FLAG_FROM_BACKGROUND + * @see #FLAG_ACTIVITY_BROUGHT_TO_FRONT + * @see #FLAG_ACTIVITY_CLEAR_TASK + * @see #FLAG_ACTIVITY_CLEAR_TOP + * @see #FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET + * @see #FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS + * @see #FLAG_ACTIVITY_FORWARD_RESULT + * @see #FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY + * @see #FLAG_ACTIVITY_MULTIPLE_TASK + * @see #FLAG_ACTIVITY_NEW_DOCUMENT + * @see #FLAG_ACTIVITY_NEW_TASK + * @see #FLAG_ACTIVITY_NO_ANIMATION + * @see #FLAG_ACTIVITY_NO_HISTORY + * @see #FLAG_ACTIVITY_NO_USER_ACTION + * @see #FLAG_ACTIVITY_PREVIOUS_IS_TOP + * @see #FLAG_ACTIVITY_RESET_TASK_IF_NEEDED + * @see #FLAG_ACTIVITY_REORDER_TO_FRONT + * @see #FLAG_ACTIVITY_SINGLE_TOP + * @see #FLAG_ACTIVITY_TASK_ON_HOME + * @see #FLAG_RECEIVER_REGISTERED_ONLY */ public void removeFlags(int flags) { mFlags &= ~flags; diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 08cd6e6b38ddf..c3a1f993bcf18 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -5957,8 +5957,20 @@ public abstract class PackageManager { *

* This hint can only be set by the app which installed this package, as * determined by {@link #getInstallerPackageName(String)}. + * + * @param packageName the package to change the category hint for. + * @param categoryHint the category hint to set; one of + * {@link ApplicationInfo#CATEGORY_AUDIO}, + * {@link ApplicationInfo#CATEGORY_GAME}, + * {@link ApplicationInfo#CATEGORY_IMAGE}, + * {@link ApplicationInfo#CATEGORY_MAPS}, + * {@link ApplicationInfo#CATEGORY_NEWS}, + * {@link ApplicationInfo#CATEGORY_PRODUCTIVITY}, + * {@link ApplicationInfo#CATEGORY_SOCIAL}, + * {@link ApplicationInfo#CATEGORY_UNDEFINED}, or + * {@link ApplicationInfo#CATEGORY_VIDEO}. */ - public abstract void setApplicationCategoryHint(String packageName, + public abstract void setApplicationCategoryHint(@NonNull String packageName, @ApplicationInfo.Category int categoryHint); /** {@hide} */ diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 3942531735534..1c15004c894d9 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -1518,7 +1518,8 @@ public class StorageManager { * last to be deleted when additional disk space is needed. *

* This quota will change over time depending on how frequently the user - * interacts with your app, and depending on how much disk space is used. + * interacts with your app, and depending on how much system-wide disk space + * is used. *

* Note: if your app uses the {@code android:sharedUserId} manifest feature, * then cached data for all packages in your shared UID is tracked together