Skip to content

Commit 2dd0c3a

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "New lockscreen: allow search gesture from nav bar." into jb-mr1-dev
2 parents 8074e98 + d5483c3 commit 2dd0c3a

File tree

8 files changed

+86
-5
lines changed

8 files changed

+86
-5
lines changed

core/java/android/app/StatusBarManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class StatusBarManager {
4545
public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
4646
public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
4747
public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;
48+
public static final int DISABLE_SEARCH = View.STATUS_BAR_DISABLE_SEARCH;
4849

4950
@Deprecated
5051
public static final int DISABLE_NAVIGATION =
@@ -54,7 +55,8 @@ public class StatusBarManager {
5455

5556
public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
5657
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
57-
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
58+
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
59+
| DISABLE_SEARCH;
5860

5961
public static final int NAVIGATION_HINT_BACK_NOP = 1 << 0;
6062
public static final int NAVIGATION_HINT_HOME_NOP = 1 << 1;

core/java/android/view/View.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,17 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
24502450
*/
24512451
public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;
24522452

2453+
/**
2454+
* @hide
2455+
*
2456+
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
2457+
* out of the public fields to keep the undefined bits out of the developer's way.
2458+
*
2459+
* Flag to disable the global search gesture. Don't use this
2460+
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
2461+
*/
2462+
public static final int STATUS_BAR_DISABLE_SEARCH = 0x02000000;
2463+
24532464
/**
24542465
* @hide
24552466
*/

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@
141141
/>
142142
</LinearLayout>
143143

144+
<ImageView
145+
android:layout_width="128dp"
146+
android:id="@+id/search_light"
147+
android:layout_height="match_parent"
148+
android:layout_gravity="center_horizontal"
149+
android:src="@drawable/ic_sysbar_lights_out_dot_large"
150+
android:scaleType="center"
151+
android:visibility="gone"
152+
/>
153+
144154
<com.android.systemui.statusbar.policy.DeadZone
145155
android:id="@+id/deadzone"
146156
android:layout_height="match_parent"
@@ -272,6 +282,16 @@
272282
/>
273283
</LinearLayout>
274284

285+
<ImageView
286+
android:layout_width="162dp"
287+
android:id="@+id/search_light"
288+
android:layout_height="match_parent"
289+
android:layout_gravity="center_horizontal"
290+
android:src="@drawable/ic_sysbar_lights_out_dot_large"
291+
android:scaleType="center"
292+
android:visibility="gone"
293+
/>
294+
275295
<com.android.systemui.statusbar.policy.DeadZone
276296
android:id="@+id/deadzone"
277297
android:layout_height="match_parent"

packages/SystemUI/res/layout/navigation_bar.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@
145145
/>
146146
</LinearLayout>
147147

148+
<ImageView
149+
android:layout_width="80dp"
150+
android:id="@+id/search_light"
151+
android:layout_height="match_parent"
152+
android:layout_gravity="center_horizontal"
153+
android:src="@drawable/ic_sysbar_lights_out_dot_large"
154+
android:scaleType="center"
155+
android:visibility="gone"
156+
/>
157+
148158
<com.android.systemui.statusbar.policy.DeadZone
149159
android:id="@+id/deadzone"
150160
android:layout_height="match_parent"
@@ -279,6 +289,16 @@
279289
/>
280290
</LinearLayout>
281291

292+
<ImageView
293+
android:id="@+id/search_light"
294+
android:layout_height="80dp"
295+
android:layout_width="match_parent"
296+
android:layout_gravity="center_vertical"
297+
android:src="@drawable/ic_sysbar_lights_out_dot_large"
298+
android:scaleType="center"
299+
android:visibility="gone"
300+
/>
301+
282302
<com.android.systemui.statusbar.policy.DeadZone
283303
android:id="@+id/deadzone"
284304
android:layout_height="match_parent"

packages/SystemUI/src/com/android/systemui/SearchPanelView.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
package com.android.systemui;
1818

1919
import android.animation.LayoutTransition;
20+
import android.app.ActivityManagerNative;
2021
import android.app.ActivityOptions;
2122
import android.app.SearchManager;
2223
import android.content.ActivityNotFoundException;
2324
import android.content.ComponentName;
2425
import android.content.Context;
2526
import android.content.Intent;
2627
import android.content.res.Resources;
28+
import android.os.RemoteException;
2729
import android.os.UserHandle;
2830
import android.os.Vibrator;
2931
import android.provider.Settings;
@@ -71,12 +73,21 @@ public SearchPanelView(Context context, AttributeSet attrs, int defStyle) {
7173
}
7274

7375
private void startAssistActivity() {
76+
if (!mBar.isDeviceProvisioned()) return;
77+
7478
// Close Recent Apps if needed
7579
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL);
7680
// Launch Assist
7781
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
7882
.getAssistIntent(mContext, UserHandle.USER_CURRENT);
7983
if (intent == null) return;
84+
85+
// Dismiss the keyguard if possible. XXX: TODO: invoke bouncer.
86+
try {
87+
ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
88+
} catch (RemoteException e) {
89+
}
90+
8091
try {
8192
ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext,
8293
R.anim.search_launch_enter, R.anim.search_launch_exit,

packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void setBar(BaseStatusBar phoneStatusBar) {
4949

5050
public boolean onInterceptTouchEvent(MotionEvent event) {
5151
if (mSourceView == null || mDelegateView == null
52-
|| mBar.shouldDisableNavbarGestures() || mBar.inKeyguardRestrictedInputMode()) {
52+
|| mBar.shouldDisableNavbarGestures()) {
5353
return false;
5454
}
5555

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public View getHomeButton() {
142142
return mCurrentView.findViewById(R.id.home);
143143
}
144144

145+
// for when home is disabled, but search isn't
146+
public View getSearchLight() {
147+
return mCurrentView.findViewById(R.id.search_light);
148+
}
149+
145150
public NavigationBarView(Context context, AttributeSet attrs) {
146151
super(context, attrs);
147152

@@ -222,12 +227,15 @@ public void setDisabledFlags(int disabledFlags, boolean force) {
222227
final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
223228
final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
224229
final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);
230+
final boolean disableSearch = ((disabledFlags & View.STATUS_BAR_DISABLE_SEARCH) != 0);
225231

226232
setSlippery(disableHome && disableRecent && disableBack);
227233

228234
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
229235
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
230236
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
237+
238+
getSearchLight().setVisibility((disableHome && !disableSearch) ? View.VISIBLE : View.GONE);
231239
}
232240

233241
public void setSlippery(boolean newSlippery) {

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ protected void updateSearchPanel() {
676676
@Override
677677
public void showSearchPanel() {
678678
super.showSearchPanel();
679+
680+
// we want to freeze the sysui state wherever it is
681+
mSearchPanelView.setSystemUiVisibility(mSystemUiVisibility);
682+
679683
WindowManager.LayoutParams lp =
680684
(android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
681685
lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
@@ -722,7 +726,7 @@ public void run() {
722726
public boolean onTouch(View v, MotionEvent event) {
723727
switch(event.getAction()) {
724728
case MotionEvent.ACTION_DOWN:
725-
if (!shouldDisableNavbarGestures() && !inKeyguardRestrictedInputMode()) {
729+
if (!shouldDisableNavbarGestures()) {
726730
mHandler.removeCallbacks(mShowSearchPanel);
727731
mHandler.postDelayed(mShowSearchPanel, mShowSearchHoldoff);
728732
}
@@ -1178,6 +1182,8 @@ public void disable(int state) {
11781182
flagdbg.append(((diff & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
11791183
flagdbg.append(((state & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
11801184
flagdbg.append(((diff & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
1185+
flagdbg.append(((state & StatusBarManager.DISABLE_SEARCH) != 0) ? "SEARCH" : "search");
1186+
flagdbg.append(((diff & StatusBarManager.DISABLE_SEARCH) != 0) ? "* " : " ");
11811187
flagdbg.append(">");
11821188
Slog.d(TAG, flagdbg.toString());
11831189

@@ -1215,7 +1221,8 @@ public void disable(int state) {
12151221

12161222
if ((diff & (StatusBarManager.DISABLE_HOME
12171223
| StatusBarManager.DISABLE_RECENT
1218-
| StatusBarManager.DISABLE_BACK)) != 0) {
1224+
| StatusBarManager.DISABLE_BACK
1225+
| StatusBarManager.DISABLE_SEARCH)) != 0) {
12191226
// the nav bar will take care of these
12201227
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);
12211228

@@ -2415,7 +2422,9 @@ protected void haltTicker() {
24152422

24162423
@Override
24172424
protected boolean shouldDisableNavbarGestures() {
2418-
return mExpandedVisible || (mDisabled & StatusBarManager.DISABLE_HOME) != 0;
2425+
return !isDeviceProvisioned()
2426+
|| mExpandedVisible
2427+
|| (mDisabled & StatusBarManager.DISABLE_SEARCH) != 0;
24192428
}
24202429

24212430
private static class FastColorDrawable extends Drawable {

0 commit comments

Comments
 (0)