Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60a82cd4 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Flesh out more API docs.

Flesh out docs for Context.getCacheDir(), Intent.addFlags(),
Intent.removeFlags(), and PackageManager.setApplicationCategoryHint().

Test: builds, boots
Bug: 37470473, 37327774, 35812899
Change-Id: Ided031185258a89c3e275d65c162d537065ad49e
parent 2b499e4e
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -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.
     * <p>
     * <strong>Note: you should not <em>rely</em> 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.</strong> 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)}.
     * <p>
     * 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.
     * <p>
     * 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.
     * <p>
     * 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.
     * <p>
     * The system will delete any files stored in this location both when your
     * specific application is upgraded, and when the entire platform is
     * upgraded.
     * <p>
     * This location is optimal for storing compiled or optimized code generated
     * by your application at runtime.
+52 −0
Original line number Diff line number Diff line
@@ -8616,6 +8616,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;
@@ -8628,6 +8654,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;
+14 −2
Original line number Diff line number Diff line
@@ -5937,8 +5937,20 @@ public abstract class PackageManager {
     * <p>
     * This hint can only be set by the app which installed this package, as
     * determined by {@link #getInstallerPackageName(String)}.
     */
    public abstract void setApplicationCategoryHint(String packageName,
     *
     * @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(@NonNull String packageName,
            @ApplicationInfo.Category int categoryHint);

    /** {@hide} */
+2 −1
Original line number Diff line number Diff line
@@ -1518,7 +1518,8 @@ public class StorageManager {
     * last to be deleted when additional disk space is needed.
     * <p>
     * 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.
     * <p class="note">
     * Note: if your app uses the {@code android:sharedUserId} manifest feature,
     * then cached data for all packages in your shared UID is tracked together