Merge "Add new folding grace period settings strings" into main
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 22a1cbc..dc81de6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -88,6 +88,11 @@
     <string name="selective_stay_awake_title">Only games, videos, and more</string>
     <!-- Summary for selective stay awake radio button. [CHAR_LIMIT=NONE] -->
     <string name="selective_stay_awake_summary">Front display turns on for apps that stop your screen going idle</string>
+    <!-- Title for fold grace period radio button that, on fold, goes to the lockscreen. [CHAR_LIMIT=NONE] -->
+    <string name="stay_awake_on_lockscreen_title">Swipe up to continue</string>
+    <!-- Summary for folding grace period radio button that, on fold, goes to the lockscreen. [CHAR_LIMIT=NONE] -->
+    <string name="stay_awake_on_lockscreen_summary">Fold your phone and swipe up on the front display to continue using the app, or wait a few seconds for the screen to lock</string>
+
     <!-- Title for sleep on fold radio button. [CHAR_LIMIT=NONE] -->
     <string name="sleep_on_fold_title">Never</string>
     <!-- Summary for sleep on fold radio button. [CHAR_LIMIT=NONE] -->
diff --git a/src/com/android/settings/display/FoldLockBehaviorPreferenceController.java b/src/com/android/settings/display/FoldLockBehaviorPreferenceController.java
index 661eb99..bee3a22 100644
--- a/src/com/android/settings/display/FoldLockBehaviorPreferenceController.java
+++ b/src/com/android/settings/display/FoldLockBehaviorPreferenceController.java
@@ -29,6 +29,7 @@
 
 import androidx.preference.Preference;
 
+import com.android.internal.foldables.FoldGracePeriodProvider;
 import com.android.internal.foldables.FoldLockSettingAvailabilityProvider;
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
@@ -58,8 +59,13 @@
         mFoldLockSettingAvailabilityProvider = foldLockSettingAvailabilityProvider;
         KEY_TO_TEXT.put(SETTING_VALUE_STAY_AWAKE_ON_FOLD,
                 resourceToString(R.string.stay_awake_on_fold_title));
-        KEY_TO_TEXT.put(SETTING_VALUE_SELECTIVE_STAY_AWAKE,
-                resourceToString(R.string.selective_stay_awake_title));
+        if (new FoldGracePeriodProvider().isEnabled()) {
+            KEY_TO_TEXT.put(SETTING_VALUE_SELECTIVE_STAY_AWAKE,
+                    resourceToString(R.string.stay_awake_on_lockscreen_title));
+        } else {
+            KEY_TO_TEXT.put(SETTING_VALUE_SELECTIVE_STAY_AWAKE,
+                    resourceToString(R.string.selective_stay_awake_title));
+        }
         KEY_TO_TEXT.put(SETTING_VALUE_SLEEP_ON_FOLD,
                 resourceToString(R.string.sleep_on_fold_title));
     }
diff --git a/src/com/android/settings/display/FoldLockBehaviorSettings.java b/src/com/android/settings/display/FoldLockBehaviorSettings.java
index e94b17e..432c230 100644
--- a/src/com/android/settings/display/FoldLockBehaviorSettings.java
+++ b/src/com/android/settings/display/FoldLockBehaviorSettings.java
@@ -24,6 +24,7 @@
 import android.provider.Settings;
 import android.util.Log;
 
+import com.android.internal.foldables.FoldGracePeriodProvider;
 import com.android.settings.R;
 import com.android.settings.support.actionbar.HelpResourceProvider;
 import com.android.settings.utils.CandidateInfoExtra;
@@ -54,6 +55,7 @@
                     SETTING_VALUE_SLEEP_ON_FOLD));
     private static final String SETTING_VALUE_DEFAULT = SETTING_VALUE_SELECTIVE_STAY_AWAKE;
     private Context mContext;
+    private final FoldGracePeriodProvider mFoldGracePeriodProvider = new FoldGracePeriodProvider();
 
     @Override
     public void onAttach(Context context) {
@@ -69,10 +71,17 @@
                 resourceToString(R.string.stay_awake_on_fold_title),
                 resourceToString(R.string.stay_awake_on_fold_summary),
                 SETTING_VALUE_STAY_AWAKE_ON_FOLD, /* enabled */ true));
-        candidates.add(new CandidateInfoExtra(
-                resourceToString(R.string.selective_stay_awake_title),
-                resourceToString(R.string.selective_stay_awake_summary),
-                SETTING_VALUE_SELECTIVE_STAY_AWAKE, /* enabled */ true));
+        if (mFoldGracePeriodProvider.isEnabled()) {
+            candidates.add(new CandidateInfoExtra(
+                    resourceToString(R.string.stay_awake_on_lockscreen_title),
+                    resourceToString(R.string.stay_awake_on_lockscreen_summary),
+                    SETTING_VALUE_SELECTIVE_STAY_AWAKE, /* enabled */ true));
+        } else {
+            candidates.add(new CandidateInfoExtra(
+                    resourceToString(R.string.selective_stay_awake_title),
+                    resourceToString(R.string.selective_stay_awake_summary),
+                    SETTING_VALUE_SELECTIVE_STAY_AWAKE, /* enabled */ true));
+        }
         candidates.add(new CandidateInfoExtra(
                 resourceToString(R.string.sleep_on_fold_title),
                 resourceToString(R.string.sleep_on_fold_summary),