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

Commit d74e72e5 authored by zachh's avatar zachh Committed by Copybara-Service
Browse files

Removed NUI shortcut.

We're not going to have a shortcut for NUI anymore. There are individual flags related to NUI that are controlled in CallLogConfig.

Other related changes to help accomplish this:

-Changed how the call log framework/config/migrator interact; the migrator is now only called on config changes and enabling/disabling of the framework now lives in CallLogFramework.

-Move CallLogConfig an interface, and moved it to its own package and added component and module. This is to simplify tests which just need to check the config status (like PhoneLookupHistoryRecorderTest).

-The "Main" package is also on longer needed since it existed to control the shortcut.

Bug: 74821995
Test: existing
PiperOrigin-RevId: 190251418
Change-Id: I73c8e83aee80295131443a8ffaa7dea716ea89b6
parent b9b64d39
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -725,9 +725,6 @@ public class DialtactsActivity extends TransactionSafeActivity
      handleMenuSettings();
      Logger.get(this).logScreenView(ScreenEvent.Type.SETTINGS, this);
      return true;
    } else if (resId == R.id.menu_new_ui_launcher_shortcut) {
      MainComponent.createNewUiLauncherShortcut(this);
      return true;
    }
    return false;
  }
@@ -1599,10 +1596,6 @@ public class DialtactsActivity extends TransactionSafeActivity
      } else {
        simulatorMenuItem.setVisible(false);
      }

      menu.findItem(R.id.menu_new_ui_launcher_shortcut)
          .setVisible(MainComponent.isNewUiEnabled(context));

      super.show();
    }
  }
+5 −35
Original line number Diff line number Diff line
@@ -19,43 +19,13 @@ package com.android.dialer.app;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import com.android.dialer.configprovider.ConfigProviderBindings;

/** This class is a copy of dialer.main.impl.MainImpl to get around a dependency issue. */
public class MainComponent {

  public static boolean isNewUiEnabled(Context context) {
    return ConfigProviderBindings.get(context).getBoolean("is_nui_shortcut_enabled", false);
  }

  public static void createNewUiLauncherShortcut(Context context) {
    enableComponent(context);
  }

  public static boolean isNuiComponentEnabled(Context context) {
    if (!isNewUiEnabled(context)) {
      return false;
    }
    return context
            .getPackageManager()
            .getComponentEnabledSetting(new ComponentName(context, getComponentName()))
        == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
  }

/**
   * Enables the NUI activity component. By default the component is disabled and can't be accessed.
   * Once the component has been enabled the user will get an option to use the new UI to handle
   * DIAL (and other) intents.
 * Main activity intents.
 *
 * <p>TODO(calderwoodra): Move this elsewhere.
 */
  private static void enableComponent(Context context) {
    context
        .getPackageManager()
        .setComponentEnabledSetting(
            new ComponentName(context, getComponentName()),
            PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
            PackageManager.DONT_KILL_APP);
  }
public class MainComponent {

  /**
   * @param context Context of the application package implementing MainActivity class.
+2 −9
Original line number Diff line number Diff line
@@ -42,12 +42,10 @@ import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.util.ArraySet;
import com.android.contacts.common.ContactsUtils;
import com.android.dialer.app.DialtactsActivity;
import com.android.dialer.app.MainComponent;
import com.android.dialer.app.R;
import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall;
import com.android.dialer.app.contactinfo.ContactPhotoLoader;
import com.android.dialer.app.list.DialtactsPagerAdapter;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.Assert;
@@ -454,13 +452,8 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> {
   * @param callUri Uri of the call to jump to. May be null
   */
  private PendingIntent createCallLogPendingIntent(@Nullable Uri callUri) {
    Intent contentIntent;
    if (MainComponent.isNuiComponentEnabled(context)) {
      contentIntent = MainComponent.getShowCallLogIntent(context);
    } else {
      contentIntent =
          DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_HISTORY);
    }
    Intent contentIntent = MainComponent.getShowCallLogIntent(context);

    // TODO (a bug): scroll to call
    contentIntent.setData(callUri);
    return PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+2 −8
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import com.android.dialer.app.MainComponent;
import com.android.dialer.app.R;
import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall;
import com.android.dialer.app.contactinfo.ContactPhotoLoader;
import com.android.dialer.app.list.DialtactsPagerAdapter;
import com.android.dialer.common.LogUtil;
import com.android.dialer.compat.android.provider.VoicemailCompat;
import com.android.dialer.logging.DialerImpression;
@@ -267,13 +266,8 @@ final class VisualVoicemailNotifier {

  private static PendingIntent newVoicemailIntent(
      @NonNull Context context, @Nullable NewCall voicemail) {
    Intent intent;
    if (MainComponent.isNuiComponentEnabled(context)) {
      intent = MainComponent.getShowVoicemailIntent(context);
    } else {
      intent =
          DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL);
    }
    Intent intent = MainComponent.getShowVoicemailIntent(context);

    // TODO (a bug): scroll to this voicemail
    if (voicemail != null) {
      intent.setData(voicemail.voicemailUri);
+0 −4
Original line number Diff line number Diff line
@@ -28,8 +28,4 @@
  <item
    android:id="@+id/menu_simulator_submenu"
    android:title="@string/simulator_submenu_label"/>
  <item
      android:id="@+id/menu_new_ui_launcher_shortcut"
      android:title="@string/new_ui_launcher_shortcut_label"/>

</menu>
Loading