Search in sources :

Example 16 with ModuleInfo

use of android.content.pm.ModuleInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ModuleLicensesPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    PackageManager packageManager = mContext.getPackageManager();
    List<ModuleInfo> modules = packageManager.getInstalledModules(0);
    PreferenceGroup group = screen.findPreference(getPreferenceKey());
    modules.stream().sorted(Comparator.comparing(o -> o.getName().toString())).filter(new Predicate(mContext)).forEach(module -> group.addPreference(new ModuleLicensePreference(group.getContext(), module)));
}
Also used : PreferenceGroup(androidx.preference.PreferenceGroup) Context(android.content.Context) PreferenceScreen(androidx.preference.PreferenceScreen) List(java.util.List) PackageManager(android.content.pm.PackageManager) BasePreferenceController(com.android.settings.core.BasePreferenceController) ModuleInfo(android.content.pm.ModuleInfo) IOException(java.io.IOException) Comparator(java.util.Comparator) ArrayUtils(com.android.internal.util.ArrayUtils) PackageManager(android.content.pm.PackageManager) ModuleInfo(android.content.pm.ModuleInfo) PreferenceGroup(androidx.preference.PreferenceGroup)

Aggregations

ModuleInfo (android.content.pm.ModuleInfo)16 Test (org.junit.Test)8 PackageManager (android.content.pm.PackageManager)6 Context (android.content.Context)5 ApplicationInfo (android.content.pm.ApplicationInfo)3 PackageInfo (android.content.pm.PackageInfo)3 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 Config (org.robolectric.annotation.Config)3 AssetManager (android.content.res.AssetManager)2 Resources (android.content.res.Resources)2 Activity (android.app.Activity)1 UsageStats (android.app.usage.UsageStats)1 Intent (android.content.Intent)1 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 ResolveInfo (android.content.pm.ResolveInfo)1 Preference (androidx.preference.Preference)1 PreferenceGroup (androidx.preference.PreferenceGroup)1 PreferenceScreen (androidx.preference.PreferenceScreen)1 ArrayUtils (com.android.internal.util.ArrayUtils)1