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

Commit 87ca3eb4 authored by Hakjun Choi's avatar Hakjun Choi Committed by Thomas Nguyen
Browse files

Add flag FLAG_ACTIVITY_CLEAR_TOP to reopen existing Activity

In case ESOS questionnaire is invoked several times without exit, only a single instance of questionnaire is shown at one time.

Bug: 349145955
Flag: EXEMPT bugfix
Test: manual e2e test using shieldbox for both T911 and ESOS
Test: 352761121

Change-Id: I4662939fa98b66fec77ff257ff33128580e1959e
parent 88a6bb96
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony.satellite;

import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.telephony.ServiceState.STATE_EMERGENCY_ONLY;
import static android.telephony.ServiceState.STATE_IN_SERVICE;
import static android.telephony.ServiceState.STATE_OUT_OF_SERVICE;
@@ -29,6 +30,7 @@ import static com.android.internal.telephony.satellite.SatelliteController.INVAL

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -707,10 +709,15 @@ public class SatelliteSOSMessageRecommender extends Handler {
            intent = new Intent(Intent.ACTION_SENDTO, uri);
        } else {
            intent = new Intent(action);
            intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP);
        }
        Bundle activityOptions = ActivityOptions.makeBasic()
                .setPendingIntentBackgroundActivityStartMode(
                        ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
                .toBundle();
        intent.setComponent(new ComponentName(packageName, className));
        return PendingIntent.getActivity(mContext, 0, intent,
                PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
                PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, activityOptions);
    }

    private boolean isEmergencyCallToSatelliteHandoverTypeT911Enforced() {