Removed "Currently running" section from drawer

- As of android L, we cannot get currently running processes, except yourself processes.
- This mode has been removed
This commit is contained in:
SVolf 2023-09-30 20:04:56 +07:00
parent dcf8e580a9
commit 31917c77a7
4 changed files with 3 additions and 91 deletions

View file

@ -643,69 +643,6 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
addAppsFromPage(mDrawerPage, items, mAllDrawerPageIDs);
Collections.sort(items, Utils.sItemComparatorByLastUpdateTime);
break;
case Utils.LAYOUT_MODE_RUNNING:
all_items = new ArrayList<Item>();
items = new ArrayList<Item>();
addAppsFromPage(mDrawerPage, all_items, mAllDrawerPageIDs);
am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
// pm = getPackageManager();
List<ActivityManager.RunningAppProcessInfo> running = am.getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo info : running) {
// if(info.importance==ActivityManager.RunningAppProcessInfo.IMPORTANCE_EMPTY) continue;
// if(info.importance==ActivityManager.RunningAppProcessInfo.IMPORTANCE_SERVICE) continue;
// if(info.importance==ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND) continue;
for (String pkg : info.pkgList) {
Item i = findItemByComponent(all_items, pkg, null);
if (i != null && findItemByComponent(items, pkg, null) == null) {
items.add(i);
}
// try {
// ApplicationInfo ai = pm.getApplicationInfo(pkg, 0);
// Bitmap icon = ((BitmapDrawable)pm.getApplicationIcon(ai)).getBitmap();
// String label = pm.getApplicationLabel(ai).toString();
// Item i = findItemByComponent(items, pkg);
// if(i==null) {
// Shortcut s = new Shortcut();
// Intent intent = new Intent();
// intent.setComponent(new ComponentName(pkg, ""));
// s.init(this, Utils.findFreeItemId(items, Utils.APP_DRAWER_PAGE), new Rect(), null, label, intent, mPageConfig);
// s.buildView(this, icon_dir, icon);
// items.add(s);
// }
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// Log.i("XXX", info+" "+pkg);
// Item i = findItemByComponent(all_items, pkg);
// if(i == null) {
// // TODO add dummy item ?
// } else {
// items.add(i);
// }
}
}
// List<ActivityManager.RunningTaskInfo> running = am.getRunningTasks(100);
// for(ActivityManager.RunningTaskInfo info : running) {
// Item i = findItemByComponent(all_items, info.baseActivity.getPackageName());
// if(i == null) {
// // TODO add dummy item ?
// } else {
// items.add(i);
// }
// }
for (Item i : all_items) {
if (!(i instanceof Shortcut)) {
items.add(i);
}
}
Collections.sort(items, Utils.sItemComparatorByNameAsc);
break;
}
@ -754,11 +691,6 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
icon_text = "T";
label_res_id = R.string.mi_mode_recently_updated;
break;
case Utils.LAYOUT_MODE_RUNNING:
icon_text = "S";
label_res_id = R.string.mi_mode_running;
break;
}
mModeIcon.setText(icon_text);
((TextView) findViewById(R.id.drawer_mode_value)).setText(label_res_id);
@ -1190,8 +1122,6 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
addBubbleItem(R.id.mi_mode_recent_apps, R.string.mi_mode_recent_apps);
if (hasMode(Utils.LAYOUT_MODE_RECENTLY_UPDATED))
addBubbleItem(R.id.mi_mode_recently_updated, R.string.mi_mode_recently_updated);
if (hasMode(Utils.LAYOUT_MODE_RUNNING))
addBubbleItem(R.id.mi_mode_running, R.string.mi_mode_running);
} else {
super.configureBubbleForContainer(mode, il);
}
@ -1337,7 +1267,7 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
break;
case R.id.mi_es_refresh:
if (mLayoutMode == Utils.LAYOUT_MODE_RECENT_APPS || mLayoutMode == Utils.LAYOUT_MODE_RUNNING) {
if (mLayoutMode == Utils.LAYOUT_MODE_RECENT_APPS) {
setLayoutMode(mLayoutMode, true);
} else {
refreshAppDrawerItems(true);
@ -1377,11 +1307,6 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
setLayoutModeAnimated(Utils.LAYOUT_MODE_RECENTLY_UPDATED);
break;
case R.id.mi_mode_running:
if (mEditMode) leaveEditMode();
setLayoutModeAnimated(Utils.LAYOUT_MODE_RUNNING);
break;
case R.id.mi_hide_unhide:
ArrayList<ItemView> itemViews = getActionItemViews();
mUndoStack.storeGroupStart();
@ -1416,15 +1341,7 @@ public class AppDrawerX extends Dashboard implements EditTextIme.OnEditTextImeLi
if (LLApp.get().isFreeVersion()) {
LLApp.get().showFeatureLockedDialog(this);
} else {
// use super class behavior but in addition, trigger a refresh if in running view
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (mLayoutMode == Utils.LAYOUT_MODE_RUNNING) {
setLayoutMode(Utils.LAYOUT_MODE_RUNNING, true);
}
}
}, 2000);
// use super class behavior
super.onClick(v);
}
break;

