Skip to content

Commit cbaa666

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Remove unnecessary code"
2 parents 6835237 + f16fc51 commit cbaa666

File tree

7 files changed

+16
-189
lines changed

7 files changed

+16
-189
lines changed

packages/SystemUI/res/values/colors.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<drawable name="notification_item_background_color_pressed">#ff257390</drawable>
2323
<drawable name="ticker_background_color">#ff1d1d1d</drawable>
2424
<drawable name="status_bar_background">#ff000000</drawable>
25-
<drawable name="status_bar_recents_background_solid">#b3000000</drawable>
2625
<drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable>
2726
<color name="status_bar_recents_app_label_color">#ffffffff</color>
2827
<drawable name="status_bar_notification_row_background_color">#ff090909</drawable>

packages/SystemUI/src/com/android/systemui/recent/RecentsCallback.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,5 @@ public interface RecentsCallback {
2727
void handleOnClick(View selectedView);
2828
void handleSwipe(View selectedView);
2929
void handleLongPress(View selectedView, View anchorView, View thumbnailView);
30-
void handleShowBackground(boolean show);
3130
void dismiss();
32-
33-
// TODO: find another way to get this info from RecentsPanelView
34-
boolean isRecentsVisible();
3531
}

packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,6 @@ public View getChildContentView(View v) {
216216
return v.findViewById(R.id.recent_item);
217217
}
218218

219-
@Override
220-
protected void onLayout (boolean changed, int left, int top, int right, int bottom) {
221-
super.onLayout(changed, left, top, right, bottom);
222-
if (mPerformanceHelper != null) {
223-
mPerformanceHelper.onLayoutCallback();
224-
}
225-
}
226-
227219
@Override
228220
public void draw(Canvas canvas) {
229221
super.draw(canvas);
@@ -327,12 +319,6 @@ public void run() {
327319
});
328320
}
329321

