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

Commit ccef2bf9 authored by erfanian's avatar erfanian Committed by android-build-merger
Browse files

Merge changes If3f2414d,I8bdd9c79

am: 8acf2083

Change-Id: I93888608a67ab0dfe9d37e606355eefd761a4870
parents e7556d59 8acf2083
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -34,9 +34,6 @@ import com.android.dialer.persistentlog.PersistentLogger;
import com.android.dialer.preferredsim.PreferredSimFallbackContract;
import com.android.dialer.simulator.SimulatorComponent;
import com.android.incallui.rtt.impl.RttChatActivity;
import com.android.incallui.speakeasy.SpeakEasy;
import com.android.incallui.speakeasy.SpeakEasyActivity;
import com.android.incallui.speakeasy.SpeakEasyComponent;

/** Implements the top level simulator menu. */
final class SimulatorMainMenu {
@@ -79,12 +76,6 @@ final class SimulatorMainMenu {
                SimulatorComponent.get(activity.getApplicationContext())
                    .getSimulator()
                    .disableSimulatorMode());
    SpeakEasy speakEasy = SpeakEasyComponent.get(activity.getApplicationContext()).speakEasy();
    if (speakEasy.isEnabled()) {
      simulatorSubMenu.addItem(
          "SpeakEasy call mock", () -> simulateSpeakEasyCallMock(activity.getApplicationContext()));
    }

    return simulatorSubMenu;
  }

