3333public class RecentsActivity extends Activity {
3434 public static final String TOGGLE_RECENTS_INTENT = "com.android.systemui.TOGGLE_RECENTS" ;
3535 public static final String CLOSE_RECENTS_INTENT = "com.android.systemui.CLOSE_RECENTS" ;
36+ private static final String WAS_SHOWING = "was_showing" ;
3637
3738 private RecentsPanelView mRecentsPanel ;
3839 private IntentFilter mIntentFilter ;
@@ -139,13 +140,21 @@ protected void onCreate(Bundle savedInstanceState) {
139140 mRecentsPanel .setMinSwipeAlpha (
140141 getResources ().getInteger (R .integer .config_recent_item_min_alpha ) / 100f );
141142
142- handleIntent (getIntent ());
143+ if (savedInstanceState == null ||
144+ savedInstanceState .getBoolean (WAS_SHOWING )) {
145+ handleIntent (getIntent ());
146+ }
143147 mIntentFilter = new IntentFilter ();
144148 mIntentFilter .addAction (CLOSE_RECENTS_INTENT );
145149 registerReceiver (mIntentReceiver , mIntentFilter );
146150 super .onCreate (savedInstanceState );
147151 }
148152
153+ @ Override
154+ protected void onSaveInstanceState (Bundle outState ) {
155+ outState .putBoolean (WAS_SHOWING , mRecentsPanel .isShowing ());
156+ }
157+
149158 @ Override
150159 protected void onDestroy () {
151160 final SystemUIApplication app = (SystemUIApplication ) getApplication ();
@@ -165,7 +174,7 @@ private void handleIntent(Intent intent) {
165174
166175 if (TOGGLE_RECENTS_INTENT .equals (intent .getAction ())) {
167176 if (mRecentsPanel != null ) {
168- if (mRecentsPanel .isShowing () && mForeground ) {
177+ if (mRecentsPanel .isShowing ()) {
169178 dismissAndGoBack ();
170179 } else {
171180 final SystemUIApplication app = (SystemUIApplication ) getApplication ();
0 commit comments