<commit_before>package org.robolectric.shadows;

import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadow.api.Shadow;

@Implements(ResolveInfo.class)
public class ShadowResolveInfo {
  private String label;

  /**
   * Creates a {@link ResolveInfo}.
   *
   * @param displayName Display name.
   * @param packageName Package name.
   * @return Resolve info instance.
   */
  public static ResolveInfo newResolveInfo(String displayName, String packageName) {
    return newResolveInfo(displayName, packageName, null);
  }

  /**
   * Creates a {@link ResolveInfo}.
   *
   * @param displayName Display name.
   * @param packageName Package name.
   * @param activityName Activity name.
   * @return Resolve info instance.
   */
  public static ResolveInfo newResolveInfo(String displayName, String packageName, String activityName) {
    ResolveInfo resInfo = new ResolveInfo();
    ActivityInfo actInfo = new ActivityInfo();
    actInfo.applicationInfo = new ApplicationInfo();
    actInfo.packageName = packageName;
    actInfo.applicationInfo.packageName = packageName;
    actInfo.name = activityName;
    resInfo.activityInfo = actInfo;

    ShadowResolveInfo shResolve = Shadow.extract(resInfo);
    shResolve.setLabel(displayName);
    return resInfo;
  }

  @Implementation
  protected CharSequence loadLabel(PackageManager mgr) {
    return label;
  }

  /**
   * Sets the value returned by {@link #loadLabel}.
   *
   * @param l Label.
   */
  public void setLabel(String l) {
    label = l;
  }
}<commit_msg>Get rid of ShadowResolveInfo and shadowing loadLabel(). People should just use nonLocalizedLabel.<commit_after>package org.robolectric.shadows;

import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;

/** Utilities for {@link ResolveInfo}. */
// TODO: Create a ResolveInfoBuilder in androidx and migrate factory methods there.
@Implements(ResolveInfo.class)
public class ShadowResolveInfo {

  @RealObject ResolveInfo realObject;

  /**
   * Creates a {@link ResolveInfo}.
   *
   * @param displayName Display name.
   * @param packageName Package name.
   * @return Resolve info instance.
   */
  public static ResolveInfo newResolveInfo(String displayName, String packageName) {
    return newResolveInfo(displayName, packageName, null);
  }

  /**
   * Creates a {@link ResolveInfo}.
   *
   * @param displayName Display name.
   * @param packageName Package name.
   * @param activityName Activity name.
   * @return Resolve info instance.
   */
  public static ResolveInfo newResolveInfo(String displayName, String packageName, String activityName) {
    ResolveInfo resInfo = new ResolveInfo();
    ActivityInfo actInfo = new ActivityInfo();
    actInfo.applicationInfo = new ApplicationInfo();
    actInfo.packageName = packageName;
    actInfo.applicationInfo.packageName = packageName;
    actInfo.name = activityName;
    resInfo.activityInfo = actInfo;
    resInfo.nonLocalizedLabel = displayName;
    return resInfo;
  }

  /**
   * Sets the value returned by {@link #loadLabel}.
   *
   * @param l Label.
   * @deprecated Just use {@link ResolveInfo#nonLocalizedLabel}.
   */
  @Deprecated
  public void setLabel(String l) {
    realObject.nonLocalizedLabel = l;
  }
}
{'fraction_non_alphanumeric': 0.09301030353661932, 'fraction_numerical': 0.0, 'mean_word_length': 4.016759776536313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3838337', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1026, 'n_words': 273}