详细分析Android中实现Zygote的源码

2020-01-06 13:36:52丽君
  • while ((line = br.readLine()) != null) {  // skip comments and blank lines. 
  • line = line.trim();  if (line.startsWith("#") || line.equals("")) { 
  • continue;  } 
  •   try { 
  • if (false) {  Log.v(TAG, "Preloading " + line + "..."); 
  • }  Class.forName(line); 
  • count ++;  } catch (ClassNotFoundException e) { 
  • Log.w(TAG, "Class not found for preloading: " + line);  } catch (UnsatisfiedLinkError e) { 
  • Log.w(TAG, "Problem preloading " + line + ": " + e);  } catch(Throwable t) { 
  • Log.e(TAG, "Error preloading " + line + ".", t);  } 
  • }  Log.i(TAG, "...preloaded " + count + " classes in " + (SystemClock.uptimeMillis()-startTime) + "ms."); 
  • } catch (IOException e) {  Log.e(TAG, "Error reading " + PRELOADED_CLASSES + ".", e); 
  • } finally {  IoUtils.closeQuietly(is); 
  • runtime.setTargetHeapUtilization(defaultUtilization);   
  • runtime.preloadDexCaches();  Debug.stopAllocCounting(); 
  •   setEffectiveUser(ROOT_UID); 
  • setEffectiveGroup(ROOT_GID);  } 
  • }  }