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

Commit e2fcabc9 authored by Jovana Knezevic's avatar Jovana Knezevic Committed by android-build-merger
Browse files

Merge "Adds user broadcasts to UserManagerHelper." into pi-dev

am: ccb8eb38

Change-Id: I22c968bfa6f1f70c175f04c5b2bd15f8509ed002
parents e9a66536 ccb8eb38
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -422,6 +422,9 @@ public final class UserManagerHelper {
        filter.addAction(Intent.ACTION_USER_REMOVED);
        filter.addAction(Intent.ACTION_USER_REMOVED);
        filter.addAction(Intent.ACTION_USER_ADDED);
        filter.addAction(Intent.ACTION_USER_ADDED);
        filter.addAction(Intent.ACTION_USER_INFO_CHANGED);
        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);
        mContext.registerReceiverAsUser(mUserChangeReceiver, UserHandle.ALL, filter, null, null);
    }
    }


+5 −1
Original line number Original line Diff line number Diff line
@@ -302,10 +302,14 @@ public class UserManagerHelperTest {
        // Verify the presence of each intent in the filter.
        // 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
        // Verify the exact number of filters. Every time a new intent is added, this test should
        // get updated.
        // 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_REMOVED)).isTrue();
        assertThat(filterCaptor.getValue().hasAction(Intent.ACTION_USER_ADDED)).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_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.
        // Verify that calling the receiver calls the listener.
        receiverCaptor.getValue().onReceive(mContext, new Intent());
        receiverCaptor.getValue().onReceive(mContext, new Intent());