• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root CM9 Rom Disable Recent Apps

hokiescoot

Member
May 3, 2013
66
13
If you hold down the Home button it brings up a list of Recent Apps. You can swipe these away to clear them. When my phone is acting wacky I found that going into Settings, Apps, Running, the apps in the Recent Apps list is cycling every second on the same line. If I press home and swipe these away they are removed from the Running apps in Settings and the phone is fine. I would like to disable the recent apps function to eliminate this problem. I would like to know how to do this on our CM9. I found a thread elsewhere that shows how to do this, but I do not know where or what file to edit on the Elite. Here is a copy past of the thread I found. Can someone explain how to do this on the Elite?

This will close the RecentActivity dialog. Put it in your activity class.
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (!hasFocus) { windowCloseHandler.postDelayed(windowCloserRunnable, 250); } } private void toggleRecents() { Intent closeRecents = new Intent("com.android.systemui.recent.action.TOGGLE_RECENTS"); closeRecents.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); ComponentName recents = new ComponentName("com.android.systemui", "com.android.systemui.recent.RecentsActivity"); closeRecents.setComponent(recents); this.startActivity(closeRecents); } private Handler windowCloseHandler = new Handler(); private Runnable windowCloserRunnable = new Runnable() { @Override public void run() { ActivityManager am = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn = am.getRunningTasks(1).get(0).topActivity; if (cn != null && cn.getClassName().equals("com.android.systemui.recent.RecentsActivity")) { toggleRecents(); } } } You will need to put the following permission in your manifest.
<uses-permission android:name="android.permission.GET_TASKS" />
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones