Search in sources :

Example 1 with InstallAppsState

use of com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState in project android_packages_apps_Settings by omnirom.

the class ExternalSourcesDetails method getPreferenceSummary.

static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
    final UserManager um = UserManager.get(context);
    final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserHandle.getUserHandleForUid(entry.info.uid));
    switch(userRestrictionSource) {
        case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
        case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
            return context.getString(R.string.disabled_by_admin);
        case UserManager.RESTRICTION_SOURCE_SYSTEM:
            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);
}
Also used : UserManager(android.os.UserManager) InstallAppsState(com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)

Example 2 with InstallAppsState

use of com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState in project android_packages_apps_Settings by DirtyUnicorns.

the class ExternalSourcesDetails method getPreferenceSummary.

static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
    final UserManager um = UserManager.get(context);
    final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserHandle.getUserHandleForUid(entry.info.uid));
    switch(userRestrictionSource) {
        case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
        case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
            return context.getString(R.string.disabled_by_admin);
        case UserManager.RESTRICTION_SOURCE_SYSTEM:
            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);
}
Also used : UserManager(android.os.UserManager) InstallAppsState(com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)

Example 3 with InstallAppsState

use of com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState in project platform_packages_apps_Settings by BlissRoms.

the class ExternalSourcesDetails method getPreferenceSummary.

static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
    final UserManager um = UserManager.get(context);
    final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserHandle.getUserHandleForUid(entry.info.uid));
    switch(userRestrictionSource) {
        case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
        case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
            return context.getString(R.string.disabled_by_admin);
        case UserManager.RESTRICTION_SOURCE_SYSTEM:
            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);
}
Also used : UserManager(android.os.UserManager) InstallAppsState(com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)

Example 4 with InstallAppsState

use of com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState in project android_packages_apps_Settings by LineageOS.

the class ExternalSourcesDetails method getPreferenceSummary.

static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
    final UserManager um = UserManager.get(context);
    final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserHandle.getUserHandleForUid(entry.info.uid));
    switch(userRestrictionSource) {
        case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
        case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
            return context.getString(R.string.disabled_by_admin);
        case UserManager.RESTRICTION_SOURCE_SYSTEM:
            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);
}
Also used : UserManager(android.os.UserManager) InstallAppsState(com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)

Example 5 with InstallAppsState

use of com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState in project android_packages_apps_Settings by crdroidandroid.

the class ExternalSourcesDetails method getPreferenceSummary.

static CharSequence getPreferenceSummary(Context context, AppEntry entry) {
    final UserManager um = UserManager.get(context);
    final int userRestrictionSource = um.getUserRestrictionSource(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, UserHandle.getUserHandleForUid(entry.info.uid));
    switch(userRestrictionSource) {
        case UserManager.RESTRICTION_SOURCE_DEVICE_OWNER:
        case UserManager.RESTRICTION_SOURCE_PROFILE_OWNER:
            return context.getString(R.string.disabled_by_admin);
        case UserManager.RESTRICTION_SOURCE_SYSTEM:
            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);
}
Also used : UserManager(android.os.UserManager) InstallAppsState(com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)

Aggregations

UserManager (android.os.UserManager)8 InstallAppsState (com.android.settings.applications.AppStateInstallAppsBridge.InstallAppsState)8 UserHandle (android.os.UserHandle)2 AppStateInstallAppsBridge (com.android.settings.applications.AppStateInstallAppsBridge)2