android.content.Context.getCodeCacheDir()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(275)

本文整理了Java中android.content.Context.getCodeCacheDir()方法的一些代码示例,展示了Context.getCodeCacheDir()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getCodeCacheDir()方法的具体详情如下:
包路径:android.content.Context
类名称:Context
方法名:getCodeCacheDir

Context.getCodeCacheDir介绍

暂无

代码示例

代码示例来源:origin: oasisfeng/condom

@RequiresApi(LOLLIPOP) @Override public File getCodeCacheDir() {
  return mBase.getCodeCacheDir();
}

代码示例来源:origin: Trumeet/MiPushFramework

@RequiresApi(LOLLIPOP) @Override public File getCodeCacheDir() {
  return mBase.getCodeCacheDir();
}

代码示例来源:origin: android-hacker/VirtualXposed

codeCacheDir = context.getCodeCacheDir();
} else {
  codeCacheDir = context.getCacheDir();

代码示例来源:origin: CaMnter/AndroidLife

public static File getCodeCacheDir(Context context) {
    return context.getCodeCacheDir();
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static File getCodeCacheDir(Context context) {
    return context.getCodeCacheDir();
  }
}

代码示例来源:origin: tmurakami/dexopener

private static File getCodeCacheDir(Context context) {
  File parentDir;
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    parentDir = new File(context.getApplicationInfo().dataDir, "code_cache");
  } else {
    parentDir = context.getCodeCacheDir();
  }
  File cacheDir = new File(parentDir, "dexopener");
  if (cacheDir.isDirectory() || cacheDir.mkdirs()) {
    FileUtils.delete(cacheDir.listFiles());
  }
  return cacheDir;
}

代码示例来源:origin: MeetMe/font-compat

@Override
public boolean init(@NonNull Context context, int fontsRes) {
  FontListParser.Config config = readFontConfig(context, fontsRes);
  if (config == null) return false;
  // this will also rewrite the Font#fontName to point to the extracted file(s)
  extractToCache(context.getAssets(), context.getCodeCacheDir(), config);
  if (BuildConfig.DEBUG) {
    Log.v(TAG, "Loading font configuration: " + config);
    Log.v(TAG, "Aliases=" + config.aliases);
    Log.v(TAG, "Families=" + config.families);
  }
  init(config);
  return true;
}

代码示例来源:origin: bmax121/BudHook

DexClassLoader dexClassLoader = new DexClassLoader(dexPath,context.getCodeCacheDir().getAbsolutePath(),null,context.getClassLoader() );
for(GenedClassInfo genedClassInfo : genedClassInfos){
  if( ! genedClassInfo.initGenedClass(dexClassLoader) ){

代码示例来源:origin: bmax121/BudHook

public static synchronized void hookMethod(Member hookMethod, BudCallBack callBack) {
  if( ! checkMember(hookMethod)) return;
  if( hookedInfo.containsKey(hookMethod)){
    BudLog.v("already hook method:" + hookMethod.toString());
    return;
    }
  HookedMethodInfo hookedMethodInfo = new HookedMethodInfo(hookMethod,callBack);
  GenedClassInfo genedClassInfo = new GenedClassInfo(prefix + suffix ++ + ";",hookedMethodInfo);
  byte[] dexbytes = GenClasses.genOneClassDexBytes(genedClassInfo);
  String dexFileName = "BudHook" + suffix + ".dex";
  String dexPath = "/data/data/" + context.getPackageName() + "/files/" + dexFileName;
  FileOutputStream fos = null;
  try {
    fos = context.openFileOutput(dexFileName, Context.MODE_PRIVATE);
    fos.write(dexbytes);
  } catch (Exception e) {
    BudLog.e("error occur when write dex");
    return;
  }
  DexClassLoader dexClassLoader = new DexClassLoader(dexPath,context.getCodeCacheDir().getAbsolutePath(),null,context.getClassLoader() );
  if( ! genedClassInfo.initGenedClass(dexClassLoader) ){
    BudLog.e("error occured while load class:" + genedClassInfo.toString());
    return;
  }
  Method replace = genedClassInfo.getReplace();
  Method backup = genedClassInfo.getBackup();
  yahfaHook(hookMethod,replace,backup);
  hookedInfo.put(hookMethod,genedClassInfo);
}

代码示例来源:origin: darkskygit/VirtualApp

info.dataDir + "/app_tbs/", info.dataDir + "/files/xlog/", info.dataDir + "/tinker/", info.dataDir + "/files/ali-s/logRecord/", info.dataDir + "/files/logs/"), RootDirKiller);
NativeEngine.redirectDirectory(info.dataDir + "/cache/", VirtualCore.get().getContext().getCacheDir().getAbsolutePath());
NativeEngine.redirectDirectory(info.dataDir + "/code_cache/", VirtualCore.get().getContext().getCodeCacheDir().getAbsolutePath());
RedirectSameDstPaths(Collections.singletonList(""), VEnvironment.getCacheDirectory().getAbsolutePath());
RedirectSameDstPaths(getProcPIDList(), RootDirKiller);

代码示例来源:origin: bzsome/VirtualApp-x326

File codeCacheDir;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  codeCacheDir = context.getCodeCacheDir();
} else {
  codeCacheDir = context.getCacheDir();

代码示例来源:origin: darkskygit/VirtualApp

codeCacheDir = context.getCodeCacheDir();
} else {
  codeCacheDir = context.getCacheDir();

相关文章

Context类方法