Search in sources :

Example 21 with UserAppInfo

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

the class ApplicationListPreferenceController method onListOfAppsResult.

@Override
public void onListOfAppsResult(List<UserAppInfo> result) {
    final PreferenceScreen screen = mParent.getPreferenceScreen();
    if (screen == null) {
        return;
    }
    final Context prefContext = mParent.getPreferenceManager().getContext();
    for (int position = 0; position < result.size(); position++) {
        final UserAppInfo item = result.get(position);
        final Preference preference = new Preference(prefContext);
        preference.setLayoutResource(R.layout.preference_app);
        preference.setTitle(item.appInfo.loadLabel(mPm));
        preference.setIcon(item.appInfo.loadIcon(mPm));
        preference.setOrder(position);
        preference.setSelectable(false);
        screen.addPreference(preference);
    }
}
Also used : Context(android.content.Context) PreferenceScreen(android.support.v7.preference.PreferenceScreen) Preference(android.support.v7.preference.Preference) UserAppInfo(com.android.settings.applications.UserAppInfo)

Example 22 with UserAppInfo

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

the class EnterpriseSetDefaultAppsPreferenceControllerTest method setEnterpriseSetDefaultApps.

private void setEnterpriseSetDefaultApps(Intent[] intents, int number) {
    final ApplicationInfo appInfo = new ApplicationInfo();
    appInfo.packageName = "app";
    for (int i = 0; i < number; i++) {
        final List<UserAppInfo> apps = new ArrayList<>(number);
        apps.add(new UserAppInfo(new UserInfo(i, "user." + i, UserInfo.FLAG_ADMIN), appInfo));
        when(mFeatureFactory.applicationFeatureProvider.findPersistentPreferredActivities(eq(i), argThat(matchesIntents(intents)))).thenReturn(apps);
    }
}
Also used : UserAppInfo(com.android.settings.applications.UserAppInfo) ApplicationInfo(android.content.pm.ApplicationInfo) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo)

Example 23 with UserAppInfo

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

the class ApplicationListPreferenceController method onListOfAppsResult.

@Override
public void onListOfAppsResult(List<UserAppInfo> result) {
    final PreferenceScreen screen = mParent.getPreferenceScreen();
    if (screen == null) {
        return;
    }
    final Context prefContext = mParent.getPreferenceManager().getContext();
    for (int position = 0; position < result.size(); position++) {
        final UserAppInfo item = result.get(position);
        final Preference preference = new Preference(prefContext);
        preference.setLayoutResource(R.layout.preference_app);
        preference.setTitle(item.appInfo.loadLabel(mPm));
        preference.setIcon(item.appInfo.loadIcon(mPm));
        preference.setOrder(position);
        preference.setSelectable(false);
        screen.addPreference(preference);
    }
}
Also used : Context(android.content.Context) PreferenceScreen(android.support.v7.preference.PreferenceScreen) Preference(android.support.v7.preference.Preference) UserAppInfo(com.android.settings.applications.UserAppInfo)

Example 24 with UserAppInfo

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

the class EnterpriseSetDefaultAppsPreferenceControllerTest method setEnterpriseSetDefaultApps.

private void setEnterpriseSetDefaultApps(Intent[] intents, int number) {
    final ApplicationInfo appInfo = new ApplicationInfo();
    appInfo.packageName = "app";
    for (int i = 0; i < number; i++) {
        final List<UserAppInfo> apps = new ArrayList<>(number);
        apps.add(new UserAppInfo(new UserInfo(i, "user." + i, UserInfo.FLAG_ADMIN), appInfo));
        when(mFeatureFactory.applicationFeatureProvider.findPersistentPreferredActivities(eq(i), argThat(matchesIntents(intents)))).thenReturn(apps);
    }
}
Also used : UserAppInfo(com.android.settings.applications.UserAppInfo) ApplicationInfo(android.content.pm.ApplicationInfo) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo)

Example 25 with UserAppInfo

use of com.android.settings.applications.UserAppInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class EnterpriseSetDefaultAppsPreferenceControllerTest method setEnterpriseSetDefaultApps.

private void setEnterpriseSetDefaultApps(Intent[] intents, int number) {
    final ApplicationInfo appInfo = new ApplicationInfo();
    appInfo.packageName = "app";
    for (int i = 0; i < number; i++) {
        final List<UserAppInfo> apps = new ArrayList<>(number);
        apps.add(new UserAppInfo(new UserInfo(i, "user." + i, UserInfo.FLAG_ADMIN), appInfo));
        when(mFeatureFactory.applicationFeatureProvider.findPersistentPreferredActivities(eq(i), argThat(matchesIntents(intents)))).thenReturn(apps);
    }
}
Also used : UserAppInfo(com.android.settings.applications.UserAppInfo) ApplicationInfo(android.content.pm.ApplicationInfo) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo)

Aggregations

UserAppInfo (com.android.settings.applications.UserAppInfo)28 ApplicationInfo (android.content.pm.ApplicationInfo)21 UserInfo (android.content.pm.UserInfo)14 UserHandle (android.os.UserHandle)14 ArrayList (java.util.ArrayList)14 Preference (android.support.v7.preference.Preference)10 Context (android.content.Context)7 EnterpriseDefaultApps (com.android.settings.applications.EnterpriseDefaultApps)7 List (java.util.List)7 Test (org.junit.Test)7 Handler (android.os.Handler)5 PreferenceScreen (android.support.v7.preference.PreferenceScreen)5 Preference (androidx.preference.Preference)4 IconDrawableFactory (android.util.IconDrawableFactory)2 PreferenceScreen (androidx.preference.PreferenceScreen)2 AppPreference (com.android.settingslib.widget.AppPreference)1 AppPreference (com.android.settingslib.widget.apppreference.AppPreference)1