diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3eb08bada1..d8089776ab 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -419,10 +419,12 @@
Work apps are paused
-
+
+ You won’t receive notifications from your work apps
+
Your work apps can’t send you notifications, use your battery, or access your location
-
- Work apps are off. Your work apps can’t send you notifications, use your battery, or access your location
+
+ You won’t receive phone calls, text messages, or notifications from your work apps
Work apps are badged and visible to your IT admin
@@ -431,7 +433,7 @@
Pause work apps
- Turn on work apps
+ Unpause
Filter
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 02e18c50a6..219d1ff163 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -126,6 +126,9 @@ public final class Utilities {
@ChecksSdkIntAtLeast(api = VERSION_CODES.TIRAMISU, codename = "T")
public static final boolean ATLEAST_T = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU;
+ @ChecksSdkIntAtLeast(api = VERSION_CODES.UPSIDE_DOWN_CAKE, codename = "U")
+ public static final boolean ATLEAST_U = Build.VERSION.SDK_INT >= VERSION_CODES.UPSIDE_DOWN_CAKE;
+
/**
* Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}.
*/
diff --git a/src/com/android/launcher3/model/StringCache.java b/src/com/android/launcher3/model/StringCache.java
index 9859ddca28..8209043ca3 100644
--- a/src/com/android/launcher3/model/StringCache.java
+++ b/src/com/android/launcher3/model/StringCache.java
@@ -18,6 +18,7 @@ package com.android.launcher3.model;
import android.annotation.SuppressLint;
import android.app.admin.DevicePolicyManager;
+import android.app.admin.ManagedSubscriptionsPolicy;
import android.content.Context;
import android.os.Build;
@@ -26,6 +27,8 @@ import androidx.annotation.RequiresApi;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import java.util.function.Supplier;
+
/**
*
* Cache for the device policy strings used in Launcher.
@@ -192,7 +195,9 @@ public class StringCache {
workProfilePausedTitle = getEnterpriseString(
context, WORK_PROFILE_PAUSED_TITLE, R.string.work_apps_paused_title);
workProfilePausedDescription = getEnterpriseString(
- context, WORK_PROFILE_PAUSED_DESCRIPTION, R.string.work_apps_paused_body);
+ context,
+ WORK_PROFILE_PAUSED_DESCRIPTION,
+ () -> getDefaultWorkProfilePausedDescriptionString(context));
workProfilePauseButton = getEnterpriseString(
context, WORK_PROFILE_PAUSE_BUTTON, R.string.work_apps_pause_btn_text);
workProfileEnableButton = getEnterpriseString(
@@ -216,20 +221,41 @@ public class StringCache {
context, DISABLED_BY_ADMIN_MESSAGE, R.string.msg_disabled_by_admin);
}
+ private String getDefaultWorkProfilePausedDescriptionString(Context context) {
+ if (Utilities.ATLEAST_U) {
+ DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
+ boolean telephonyIsUnavailable =
+ dpm.getManagedSubscriptionsPolicy().getPolicyType()
+ == ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS;
+ return telephonyIsUnavailable
+ ? context.getString(R.string.work_apps_paused_telephony_unavailable_body)
+ : context.getString(R.string.work_apps_paused_info_body);
+ }
+ return context.getString(R.string.work_apps_paused_body);
+ }
+
@SuppressLint("NewApi")
private String getEnterpriseString(
Context context, String updatableStringId, int defaultStringId) {
+ return getEnterpriseString(
+ context,
+ updatableStringId,
+ () -> context.getString(defaultStringId));
+ }
+
+ @SuppressLint("NewApi")
+ private String getEnterpriseString(
+ Context context, String updateableStringId, Supplier defaultStringSupplier) {
return Utilities.ATLEAST_T
- ? getUpdatableEnterpriseSting(context, updatableStringId, defaultStringId)
- : context.getString(defaultStringId);
+ ? getUpdatableEnterpriseString(context, updateableStringId, defaultStringSupplier)
+ : defaultStringSupplier.get();
}
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
- private String getUpdatableEnterpriseSting(
- Context context, String updatableStringId, int defaultStringId) {
+ private String getUpdatableEnterpriseString(
+ Context context, String updatableStringId, Supplier defaultStringSupplier) {
DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
- return dpm.getResources().getString(
- updatableStringId, () -> context.getString(defaultStringId));
+ return dpm.getResources().getString(updatableStringId, defaultStringSupplier);
}
@Override