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

Commit c85bbe00 authored by Kweku Adams's avatar Kweku Adams
Browse files

Automatically load ActivityManager DeviceConfig constants.

The former method required us to load each individual DeviceConfig
constant at startup time. This could easily lead to an issue where
someone forgets to add that line in the startup path and the value
isn't loaded. Switching to have all DeviceConfig constants read and
processed by a generic loop so we don't run into this issue.

Bug: N/A
Test: flash device and confirm DeviceConfig constants are loaded
Change-Id: I981829722cf035e894415a11e214724b213c65fa
parent 8a269993
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -438,14 +438,15 @@ final class ActivityManagerConstants extends ContentObserver {
        DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER,
                ActivityThread.currentApplication().getMainExecutor(),
                mOnDeviceConfigChangedListener);
        updateMaxCachedProcesses();
        loadDeviceConfigConstants();
        // The following read from Settings.
        updateActivityStartsLoggingEnabled();
        updateBackgroundActivityStarts();
        updateForceRestrictedBackgroundCheck();
        updateForegroundServiceStartsLoggingEnabled();
        updateBackgroundFgsStartsRestriction();
        updateOomAdjUpdatePolicy();
        updateImperceptibleKillExemptions();
    }

    private void loadDeviceConfigConstants() {
        mOnDeviceConfigChangedListener.onPropertiesChanged(
                DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER));
    }

    public void setOverrideMaxCachedProcesses(int value) {