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

Commit 240bea3f authored by Marco Ballesio's avatar Marco Ballesio
Browse files

ActivityManager API to check availability of app freezer

A method to verify the availability of the app freezer is required for
configuration code running in places like the Settings app

Bug: 155465196
Change-Id: I5779d263536091689a099eec0815f207dfbbf6ad
Test: verified its workings through the developer options CL
parent 06028798
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -673,4 +673,9 @@ interface IActivityManager {
     * @param state The customized state data
     */
    void setProcessStateSummary(in byte[] state);

    /**
     * Return whether the app freezer is supported (true) or not (false) by this system.
     */
    boolean isAppFreezerSupported();
}
+11 −0
Original line number Diff line number Diff line
@@ -20171,4 +20171,15 @@ public class ActivityManagerService extends IActivityManager.Stub
            mUsageStatsService.reportLocusUpdate(activity, userId, locusId, appToken);
        }
    }
    @Override
    public boolean isAppFreezerSupported() {
        final long token = Binder.clearCallingIdentity();
        try {
            return mOomAdjuster.mCachedAppOptimizer.isFreezerSupported();
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ public final class CachedAppOptimizer {
    /**
     * Determines whether the freezer is correctly supported by this system
     */
    public boolean isFreezerSupported() {
    public static boolean isFreezerSupported() {
        boolean supported = false;
        FileReader fr = null;