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

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

Reduce prefetch launch time threshold.

Reduce the prefetch job launch time threshold to one hour so we will
only consider running a prefetch job at most one hour before the app is
estimated to be launched.

Bug: 295046507
Test: atest FrameworksMockingServicesTests:PrefetchControllerTest
Change-Id: Ia3d4d049fb44b8f12418c987425949b60b37bd65
parent 2a0f9e11
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -536,10 +536,13 @@ public class PrefetchController extends StateController {
        static final String KEY_LAUNCH_TIME_ALLOWANCE_MS =
                PC_CONSTANT_PREFIX + "launch_time_allowance_ms";

        private static final long DEFAULT_LAUNCH_TIME_THRESHOLD_MS = 7 * HOUR_IN_MILLIS;
        private static final long DEFAULT_LAUNCH_TIME_ALLOWANCE_MS = 20 * MINUTE_IN_MILLIS;
        private static final long DEFAULT_LAUNCH_TIME_THRESHOLD_MS = HOUR_IN_MILLIS;
        private static final long DEFAULT_LAUNCH_TIME_ALLOWANCE_MS = 30 * MINUTE_IN_MILLIS;

        /** How much time each app will have to run jobs within their standby bucket window. */
        /**
         * The earliest amount of time before the next estimated app launch time that we may choose
         * to run a prefetch job for the app.
         */
        public long LAUNCH_TIME_THRESHOLD_MS = DEFAULT_LAUNCH_TIME_THRESHOLD_MS;

        /**
+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ public class PrefetchControllerTest {
        mPrefetchController = new PrefetchController(mJobSchedulerService);
        mPcConstants = mPrefetchController.getPcConstants();

        setDeviceConfigLong(PcConstants.KEY_LAUNCH_TIME_THRESHOLD_MS, 7 * HOUR_IN_MILLIS);

        setUidBias(Process.myUid(), JobInfo.BIAS_DEFAULT);

        verify(mUsageStatsManagerInternal)