@@ -92,10 +83,6 @@ final class SimulatorMainMenu {
    context.startActivity(new Intent(context, RttChatActivity.class));
  }

  private static void simulateSpeakEasyCallMock(@NonNull Context context) {
    context.startActivity(new Intent(context, SpeakEasyActivity.class));
  }

  private static void populateDatabase(@NonNull Context context) {
    DialerExecutorComponent.get(context)
        .dialerExecutorFactory()
+15 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import com.android.incallui.audiomode.AudioModeProvider;
import com.android.incallui.call.CallList;
import com.android.incallui.call.ExternalCallList;
import com.android.incallui.call.TelecomAdapter;
import com.android.incallui.speakeasy.SpeakEasyCallManager;
import com.android.incallui.speakeasy.SpeakEasyComponent;

/**
 * Used to receive updates about calls from the Telecom component. This service is bound to Telecom
@@ -41,6 +43,11 @@ public class InCallServiceImpl extends InCallService {
  private ReturnToCallController returnToCallController;
  private NewReturnToCallController newReturnToCallController;
  private CallList.Listener feedbackListener;
  // We only expect there to be one speakEasyCallManager to be instantiated at a time.
  // We did not use a singleton SpeakEasyCallManager to avoid holding on to state beyond the
  // lifecycle of this service, because the singleton is associated with the state of the
  // Application, not this service.
  private SpeakEasyCallManager speakEasyCallManager;

  @Override
  public void onCallAudioStateChanged(CallAudioState audioState) {
@@ -66,6 +73,8 @@ public class InCallServiceImpl extends InCallService {
  @Override
  public void onCallRemoved(Call call) {
    Trace.beginSection("InCallServiceImpl.onCallRemoved");
    speakEasyCallManager.onCallRemoved(CallList.getInstance().getDialerCallFromTelecomCall(call));

    InCallPresenter.getInstance().onCallRemoved(call);
    Trace.endSection();
  }
@@ -77,6 +86,12 @@ public class InCallServiceImpl extends InCallService {
    Trace.endSection();
  }

  @Override
  public void onCreate() {
    super.onCreate();
    this.speakEasyCallManager = SpeakEasyComponent.get(this).speakEasyCallManager();
  }

  @Override
  public IBinder onBind(Intent intent) {
    Trace.beginSection("InCallServiceImpl.onBind");
+2 −2
Original line number Diff line number Diff line
@@ -67,14 +67,14 @@
    <item name="dialpad_elevation">10dp</item>
  </style>

  <style name="AfterCallNotificationTheme" parent="@style/Theme.AppCompat.Light.Dialog.MinWidth">
  <style name="AfterCallNotificationTheme" parent="@android:style/Theme.Material.Light.Dialog">
    <!-- This colorAccent is to style checkboxes in the dialogs -->
    <item name="colorAccent">@color/dialer_theme_color</item>
    <!-- This is needed to make any alert dialogs in this activity take up minimum space -->
    <item name="android:alertDialogTheme">@style/AfterCallDialogStyle</item>
  </style>

  <style name="AfterCallDialogStyle" parent="@style/Theme.AppCompat.Light.Dialog.MinWidth">
  <style name="AfterCallDialogStyle" parent="@android:style/Theme.Material.Light.Dialog">
    <!-- This colorAccent is to style text in the dialogs -->
    <item name="android:colorAccent">@color/dialer_theme_color</item>
  </style>
+1 −4
Original line number Diff line number Diff line
@@ -391,14 +391,11 @@ public class SpamCallListListener implements CallList.Listener {
        createAfterCallNotificationBuilder(call)
            .setLargeIcon(Icon.createWithResource(context, R.drawable.spam_notification_icon))
            .setContentText(context.getString(R.string.spam_notification_spam_call_collapsed_text))
            .setStyle(
                new Notification.BigTextStyle()
                    .bigText(context.getString(R.string.spam_notification_spam_call_expanded_text)))
            // Not spam
            .addAction(
                new Notification.Action.Builder(
                        R.drawable.quantum_ic_close_vd_theme_24,
                        context.getString(R.string.spam_notification_not_spam_action_text),
                        context.getString(R.string.spam_notification_was_not_spam_action_text),
                        createNotSpamPendingIntent(call))
                    .build())
            // Block/report spam
+25 −19
Original line number Diff line number Diff line
@@ -18,14 +18,15 @@ package com.android.incallui.spam;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.provider.CallLog;
import android.provider.ContactsContract;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.telephony.PhoneNumberUtils;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
import com.android.dialer.blocking.BlockReportSpamDialogs;
import com.android.dialer.blocking.BlockedNumbersMigrator;
@@ -106,8 +107,14 @@ public class SpamNotificationActivity extends FragmentActivity {
  }

  /** Returns the formatted version of the given number. */
  private static String getFormattedNumber(String number) {
    return PhoneNumberUtilsCompat.createTtsSpannable(number).toString();
  private static String getFormattedNumber(String number, Context context) {
    String formattedNumber =
        PhoneNumberUtils.formatNumber(number, GeoUtil.getCurrentCountryIso(context));
    return PhoneNumberUtilsCompat.createTtsSpannable(formattedNumber).toString();
  }

  private void logCallImpression(DialerImpression.Type impression) {
    logCallImpression(this, getCallInfo(), impression);
  }

  private static void logCallImpression(
@@ -190,7 +197,7 @@ public class SpamNotificationActivity extends FragmentActivity {
      final String number, final ContactLookupResult.Type contactLookupResultType) {
    if (SpamComponent.get(this).spam().isDialogEnabledForSpamNotification()) {
      BlockReportSpamDialogs.ReportNotSpamDialogFragment.newInstance(
              getFormattedNumber(number),
              getFormattedNumber(number, this),
              new BlockReportSpamDialogs.OnConfirmListener() {
                @Override
                public void onClick() {
@@ -208,12 +215,13 @@ public class SpamNotificationActivity extends FragmentActivity {
  private void maybeShowBlockReportSpamDialog(
      final String number, final ContactLookupResult.Type contactLookupResultType) {
    if (SpamComponent.get(this).spam().isDialogEnabledForSpamNotification()) {
      String displayNumber = getFormattedNumber(number, this);
      maybeShowBlockNumberMigrationDialog(
          new BlockedNumbersMigrator.Listener() {
            @Override
            public void onComplete() {
              BlockReportSpamDialogs.BlockReportSpamDialogFragment.newInstance(
                      getFormattedNumber(number),
                      displayNumber,
                      SpamComponent.get(SpamNotificationActivity.this)
                          .spam()
                          .isDialogReportSpamCheckedByDefault(),
@@ -240,7 +248,7 @@ public class SpamNotificationActivity extends FragmentActivity {
  private void showNonSpamDialog() {
    logCallImpression(DialerImpression.Type.SPAM_AFTER_CALL_NOTIFICATION_SHOW_NON_SPAM_DIALOG);
    FirstTimeNonSpamCallDialogFragment.newInstance(getCallInfo())
        .show(getSupportFragmentManager(), FirstTimeNonSpamCallDialogFragment.TAG);
        .show(getFragmentManager(), FirstTimeNonSpamCallDialogFragment.TAG);
  }

  /**
@@ -249,7 +257,7 @@ public class SpamNotificationActivity extends FragmentActivity {
  private void showSpamFullDialog() {
    logCallImpression(DialerImpression.Type.SPAM_AFTER_CALL_NOTIFICATION_SHOW_SPAM_DIALOG);
    FirstTimeSpamCallDialogFragment.newInstance(getCallInfo())
        .show(getSupportFragmentManager(), FirstTimeSpamCallDialogFragment.TAG);
        .show(getFragmentManager(), FirstTimeSpamCallDialogFragment.TAG);
  }

  /** Checks if the user has migrated to the new blocking and display a dialog if necessary. */
@@ -319,10 +327,6 @@ public class SpamNotificationActivity extends FragmentActivity {
    return getIntent().getBundleExtra(EXTRA_CALL_INFO);
  }

  private void logCallImpression(DialerImpression.Type impression) {
    logCallImpression(this, getCallInfo(), impression);
  }

  /** Dialog that displays "Not spam", "Block/report spam" and "Dismiss". */
  public static class FirstTimeSpamCallDialogFragment extends DialogFragment {

@@ -374,8 +378,9 @@ public class SpamNotificationActivity extends FragmentActivity {

      return new AlertDialog.Builder(getActivity())
          .setCancelable(false)
          .setTitle(getString(R.string.spam_notification_title, getFormattedNumber(number)))
          .setMessage(getString(R.string.spam_notification_spam_call_expanded_text))
          .setTitle(
              getString(
                  R.string.spam_notification_title, getFormattedNumber(number, applicationContext)))
          .setNeutralButton(
              getString(R.string.spam_notification_action_dismiss),
              new DialogInterface.OnClickListener() {
@@ -385,24 +390,24 @@ public class SpamNotificationActivity extends FragmentActivity {
                }
              })
          .setPositiveButton(
              getString(R.string.spam_notification_dialog_was_not_spam_action_text),
              getString(R.string.spam_notification_block_spam_action_text),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  dismissed = true;
                  dismiss();
                  spamNotificationActivity.maybeShowNotSpamDialog(number, contactLookupResultType);
                  spamNotificationActivity.maybeShowBlockReportSpamDialog(
                      number, contactLookupResultType);
                }
              })
          .setNegativeButton(
              getString(R.string.spam_notification_block_spam_action_text),
              getString(R.string.spam_notification_was_not_spam_action_text),
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  dismissed = true;
                  dismiss();
                  spamNotificationActivity.maybeShowBlockReportSpamDialog(
                      number, contactLookupResultType);
                  spamNotificationActivity.maybeShowNotSpamDialog(number, contactLookupResultType);
                }
              })
          .create();
@@ -459,7 +464,8 @@ public class SpamNotificationActivity extends FragmentActivity {
          ContactLookupResult.Type.forNumber(
              getArguments().getInt(CALL_INFO_CONTACT_LOOKUP_RESULT_TYPE, 0));
      return new AlertDialog.Builder(getActivity())
          .setTitle(getString(R.string.non_spam_notification_title, getFormattedNumber(number)))
          .setTitle(
              getString(R.string.non_spam_notification_title, getFormattedNumber(number, context)))
          .setCancelable(false)
          .setMessage(getString(R.string.spam_notification_non_spam_call_expanded_text))
          .setNeutralButton(
Loading