本文整理了Java中android.app.Application.getApplicationInfo()
方法的一些代码示例,展示了Application.getApplicationInfo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getApplicationInfo()
方法的具体详情如下:
包路径:android.app.Application
类名称:Application
方法名:getApplicationInfo
暂无
代码示例来源:origin: oasisfeng/condom
/**
* Install the condom protection for current process if it is not the default process.
*
* <p>This method must be called in {@link Application#onCreate()} to eliminate potential leakage.
*/
public static void installExceptDefaultProcess(final Application app, final CondomOptions options) {
validateCondomOptions(options);
final String current_process_name = getProcessName(app);
if (current_process_name == null) return;
final String default_process_name = app.getApplicationInfo().processName;
if (! current_process_name.equals(default_process_name)) install(app, current_process_name, options);
}
代码示例来源:origin: oasisfeng/condom
/**
* Install the condom protection for current process if its process name matches. This method should be called in {@link Application#onCreate()}.
*
* @param process_names list of processes where Condom process should NOT be installed, in the form exactly as defined
* by <code>"android:process"</code> attribute of components in <code>AndroidManifest.xml</code>.
* <b>BEWARE: Default process must be explicitly listed here if it is expected to be excluded.</b>
*/
public static void installExcept(final Application app, final CondomOptions options, final String... process_names) {
if (process_names.length == 0) throw new IllegalArgumentException("At lease one process name must be specified");
validateCondomOptions(options);
final String current_process_name = getProcessName(app);
if (current_process_name == null) return;
for (final String process_name : process_names)
if (! current_process_name.equals(getFullProcessName(app, process_name))) {
install(app, current_process_name, options);
return;
}
if ((app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) validateProcessNames(app, process_names);
}
代码示例来源:origin: android-hacker/VirtualXposed
try {
if (label == null) {
label = app.getApplicationInfo().loadLabel(app.getPackageManager()).toString();
Drawable drawable = app.getApplicationInfo().loadIcon(app.getPackageManager());
if (drawable != null) {
icon = DrawableUtils.drawableToBitMap(drawable);
代码示例来源:origin: weexteam/weex-hackernews
public static boolean isApkDebugable() {
if (sApplication == null) {
return false;
}
if (isPerf) {
return false;
}
if (!isApkDebug) {
return false;
}
try {
ApplicationInfo info = sApplication.getApplicationInfo();
isApkDebug = (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
return isApkDebug;
} catch (Exception e) {
/**
* Don't call WXLogUtils.e here,will cause stackoverflow
*/
e.printStackTrace();
}
return false;
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
private static ArrayList<String> getSupportedAbis() {
ArrayList<String> abiList = new ArrayList<>();
String defaultAbi = (String) RefInvoker.getField(FairyGlobal.getHostApplication().getApplicationInfo(), ApplicationInfo.class, "primaryCpuAbi");
abiList.add(defaultAbi);
if (Build.VERSION.SDK_INT >= 21) {
String[] abis = Build.SUPPORTED_ABIS;
if (abis != null) {
for (String abi: abis) {
abiList.add(abi);
}
}
} else {
abiList.add(Build.CPU_ABI);
abiList.add(Build.CPU_ABI2);
abiList.add("armeabi");
}
return abiList;
}
代码示例来源:origin: Trumeet/MiPushFramework
/**
* Install the condom protection for current process if it is not the default process.
*
* <p>This method must be called in {@link Application#onCreate()} to eliminate potential leakage.
*/
public static void installExceptDefaultProcess(final Application app, final CondomOptions options) {
validateCondomOptions(options);
final String current_process_name = getProcessName(app);
if (current_process_name == null) return;
final String default_process_name = app.getApplicationInfo().processName;
if (! current_process_name.equals(default_process_name)) install(app, current_process_name, options);
}
代码示例来源:origin: Trumeet/MiPushFramework
/**
* Install the condom protection for current process if its process name matches. This method should be called in {@link Application#onCreate()}.
*
* @param process_names list of processes where Condom process should NOT be installed, in the form exactly as defined
* by <code>"android:process"</code> attribute of components in <code>AndroidManifest.xml</code>.
* <b>BEWARE: Default process must be explicitly listed here if it is expected to be excluded.</b>
*/
public static void installExcept(final Application app, final CondomOptions options, final String... process_names) {
if (process_names.length == 0) throw new IllegalArgumentException("At lease one process name must be specified");
validateCondomOptions(options);
final String current_process_name = getProcessName(app);
if (current_process_name == null) return;
for (final String process_name : process_names)
if (! current_process_name.equals(getFullProcessName(app, process_name))) {
install(app, current_process_name, options);
return;
}
if ((app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) validateProcessNames(app, process_names);
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
private static ApplicationInfo getApplicationInfo(PluginDescriptor pluginDescriptor) {
ApplicationInfo info = new ApplicationInfo();
info.packageName = getPackageName(pluginDescriptor);
info.metaData = pluginDescriptor.getMetaData();
info.name = pluginDescriptor.getApplicationName();
info.className = pluginDescriptor.getApplicationName();
info.enabled = true;
info.processName = null;//需要时再添加
info.sourceDir = pluginDescriptor.getInstalledPath();
info.dataDir = new File(pluginDescriptor.getInstalledPath()).getParent();
//info.uid == Process.myUid();
info.publicSourceDir = pluginDescriptor.getInstalledPath();
info.taskAffinity = null;//需要时再加上
info.theme = pluginDescriptor.getApplicationTheme();
info.flags = info.flags | ApplicationInfo.FLAG_HAS_CODE;
info.nativeLibraryDir = new File(pluginDescriptor.getInstalledPath()).getParentFile().getAbsolutePath() + "/lib";
String targetSdkVersion = pluginDescriptor.getTargetSdkVersion();
if (!TextUtils.isEmpty(targetSdkVersion)) {
info.targetSdkVersion = Integer.valueOf(targetSdkVersion);
} else {
info.targetSdkVersion = FairyGlobal.getHostApplication().getApplicationInfo().targetSdkVersion;
}
return info;
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
loadedApk.setApplication(pluginApplication);
loadedApk.setResources(pluginResource);
loadedApk.setDataDirFile(new File(FairyGlobal.getHostApplication().getApplicationInfo().dataDir));
loadedApk.setDataDir(FairyGlobal.getHostApplication().getApplicationInfo().dataDir);
代码示例来源:origin: parse-community/Parse-SDK-Android
private static void mocksForUpdateBeforeSave() {
// Mock currentInstallationController to make setAsync work
ParseCurrentInstallationController controller =
mock(ParseCurrentInstallationController.class);
when(controller.isCurrent(any(ParseInstallation.class))).thenReturn(true);
ParseCorePlugins.getInstance().registerCurrentInstallationController(controller);
// Mock App Name
RuntimeEnvironment.application.getApplicationInfo().name = "parseTest";
ParsePlugins plugins = mock(ParsePlugins.class);
// Mock installationId
InstallationId installationId = mock(InstallationId.class);
when(installationId.get()).thenReturn("installationId");
when(plugins.installationId()).thenReturn(installationId);
// Mock application context
when(plugins.applicationContext()).thenReturn(RuntimeEnvironment.application);
ParsePlugins.set(plugins);
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
providerInfo.applicationInfo = FairyGlobal.getHostApplication().getApplicationInfo();
providerInfo.authority = auth;
providerInfo.name = ProviderClientProxy.class.getName();
代码示例来源:origin: limpoxe/Android-Plugin-Framework
FairyGlobal.getHostApplication().getApplicationInfo().sourceDir,
FairyGlobal.getHostApplication().getResources(), pluginDescriptor);
代码示例来源:origin: roomanl/AndroidDownload
@Override
public ApplicationInfo getApplicationInfo() {
Log.d(TAG,"----getApplicationInfo");
return app.getApplicationInfo();
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
boolean isDebugable = (0 != (FairyGlobal.getHostApplication().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
if (pluginSignatures == null) {
LogUtil.e("插件签名验证失败", srcPluginFile);
FileUtil.printAll(new File(FairyGlobal.getHostApplication().getApplicationInfo().dataDir));
代码示例来源:origin: limpoxe/Android-Plugin-Framework
ApplicationInfo applicationInfo = FairyGlobal.getHostApplication().getApplicationInfo();
newInfo.packageName = applicationInfo.packageName;
newInfo.sourceDir = applicationInfo.sourceDir;
代码示例来源:origin: nativelibs4java/BridJ
synchronized File getApplicationDataDir(String someKnownResource) throws FileNotFoundException {
if (app != null) {
return new File(app.getApplicationInfo().dataDir);
} else {
return new File(new File(Environment.getDataDirectory(), "data"), getPackageName(someKnownResource));
}
}
代码示例来源:origin: gdpancheng/LoonAndroid3
private Logger(String name) {
this.name = name;
ApplicationInfo info=Ioc.getIoc().getApplication().getApplicationInfo();
debug = ((info.flags&ApplicationInfo.FLAG_DEBUGGABLE)!=0);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
public ClassLoader getJarClassLoader(ClassLoader parent, File dexCache, String jarName) throws IOException {
if (dexCache == null) {
String property = System.getProperty("dexmaker.dexcache");
if (property != null) {
dexCache = new File(property);
} else {
dexCache = new AppDataDirGuesser().guess();
if (dexCache == null) {
throw new IllegalArgumentException("dexcache == null (and no default could be" + " found; consider setting the 'dexmaker.dexcache' system property)");
}
}
}
File result = new File(dexCache, jarName + ".jar");
if (!result.exists() || result.length() == 0) {
return null;
}
DexClassLoader dexClassLoader = new DexClassLoader(result.getPath(), application.getApplicationInfo().dataDir, null, parent);
return dexClassLoader;
}
代码示例来源:origin: nativelibs4java/BridJ
synchronized File getNativeLibraryDir(String someBundledNativeLibraryName) throws FileNotFoundException {
//String someKnownResource =
File f = null;
if (app != null) {
try {
// ApplicationInfo.nativeLibraryDir is only available from API level 9 and later
// http://developer.android.com/reference/android/content/pm/ApplicationInfo.html#nativeLibraryDir
f = (File) ApplicationInfo.class.getField("nativeLibraryDir").get(app.getApplicationInfo());
} catch (Throwable th) {
}
}
if (f == null) {
String someKnownResource = "lib/armeabi/" + getLibFileName(someBundledNativeLibraryName);
f = new File(getApplicationDataDir(someKnownResource), "lib");
}
if (f != null && f.isDirectory()) {
return f;
}
throw new FileNotFoundException("Failed to get the native library directory " + (f != null ? "(" + f + " is not a directory). " : ". ") + adviseToSetApp());
}
代码示例来源:origin: darkskygit/VirtualApp
try {
if (label == null) {
label = app.getApplicationInfo().loadLabel(app.getPackageManager()).toString();
Drawable drawable = app.getApplicationInfo().loadIcon(app.getPackageManager());
if (drawable != null) {
icon = DrawableUtils.drawableToBitMap(drawable);
内容来源于网络,如有侵权,请联系作者删除!