diff --git a/packages/SystemUI/res/layout/screenshot_work_profile_first_run.xml b/packages/SystemUI/res/layout/screenshot_work_profile_first_run.xml index c1817242aa01e..392d84537e92c 100644 --- a/packages/SystemUI/res/layout/screenshot_work_profile_first_run.xml +++ b/packages/SystemUI/res/layout/screenshot_work_profile_first_run.xml @@ -4,12 +4,16 @@ android:id="@+id/work_profile_first_run" android:layout_height="wrap_content" android:layout_width="match_parent" + android:paddingStart="16dp" + android:paddingEnd="4dp" + android:paddingVertical="16dp" android:visibility="gone"> + android:layout_gravity="start|center_vertical" + android:textSize="18sp" + android:textColor="?android:attr/textColorPrimary" + android:lineHeight="24sp" + /> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 16bffb7b83fc5..0f9462866cd49 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -240,7 +240,7 @@ Right boundary %1$d percent - Work screenshots are saved in the %1$s app + Saved in %1$s in the work profile Files diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt b/packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt index 66b78420146b7..1b728b8aa9cc0 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/WorkProfileMessageController.kt @@ -67,10 +67,7 @@ constructor( } // If label wasn't loaded, use a default - val badgedLabel = - packageManager.getUserBadgedLabel(label ?: defaultFileAppName(), userHandle) - - return WorkProfileFirstRunData(badgedLabel, badgedIcon) + return WorkProfileFirstRunData(label ?: defaultFileAppName(), badgedIcon) } return null } diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java index 576652f4dbdbf..3440f91c1237b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/WorkProfileMessageControllerTest.java @@ -59,9 +59,7 @@ import kotlin.Unit; @RunWith(AndroidTestingRunner.class) public class WorkProfileMessageControllerTest extends SysuiTestCase { private static final String DEFAULT_LABEL = "default label"; - private static final String BADGED_DEFAULT_LABEL = "badged default label"; private static final String APP_LABEL = "app label"; - private static final String BADGED_APP_LABEL = "badged app label"; private static final UserHandle NON_WORK_USER = UserHandle.of(0); private static final UserHandle WORK_USER = UserHandle.of(10); @@ -91,10 +89,6 @@ public class WorkProfileMessageControllerTest extends SysuiTestCase { eq(WorkProfileMessageController.SHARED_PREFERENCES_NAME), eq(Context.MODE_PRIVATE))).thenReturn(mSharedPreferences); when(mMockContext.getString(ArgumentMatchers.anyInt())).thenReturn(DEFAULT_LABEL); - when(mPackageManager.getUserBadgedLabel(eq(DEFAULT_LABEL), any())) - .thenReturn(BADGED_DEFAULT_LABEL); - when(mPackageManager.getUserBadgedLabel(eq(APP_LABEL), any())) - .thenReturn(BADGED_APP_LABEL); when(mPackageManager.getActivityIcon(any(ComponentName.class))) .thenReturn(mActivityIcon); when(mPackageManager.getUserBadgedIcon( @@ -133,7 +127,7 @@ public class WorkProfileMessageControllerTest extends SysuiTestCase { WorkProfileMessageController.WorkProfileFirstRunData data = mMessageController.onScreenshotTaken(WORK_USER); - assertEquals(BADGED_DEFAULT_LABEL, data.getAppName()); + assertEquals(DEFAULT_LABEL, data.getAppName()); assertNull(data.getIcon()); } @@ -142,7 +136,7 @@ public class WorkProfileMessageControllerTest extends SysuiTestCase { WorkProfileMessageController.WorkProfileFirstRunData data = mMessageController.onScreenshotTaken(WORK_USER); - assertEquals(BADGED_APP_LABEL, data.getAppName()); + assertEquals(APP_LABEL, data.getAppName()); assertEquals(mBadgedActivityIcon, data.getIcon()); } @@ -151,7 +145,7 @@ public class WorkProfileMessageControllerTest extends SysuiTestCase { ViewGroup layout = (ViewGroup) LayoutInflater.from(mContext).inflate( R.layout.screenshot_work_profile_first_run, null); WorkProfileMessageController.WorkProfileFirstRunData data = - new WorkProfileMessageController.WorkProfileFirstRunData(BADGED_APP_LABEL, + new WorkProfileMessageController.WorkProfileFirstRunData(APP_LABEL, mBadgedActivityIcon); final CountDownLatch countdown = new CountDownLatch(1); mMessageController.populateView(layout, data, () -> { @@ -163,7 +157,7 @@ public class WorkProfileMessageControllerTest extends SysuiTestCase { assertEquals(mBadgedActivityIcon, image.getDrawable()); TextView text = layout.findViewById(R.id.screenshot_message_content); // The app name is used in a template, but at least validate that it was inserted. - assertTrue(text.getText().toString().contains(BADGED_APP_LABEL)); + assertTrue(text.getText().toString().contains(APP_LABEL)); // Validate that clicking the dismiss button calls back properly. assertEquals(1, countdown.getCount());