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

Commit 83eb599a authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Apply "most-recent" delivery policy to ACTION_USER_RESTRICTIONS_CHANGED."

parents aa8a8dff 13452f6e
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.ActivityManagerNative;
import android.app.BroadcastOptions;
import android.app.IActivityManager;
import android.app.IStopUserCallback;
import android.app.KeyguardManager;
@@ -2924,7 +2925,13 @@ public class UserManagerService extends IUserManager.Stub {

                final Intent broadcast = new Intent(UserManager.ACTION_USER_RESTRICTIONS_CHANGED)
                        .setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                mContext.sendBroadcastAsUser(broadcast, UserHandle.of(userId));
                // Setting the MOST_RECENT policy allows us to discard older broadcasts
                // still waiting to be delivered.
                final Bundle options = BroadcastOptions.makeBasic()
                        .setDeliveryGroupPolicy(BroadcastOptions.DELIVERY_GROUP_POLICY_MOST_RECENT)
                        .toBundle();
                mContext.sendBroadcastAsUser(broadcast, UserHandle.of(userId),
                        null /* receiverPermission */, options);
            }
        });
    }