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

Commit b83bb364 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update TRIM_MEMORY_* docs per Snowbird changes in Android 14" into main

parents b6d08a52 b31ea8f0
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -10147,17 +10147,17 @@ package android.content {
  public interface ComponentCallbacks {
  public interface ComponentCallbacks {
    method public void onConfigurationChanged(@NonNull android.content.res.Configuration);
    method public void onConfigurationChanged(@NonNull android.content.res.Configuration);
    method public void onLowMemory();
    method @Deprecated public void onLowMemory();
  }
  }
  public interface ComponentCallbacks2 extends android.content.ComponentCallbacks {
  public interface ComponentCallbacks2 extends android.content.ComponentCallbacks {
    method public void onTrimMemory(int);
    method public void onTrimMemory(int);
    field public static final int TRIM_MEMORY_BACKGROUND = 40; // 0x28
    field public static final int TRIM_MEMORY_BACKGROUND = 40; // 0x28
    field public static final int TRIM_MEMORY_COMPLETE = 80; // 0x50
    field @Deprecated public static final int TRIM_MEMORY_COMPLETE = 80; // 0x50
    field public static final int TRIM_MEMORY_MODERATE = 60; // 0x3c
    field @Deprecated public static final int TRIM_MEMORY_MODERATE = 60; // 0x3c
    field public static final int TRIM_MEMORY_RUNNING_CRITICAL = 15; // 0xf
    field @Deprecated public static final int TRIM_MEMORY_RUNNING_CRITICAL = 15; // 0xf
    field public static final int TRIM_MEMORY_RUNNING_LOW = 10; // 0xa
    field @Deprecated public static final int TRIM_MEMORY_RUNNING_LOW = 10; // 0xa
    field public static final int TRIM_MEMORY_RUNNING_MODERATE = 5; // 0x5
    field @Deprecated public static final int TRIM_MEMORY_RUNNING_MODERATE = 5; // 0x5
    field public static final int TRIM_MEMORY_UI_HIDDEN = 20; // 0x14
    field public static final int TRIM_MEMORY_UI_HIDDEN = 20; // 0x14
  }
  }
+5 −9
Original line number Original line Diff line number Diff line
@@ -55,15 +55,11 @@ public interface ComponentCallbacks {
     * That is, before reaching the point of killing processes hosting
     * That is, before reaching the point of killing processes hosting
     * service and foreground UI that we would like to avoid killing.
     * service and foreground UI that we would like to avoid killing.
     *
     *
     * <p>You should implement this method to release
     * @deprecated Since API level 14 this is superseded by
     * any caches or other unnecessary resources you may be holding on to.
     *             {@link ComponentCallbacks2#onTrimMemory}.
     * The system will perform a garbage collection for you after returning from this method.
     *             Since API level 34 this is never called.
     * <p>Preferably, you should implement {@link ComponentCallbacks2#onTrimMemory} from
     *             Apps targeting API level 34 and above may provide an empty implementation.
     * {@link ComponentCallbacks2} to incrementally unload your resources based on various
     * levels of memory demands.  That API is available for API level 14 and higher, so you should
     * only use this {@link #onLowMemory} method as a fallback for older versions, which can be
     * treated the same as {@link ComponentCallbacks2#onTrimMemory} with the {@link
     * ComponentCallbacks2#TRIM_MEMORY_COMPLETE} level.</p>
     */
     */
    @Deprecated
    void onLowMemory();
    void onLowMemory();
}
}
+20 −6
Original line number Original line Diff line number Diff line
@@ -105,14 +105,20 @@ public interface ComponentCallbacks2 extends ComponentCallbacks {
     * Level for {@link #onTrimMemory(int)}: the process is nearing the end
     * Level for {@link #onTrimMemory(int)}: the process is nearing the end
     * of the background LRU list, and if more memory isn't found soon it will
     * of the background LRU list, and if more memory isn't found soon it will
     * be killed.
     * be killed.
     *
     * @deprecated Apps are not notified of this level since API level 34
     */
     */
    @Deprecated
    static final int TRIM_MEMORY_COMPLETE = 80;
    static final int TRIM_MEMORY_COMPLETE = 80;
    
    
    /**
    /**
     * Level for {@link #onTrimMemory(int)}: the process is around the middle
     * Level for {@link #onTrimMemory(int)}: the process is around the middle
     * of the background LRU list; freeing memory can help the system keep
     * of the background LRU list; freeing memory can help the system keep
     * other processes running later in the list for better overall performance.
     * other processes running later in the list for better overall performance.
     *
     * @deprecated Apps are not notified of this level since API level 34
     */
     */
    @Deprecated
    static final int TRIM_MEMORY_MODERATE = 60;
    static final int TRIM_MEMORY_MODERATE = 60;
    
    
    /**
    /**
@@ -139,7 +145,10 @@ public interface ComponentCallbacks2 extends ComponentCallbacks {
     * will happen after this is {@link #onLowMemory()} called to report that
     * will happen after this is {@link #onLowMemory()} called to report that
     * nothing at all can be kept in the background, a situation that can start
     * nothing at all can be kept in the background, a situation that can start
     * to notably impact the user.
     * to notably impact the user.
     *
     * @deprecated Apps are not notified of this level since API level 34
     */
     */
    @Deprecated
    static final int TRIM_MEMORY_RUNNING_CRITICAL = 15;
    static final int TRIM_MEMORY_RUNNING_CRITICAL = 15;


    /**
    /**
@@ -147,7 +156,10 @@ public interface ComponentCallbacks2 extends ComponentCallbacks {
     * background process, but the device is running low on memory.
     * background process, but the device is running low on memory.
     * Your running process should free up unneeded resources to allow that
     * Your running process should free up unneeded resources to allow that
     * memory to be used elsewhere.
     * memory to be used elsewhere.
     *
     * @deprecated Apps are not notified of this level since API level 34
     */
     */
    @Deprecated
    static final int TRIM_MEMORY_RUNNING_LOW = 10;
    static final int TRIM_MEMORY_RUNNING_LOW = 10;


    /**
    /**
@@ -155,17 +167,19 @@ public interface ComponentCallbacks2 extends ComponentCallbacks {
     * background process, but the device is running moderately low on memory.
     * background process, but the device is running moderately low on memory.
     * Your running process may want to release some unneeded resources for
     * Your running process may want to release some unneeded resources for
     * use elsewhere.
     * use elsewhere.
     *
     * @deprecated Apps are not notified of this level since API level 34
     */
     */
    @Deprecated
    static final int TRIM_MEMORY_RUNNING_MODERATE = 5;
    static final int TRIM_MEMORY_RUNNING_MODERATE = 5;


    /**
    /**
     * Called when the operating system has determined that it is a good
     * Called when the operating system has determined that it is a good
     * time for a process to trim unneeded memory from its process.  This will
     * time for a process to trim unneeded memory from its process.
     * happen for example when it goes in the background and there is not enough
     *
     * memory to keep as many background processes running as desired.  You
     * You should never compare to exact values of the level, since new
     * should never compare to exact values of the level, since new intermediate
     * intermediate values may be added -- you will typically want to compare if
     * values may be added -- you will typically want to compare if the value
     * the value is greater or equal to a level you are interested in.
     * is greater or equal to a level you are interested in.
     *
     *
     * <p>To retrieve the processes current trim level at any point, you can
     * <p>To retrieve the processes current trim level at any point, you can
     * use {@link android.app.ActivityManager#getMyMemoryState
     * use {@link android.app.ActivityManager#getMyMemoryState