summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-07-23 03:37:51 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-07-23 03:37:51 +0000
commita6ef24edd1b45a222a35377b6e4886dce900f859 (patch)
tree8713ed8d1dc4b26170f04ed2e83bdc07aea03b09
parent4ca06afb2f9ea022e22b4aea5f1a5840fbbea6ff (diff)
parent69011866a2b2f4c0209892bd722ead3be67f4801 (diff)
downloadbase-a6ef24edd1b45a222a35377b6e4886dce900f859.tar.gz
Merge cherrypicks of [8709890, 8710035, 8710036, 8710037, 8710038, 8709945, 8709612] into qt-release
Change-Id: I7562106135f6c9d72c2c15a3c60157903ca9e3d1
-rw-r--r--packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingManagerProxyTest.java3
5 files changed, 32 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
index 3cc8ec9afbb2..69f243c8ed70 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java
@@ -91,7 +91,7 @@ public class FalsingManagerProxy implements FalsingManager {
@VisibleForTesting
public void setupFalsingManager(Context context) {
boolean brightlineEnabled = DeviceConfig.getBoolean(
- DeviceConfig.NAMESPACE_SYSTEMUI, BRIGHTLINE_FALSING_MANAGER_ENABLED, false);
+ DeviceConfig.NAMESPACE_SYSTEMUI, BRIGHTLINE_FALSING_MANAGER_ENABLED, true);
if (!brightlineEnabled) {
mInternalFalsingManager = new FalsingManagerImpl(context);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index 5f52486b2bc6..a882309c06d4 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -43,6 +43,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.systemui.R;
import com.android.systemui.plugins.SensorManagerPlugin;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.util.AlarmTimeout;
@@ -255,12 +256,21 @@ public class DozeSensors {
long mLastNear;
final AlarmTimeout mCooldownTimer;
final AlwaysOnDisplayPolicy mPolicy;
-
+ final Sensor mSensor;
public ProxSensor(AlwaysOnDisplayPolicy policy) {
mPolicy = policy;
mCooldownTimer = new AlarmTimeout(mAlarmManager, this::updateRegistered,
"prox_cooldown", mHandler);
+
+ // The default prox sensor can be noisy, so let's use a prox gated brightness sensor
+ // if available.
+ Sensor sensor = DozeSensors.findSensorWithType(mSensorManager,
+ mContext.getString(R.string.doze_brightness_sensor_type));
+ if (sensor == null) {
+ sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
+ }
+ mSensor = sensor;
}
void setRequested(boolean requested) {
@@ -324,8 +334,9 @@ public class DozeSensors {
@Override
public String toString() {
- return String.format("{registered=%s, requested=%s, coolingDown=%s, currentlyFar=%s}",
- mRegistered, mRequested, mCooldownTimer.isScheduled(), mCurrentlyFar);
+ return String.format("{registered=%s, requested=%s, coolingDown=%s, currentlyFar=%s,"
+ + " sensor=%s}", mRegistered, mRequested, mCooldownTimer.isScheduled(),
+ mCurrentlyFar, mSensor);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 8fe34180203f..80e1ac10e319 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -2516,12 +2516,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
}
return;
}
- int minTopPosition = 0;
+ int minTopPosition;
NotificationSection lastSection = getLastVisibleSection();
if (mStatusBarState != StatusBarState.KEYGUARD) {
minTopPosition = (int) (mTopPadding + mStackTranslation);
} else if (lastSection == null) {
minTopPosition = mTopPadding;
+ } else {
+ // The first sections could be empty while there could still be elements in later
+ // sections. The position of these first few sections is determined by the position of
+ // the first visible section.
+ NotificationSection firstVisibleSection = getFirstVisibleSection();
+ firstVisibleSection.updateBounds(0 /* minTopPosition*/, 0 /* minBottomPosition */,
+ false /* shiftPulsingWithFirst */);
+ minTopPosition = firstVisibleSection.getBounds().top;
}
boolean shiftPulsingWithFirst = mAmbientPulseManager.getAllEntries().count() <= 1;
for (NotificationSection section : mSections) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
index 1d0d231424d1..595c1acaf56d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpManagerPhone.java
@@ -301,12 +301,15 @@ public class HeadsUpManagerPhone extends HeadsUpManager implements Dumpable,
}
public Region calculateTouchableRegion() {
- if (!hasPinnedHeadsUp()) {
+ NotificationEntry topEntry = getTopEntry();
+ // This call could be made in an inconsistent state while the pinnedMode hasn't been
+ // updated yet, but callbacks leading out of the headsUp manager, querying it. Let's
+ // therefore also check if the topEntry is null.
+ if (!hasPinnedHeadsUp() || topEntry == null) {
mTouchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight);
updateRegionForNotch(mTouchableRegion);
} else {
- NotificationEntry topEntry = getTopEntry();
if (topEntry.isChildInGroup()) {
final NotificationEntry groupSummary =
mGroupManager.getGroupSummary(topEntry.notification);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingManagerProxyTest.java b/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingManagerProxyTest.java
index 329ef1c19a2b..7ea6493da83d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingManagerProxyTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/classifier/FalsingManagerProxyTest.java
@@ -56,6 +56,9 @@ public class FalsingManagerProxyTest extends SysuiTestCase {
mHandler = new Handler(mTestableLooper.getLooper());
mDefaultConfigValue = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
BRIGHTLINE_FALSING_MANAGER_ENABLED, false);
+ // In case it runs on a device where it's been set to true, set it to false by hand.
+ DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
+ BRIGHTLINE_FALSING_MANAGER_ENABLED, "false", false);
}
@After