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

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

Merge changes I7bab7a57,I18724e22,Id1e1f548,I0c5dbdd2,I2ebc19fb into main

* changes:
  Remove flag for rate limiting getRunningAppProcesses.
  Remove flag for rate limiting getProcessesInErrorState.
  Remove flag for caching getCurrentUserId.
  Remove flag for rate limiting getMemoryInfo.
  Remove flag for rate limiting getMyMemoryState.
parents 0a201105 fb127f8a
Loading
Loading
Loading
Loading
+27 −57
Original line number Diff line number Diff line
@@ -257,7 +257,7 @@ public class ActivityManager {

    /**
     * Query handler for mGetCurrentUserIdCache - returns a cached value of the current foreground
     * user id if the backstage_power/android.app.cache_get_current_user_id flag is enabled.
     * user id.
     */
    private static final IpcDataCache.QueryHandler<Void, Integer> mGetCurrentUserIdQuery =
            new IpcDataCache.QueryHandler<>() {
@@ -269,12 +269,6 @@ public class ActivityManager {
                        throw e.rethrowFromSystemServer();
                    }
                }

                @Override
                public boolean shouldBypassCache(Void query) {
                    // If the flag to enable the new caching behavior is off, bypass the cache.
                    return !Flags.cacheGetCurrentUserId();
                }
            };

    /** A cache which maintains the current foreground user id. */
@@ -3520,7 +3514,6 @@ public class ActivityManager {
     * manage its memory.
     */
    public void getMemoryInfo(MemoryInfo outInfo) {
        if (Flags.rateLimitGetMemoryInfo()) {
        synchronized (mMemoryInfoCache) {
            mMemoryInfoCache.get(() -> {
                getMemoryInfoInternal(mRateLimitedMemInfo);
@@ -3528,9 +3521,6 @@ public class ActivityManager {
            });
            mRateLimitedMemInfo.copyTo(outInfo);
        }
        } else {
            getMemoryInfoInternal(outInfo);
        }
    }

    private void getMemoryInfoInternal(MemoryInfo outInfo) {
@@ -3726,21 +3716,13 @@ public class ActivityManager {
     * specified.
     */
    public List<ProcessErrorStateInfo> getProcessesInErrorState() {
        if (Flags.rateLimitGetProcessesInErrorState()) {
        return mErrorProcessesCache.get(() -> {
                return getProcessesInErrorStateInternal();
            });
        } else {
            return getProcessesInErrorStateInternal();
        }
    }

    private List<ProcessErrorStateInfo> getProcessesInErrorStateInternal() {
            try {
                return getService().getProcessesInErrorState();
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        });
    }

    /**
@@ -4277,21 +4259,13 @@ public class ActivityManager {
     * specified.
     */
    public List<RunningAppProcessInfo> getRunningAppProcesses() {
        if (!Flags.rateLimitGetRunningAppProcesses()) {
            return getRunningAppProcessesInternal();
        } else {
        return mRunningProcessesCache.get(() -> {
                return getRunningAppProcessesInternal();
            });
        }
    }

    private List<RunningAppProcessInfo> getRunningAppProcessesInternal() {
            try {
                return getService().getRunningAppProcesses();
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        });
    }

    /**
@@ -4825,7 +4799,6 @@ public class ActivityManager {
     * {@link RunningAppProcessInfo#importanceReasonCode}.
     */
    public static void getMyMemoryState(RunningAppProcessInfo outState) {
        if (Flags.rateLimitGetMyMemoryState()) {
        synchronized (mMyMemoryStateCache) {
            mMyMemoryStateCache.get(() -> {
                getMyMemoryStateInternal(mRateLimitedMemState);
@@ -4833,9 +4806,6 @@ public class ActivityManager {
            });
            mRateLimitedMemState.copyTo(outState);
        }
        } else {
            getMyMemoryStateInternal(outState);
        }
    }

    private static void getMyMemoryStateInternal(RunningAppProcessInfo outState) {
+0 −55
Original line number Diff line number Diff line
@@ -72,28 +72,6 @@ flag {
     }
}

flag {
     namespace: "backstage_power"
     name: "rate_limit_get_running_app_processes"
     description: "Rate limit calls to getRunningAppProcesses using a cache"
     is_fixed_read_only: true
     bug: "360374604"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "rate_limit_get_processes_in_error_state"
     description: "Rate limit calls to getProcessesInErrorState using a cache"
     is_fixed_read_only: true
     bug: "361146083"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "use_app_info_not_launched"
@@ -105,39 +83,6 @@ flag {
     }
}

flag {
     namespace: "backstage_power"
     name: "cache_get_current_user_id"
     description: "Add caching for getCurrentUserId"
     is_fixed_read_only: true
     bug: "361853873"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "rate_limit_get_memory_info"
     description: "Rate limit calls to getMemoryInfo using a cache"
     is_fixed_read_only: true
     bug: "364312431"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "rate_limit_get_my_memory_state"
     description: "Rate limit calls to getMyMemoryState using a cache"
     is_fixed_read_only: true
     bug: "365182205"
     metadata {
         purpose: PURPOSE_BUGFIX
     }
}

flag {
     namespace: "backstage_power"
     name: "use_sticky_bcast_cache"