330-
public void onRecentsVisibilityChanged() {
331-
if (mPerformanceHelper != null) {
332-
mPerformanceHelper.updateShowBackground();
333-
}
334-
}
335-
336322
@Override
337323
protected void onVisibilityChanged(View changedView, int visibility) {
338324
super.onVisibilityChanged(changedView, visibility);
@@ -379,9 +365,6 @@ public int numItemsInOneScreenful() {
379365

380366
@Override
381367
public void setLayoutTransition(LayoutTransition transition) {
382-
if (mPerformanceHelper != null) {
383-
mPerformanceHelper.setLayoutTransitionCallback(transition);
384-
}
385368
// The layout transition applies to our embedded LinearLayout
386369
mLinearLayout.setLayoutTransition(transition);
387370
}

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
import android.provider.Settings;
3333
import android.util.AttributeSet;
3434
import android.util.Log;
35+
import android.view.Display;
3536
import android.view.KeyEvent;
3637
import android.view.LayoutInflater;
3738
import android.view.MenuItem;
3839
import android.view.MotionEvent;
3940
import android.view.View;
4041
import android.view.ViewGroup;
41-
import android.view.ViewRootImpl;
42+
import android.view.WindowManager;
4243
import android.view.accessibility.AccessibilityEvent;
4344
import android.view.animation.AnimationUtils;
4445
import android.widget.AdapterView;
@@ -325,18 +326,6 @@ public void hide(boolean animate) {
325326
}
326327
}
327328

328-
public void handleShowBackground(boolean show) {
329-
if (show) {
330-
mRecentsScrim.setBackgroundResource(R.drawable.status_bar_recents_background_solid);
331-
} else {
332-
mRecentsScrim.setBackgroundDrawable(null);
333-
}
334-
}
335-
336-
public boolean isRecentsVisible() {
337-
return getVisibility() == VISIBLE;
338-
}
339-
340329
public void onAnimationCancel(Animator animation) {
341330
}
342331

@@ -457,9 +446,15 @@ protected void onFinishInflate() {
457446
mRecentsNoApps = findViewById(R.id.recents_no_apps);
458447
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this);
459448

460-
// In order to save space, we make the background texture repeat in the Y direction
461-
if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {
462-
((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
449+
if (mRecentsScrim != null) {
450+
Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
451+
.getDefaultDisplay();
452+
if (!ActivityManager.isHighEndGfx(d)) {
453+
mRecentsScrim.setBackgroundDrawable(null);
454+
} else if (mRecentsScrim.getBackground() instanceof BitmapDrawable) {
455+
// In order to save space, we make the background texture repeat in the Y direction
456+
((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
457+
}
463458
}
464459

465460
mPreloadTasksRunnable = new Runnable() {
@@ -478,21 +473,6 @@ private void createCustomAnimations(LayoutTransition transitioner) {
478473
transitioner.setAnimator(LayoutTransition.DISAPPEARING, null);
479474
}
480475

481-
@Override
482-
protected void onVisibilityChanged(View changedView, int visibility) {
483-
super.onVisibilityChanged(changedView, visibility);
484-
if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + changedView + ", " + visibility + ")");
485-
486-
if (mRecentsContainer instanceof RecentsHorizontalScrollView) {
487-
((RecentsHorizontalScrollView) mRecentsContainer).onRecentsVisibilityChanged();
488-
} else if (mRecentsContainer instanceof RecentsVerticalScrollView) {
489-
((RecentsVerticalScrollView) mRecentsContainer).onRecentsVisibilityChanged();
490-
} else {
491-
throw new IllegalArgumentException("missing Recents[Horizontal]ScrollView");
492-
}
493-
}
494-
495-
496476
private void updateIcon(ViewHolder h, Drawable icon, boolean show, boolean anim) {
497477
if (icon != null) {
498478
h.iconView.setImageDrawable(icon);

packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java

Lines changed: 2 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -78,77 +78,20 @@ public void onAttachedToWindowCallback(
7878
mScrollView.setVerticalFadingEdgeEnabled(false);
7979
mScrollView.setHorizontalFadingEdgeEnabled(false);
8080
}
81-
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
82-
mCallback = callback;
83-
mLinearLayout = layout;
84-
mAttachedToWindow = true;
85-
mBackgroundDrawable = mContext.getResources()
86-
.getDrawable(R.drawable.status_bar_recents_background_solid).getConstantState();
87-
updateShowBackground();
88-
}
89-
9081
}
9182

9283
public void addViewCallback(View newLinearLayoutChild) {
9384
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
9485
final View view = newLinearLayoutChild;
95-
if (mShowBackground) {
96-
view.setBackgroundDrawable(mBackgroundDrawable.newDrawable());
97-
view.setDrawingCacheEnabled(true);
98-
view.buildDrawingCache();
99-
} else {
100-
view.setBackgroundDrawable(null);
101-
view.setDrawingCacheEnabled(false);
102-
view.destroyDrawingCache();
103-
}
104-
}
105-
}
106-
107-
public void onLayoutCallback() {
108-
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
109-
mScrollView.post(new Runnable() {
110-
public void run() {
111-
updateShowBackground();
112-
}
113-
});
86+
view.setDrawingCacheEnabled(true);
87+
view.buildDrawingCache();
11488
}
11589
}
11690

11791
public void drawCallback(Canvas canvas,
11892
int left, int right, int top, int bottom, int scrollX, int scrollY,
11993
float topFadingEdgeStrength, float bottomFadingEdgeStrength,
12094
float leftFadingEdgeStrength, float rightFadingEdgeStrength) {
121-
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
122-
if (mIsVertical) {
123-
if (scrollY < 0) {
124-
Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
125-
d.setBounds(0, scrollY, mScrollView.getWidth(), 0);
126-
d.draw(canvas);
127-
} else {
128-
final int childHeight = mLinearLayout.getHeight();
129-
if (scrollY + mScrollView.getHeight() > childHeight) {
130-
Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
131-
d.setBounds(0, childHeight, mScrollView.getWidth(),
132-
scrollY + mScrollView.getHeight());
133-
d.draw(canvas);
134-
}
135-
}
136-
} else {
137-
if (scrollX < 0) {
138-
Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
139-
d.setBounds(scrollX, 0, 0, mScrollView.getHeight());
140-
d.draw(canvas);
141-
} else {
142-
final int childWidth = mLinearLayout.getWidth();
143-
if (scrollX + mScrollView.getWidth() > childWidth) {
144-
Drawable d = mBackgroundDrawable.newDrawable().getCurrent();
145-
d.setBounds(childWidth, 0,
146-
scrollX + mScrollView.getWidth(), mScrollView.getHeight());
147-
d.draw(canvas);
148-
}
149-
}
150-
}
151-
}
15295

15396
if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
15497
|| USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
@@ -241,64 +184,4 @@ public int getHorizontalFadingEdgeLengthCallback() {
241184
return mFadingEdgeLength;
242185
}
243186

244-
public void setLayoutTransitionCallback(LayoutTransition transition) {
245-
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
246-
if (transition != null) {
247-
transition.addTransitionListener(new LayoutTransition.TransitionListener() {
248-
@Override
249-
public void startTransition(LayoutTransition transition,
250-
ViewGroup container, View view, int transitionType) {
251-
updateShowBackground();
252-
}
253-
254-
@Override
255-
public void endTransition(LayoutTransition transition,
256-
ViewGroup container, View view, int transitionType) {
257-
updateShowBackground();
258-
}
259-
});
260-
}
261-
}
262-
}
263-
264-
// Turn on/off drawing the background in our ancestor, and turn on/off drawing
265-
// in the items in LinearLayout contained by this scrollview.
266-
// Moving the background drawing to our children, and turning on a drawing cache
267-
// for each of them, gives us a ~20fps gain when Recents is rendered in software
268-
public void updateShowBackground() {
269-
if (!mAttachedToWindow) {
270-
// We haven't been initialized yet-- we'll get called again when we are
271-
return;
272-
}
273-
if (mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS) {
274-
LayoutTransition transition = mLinearLayout.getLayoutTransition();
275-
int linearLayoutSize =
276-
mIsVertical ? mLinearLayout.getHeight() : mLinearLayout.getWidth();
277-
int scrollViewSize =
278-
mIsVertical ? mScrollView.getHeight() : mScrollView.getWidth();
279-
boolean show = !mScrollView.isHardwareAccelerated() &&
280-
(linearLayoutSize > scrollViewSize) &&
281-
!(transition != null && transition.isRunning()) &&
282-
mCallback.isRecentsVisible();
283-
284-
if (!mFirstTime && show == mShowBackground) return;
285-
mShowBackground = show;
286-
mFirstTime = false;
287-
288-
mCallback.handleShowBackground(!show);
289-
for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
290-
View v = mLinearLayout.getChildAt(i);
291-
if (show) {
292-
v.setBackgroundDrawable(mBackgroundDrawable.newDrawable());
293-
v.setDrawingCacheEnabled(true);
294-
v.buildDrawingCache();
295-
} else {
296-
v.setDrawingCacheEnabled(false);
297-
v.destroyDrawingCache();
298-
v.setBackgroundDrawable(null);
299-
}
300-
}
301-
}
302-
}
303-
304187
}

packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,6 @@ public View getChildContentView(View v) {
223223
return v.findViewById(R.id.recent_item);
224224
}
225225

226-
@Override
227-
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
228-
super.onLayout(changed, left, top, right, bottom);
229-
if (mPerformanceHelper != null) {
230-
mPerformanceHelper.onLayoutCallback();
231-
}
232-
}
233-
234226
@Override
235227
public void draw(Canvas canvas) {
236228
super.draw(canvas);
@@ -334,12 +326,6 @@ public void run() {
334326
});
335327
}
336328

337-
public void onRecentsVisibilityChanged() {
338-
if (mPerformanceHelper != null) {
339-
mPerformanceHelper.updateShowBackground();
340-
}
341-
}
342-
343329
@Override
344330
protected void onVisibilityChanged(View changedView, int visibility) {
345331
super.onVisibilityChanged(changedView, visibility);
@@ -387,9 +373,6 @@ public int numItemsInOneScreenful() {
387373

388374
@Override
389375
public void setLayoutTransition(LayoutTransition transition) {
390-
if (mPerformanceHelper != null) {
391-
mPerformanceHelper.setLayoutTransitionCallback(transition);
392-
}
393376
// The layout transition applies to our embedded LinearLayout
394377
mLinearLayout.setLayoutTransition(transition);
395378
}

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ protected WindowManager.LayoutParams getRecentsLayoutParams(LayoutParams layoutP
397397
(opaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT));
398398
if (ActivityManager.isHighEndGfx(mDisplay)) {
399399
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
400+
} else {
401+
lp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
402+
lp.dimAmount = 0.7f;
400403
}
401404
lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
402405
lp.setTitle("RecentsPanel");

0 commit comments

Comments
 (0)