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

Commit 5e523fa3 authored by jovanak's avatar jovanak Committed by Jovana Knezevic
Browse files

Adds user broadcasts to UserManagerHelper.

Same broadcasts supported by UserSwitcherController.

Car User switcher listens to user changes.
Switcher needs to hear when the user is switched to dismiss the
keyguard,which causes the switching animation to terminate.

Bug:77653809
Test: Unit tests.
Change-Id: I633cbd9045e7254dcc173ca0e1118fca06c669df
parent 0e675bd9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -348,6 +348,9 @@ public final class UserManagerHelper {
        filter.addAction(Intent.ACTION_USER_REMOVED);
        filter.addAction(Intent.ACTION_USER_ADDED);
        filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
        filter.addAction(Intent.ACTION_USER_SWITCHED);
        filter.addAction(Intent.ACTION_USER_STOPPED);
        filter.addAction(Intent.ACTION_USER_UNLOCKED);
        mContext.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null, null);
    }

+5 −1
Original line number Diff line number Diff line
@@ -335,10 +335,14 @@ public class UserManagerHelperTest {
        // Verify the presence of each intent in the filter.
        // Verify the exact number of filters. Every time a new intent is added, this test should
        // get updated.
        assertThat(filterCaptor.getValue().countActions()).isEqualTo(3);
        assertThat(filterCaptor.getValue().countActions()).isEqualTo(6);
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_REMOVED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_ADDED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_INFO_CHANGED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_SWITCHED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_STOPPED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_UNLOCKED)).isTrue();


        // Verify that calling the receiver calls the listener.
        receiverCaptor.getValue().onReceive(mContext, new Intent());