Loading src/com/android/settings/applications/manageapplications/ManageApplications.java +27 −28 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageItemInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.IBinder; Loading Loading @@ -143,7 +144,7 @@ public class ManageApplications extends InstrumentedFragment implements View.OnClickListener, OnItemSelectedListener, SearchView.OnQueryTextListener { static final String TAG = "ManageApplications"; static final boolean DEBUG = false; static final boolean DEBUG = Build.IS_DEBUGGABLE; // Intent extras. public static final String EXTRA_CLASSNAME = "classname"; Loading Loading @@ -178,8 +179,6 @@ public class ManageApplications extends InstrumentedFragment public static final int STORAGE_TYPE_LEGACY = 2; // Show apps even if they can be categorized. public static final int STORAGE_TYPE_PHOTOS_VIDEOS = 3; private static final int NO_USER_SPECIFIED = -1; /** * Intents with action {@code android.settings.MANAGE_APP_OVERLAY_PERMISSION} * and data URI scheme {@code package} don't go to the app-specific screen for managing the Loading Loading @@ -461,19 +460,8 @@ public class ManageApplications extends InstrumentedFragment pinnedHeader.addView(mSpinnerHeader, 0); final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance(); mFilterAdapter.enableFilter(appFilterRegistry.getDefaultFilterType(mListType)); AppFilter compositeFilter = getCompositeFilter(mListType, mStorageType, mVolumeUuid); if (mIsWorkOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_WORK); } if (mIsPersonalOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_PERSONAL); } if (compositeFilter != null) { mApplications.setCompositeFilter(compositeFilter); } final int filterType = appFilterRegistry.getDefaultFilterType(mListType); mFilterAdapter.enableFilter(filterType); if (mListType == LIST_TYPE_MAIN) { if (UserManager.get(getActivity()).getUserProfiles().size() > 1 && !mIsWorkOnly Loading @@ -491,6 +479,8 @@ public class ManageApplications extends InstrumentedFragment if (mListType == LIST_TYPE_HIGH_POWER) { mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL); } setCompositeFilter(); } @VisibleForTesting Loading @@ -511,11 +501,8 @@ public class ManageApplications extends InstrumentedFragment return new CompoundFilter(ApplicationsState.FILTER_MOVIES, filter); } else if (listType == LIST_TYPE_PHOTOGRAPHY) { return new CompoundFilter(ApplicationsState.FILTER_PHOTOS, filter); } else { final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance(); return appFilterRegistry.get( appFilterRegistry.getDefaultFilterType(listType)).getFilter(); } return null; } @Override Loading Loading @@ -615,6 +602,21 @@ public class ManageApplications extends InstrumentedFragment } } private void setCompositeFilter() { AppFilter compositeFilter = getCompositeFilter(mListType, mStorageType, mVolumeUuid); if (compositeFilter == null) { compositeFilter = mFilter.getFilter(); } if (mIsWorkOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_WORK); } if (mIsPersonalOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_PERSONAL); } mApplications.setCompositeFilter(compositeFilter); } // utility method used to start sub activity private void startApplicationDetailsActivity() { switch (mListType) { Loading Loading @@ -823,6 +825,7 @@ public class ManageApplications extends InstrumentedFragment @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mFilter = mFilterAdapter.getFilter(position); setCompositeFilter(); mApplications.setFilter(mFilter); if (DEBUG) { Loading Loading @@ -1227,14 +1230,10 @@ public class ManageApplications extends InstrumentedFragment comparatorObj = ApplicationsState.ALPHA_COMPARATOR; } filterObj = new CompoundFilter(filterObj, ApplicationsState.FILTER_NOT_HIDE); AppFilter finalFilterObj = filterObj; final AppFilter finalFilterObj = new CompoundFilter(filterObj, ApplicationsState.FILTER_NOT_HIDE); ThreadUtils.postOnBackgroundThread(() -> { final ArrayList<AppEntry> entries = mSession.rebuild(finalFilterObj, comparatorObj, false); if (entries != null) { ThreadUtils.postOnMainThread(() -> onRebuildComplete(entries)); } mSession.rebuild(finalFilterObj, comparatorObj, false); }); } Loading Loading @@ -1284,7 +1283,7 @@ public class ManageApplications extends InstrumentedFragment @Override public void onRebuildComplete(ArrayList<AppEntry> entries) { if (DEBUG) { Log.d(TAG, "onRebuildComplete"); Log.d(TAG, "onRebuildComplete size=" + entries.size()); } final int filterType = mAppFilter.getFilterType(); if (filterType == FILTER_APPS_POWER_WHITELIST || Loading Loading
src/com/android/settings/applications/manageapplications/ManageApplications.java +27 −28 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageItemInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.IBinder; Loading Loading @@ -143,7 +144,7 @@ public class ManageApplications extends InstrumentedFragment implements View.OnClickListener, OnItemSelectedListener, SearchView.OnQueryTextListener { static final String TAG = "ManageApplications"; static final boolean DEBUG = false; static final boolean DEBUG = Build.IS_DEBUGGABLE; // Intent extras. public static final String EXTRA_CLASSNAME = "classname"; Loading Loading @@ -178,8 +179,6 @@ public class ManageApplications extends InstrumentedFragment public static final int STORAGE_TYPE_LEGACY = 2; // Show apps even if they can be categorized. public static final int STORAGE_TYPE_PHOTOS_VIDEOS = 3; private static final int NO_USER_SPECIFIED = -1; /** * Intents with action {@code android.settings.MANAGE_APP_OVERLAY_PERMISSION} * and data URI scheme {@code package} don't go to the app-specific screen for managing the Loading Loading @@ -461,19 +460,8 @@ public class ManageApplications extends InstrumentedFragment pinnedHeader.addView(mSpinnerHeader, 0); final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance(); mFilterAdapter.enableFilter(appFilterRegistry.getDefaultFilterType(mListType)); AppFilter compositeFilter = getCompositeFilter(mListType, mStorageType, mVolumeUuid); if (mIsWorkOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_WORK); } if (mIsPersonalOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_PERSONAL); } if (compositeFilter != null) { mApplications.setCompositeFilter(compositeFilter); } final int filterType = appFilterRegistry.getDefaultFilterType(mListType); mFilterAdapter.enableFilter(filterType); if (mListType == LIST_TYPE_MAIN) { if (UserManager.get(getActivity()).getUserProfiles().size() > 1 && !mIsWorkOnly Loading @@ -491,6 +479,8 @@ public class ManageApplications extends InstrumentedFragment if (mListType == LIST_TYPE_HIGH_POWER) { mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL); } setCompositeFilter(); } @VisibleForTesting Loading @@ -511,11 +501,8 @@ public class ManageApplications extends InstrumentedFragment return new CompoundFilter(ApplicationsState.FILTER_MOVIES, filter); } else if (listType == LIST_TYPE_PHOTOGRAPHY) { return new CompoundFilter(ApplicationsState.FILTER_PHOTOS, filter); } else { final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance(); return appFilterRegistry.get( appFilterRegistry.getDefaultFilterType(listType)).getFilter(); } return null; } @Override Loading Loading @@ -615,6 +602,21 @@ public class ManageApplications extends InstrumentedFragment } } private void setCompositeFilter() { AppFilter compositeFilter = getCompositeFilter(mListType, mStorageType, mVolumeUuid); if (compositeFilter == null) { compositeFilter = mFilter.getFilter(); } if (mIsWorkOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_WORK); } if (mIsPersonalOnly) { compositeFilter = new CompoundFilter(compositeFilter, ApplicationsState.FILTER_PERSONAL); } mApplications.setCompositeFilter(compositeFilter); } // utility method used to start sub activity private void startApplicationDetailsActivity() { switch (mListType) { Loading Loading @@ -823,6 +825,7 @@ public class ManageApplications extends InstrumentedFragment @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mFilter = mFilterAdapter.getFilter(position); setCompositeFilter(); mApplications.setFilter(mFilter); if (DEBUG) { Loading Loading @@ -1227,14 +1230,10 @@ public class ManageApplications extends InstrumentedFragment comparatorObj = ApplicationsState.ALPHA_COMPARATOR; } filterObj = new CompoundFilter(filterObj, ApplicationsState.FILTER_NOT_HIDE); AppFilter finalFilterObj = filterObj; final AppFilter finalFilterObj = new CompoundFilter(filterObj, ApplicationsState.FILTER_NOT_HIDE); ThreadUtils.postOnBackgroundThread(() -> { final ArrayList<AppEntry> entries = mSession.rebuild(finalFilterObj, comparatorObj, false); if (entries != null) { ThreadUtils.postOnMainThread(() -> onRebuildComplete(entries)); } mSession.rebuild(finalFilterObj, comparatorObj, false); }); } Loading Loading @@ -1284,7 +1283,7 @@ public class ManageApplications extends InstrumentedFragment @Override public void onRebuildComplete(ArrayList<AppEntry> entries) { if (DEBUG) { Log.d(TAG, "onRebuildComplete"); Log.d(TAG, "onRebuildComplete size=" + entries.size()); } final int filterType = mAppFilter.getFilterType(); if (filterType == FILTER_APPS_POWER_WHITELIST || Loading