AOD: Delay wakeup until interaction with notification

Instead of immediately waking upon touching the screen, the
wakeup now happens when interacting with the notification.

Also adds feedback for the first tap of the double tap gesture
on the content view.

Bug: 30876804
Fixes: 34498705
Fixes: 34500641
Fixes: 34500802
Test: manual
Change-Id: I75ea86a6009dd7efab480738584c96bb8743b2ba
This commit is contained in:
Adrian Roos
2017-01-23 14:49:54 -08:00
parent 2536cc6872
commit 500263a9bc
5 changed files with 32 additions and 9 deletions

View File

@@ -75,6 +75,9 @@
<!-- The color of the material notification background when dimmed -->
<color name="notification_material_background_dimmed_color">#ccffffff</color>
<!-- The color of the material notification background when dark -->
<color name="notification_material_background_dark_color">#ff333333</color>
<!-- The color of the material notification background when low priority -->
<color name="notification_material_background_low_priority_color">#fff5f5f5</color>

View File

@@ -463,6 +463,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
mDark = dark;
updateBackground();
updateBackgroundTint(fade);
if (!dark && fade && !shouldHideBackground()) {
fadeInFromDark(delay);
}
@@ -700,8 +701,8 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
protected void updateBackground() {
cancelFadeAnimations();
if (shouldHideBackground()) {
mBackgroundDimmed.setVisibility(View.INVISIBLE);
mBackgroundNormal.setVisibility(View.INVISIBLE);
mBackgroundDimmed.setVisibility(INVISIBLE);
mBackgroundNormal.setVisibility(mActivated ? VISIBLE : INVISIBLE);
} else if (mDimmed) {
// When groups are animating to the expanded state from the lockscreen, show the
// normal background instead of the dimmed background
@@ -940,6 +941,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
* @return the calculated background color
*/
private int calculateBgColor(boolean withTint, boolean withOverRide) {
if (mDark) {
return getContext().getColor(R.color.notification_material_background_dark_color);
}
if (withOverRide && mOverrideTint != NO_COLOR) {
int defaultTint = calculateBgColor(withTint, false);
return NotificationUtils.interpolateColors(defaultTint, mOverrideTint, mOverrideAmount);

View File

@@ -41,6 +41,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.AsyncTask;
import android.os.Build;
@@ -51,6 +52,7 @@ import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -316,9 +318,16 @@ public abstract class BaseStatusBar extends SystemUI implements
};
private RemoteViews.OnClickHandler mOnClickHandler = new RemoteViews.OnClickHandler() {
private final int[] mTmpInt2 = new int[2];
@Override
public boolean onClickHandler(
final View view, final PendingIntent pendingIntent, final Intent fillInIntent) {
view.getLocationInWindow(mTmpInt2);
wakeUpIfDozing(SystemClock.uptimeMillis(), new PointF(
mTmpInt2[0] + view.getWidth() / 2, mTmpInt2[1] + view.getHeight() / 2));
if (handleRemoteInput(view, pendingIntent, fillInIntent)) {
return true;
}
@@ -1785,13 +1794,22 @@ public abstract class BaseStatusBar extends SystemUI implements
return false;
}
public void wakeUpIfDozing(long time, PointF where) {
}
private final class NotificationClicker implements View.OnClickListener {
private final int[] mTmpInt2 = new int[2];
public void onClick(final View v) {
if (!(v instanceof ExpandableNotificationRow)) {
Log.e(TAG, "NotificationClicker called on a view that is not a notification row.");
return;
}
v.getLocationInWindow(mTmpInt2);
wakeUpIfDozing(SystemClock.uptimeMillis(),
new PointF(mTmpInt2[0] + v.getWidth() / 2, mTmpInt2[1] + v.getHeight() / 2));
final ExpandableNotificationRow row = (ExpandableNotificationRow) v;
final StatusBarNotification sbn = row.getStatusBarNotification();
if (sbn == null) {

View File

@@ -4605,12 +4605,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return !mNotificationData.getActiveNotifications().isEmpty();
}
public void wakeUpIfDozing(long time, MotionEvent event) {
@Override
public void wakeUpIfDozing(long time, PointF where) {
if (mDozing && mDozeScrimController.isPulsing()) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(time, "com.android.systemui:NODOZE");
mWakeUpComingFromTouch = true;
mWakeUpTouchLocation = new PointF(event.getX(), event.getY());
mWakeUpTouchLocation = where;
mNotificationPanel.setTouchDisabled(false);
mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
mFalsingManager.onScreenOnFromTouch();

View File

@@ -263,12 +263,9 @@ public class StatusBarWindowView extends FrameLayout {
if (mNotificationPanel.isFullyExpanded()
&& mStackScrollLayout.getVisibility() == View.VISIBLE
&& mService.getBarState() == StatusBarState.KEYGUARD
&& !mService.isBouncerShowing()) {
&& !mService.isBouncerShowing()
&& !mService.isDozing()) {
intercept = mDragDownHelper.onInterceptTouchEvent(ev);
// wake up on a touch down event, if dozing
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
mService.wakeUpIfDozing(ev.getEventTime(), ev);
}
}
if (!intercept) {
super.onInterceptTouchEvent(ev);