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

Commit 3c98dd08 authored by Mitsuhashi Nanase's avatar Mitsuhashi Nanase Committed by takeshi tanigawa
Browse files

Show an error toast if there is not available SMS app when sending SMS

User cannot send SMS and no error message if there is not available SMS
app when sending it from missed call notification. Show an error toast
if there is not available SMS app.

Test: manual - Verified behavior of launching the SMS application from
missed call notification when the SMS application is disabled.
Test: auto - Passed TelecomUnitTests.
Bug: 141276199

Change-Id: Iaa48ee7a9ce94ffebba0d132cad331526112c107
parent e4b693b7
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -18,12 +18,17 @@ package com.android.server.telecom;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.UserHandle;
import android.telecom.Log;
import android.widget.Toast;

import com.android.server.telecom.ui.CallRedirectionConfirmDialogActivity;
import com.android.server.telecom.ui.ConfirmCallDialogActivity;

import java.util.List;

public final class TelecomBroadcastIntentProcessor {
    /** The action used to send SMS response for the missed call notification. */
    public static final String ACTION_SEND_SMS_FROM_NOTIFICATION =
@@ -119,7 +124,15 @@ public final class TelecomBroadcastIntentProcessor {

                Intent callIntent = new Intent(Intent.ACTION_SENDTO, intent.getData());
                callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                PackageManager packageManager = mContext.getPackageManager();
                List<ResolveInfo> activities = packageManager.queryIntentActivitiesAsUser(
                        callIntent, PackageManager.MATCH_DEFAULT_ONLY, userHandle.getIdentifier());
                if (activities.size() > 0) {
                    mContext.startActivityAsUser(callIntent, userHandle);
                } else {
                    Toast.makeText(mContext, com.android.internal.R.string.noApplications,
                            Toast.LENGTH_SHORT).show();
                }

                // Call back recent caller from the missed call notification.
            } else if (ACTION_CALL_BACK_FROM_NOTIFICATION.equals(action)) {