2424import android .app .TaskStackBuilder ;
2525import android .content .Context ;
2626import android .content .Intent ;
27- import android .content .res .Configuration ;
2827import android .content .res .Resources ;
2928import android .content .res .TypedArray ;
3029import android .graphics .Bitmap ;
@@ -67,7 +66,6 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener
6766 StatusBarPanel , Animator .AnimatorListener {
6867 static final String TAG = "RecentsPanelView" ;
6968 static final boolean DEBUG = TabletStatusBar .DEBUG || PhoneStatusBar .DEBUG || false ;
70- private Context mContext ;
7169 private PopupMenu mPopup ;
7270 private View mRecentsScrim ;
7371 private View mRecentsNoApps ;
@@ -203,7 +201,6 @@ public RecentsPanelView(Context context, AttributeSet attrs) {
203201
204202 public RecentsPanelView (Context context , AttributeSet attrs , int defStyle ) {
205203 super (context , attrs , defStyle );
206- mContext = context ;
207204 updateValuesFromResources ();
208205
209206 TypedArray a = context .obtainStyledAttributes (attrs , R .styleable .RecentsPanelView ,
@@ -374,7 +371,6 @@ public void updateValuesFromResources() {
374371 protected void onFinishInflate () {
375372 super .onFinishInflate ();
376373
377- mContext .getSystemService (Context .LAYOUT_INFLATER_SERVICE );
378374 mRecentsContainer = (ViewGroup ) findViewById (R .id .recents_container );
379375 mStatusBarTouchProxy = (StatusBarTouchProxy ) findViewById (R .id .status_bar_touch_proxy );
380376 mListAdapter = new TaskDescriptionAdapter (mContext );
@@ -488,7 +484,7 @@ void onTaskThumbnailLoaded(TaskDescription td) {
488484 }
489485 }
490486 }
491- }
487+ }
492488 showIfReady ();
493489 }
494490
@@ -508,6 +504,12 @@ public void onTaskLoadingCancelled() {
508504 }
509505 }
510506
507+ public void refreshViews () {
508+ mListAdapter .notifyDataSetInvalidated ();
509+ updateUiElements ();
510+ showIfReady ();
511+ }
512+
511513 public void refreshRecentTasksList () {
512514 refreshRecentTasksList (null , false );
513515 }
@@ -530,12 +532,12 @@ public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenf
530532 } else {
531533 mRecentTaskDescriptions .addAll (tasks );
532534 }
533- mListAdapter . notifyDataSetInvalidated ();
534- updateUiElements ( getResources (). getConfiguration () );
535- showIfReady ();
535+ if ((( RecentsActivity ) mContext ). isForeground ()) {
536+ refreshViews ( );
537+ }
536538 }
537539
538- private void updateUiElements (Configuration config ) {
540+ private void updateUiElements () {
539541 final int items = mRecentTaskDescriptions .size ();
540542
541543 mRecentsContainer .setVisibility (items > 0 ? View .VISIBLE : View .GONE );
0 commit comments