Skip to content

Commit ea193ce

Browse files
dsandlerAndrew Flynn
authored andcommitted
DO NOT MERGE
System bar now renders the back button for recents We used to render the back button in Recents itself, but that had an inconsistent visual experience. As a part of this change, add the early beginning of support for private status bar APIs for dimming navigation buttons. Bug: 3448536 Change-Id: Ie64369e3df3178178f35b56763ea96d380b6ddd4
1 parent dfc87c8 commit ea193ce

File tree

16 files changed

+213
-71
lines changed

16 files changed

+213
-71
lines changed

core/java/android/app/StatusBarManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class StatusBarManager {
5656
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
5757
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
5858

59+
public static final int NAVIGATION_HINT_BACK_NOP = 1 << 0;
60+
public static final int NAVIGATION_HINT_HOME_NOP = 1 << 1;
61+
public static final int NAVIGATION_HINT_RECENT_NOP = 1 << 2;
62+
public static final int NAVIGATION_HINT_BACK_ALT = 1 << 3;
63+
5964
private Context mContext;
6065
private IStatusBarService mService;
6166
private IBinder mToken = new Binder();

packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_ime_default.png renamed to packages/SystemUI/res/drawable-hdpi/ic_sysbar_back_ime.png

File renamed without changes.
-6.56 KB
Binary file not shown.

packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_ime_default.png renamed to packages/SystemUI/res/drawable-mdpi/ic_sysbar_back_ime.png

File renamed without changes.
Binary file not shown.

packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_ime_default.png renamed to packages/SystemUI/res/drawable-xhdpi/ic_sysbar_back_ime.png

File renamed without changes.
Binary file not shown.

packages/SystemUI/res/drawable/ic_sysbar_back_ime.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/SystemUI/res/layout-sw600dp/status_bar_recent_panel.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
android:layout_width="wrap_content"
3333
android:layout_height="match_parent"
3434
android:layout_alignParentBottom="true"
35-
android:paddingBottom="@*android:dimen/status_bar_height"
35+
android:layout_marginBottom="@*android:dimen/status_bar_height"
3636
android:clipToPadding="false"
3737
android:clipChildren="false">
3838

@@ -69,13 +69,12 @@
6969

7070
</FrameLayout>
7171

72-
<View android:id="@+id/recents_dismiss_button"
73-
android:layout_width="80px"
72+
<com.android.systemui.recent.StatusBarTouchProxy
73+
android:id="@+id/status_bar_touch_proxy"
74+
android:layout_width="match_parent"
7475
android:layout_height="@*android:dimen/status_bar_height"
7576
android:layout_alignParentBottom="true"
7677
android:layout_alignParentLeft="true"
77-
android:background="@drawable/ic_sysbar_back_ime"
78-
android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
7978
/>
8079

8180

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

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
6868
private View mRecentsScrim;
6969
private View mRecentsNoApps;
7070
private ViewGroup mRecentsContainer;
71+
private StatusBarTouchProxy mStatusBarTouchProxy;
7172

7273
private boolean mShowing;
7374
private Choreographer mChoreo;
74-
private View mRecentsDismissButton;
75+
OnRecentsPanelVisibilityChangedListener mVisibilityChangedListener;
7576

7677
private RecentTasksLoader mRecentTasksLoader;
7778
private ArrayList<TaskDescription> mRecentTaskDescriptions;
@@ -81,8 +82,8 @@ public class RecentsPanelView extends RelativeLayout implements OnItemClickListe
8182
private int mThumbnailWidth;
8283
private boolean mFitThumbnailToXY;
8384

84-
public void setRecentTasksLoader(RecentTasksLoader loader) {
85-
mRecentTasksLoader = loader;
85+
public static interface OnRecentsPanelVisibilityChangedListener {
86+
public void onRecentsPanelVisibilityChanged(boolean visible);
8687
}
8788

8889
private final class OnLongClickDelegate implements View.OnLongClickListener {
@@ -171,15 +172,18 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
171172
return super.onKeyUp(keyCode, event);
172173
}
173174

174-
public boolean isInContentArea(int x, int y) {
175-
// use mRecentsContainer's exact bounds to determine horizontal position
176-
final int l = mRecentsContainer.getLeft();
177-
final int r = mRecentsContainer.getRight();
178-
final int t = mRecentsContainer.getTop();
179-
final int b = mRecentsContainer.getBottom();
175+
private boolean pointInside(int x, int y, View v) {
176+
final int l = v.getLeft();
177+
final int r = v.getRight();
178+
final int t = v.getTop();
179+
final int b = v.getBottom();
180180
return x >= l && x < r && y >= t && y < b;
181181
}
182182

183+
public boolean isInContentArea(int x, int y) {
184+
return pointInside(x, y, mRecentsContainer) || pointInside(x, y, mStatusBarTouchProxy);
185+
}
186+
183187
public void show(boolean show, boolean animate) {
184188
show(show, animate, null);
185189
}
@@ -278,7 +282,6 @@ public void onAnimationRepeat(Animator animation) {
278282
public void onAnimationStart(Animator animation) {
279283
}
280284

281-
282285
/**
283286
* We need to be aligned at the bottom. LinearLayout can't do this, so instead,
284287
* let LinearLayout do all the hard work, and then shift everything down to the bottom.
@@ -312,6 +315,29 @@ public boolean isShowing() {
312315

313316
public void setBar(StatusBar bar) {
314317
mBar = bar;
318+
319+
}
320+
321+
public void setStatusBarView(View statusBarView) {
322+
if (mStatusBarTouchProxy != null) {
323+
mStatusBarTouchProxy.setStatusBar(statusBarView);
324+
}
325+
}
326+
327+
public void setRecentTasksLoader(RecentTasksLoader loader) {
328+
mRecentTasksLoader = loader;
329+
}
330+
331+
public void setOnVisibilityChangedListener(OnRecentsPanelVisibilityChangedListener l) {
332+
mVisibilityChangedListener = l;
333+
334+
}
335+
336+
public void setVisibility(int visibility) {
337+
if (mVisibilityChangedListener != null) {
338+
mVisibilityChangedListener.onRecentsPanelVisibilityChanged(visibility == VISIBLE);
339+
}
340+
super.setVisibility(visibility);
315341
}
316342

317343
public RecentsPanelView(Context context, AttributeSet attrs) {
@@ -335,6 +361,7 @@ protected void onFinishInflate() {
335361
super.onFinishInflate();
336362
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
337363
mRecentsContainer = (ViewGroup) findViewById(R.id.recents_container);
364+
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
338365
mListAdapter = new TaskDescriptionAdapter(mContext);
339366
if (mRecentsContainer instanceof RecentsHorizontalScrollView){
340367
RecentsHorizontalScrollView scrollView
@@ -355,14 +382,6 @@ protected void onFinishInflate() {
355382
mRecentsScrim = findViewById(R.id.recents_bg_protect);
356383
mRecentsNoApps = findViewById(R.id.recents_no_apps);
357384
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsContainer, mRecentsNoApps, this);
358-
mRecentsDismissButton = findViewById(R.id.recents_dismiss_button);
359-
if (mRecentsDismissButton != null) {
360-
mRecentsDismissButton.setOnClickListener(new OnClickListener() {
361-
public void onClick(View v) {
362-
hide(true);
363-
}
364-
});
365-
}
366385

367386
// In order to save space, we make the background texture repeat in the Y direction
368387
if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {

0 commit comments

Comments
 (0)