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

Commit 6fbe794e authored by Matt Casey's avatar Matt Casey
Browse files

UI updates for work profile first run.

Based upon UX feedback

- Update message text.
- Update sizes/padding
- Update text color

Bug: 254245929
Test: atest WorkProfileMessageControllerTest
Change-Id: Ia9b1231a12be6269ed9eb8a42c5605ec93727ccf
parent b2dc8d84
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -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">
    <ImageView
        android:id="@+id/screenshot_message_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:paddingEnd="4dp"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_marginEnd="12dp"
        android:layout_gravity="center_vertical"
        android:src="@drawable/ic_work_app_badge"/>

    <TextView
@@ -17,7 +21,11 @@
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_gravity="start"/>
        android:layout_gravity="start|center_vertical"
        android:textSize="18sp"
        android:textColor="?android:attr/textColorPrimary"
        android:lineHeight="24sp"
        />

    <FrameLayout
        android:id="@+id/message_dismiss_button"
@@ -25,9 +33,9 @@
        android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
        android:contentDescription="@string/screenshot_dismiss_work_profile">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="@dimen/overlay_dismiss_button_margin"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_gravity="center"
            android:src="@drawable/overlay_cancel"/>
    </FrameLayout>
</LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@
    <!-- Content description for the right boundary of the screenshot being cropped, with the current position as a percentage. [CHAR LIMIT=NONE] -->
    <string name="screenshot_right_boundary_pct">Right boundary <xliff:g id="percent" example="50">%1$d</xliff:g> percent</string>
    <!-- Notification displayed when a screenshot is saved in a work profile. [CHAR LIMIT=NONE] -->
    <string name="screenshot_work_profile_notification">Work screenshots are saved in the <xliff:g id="app" example="Work Files">%1$s</xliff:g> app</string>
    <string name="screenshot_work_profile_notification">Saved in <xliff:g id="app" example="Files">%1$s</xliff:g> in the work profile</string>
    <!-- Default name referring to the app on the device that lets the user browse stored files. [CHAR LIMIT=NONE] -->
    <string name="screenshot_default_files_app_name">Files</string>
    <!-- A notice shown to the user to indicate that an app has detected the screenshot that the user has just taken. [CHAR LIMIT=75] -->
+1 −4
Original line number Diff line number Diff line
@@ -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
    }
+4 −10
Original line number Diff line number Diff line
@@ -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());