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

Commit fd0e047e authored by Alex Johnston's avatar Alex Johnston Committed by Oleg Matcovschi
Browse files

Add background protection when work biometrics is shown

* Remove existing coloured background.
* Add a background with a layout that includes a
  badged icon of the app being opened.

Manual testing steps:
* Set up device with a work profile using TestDPC
* Set a fingerprint in the work profile
* Open a work app
* Lock the device
* Verify the background protection is shown behind
  the biometric prompt

Screenshots:
* Dark mode: https://screenshot.googleplex.com/3SwGWrBREYoZFaH
* Light mode: https://screenshot.googleplex.com/8bzX9wLoFGJ2ado

Bug: 206761107
Test: Manual testing
    WorkLockActivityControllerTest
    TaskStackListenerImplTest
Change-Id: I90d117a97d7457a3186953c16db8bd0bbac048ed
(cherry picked from commit b3aa96f8)
parent 06f549c6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ oneway interface ITaskStackListener {
     * activities inside it belong to a managed profile user, and that user has just
     * been locked.
     */
    void onTaskProfileLocked(int taskId, int userId);
    void onTaskProfileLocked(in ActivityManager.RunningTaskInfo taskInfo);

    /**
     * Called when a task snapshot got updated.
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ public abstract class TaskStackListener extends ITaskStackListener.Stub {

    @Override
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public void onTaskProfileLocked(int taskId, int userId) throws RemoteException {
    public void onTaskProfileLocked(RunningTaskInfo taskInfo) throws RemoteException {
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public interface TaskStackListenerCallback {

    default void onTaskStackChanged() { }

    default void onTaskProfileLocked(int taskId, int userId) { }
    default void onTaskProfileLocked(RunningTaskInfo taskInfo) { }

    default void onTaskDisplayChanged(int taskId, int newDisplayId) { }

+5 −3
Original line number Diff line number Diff line
@@ -150,8 +150,8 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler.
    }

    @Override
    public void onTaskProfileLocked(int taskId, int userId) {
        mMainHandler.obtainMessage(ON_TASK_PROFILE_LOCKED, taskId, userId).sendToTarget();
    public void onTaskProfileLocked(ActivityManager.RunningTaskInfo taskInfo) {
        mMainHandler.obtainMessage(ON_TASK_PROFILE_LOCKED, taskInfo).sendToTarget();
    }

    @Override
@@ -341,8 +341,10 @@ public class TaskStackListenerImpl extends TaskStackListener implements Handler.
                    break;
                }
                case ON_TASK_PROFILE_LOCKED: {
                    final ActivityManager.RunningTaskInfo
                            info = (ActivityManager.RunningTaskInfo) msg.obj;
                    for (int i = mTaskStackListeners.size() - 1; i >= 0; i--) {
                        mTaskStackListeners.get(i).onTaskProfileLocked(msg.arg1, msg.arg2);
                        mTaskStackListeners.get(i).onTaskProfileLocked(info);
                    }
                    break;
                }
+4 −3
Original line number Diff line number Diff line
@@ -109,9 +109,10 @@ public class TaskStackListenerImplTest {

    @Test
    public void testOnTaskProfileLocked() {
        mImpl.onTaskProfileLocked(1, 2);
        verify(mCallback).onTaskProfileLocked(eq(1), eq(2));
        verify(mOtherCallback).onTaskProfileLocked(eq(1), eq(2));
        ActivityManager.RunningTaskInfo info = mock(ActivityManager.RunningTaskInfo.class);
        mImpl.onTaskProfileLocked(info);
        verify(mCallback).onTaskProfileLocked(eq(info));
        verify(mOtherCallback).onTaskProfileLocked(eq(info));
    }

    @Test
Loading