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

Commit 99111bf4 authored by Li Li's avatar Li Li
Browse files

Update Freezer app kill reasons

Update Freezer app kill reasons from REASON_OTHER to REASON_FREEZER.

Bug: 179715791
Test: dumpsys activity exit-info shows the new reason.
Test: atest android.app.cts.ActivityManagerAppExitInfoTest
Change-Id: If65c14af2fcd11efd7228b47fcf7b1189adb45bb
parent 3fc735da
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4862,6 +4862,7 @@ package android.app {
    field public static final int REASON_DEPENDENCY_DIED = 12; // 0xc
    field public static final int REASON_EXCESSIVE_RESOURCE_USAGE = 9; // 0x9
    field public static final int REASON_EXIT_SELF = 1; // 0x1
    field public static final int REASON_FREEZER = 14; // 0xe
    field public static final int REASON_INITIALIZATION_FAILURE = 7; // 0x7
    field public static final int REASON_LOW_MEMORY = 3; // 0x3
    field public static final int REASON_OTHER = 13; // 0xd
+9 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ public final class ApplicationExitInfo implements Parcelable {
     */
    public static final int REASON_OTHER = 13;

    /**
     * Application process was killed by App Freezer, for example, because it receives
     * sync binder transactions while being frozen.
     */
    public static final int REASON_FREEZER = 14;

    /**
     * Application process kills subreason is unknown.
     *
@@ -487,6 +493,7 @@ public final class ApplicationExitInfo implements Parcelable {
        REASON_USER_STOPPED,
        REASON_DEPENDENCY_DIED,
        REASON_OTHER,
        REASON_FREEZER,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Reason {}
@@ -1138,6 +1145,8 @@ public final class ApplicationExitInfo implements Parcelable {
                return "DEPENDENCY DIED";
            case REASON_OTHER:
                return "OTHER KILLS BY SYSTEM";
            case REASON_FREEZER:
                return "FREEZER";
            default:
                return "UNKNOWN";
        }
+4 −0
Original line number Diff line number Diff line
@@ -679,6 +679,10 @@ interface IActivityManager {
     */
    boolean isAppFreezerSupported();

    /**
     * Return whether the app freezer is enabled (true) or not (false) by this system.
     */
    boolean isAppFreezerEnabled();

    /**
     * Kills uid with the reason of permission change.
+5 −0
Original line number Diff line number Diff line
@@ -17762,6 +17762,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    @Override
    public boolean isAppFreezerEnabled() {
        return mOomAdjuster.mCachedAppOptimizer.useFreezer();
    }
    /**
     * Resets the state of the {@link com.android.server.am.AppErrors} instance.
     * This is intended for testing within the CTS only and is protected by
+5 −5
Original line number Diff line number Diff line
@@ -977,7 +977,7 @@ public final class CachedAppOptimizer {
                Slog.d(TAG_AM, "pid " + pid + " " + app.processName
                        + " received sync transactions while frozen, killing");
                app.killLocked("Sync transaction while in frozen state",
                        ApplicationExitInfo.REASON_OTHER,
                        ApplicationExitInfo.REASON_FREEZER,
                        ApplicationExitInfo.SUBREASON_FREEZER_BINDER_TRANSACTION, true);
                processKilled = true;
            }
@@ -990,7 +990,7 @@ public final class CachedAppOptimizer {
            Slog.d(TAG_AM, "Unable to query binder frozen info for pid " + pid + " "
                    + app.processName + ". Killing it. Exception: " + e);
            app.killLocked("Unable to query binder frozen stats",
                    ApplicationExitInfo.REASON_OTHER,
                    ApplicationExitInfo.REASON_FREEZER,
                    ApplicationExitInfo.SUBREASON_FREEZER_BINDER_IOCTL, true);
            processKilled = true;
        }
@@ -1007,7 +1007,7 @@ public final class CachedAppOptimizer {
            Slog.e(TAG_AM, "Unable to unfreeze binder for " + pid + " " + app.processName
                    + ". Killing it");
            app.killLocked("Unable to unfreeze",
                    ApplicationExitInfo.REASON_OTHER,
                    ApplicationExitInfo.REASON_FREEZER,
                    ApplicationExitInfo.SUBREASON_FREEZER_BINDER_IOCTL, true);
            return;
        }
@@ -1423,7 +1423,7 @@ public final class CachedAppOptimizer {
                    mFreezeHandler.post(() -> {
                        synchronized (mAm) {
                            proc.killLocked("Unable to freeze binder interface",
                                    ApplicationExitInfo.REASON_OTHER,
                                    ApplicationExitInfo.REASON_FREEZER,
                                    ApplicationExitInfo.SUBREASON_FREEZER_BINDER_IOCTL, true);
                        }
                    });
@@ -1477,7 +1477,7 @@ public final class CachedAppOptimizer {
                mFreezeHandler.post(() -> {
                    synchronized (mAm) {
                        proc.killLocked("Unable to freeze binder interface",
                                ApplicationExitInfo.REASON_OTHER,
                                ApplicationExitInfo.REASON_FREEZER,
                                ApplicationExitInfo.SUBREASON_FREEZER_BINDER_IOCTL, true);
                    }
                });