當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。