Program: 191696
Project: 191696
Buggy source:
/** 
 * Creates base resources for an Activity. Calls to  {@link #getResources(IBinder,String,String[],String[],String[],int,Configuration,CompatibilityInfo,ClassLoader)} with the same activityToken will have their overrideconfigurations merged with the one specified here.
 * @param activityToken Represents an Activity.
 * @param resDir The base resource path. Can be null (only framework resources will be loaded).
 * @param splitResDirs An array of split resource paths. Can be null.
 * @param overlayDirs An array of overlay paths. Can be null.
 * @param libDirs An array of resource library paths. Can be null.
 * @param displayId The ID of the display for which to create the resources.
 * @param overrideConfig The configuration to apply on top of the base configuration. Can benull. This provides the base override for this Activity.
 * @param compatInfo The compatibility settings to use. Cannot be null. A default to use is{@link CompatibilityInfo#DEFAULT_COMPATIBILITY_INFO}.
 * @param classLoader The class loader to use when inflating Resources. If null, the{@link ClassLoader#getSystemClassLoader()} is used.
 * @return a Resources object from which to access resources.
 */
public Resources createBaseActivityResources(@NonNull IBinder activityToken,@Nullable String resDir,@Nullable String[] splitResDirs,@Nullable String[] overlayDirs,@Nullable String[] libDirs,int displayId,@Nullable Configuration overrideConfig,@NonNull CompatibilityInfo compatInfo,@Nullable ClassLoader classLoader){
  try {
    Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,"String_Node_Str");
    final ResourcesKey key=new ResourcesKey(resDir,splitResDirs,overlayDirs,libDirs,displayId,overrideConfig != null ? new Configuration(overrideConfig) : null,compatInfo);
    classLoader=classLoader != null ? classLoader : ClassLoader.getSystemClassLoader();
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + activityToken + "String_Node_Str"+ key);
    }
synchronized (this) {
      final ActivityResources activityResources=getOrCreateActivityResourcesStructLocked(activityToken);
      if (overrideConfig != null) {
        activityResources.overrideConfig.setTo(overrideConfig);
      }
 else {
        activityResources.overrideConfig.setToDefaults();
      }
    }
    updateResourcesForActivity(activityToken,overrideConfig);
    return getOrCreateResources(activityToken,key,classLoader);
  }
  finally {
    Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
  }
}

Fixed version (ground truth):
/** 
 * Creates base resources for an Activity. Calls to  {@link #getResources(IBinder,String,String[],String[],String[],int,Configuration,CompatibilityInfo,ClassLoader)} with the same activityToken will have their overrideconfigurations merged with the one specified here.
 * @param activityToken Represents an Activity.
 * @param resDir The base resource path. Can be null (only framework resources will be loaded).
 * @param splitResDirs An array of split resource paths. Can be null.
 * @param overlayDirs An array of overlay paths. Can be null.
 * @param libDirs An array of resource library paths. Can be null.
 * @param displayId The ID of the display for which to create the resources.
 * @param overrideConfig The configuration to apply on top of the base configuration. Can benull. This provides the base override for this Activity.
 * @param compatInfo The compatibility settings to use. Cannot be null. A default to use is{@link CompatibilityInfo#DEFAULT_COMPATIBILITY_INFO}.
 * @param classLoader The class loader to use when inflating Resources. If null, the{@link ClassLoader#getSystemClassLoader()} is used.
 * @return a Resources object from which to access resources.
 */
public Resources createBaseActivityResources(@NonNull IBinder activityToken,@Nullable String resDir,@Nullable String[] splitResDirs,@Nullable String[] overlayDirs,@Nullable String[] libDirs,int displayId,@Nullable Configuration overrideConfig,@NonNull CompatibilityInfo compatInfo,@Nullable ClassLoader classLoader){
  try {
    Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,"String_Node_Str");
    final ResourcesKey key=new ResourcesKey(resDir,splitResDirs,overlayDirs,libDirs,displayId,overrideConfig != null ? new Configuration(overrideConfig) : null,compatInfo);
    classLoader=classLoader != null ? classLoader : ClassLoader.getSystemClassLoader();
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + activityToken + "String_Node_Str"+ key);
    }
synchronized (this) {
      getOrCreateActivityResourcesStructLocked(activityToken);
    }
    updateResourcesForActivity(activityToken,overrideConfig);
    return getOrCreateResources(activityToken,key,classLoader);
  }
  finally {
    Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
  }
}