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

Commit 87241a14 authored by Lucas Silva's avatar Lucas Silva
Browse files

Listen to device policy broadcast for all users

Fixes: 352328660
Test: atest CommunalSettingsRepositoryImplTest
Flag: com.android.systemui.communal_hub
Change-Id: Iab0a846dc888bf9b205af526051f8722fd3e61a5
parent 78f735a9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.admin.DevicePolicyManager
import android.app.admin.DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL
import android.content.IntentFilter
import android.content.pm.UserInfo
import android.os.UserHandle
import android.provider.Settings
import com.android.systemui.Flags.communalHub
import com.android.systemui.broadcast.BroadcastDispatcher
@@ -102,7 +103,10 @@ constructor(
            .broadcastFlow(
                filter =
                    IntentFilter(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED),
                user = user.userHandle
                // In COPE management mode, the restriction from the managed profile may
                // propagate to the main profile. Therefore listen to this broadcast across
                // all users and update the state each time it changes.
                user = UserHandle.ALL,
            )
            .emitOnStart()
            .map { devicePolicyManager.areKeyguardWidgetsAllowed(user.id) }