Program: 197619
Project: 197619
Buggy source:
private void handleBindApplication(AppBindData data){
  mBoundApplication=data;
  mConfiguration=new Configuration(data.config);
  mCompatConfiguration=new Configuration(data.config);
  mProfiler=new Profiler();
  if (data.initProfilerInfo != null) {
    mProfiler.profileFile=data.initProfilerInfo.profileFile;
    mProfiler.profileFd=data.initProfilerInfo.profileFd;
    mProfiler.samplingInterval=data.initProfilerInfo.samplingInterval;
    mProfiler.autoStopProfiler=data.initProfilerInfo.autoStopProfiler;
  }
  Process.setArgV0(data.processName);
  android.ddm.DdmHandleAppName.setAppName(data.processName,UserHandle.myUserId());
  if (data.persistent) {
    if (!ActivityManager.isHighEndGfx()) {
      HardwareRenderer.disable(false);
    }
  }
  if (mProfiler.profileFd != null) {
    mProfiler.startProfiling();
  }
  if (data.appInfo.targetSdkVersion <= android.os.Build.VERSION_CODES.HONEYCOMB_MR1) {
    AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
  TimeZone.setDefault(null);
  Locale.setDefault(data.config.locale);
  mResourcesManager.applyConfigurationToResourcesLocked(data.config,data.compatInfo);
  mCurDefaultDisplayDpi=data.config.densityDpi;
  applyCompatConfiguration(mCurDefaultDisplayDpi);
  data.info=getPackageInfoNoCheck(data.appInfo,data.compatInfo);
  if ((data.appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) == 0) {
    mDensityCompatMode=true;
    Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
  }
  updateDefaultDensity();
  final ContextImpl appContext=ContextImpl.createAppContext(this,data.info);
  if (!Process.isIsolated()) {
    final File cacheDir=appContext.getCacheDir();
    if (cacheDir != null) {
      System.setProperty("String_Node_Str",cacheDir.getAbsolutePath());
      setupGraphicsSupport(data.info,cacheDir);
    }
 else {
      Log.e(TAG,"String_Node_Str");
    }
  }
  final boolean is24Hr="String_Node_Str".equals(mCoreSettings.getString(Settings.System.TIME_12_24));
  DateFormat.set24HourTimePref(is24Hr);
  View.mDebugViewAttributes=mCoreSettings.getInt(Settings.Global.DEBUG_VIEW_ATTRIBUTES,0) != 0;
  if ((data.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
    StrictMode.conditionallyEnableDebugLogging();
  }
  if (data.appInfo.targetSdkVersion > 9) {
    StrictMode.enableDeathOnNetwork();
  }
  if (data.debugMode != IApplicationThread.DEBUG_OFF) {
    Debug.changeDebugPort(8100);
    if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
      Slog.w(TAG,"String_Node_Str" + data.info.getPackageName() + "String_Node_Str");
      IActivityManager mgr=ActivityManagerNative.getDefault();
      try {
        mgr.showWaitingForDebugger(mAppThread,true);
      }
 catch (      RemoteException ex) {
      }
      Debug.waitForDebugger();
      try {
        mgr.showWaitingForDebugger(mAppThread,false);
      }
 catch (      RemoteException ex) {
      }
    }
 else {
      Slog.w(TAG,"String_Node_Str" + data.info.getPackageName() + "String_Node_Str");
    }
  }
  if (data.enableOpenGlTrace) {
    GLUtils.setTracingLevel(1);
  }
  boolean appTracingAllowed=(data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  Trace.setAppTracingAllowed(appTracingAllowed);
  IBinder b=ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
  if (b != null) {
    IConnectivityManager service=IConnectivityManager.Stub.asInterface(b);
    try {
      ProxyInfo proxyInfo=service.getProxy();
      Proxy.setHttpProxySystemProperty(proxyInfo);
    }
 catch (    RemoteException e) {
    }
  }
  if (data.instrumentationName != null) {
    InstrumentationInfo ii=null;
    try {
      ii=appContext.getPackageManager().getInstrumentationInfo(data.instrumentationName,0);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    if (ii == null) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName);
    }
    mInstrumentationPackageName=ii.packageName;
    mInstrumentationAppDir=ii.sourceDir;
    mInstrumentationSplitAppDirs=ii.splitSourceDirs;
    mInstrumentationLibDir=ii.nativeLibraryDir;
    mInstrumentedAppDir=data.info.getAppDir();
    mInstrumentedSplitAppDirs=data.info.getSplitAppDirs();
    mInstrumentedLibDir=data.info.getLibDir();
    ApplicationInfo instrApp=new ApplicationInfo();
    instrApp.packageName=ii.packageName;
    instrApp.sourceDir=ii.sourceDir;
    instrApp.publicSourceDir=ii.publicSourceDir;
    instrApp.splitSourceDirs=ii.splitSourceDirs;
    instrApp.splitPublicSourceDirs=ii.splitPublicSourceDirs;
    instrApp.dataDir=ii.dataDir;
    instrApp.nativeLibraryDir=ii.nativeLibraryDir;
    LoadedApk pi=getPackageInfo(instrApp,data.compatInfo,appContext.getClassLoader(),false,true,false);
    ContextImpl instrContext=ContextImpl.createAppContext(this,pi);
    try {
      java.lang.ClassLoader cl=instrContext.getClassLoader();
      mInstrumentation=(Instrumentation)cl.loadClass(data.instrumentationName.getClassName()).newInstance();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName + "String_Node_Str"+ e.toString(),e);
    }
    mInstrumentation.init(this,instrContext,appContext,new ComponentName(ii.packageName,ii.name),data.instrumentationWatcher,data.instrumentationUiAutomationConnection);
    if (mProfiler.profileFile != null && !ii.handleProfiling && mProfiler.profileFd == null) {
      mProfiler.handlingProfiling=true;
      File file=new File(mProfiler.profileFile);
      file.getParentFile().mkdirs();
      Debug.startMethodTracing(file.toString(),8 * 1024 * 1024);
    }
  }
 else {
    mInstrumentation=new Instrumentation();
  }
  if ((data.appInfo.flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0) {
    dalvik.system.VMRuntime.getRuntime().clearGrowthLimit();
  }
  final StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskWrites();
  try {
    Application app=data.info.makeApplication(data.restrictedBackupMode,null);
    mInitialApplication=app;
    if (!data.restrictedBackupMode) {
      List<ProviderInfo> providers=data.providers;
      if (providers != null) {
        installContentProviders(app,providers);
        mH.sendEmptyMessageDelayed(H.ENABLE_JIT,10 * 1000);
      }
    }
    try {
      mInstrumentation.onCreate(data.instrumentationArgs);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName + "String_Node_Str"+ e.toString(),e);
    }
    try {
      mInstrumentation.callApplicationOnCreate(app);
    }
 catch (    Exception e) {
      if (!mInstrumentation.onException(app,e)) {
        throw new RuntimeException("String_Node_Str" + app.getClass().getName() + "String_Node_Str"+ e.toString(),e);
      }
    }
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}

Fixed version (ground truth):
private void handleBindApplication(AppBindData data){
  mBoundApplication=data;
  mConfiguration=new Configuration(data.config);
  mCompatConfiguration=new Configuration(data.config);
  mProfiler=new Profiler();
  if (data.initProfilerInfo != null) {
    mProfiler.profileFile=data.initProfilerInfo.profileFile;
    mProfiler.profileFd=data.initProfilerInfo.profileFd;
    mProfiler.samplingInterval=data.initProfilerInfo.samplingInterval;
    mProfiler.autoStopProfiler=data.initProfilerInfo.autoStopProfiler;
  }
  Process.setArgV0(data.processName);
  android.ddm.DdmHandleAppName.setAppName(data.processName,UserHandle.myUserId());
  if (data.persistent) {
    if (!ActivityManager.isHighEndGfx()) {
      HardwareRenderer.disable(false);
    }
  }
  if (mProfiler.profileFd != null) {
    mProfiler.startProfiling();
  }
  if (data.appInfo.targetSdkVersion <= android.os.Build.VERSION_CODES.HONEYCOMB_MR1) {
    AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
  Message.updateCheckRecycle(data.appInfo.targetSdkVersion);
  TimeZone.setDefault(null);
  Locale.setDefault(data.config.locale);
  mResourcesManager.applyConfigurationToResourcesLocked(data.config,data.compatInfo);
  mCurDefaultDisplayDpi=data.config.densityDpi;
  applyCompatConfiguration(mCurDefaultDisplayDpi);
  data.info=getPackageInfoNoCheck(data.appInfo,data.compatInfo);
  if ((data.appInfo.flags & ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) == 0) {
    mDensityCompatMode=true;
    Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
  }
  updateDefaultDensity();
  final ContextImpl appContext=ContextImpl.createAppContext(this,data.info);
  if (!Process.isIsolated()) {
    final File cacheDir=appContext.getCacheDir();
    if (cacheDir != null) {
      System.setProperty("String_Node_Str",cacheDir.getAbsolutePath());
      setupGraphicsSupport(data.info,cacheDir);
    }
 else {
      Log.e(TAG,"String_Node_Str");
    }
  }
  final boolean is24Hr="String_Node_Str".equals(mCoreSettings.getString(Settings.System.TIME_12_24));
  DateFormat.set24HourTimePref(is24Hr);
  View.mDebugViewAttributes=mCoreSettings.getInt(Settings.Global.DEBUG_VIEW_ATTRIBUTES,0) != 0;
  if ((data.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
    StrictMode.conditionallyEnableDebugLogging();
  }
  if (data.appInfo.targetSdkVersion > 9) {
    StrictMode.enableDeathOnNetwork();
  }
  if (data.debugMode != IApplicationThread.DEBUG_OFF) {
    Debug.changeDebugPort(8100);
    if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
      Slog.w(TAG,"String_Node_Str" + data.info.getPackageName() + "String_Node_Str");
      IActivityManager mgr=ActivityManagerNative.getDefault();
      try {
        mgr.showWaitingForDebugger(mAppThread,true);
      }
 catch (      RemoteException ex) {
      }
      Debug.waitForDebugger();
      try {
        mgr.showWaitingForDebugger(mAppThread,false);
      }
 catch (      RemoteException ex) {
      }
    }
 else {
      Slog.w(TAG,"String_Node_Str" + data.info.getPackageName() + "String_Node_Str");
    }
  }
  if (data.enableOpenGlTrace) {
    GLUtils.setTracingLevel(1);
  }
  boolean appTracingAllowed=(data.appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  Trace.setAppTracingAllowed(appTracingAllowed);
  IBinder b=ServiceManager.getService(Context.CONNECTIVITY_SERVICE);
  if (b != null) {
    IConnectivityManager service=IConnectivityManager.Stub.asInterface(b);
    try {
      ProxyInfo proxyInfo=service.getProxy();
      Proxy.setHttpProxySystemProperty(proxyInfo);
    }
 catch (    RemoteException e) {
    }
  }
  if (data.instrumentationName != null) {
    InstrumentationInfo ii=null;
    try {
      ii=appContext.getPackageManager().getInstrumentationInfo(data.instrumentationName,0);
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
    if (ii == null) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName);
    }
    mInstrumentationPackageName=ii.packageName;
    mInstrumentationAppDir=ii.sourceDir;
    mInstrumentationSplitAppDirs=ii.splitSourceDirs;
    mInstrumentationLibDir=ii.nativeLibraryDir;
    mInstrumentedAppDir=data.info.getAppDir();
    mInstrumentedSplitAppDirs=data.info.getSplitAppDirs();
    mInstrumentedLibDir=data.info.getLibDir();
    ApplicationInfo instrApp=new ApplicationInfo();
    instrApp.packageName=ii.packageName;
    instrApp.sourceDir=ii.sourceDir;
    instrApp.publicSourceDir=ii.publicSourceDir;
    instrApp.splitSourceDirs=ii.splitSourceDirs;
    instrApp.splitPublicSourceDirs=ii.splitPublicSourceDirs;
    instrApp.dataDir=ii.dataDir;
    instrApp.nativeLibraryDir=ii.nativeLibraryDir;
    LoadedApk pi=getPackageInfo(instrApp,data.compatInfo,appContext.getClassLoader(),false,true,false);
    ContextImpl instrContext=ContextImpl.createAppContext(this,pi);
    try {
      java.lang.ClassLoader cl=instrContext.getClassLoader();
      mInstrumentation=(Instrumentation)cl.loadClass(data.instrumentationName.getClassName()).newInstance();
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName + "String_Node_Str"+ e.toString(),e);
    }
    mInstrumentation.init(this,instrContext,appContext,new ComponentName(ii.packageName,ii.name),data.instrumentationWatcher,data.instrumentationUiAutomationConnection);
    if (mProfiler.profileFile != null && !ii.handleProfiling && mProfiler.profileFd == null) {
      mProfiler.handlingProfiling=true;
      File file=new File(mProfiler.profileFile);
      file.getParentFile().mkdirs();
      Debug.startMethodTracing(file.toString(),8 * 1024 * 1024);
    }
  }
 else {
    mInstrumentation=new Instrumentation();
  }
  if ((data.appInfo.flags & ApplicationInfo.FLAG_LARGE_HEAP) != 0) {
    dalvik.system.VMRuntime.getRuntime().clearGrowthLimit();
  }
  final StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskWrites();
  try {
    Application app=data.info.makeApplication(data.restrictedBackupMode,null);
    mInitialApplication=app;
    if (!data.restrictedBackupMode) {
      List<ProviderInfo> providers=data.providers;
      if (providers != null) {
        installContentProviders(app,providers);
        mH.sendEmptyMessageDelayed(H.ENABLE_JIT,10 * 1000);
      }
    }
    try {
      mInstrumentation.onCreate(data.instrumentationArgs);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + data.instrumentationName + "String_Node_Str"+ e.toString(),e);
    }
    try {
      mInstrumentation.callApplicationOnCreate(app);
    }
 catch (    Exception e) {
      if (!mInstrumentation.onException(app,e)) {
        throw new RuntimeException("String_Node_Str" + app.getClass().getName() + "String_Node_Str"+ e.toString(),e);
      }
    }
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}