当前位置: 首页>>代码示例>>Java>>正文


Java PackageManager.getApplicationEnabledSetting方法代码示例

本文整理汇总了Java中android.content.pm.PackageManager.getApplicationEnabledSetting方法的典型用法代码示例。如果您正苦于以下问题:Java PackageManager.getApplicationEnabledSetting方法的具体用法?Java PackageManager.getApplicationEnabledSetting怎么用?Java PackageManager.getApplicationEnabledSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.PackageManager的用法示例。


在下文中一共展示了PackageManager.getApplicationEnabledSetting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isFrozen

import android.content.pm.PackageManager; //导入方法依赖的package包/类
public boolean isFrozen(Context context) {
	if (mFrozen == null) {
		PackageManager pm = context.getPackageManager();
		boolean enabled = false;
		for (ApplicationInfo appInfo : mMapAppInfo.values())
			try {
				int setting = pm.getApplicationEnabledSetting(appInfo.packageName);
				enabled = (enabled || setting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
				enabled = (enabled || setting == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
				if (enabled)
					break;
			} catch (IllegalArgumentException ignored) {
			}
		mFrozen = !enabled;
	}
	return mFrozen;
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:18,代码来源:ApplicationInfoEx.java

示例2: Rule

import android.content.pm.PackageManager; //导入方法依赖的package包/类
private Rule(PackageInfo info, boolean wifi_blocked, boolean other_blocked, boolean changed, Context context) {
    PackageManager pm = context.getPackageManager();
    this.info = info;
    this.name = info.applicationInfo.loadLabel(pm).toString();
    this.system = ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);

    int setting = pm.getApplicationEnabledSetting(info.packageName);
    if (setting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
        this.disabled = !info.applicationInfo.enabled;
    else
        this.disabled = (setting != PackageManager.COMPONENT_ENABLED_STATE_ENABLED);

    this.wifi_blocked = wifi_blocked;
    this.other_blocked = other_blocked;
    this.changed = changed;
}
 
开发者ID:shivam141296,项目名称:Android-Firewall,代码行数:17,代码来源:Rule.java

示例3: isEnabled

import android.content.pm.PackageManager; //导入方法依赖的package包/类
public static boolean isEnabled(PackageInfo info, Context context) {
    int setting;
    try {
        PackageManager pm = context.getPackageManager();
        setting = pm.getApplicationEnabledSetting(info.packageName);
    } catch (IllegalArgumentException ex) {
        setting = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
        Log.w(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }
    if (setting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
        return info.applicationInfo.enabled;
    else
        return (setting == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
 
开发者ID:miankai,项目名称:MKAPP,代码行数:15,代码来源:Util.java


注:本文中的android.content.pm.PackageManager.getApplicationEnabledSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。