Merge "Add missing abstract method override in BridgePowerManager." into lmp-preview-dev
diff --git a/api/current.txt b/api/current.txt
index eb63f90..5f4ea23 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6992,7 +6992,6 @@
field public static final java.lang.String DISPLAY_SERVICE = "display";
field public static final java.lang.String DOWNLOAD_SERVICE = "download";
field public static final java.lang.String DROPBOX_SERVICE = "dropbox";
- field public static final java.lang.String FINGERPRINT_SERVICE = "fingerprint";
field public static final java.lang.String HDMI_CEC_SERVICE = "hdmi_cec";
field public static final java.lang.String HDMI_CONTROL_SERVICE = "hdmi_control";
field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
@@ -26016,36 +26015,6 @@
}
-package android.service.fingerprint {
-
- public class FingerprintManager {
- ctor public FingerprintManager(android.content.Context);
- method public void enroll(long);
- method public boolean enrolledAndEnabled();
- method public void remove(int);
- method public void startListening(android.service.fingerprint.FingerprintManagerReceiver);
- method public void stopListening();
- field public static final int FINGERPRINT_ERROR = -1; // 0xffffffff
- field public static final int FINGERPRINT_ERROR_BAD_CAPTURE = 2; // 0x2
- field public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1; // 0x1
- field public static final int FINGERPRINT_ERROR_NO_RECEIVER = -10; // 0xfffffff6
- field public static final int FINGERPRINT_ERROR_NO_SPACE = 4; // 0x4
- field public static final int FINGERPRINT_ERROR_TIMEOUT = 3; // 0x3
- field public static final int FINGERPRINT_SCANNED = 1; // 0x1
- field public static final int FINGERPRINT_TEMPLATE_ENROLLING = 2; // 0x2
- field public static final int FINGERPRINT_TEMPLATE_REMOVED = 4; // 0x4
- }
-
- public class FingerprintManagerReceiver {
- ctor public FingerprintManagerReceiver();
- method public void onEnrollResult(int, int);
- method public void onError(int);
- method public void onRemoved(int);
- method public void onScanned(int, int);
- }
-
-}
-
package android.service.notification {
public abstract class NotificationListenerService extends android.app.Service {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index e8885bf..9baac32 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2461,6 +2461,7 @@
*
* @see #getSystemService
* @see android.app.FingerprintManager
+ * @hide
*/
public static final String FINGERPRINT_SERVICE = "fingerprint";
diff --git a/core/java/android/service/fingerprint/FingerprintManager.java b/core/java/android/service/fingerprint/FingerprintManager.java
index 2fcec52..dd2030b 100644
--- a/core/java/android/service/fingerprint/FingerprintManager.java
+++ b/core/java/android/service/fingerprint/FingerprintManager.java
@@ -31,6 +31,7 @@
/**
* A class that coordinates access to the fingerprint hardware.
+ * @hide
*/
public class FingerprintManager {
diff --git a/core/java/android/service/fingerprint/FingerprintManagerReceiver.java b/core/java/android/service/fingerprint/FingerprintManagerReceiver.java
index 34f1655..5960791 100644
--- a/core/java/android/service/fingerprint/FingerprintManagerReceiver.java
+++ b/core/java/android/service/fingerprint/FingerprintManagerReceiver.java
@@ -13,6 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ * @hide
*/
public class FingerprintManagerReceiver {
diff --git a/core/res/res/values/themes_quantum.xml b/core/res/res/values/themes_quantum.xml
index eda7174..1eeaaeb 100644
--- a/core/res/res/values/themes_quantum.xml
+++ b/core/res/res/values/themes_quantum.xml
@@ -733,6 +733,9 @@
<style name="Theme.Quantum.Light.DarkActionBar">
<item name="actionBarWidgetTheme">@null</item>
<item name="actionBarTheme">@style/ThemeOverlay.Quantum.Dark.ActionBar</item>
+
+ <item name="colorPrimaryDark">@color/quantum_blue_grey_900</item>
+ <item name="colorPrimary">@color/quantum_blue_grey_800</item>
</style>
<style name="ThemeOverlay" />
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index c95ac82..ef6c085 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -706,10 +706,24 @@
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.BitmapDrawable);
updateStateFromTypedArray(a);
+ verifyState(a);
a.recycle();
}
/**
+ * Ensures all required attributes are set.
+ *
+ * @throws XmlPullParserException if any required attributes are missing
+ */
+ private void verifyState(TypedArray a) throws XmlPullParserException {
+ final BitmapState state = mBitmapState;
+ if (state.mBitmap == null) {
+ throw new XmlPullParserException(a.getPositionDescription() +
+ ": <bitmap> requires a valid src attribute");
+ }
+ }
+
+ /**
* Updates the constant state from the values in the typed array.
*/
private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserException {
@@ -912,6 +926,7 @@
*/
private BitmapDrawable(BitmapState state, Resources res, Theme theme) {
if (theme != null && state.canApplyTheme()) {
+ // If we need to apply a theme, implicitly mutate.
mBitmapState = new BitmapState(state);
applyTheme(theme);
} else {
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 241b89e..005b8ef 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1662,9 +1662,12 @@
* @param theme Theme to apply to the drawable
*/
private GradientDrawable(GradientState state, Theme theme) {
- mGradientState = new GradientState(state);
if (theme != null && state.canApplyTheme()) {
+ // If we need to apply a theme, implicitly mutate.
+ mGradientState = new GradientState(state);
applyTheme(theme);
+ } else {
+ mGradientState = state;
}
initializeWithState(state);
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index 77ed29a..fea68ee 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -659,6 +659,7 @@
*/
private NinePatchDrawable(NinePatchState state, Resources res, Theme theme) {
if (theme != null && state.canApplyTheme()) {
+ // If we need to apply a theme, implicitly mutate.
mNinePatchState = new NinePatchState(state);
applyTheme(theme);
} else {
diff --git a/services/core/java/com/android/server/notification/NotificationComparator.java b/services/core/java/com/android/server/notification/NotificationComparator.java
index b30baea..6cd4019 100644
--- a/services/core/java/com/android/server/notification/NotificationComparator.java
+++ b/services/core/java/com/android/server/notification/NotificationComparator.java
@@ -41,6 +41,6 @@
return -1 * Float.compare(leftPeple, rightPeople);
}
// then break ties by time, most recent first
- return -1 * Long.compare(lhs.sbn.getPostTime(), rhs.sbn.getPostTime());
+ return -1 * Long.compare(lhs.getRankingTimeMs(), rhs.getRankingTimeMs());
}
}
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index 30d4fec..13fb986 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -54,6 +54,9 @@
// InterceptedNotifications needs to know if this has been previously evaluated.
private boolean mTouchedByZen;
+ // The timestamp used for ranking.
+ private long mRankingTimeMs;
+
// Is this record an update of an old record?
public boolean isUpdate;
@@ -61,6 +64,7 @@
{
this.sbn = sbn;
this.score = score;
+ mRankingTimeMs = calculateRankingTimeMs(0L);
}
// copy any notes that the ranking system may have made before the update
@@ -69,6 +73,7 @@
mRecentlyIntrusive = previous.mRecentlyIntrusive;
mTouchedByZen = previous.mTouchedByZen;
mIntercept = previous.mIntercept;
+ mRankingTimeMs = calculateRankingTimeMs(previous.getRankingTimeMs());
}
public Notification getNotification() { return sbn.getNotification(); }
@@ -139,6 +144,7 @@
pw.println(prefix + " mContactAffinity=" + mContactAffinity);
pw.println(prefix + " mRecentlyIntrusive=" + mRecentlyIntrusive);
pw.println(prefix + " mIntercept=" + mIntercept);
+ pw.println(prefix + " mRankingTimeMs=" + mRankingTimeMs);
}
@@ -206,4 +212,29 @@
mTouchedByZen = true;
}
+ /**
+ * Returns the timestamp to use for time-based sorting in the ranker.
+ */
+ public long getRankingTimeMs() {
+ return mRankingTimeMs;
+ }
+
+ /**
+ * @param previousRankingTimeMs for updated notifications, {@link #getRankingTimeMs()}
+ * of the previous notification record, 0 otherwise
+ */
+ private long calculateRankingTimeMs(long previousRankingTimeMs) {
+ Notification n = getNotification();
+ // Take developer provided 'when', unless it's in the future.
+ if (n.when != 0 && n.when <= sbn.getPostTime()) {
+ return n.when;
+ }
+ // If we've ranked a previous instance with a timestamp, inherit it. This case is
+ // important in order to have ranking stability for updating notifications.
+ if (previousRankingTimeMs > 0) {
+ return previousRankingTimeMs;
+ }
+ return sbn.getPostTime();
+ }
+
}
diff --git a/services/core/java/com/android/server/task/controllers/BatteryController.java b/services/core/java/com/android/server/task/controllers/BatteryController.java
index 585b41f..4727e9a 100644
--- a/services/core/java/com/android/server/task/controllers/BatteryController.java
+++ b/services/core/java/com/android/server/task/controllers/BatteryController.java
@@ -151,7 +151,7 @@
// Initialise tracker state.
BatteryService batteryService = (BatteryService) ServiceManager.getService("battery");
if (batteryService != null) {
- mBatteryHealthy = !batteryService.isBatteryLow();
+ mBatteryHealthy = !batteryService.getBatteryLevelLow();
mCharging = batteryService.isPowered(BatteryManager.BATTERY_PLUGGED_ANY);
} else {
// Unavailable for some reason, we default to false and let ACTION_BATTERY_[OK,LOW]