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

Commit 22f9a0d9 authored by Sahil Sonar's avatar Sahil Sonar 💬
Browse files

Settings: Force 60Hz refresh rate on boot with prop [2/2]

parent 100a7449
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ import android.app.StatsManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.ContentResolver;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;

/**
@@ -46,6 +49,18 @@ public class AnomalyConfigReceiver extends BroadcastReceiver {

            if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
                AnomalyCleanupJobService.scheduleCleanUp(context);
                boolean forceBoot60Hz = SystemProperties.getBoolean("ro.display.force_boot_60hz", false);
                if (forceBoot60Hz) {
                    final ContentResolver cr = context.getContentResolver();
                    float minRefreshRate = Settings.System.getFloatForUser(cr,
                            Settings.System.MIN_REFRESH_RATE, 0f, cr.getUserId());
                    if(minRefreshRate == 90f){
                       Settings.System.putFloatForUser(cr,
                               Settings.System.MIN_REFRESH_RATE, 60f,cr.getUserId());
                       Settings.System.putFloatForUser(cr,
                               Settings.System.MIN_REFRESH_RATE, 90f,cr.getUserId());
                    }
                }
            }
        }
    }