Settings: Display actual device peak refresh rate in summary

The hardcoded value of 90Hz might be incorrect for some devices.

Squashed with:
Author: Michael W <baddaemon87@gmail.com>
Date:   Thu Oct 14 19:22:29 2021 +0200

    Fixup "settings: display actual device peak refresh rate in summary"

    This partially reverts commit 892841cc0bdbfab787a35952cb38e67ebcc07e9a.

    * peak_refresh_rate_summary ->
      peak_refresh_rate_summary_custom

    Change-Id: I11140715990215329a0813a232651bfbd230828d

Change-Id: I6074f081855f20f8c4b973e893175d9b0f79b3ab
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 9729894..3249abe 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -75,4 +75,7 @@
     <!-- Status bar -->
     <string name="status_bar_title">Status bar</string>
     <string name="status_bar_system_icons_summary">Control which status bar icons are shown</string>
+
+    <!-- Display settings screen, peak refresh rate settings summary [CHAR LIMIT=NONE] -->
+    <string name="peak_refresh_rate_summary_custom">Automatically raises the refresh rate from 60 to %1$d Hz for some content. Increases battery usage.</string>
 </resources>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 6c4b8f6..88a2883 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -173,7 +173,6 @@
         <SwitchPreferenceCompat
             android:key="peak_refresh_rate"
             android:title="@string/peak_refresh_rate_title"
-            android:summary="@string/peak_refresh_rate_summary"
             settings:controller="com.android.settings.display.PeakRefreshRatePreferenceController"/>
 
         <SwitchPreferenceCompat
diff --git a/src/com/android/settings/display/PeakRefreshRatePreferenceController.java b/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
index dfe571a..6d7101a 100644
--- a/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
+++ b/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
@@ -83,6 +83,10 @@
         mPreference = screen.findPreference(getPreferenceKey());
         mPreference.setSummary(mContext.getString(
                 R.string.peak_refresh_rate_summary, defaultPeakRefreshRate));
+
+        final String summary = mContext.getString(R.string.peak_refresh_rate_summary_custom,
+                (int)mPeakRefreshRate);
+        mPreference.setSummary(summary);
     }
 
     @Override