Loading services/core/java/com/android/server/ZramWriteback.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -60,6 +60,7 @@ public final class ZramWriteback extends JobService { private static final String MARK_IDLE_DELAY_PROP = "ro.zram.mark_idle_delay_mins"; private static final String MARK_IDLE_DELAY_PROP = "ro.zram.mark_idle_delay_mins"; private static final String FIRST_WB_DELAY_PROP = "ro.zram.first_wb_delay_mins"; private static final String FIRST_WB_DELAY_PROP = "ro.zram.first_wb_delay_mins"; private static final String PERIODIC_WB_DELAY_PROP = "ro.zram.periodic_wb_delay_hours"; private static final String PERIODIC_WB_DELAY_PROP = "ro.zram.periodic_wb_delay_hours"; private static final String FORCE_WRITEBACK_PROP = "zram.force_writeback"; private void markPagesAsIdle() { private void markPagesAsIdle() { String idlePath = String.format(IDLE_SYS, sZramDeviceId); String idlePath = String.format(IDLE_SYS, sZramDeviceId); Loading Loading @@ -122,11 +123,12 @@ public final class ZramWriteback extends JobService { private static void schedNextWriteback(Context context) { private static void schedNextWriteback(Context context) { int nextWbDelay = SystemProperties.getInt(PERIODIC_WB_DELAY_PROP, 24); int nextWbDelay = SystemProperties.getInt(PERIODIC_WB_DELAY_PROP, 24); boolean forceWb = SystemProperties.getBoolean(FORCE_WRITEBACK_PROP, false); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) .setMinimumLatency(TimeUnit.HOURS.toMillis(nextWbDelay)) .setMinimumLatency(TimeUnit.HOURS.toMillis(nextWbDelay)) .setRequiresDeviceIdle(true) .setRequiresDeviceIdle(!forceWb) .build()); .build()); } } Loading Loading @@ -167,6 +169,7 @@ public final class ZramWriteback extends JobService { public static void scheduleZramWriteback(Context context) { public static void scheduleZramWriteback(Context context) { int markIdleDelay = SystemProperties.getInt(MARK_IDLE_DELAY_PROP, 20); int markIdleDelay = SystemProperties.getInt(MARK_IDLE_DELAY_PROP, 20); int firstWbDelay = SystemProperties.getInt(FIRST_WB_DELAY_PROP, 180); int firstWbDelay = SystemProperties.getInt(FIRST_WB_DELAY_PROP, 180); boolean forceWb = SystemProperties.getBoolean(FORCE_WRITEBACK_PROP, false); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); Loading @@ -182,7 +185,7 @@ public final class ZramWriteback extends JobService { // by ro.zram.periodic_wb_delay_hours. // by ro.zram.periodic_wb_delay_hours. js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) .setMinimumLatency(TimeUnit.MINUTES.toMillis(firstWbDelay)) .setMinimumLatency(TimeUnit.MINUTES.toMillis(firstWbDelay)) .setRequiresDeviceIdle(true) .setRequiresDeviceIdle(!forceWb) .build()); .build()); } } } } Loading
services/core/java/com/android/server/ZramWriteback.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -60,6 +60,7 @@ public final class ZramWriteback extends JobService { private static final String MARK_IDLE_DELAY_PROP = "ro.zram.mark_idle_delay_mins"; private static final String MARK_IDLE_DELAY_PROP = "ro.zram.mark_idle_delay_mins"; private static final String FIRST_WB_DELAY_PROP = "ro.zram.first_wb_delay_mins"; private static final String FIRST_WB_DELAY_PROP = "ro.zram.first_wb_delay_mins"; private static final String PERIODIC_WB_DELAY_PROP = "ro.zram.periodic_wb_delay_hours"; private static final String PERIODIC_WB_DELAY_PROP = "ro.zram.periodic_wb_delay_hours"; private static final String FORCE_WRITEBACK_PROP = "zram.force_writeback"; private void markPagesAsIdle() { private void markPagesAsIdle() { String idlePath = String.format(IDLE_SYS, sZramDeviceId); String idlePath = String.format(IDLE_SYS, sZramDeviceId); Loading Loading @@ -122,11 +123,12 @@ public final class ZramWriteback extends JobService { private static void schedNextWriteback(Context context) { private static void schedNextWriteback(Context context) { int nextWbDelay = SystemProperties.getInt(PERIODIC_WB_DELAY_PROP, 24); int nextWbDelay = SystemProperties.getInt(PERIODIC_WB_DELAY_PROP, 24); boolean forceWb = SystemProperties.getBoolean(FORCE_WRITEBACK_PROP, false); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) .setMinimumLatency(TimeUnit.HOURS.toMillis(nextWbDelay)) .setMinimumLatency(TimeUnit.HOURS.toMillis(nextWbDelay)) .setRequiresDeviceIdle(true) .setRequiresDeviceIdle(!forceWb) .build()); .build()); } } Loading Loading @@ -167,6 +169,7 @@ public final class ZramWriteback extends JobService { public static void scheduleZramWriteback(Context context) { public static void scheduleZramWriteback(Context context) { int markIdleDelay = SystemProperties.getInt(MARK_IDLE_DELAY_PROP, 20); int markIdleDelay = SystemProperties.getInt(MARK_IDLE_DELAY_PROP, 20); int firstWbDelay = SystemProperties.getInt(FIRST_WB_DELAY_PROP, 180); int firstWbDelay = SystemProperties.getInt(FIRST_WB_DELAY_PROP, 180); boolean forceWb = SystemProperties.getBoolean(FORCE_WRITEBACK_PROP, false); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); Loading @@ -182,7 +185,7 @@ public final class ZramWriteback extends JobService { // by ro.zram.periodic_wb_delay_hours. // by ro.zram.periodic_wb_delay_hours. js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) js.schedule(new JobInfo.Builder(WRITEBACK_IDLE_JOB_ID, sZramWriteback) .setMinimumLatency(TimeUnit.MINUTES.toMillis(firstWbDelay)) .setMinimumLatency(TimeUnit.MINUTES.toMillis(firstWbDelay)) .setRequiresDeviceIdle(true) .setRequiresDeviceIdle(!forceWb) .build()); .build()); } } } }