View file

@ -492,7 +492,6 @@ public class Customize extends ResourceWrapperActivity implements
private LLPreferenceCheckBox mPGADModeFrequentlyUsed;
private LLPreferenceCheckBox mPGADModeRecentApps;
private LLPreferenceCheckBox mPGADModeRecentlyUpdated;
private LLPreferenceCheckBox mPGADModeRunning;
private LLPreference mPGMisc;
private LLPreferenceList mPGMiscScreenOrientation;
private LLPreferenceCheckBox mPGMiscSwapItems;
@ -1629,7 +1628,6 @@ public class Customize extends ResourceWrapperActivity implements
mPreferencesPageADModes.add(mPGADModeByName = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_by_name, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_BY_NAME), null));
mPreferencesPageADModes.add(mPGADModeFrequentlyUsed = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_frequently_used, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_FREQUENTLY_USED), null));
mPreferencesPageADModes.add(mPGADModeRecentlyUpdated = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_recently_updated, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RECENTLY_UPDATED), null));
mPreferencesPageADModes.add(mPGADModeRunning = new LLPreferenceCheckBox(this, 0, R.string.mi_mode_running, 0, Utils.hasAppDrawerMode(modes, Utils.LAYOUT_MODE_RUNNING), null));
}
if ((!is_folder_page && !is_embedded_folder_page) || mSystemConfig.expertMode) {
@ -2034,7 +2032,6 @@ public class Customize extends ResourceWrapperActivity implements
modes |= (1 << Utils.LAYOUT_MODE_RECENT_APPS);
if (mPGADModeRecentlyUpdated.isChecked())
modes |= (1 << Utils.LAYOUT_MODE_RECENTLY_UPDATED);
if (mPGADModeRunning.isChecked()) modes |= (1 << Utils.LAYOUT_MODE_RUNNING);
return modes;
}

View file

@ -111,8 +111,7 @@ public class Utils {
public static final int LAYOUT_MODE_FREQUENTLY_USED = 2;
public static final int LAYOUT_MODE_RECENT_APPS = 3;
public static final int LAYOUT_MODE_RECENTLY_UPDATED = 4;
public static final int LAYOUT_MODE_RUNNING = 5;
public static final int LAYOUT_MODE_LAST = LAYOUT_MODE_RUNNING;
public static final int LAYOUT_MODE_LAST = LAYOUT_MODE_RECENTLY_UPDATED;
public static final Collator sItemNameCollator = Collator.getInstance(Locale.getDefault());
public static final Comparator<Item> sItemComparatorByNameAsc = new Comparator<Item>() {

View file

@ -525,7 +525,6 @@
<string name="mi_mode_recent_apps">Recently launched</string>
<string name="mi_mode_recently_updated">Recently updated</string>
<string name="mi_mode_frequently_used">Used often</string>
<string name="mi_mode_running">Currently running</string>
<string name="mi_es_edit_layout">Edit layout</string>
<string name="mi_es_refresh">Refresh</string>
<string name="mi_es_settings">Settings…</string>