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

Commit ab031bc2 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Apply delivery group policies to CLOSE_SYSTEM_DIALOG broadcast.

- The "set-defer-until-active" policy is applied so that the
broadcast targeted to apps in the Cached state is deferred until
they come out of that state.
- The "deliver-most-recent" policy is applied so that if there are
already pending broadcasts waiting to be delivered when a new
broadcast is sent, the old ones are discarded.

Bug: 271950524
Test: TH
AOSP: The new broadcasts are not available in AOSP
Change-Id: I5e624b271cfb0401e247fd43f429efb45bce6a3b
parent fb849665
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -16,10 +16,12 @@


package com.android.server.telecom;
package com.android.server.telecom;


import android.app.BroadcastOptions;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserHandle;
import android.telecom.Log;
import android.telecom.Log;
import android.widget.Toast;
import android.widget.Toast;
@@ -247,8 +249,14 @@ public final class TelecomBroadcastIntentProcessor {
     * Closes open system dialogs and the notification shade.
     * Closes open system dialogs and the notification shade.
     */
     */
    private void closeSystemDialogs(Context context) {
    private void closeSystemDialogs(Context context) {
        Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
        context.sendBroadcastAsUser(intent, UserHandle.ALL);
                .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        Bundle options = BroadcastOptions.makeBasic()
                .setDeliveryGroupPolicy(BroadcastOptions.DELIVERY_GROUP_POLICY_MOST_RECENT)
                .setDeferralPolicy(BroadcastOptions.DEFERRAL_POLICY_UNTIL_ACTIVE)
                .toBundle();
        context.sendBroadcastAsUser(intent, UserHandle.ALL, null /* receiverPermission */,
                options);
    }
    }


    private void sendSmsIntent(Intent intent, UserHandle userHandle) {
    private void sendSmsIntent(Intent intent, UserHandle userHandle) {