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

Commit 221b19e9 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Lower SMS background importance

The messaging app is currently bound with the BIND_NOT_VISIBLE flag
by the system. This keeps it in the oom score 200 slot, which
competes with higher priority processes like foreground services.
Binding with BIND_ALMOST_PERCEPTIBLE will lower its background
importance to 201, keeping it warm in memory for snappier UX but
allows them to die in favor of process doing more important work.

Flag: com.android.server.am.lower_sms_oom_importance
Fixes: 372511805
Test: manual (`adb shell dumpsys activity lru`, background sms
process should have `prcp+1` oom score.)

Change-Id: Ia4fef6afa57ff822e5122e1716ea05462dd1ed48
parent 6c118a5b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -319,3 +319,14 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "lower_sms_oom_importance"
    namespace: "backstage_power"
    description: "Lower messaging app process oom importance to PERCEPTIBLE_APP_ADJ + 1."
    bug: "372511805"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+10 −3
Original line number Diff line number Diff line
@@ -102,9 +102,16 @@ public class AppBindingConstants {

        boolean smsServiceEnabled = parser.getBoolean(SMS_SERVICE_ENABLED_KEY, true);

        int smsAppBindFlags = parser.getInt(
        int smsAppBindFlags;
        if (com.android.server.am.Flags.lowerSmsOomImportance()) {
            smsAppBindFlags = parser.getInt(
                    SMS_APP_BIND_FLAGS_KEY,
                    Context.BIND_ALMOST_PERCEPTIBLE | Context.BIND_FOREGROUND_SERVICE);
        } else {
            smsAppBindFlags = parser.getInt(
                    SMS_APP_BIND_FLAGS_KEY,
                    Context.BIND_NOT_VISIBLE | Context.BIND_FOREGROUND_SERVICE);
        }

        long serviceStableConnectionThresholdSec = parser.getLong(
                SERVICE_STABLE_CONNECTION_THRESHOLD_SEC_KEY, TimeUnit.MINUTES.toSeconds(2));