use of com.android.settings.applications.AppStateInstallAppsBridge in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ExternalSourcesDetails method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Context context = getActivity();
mAppBridge = new AppStateInstallAppsBridge(context, mState, null);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mActivityManager = context.getSystemService(ActivityManager.class);
mUserManager = UserManager.get(context);
addPreferencesFromResource(R.xml.external_sources_details);
mSwitchPref = (RestrictedSwitchPreference) findPreference(KEY_EXTERNAL_SOURCE_SWITCH);
mSwitchPref.setOnPreferenceChangeListener(this);
}
use of com.android.settings.applications.AppStateInstallAppsBridge in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ExternalSourcesDetails method getPreferenceSummary.
public static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
final UserHandle userHandle = UserHandle.getUserHandleForUid(entry.info.uid);
final UserManager um = UserManager.get(context);
final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, userHandle) | um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY, userHandle);
if ((userRestrictionSource & UserManager.RESTRICTION_SOURCE_SYSTEM) != 0) {
return context.getString(R.string.disabled_by_admin);
} else if (userRestrictionSource != 0) {
return context.getString(R.string.disabled);
}
final InstallAppsState appsState = new AppStateInstallAppsBridge(context, null, null).createInstallAppsStateFor(entry.info.packageName, entry.info.uid);
return context.getString(appsState.canInstallApps() ? R.string.app_permission_summary_allowed : R.string.app_permission_summary_not_allowed);
}
use of com.android.settings.applications.AppStateInstallAppsBridge in project android_packages_apps_Settings by omnirom.
the class ExternalSourcesDetails method getPreferenceSummary.
public static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
final UserHandle userHandle = UserHandle.getUserHandleForUid(entry.info.uid);
final UserManager um = UserManager.get(context);
final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, userHandle) | um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY, userHandle);
if ((userRestrictionSource & UserManager.RESTRICTION_SOURCE_SYSTEM) != 0) {
return context.getString(R.string.disabled_by_admin);
} else if (userRestrictionSource != 0) {
return context.getString(R.string.disabled);
}
final InstallAppsState appsState = new AppStateInstallAppsBridge(context, null, null).createInstallAppsStateFor(entry.info.packageName, entry.info.uid);
return context.getString(appsState.canInstallApps() ? R.string.app_permission_summary_allowed : R.string.app_permission_summary_not_allowed);
}
use of com.android.settings.applications.AppStateInstallAppsBridge in project android_packages_apps_Settings by omnirom.
the class ExternalSourcesDetails method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Context context = getActivity();
mAppBridge = new AppStateInstallAppsBridge(context, mState, null);
mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
mUserManager = UserManager.get(context);
addPreferencesFromResource(R.xml.external_sources_details);
mSwitchPref = (RestrictedSwitchPreference) findPreference(KEY_EXTERNAL_SOURCE_SWITCH);
mSwitchPref.setOnPreferenceChangeListener(this);
}
Aggregations