diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 7cb1d89aa9543..3363872044106 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -387,6 +387,13 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac *
This mode makes sense for things that will be explicitly started * and stopped to run for arbitrary periods of time, such as a service * performing background music playback. + * + *
Since Android version {@link Build.VERSION_CODES#S}, apps + * targeting {@link Build.VERSION_CODES#S} or above are disallowed + * to start a foreground service from the background, but the restriction + * doesn't impact restarts of a sticky foreground service. However, + * when apps start a sticky foreground service from the background, + * the same restriction still applies. */ public static final int START_STICKY = 1; diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java index 1e8b9521e41ea..209903c57d902 100644 --- a/location/java/android/location/Location.java +++ b/location/java/android/location/Location.java @@ -1084,6 +1084,12 @@ public class Location implements Parcelable { mExtras = (extras == null) ? null : new Bundle(extras); } + /** + * Location equality is provided primarily for test purposes. Comparing locations for equality + * in production may indicate incorrect assumptions, and should be avoided whenever possible. + * + *
{@inheritDoc}
+ */
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -1121,7 +1127,17 @@ public class Location implements Parcelable {
&& (!hasBearingAccuracy() || Float.compare(location.mBearingAccuracyDegrees,
mBearingAccuracyDegrees) == 0)
&& Objects.equals(mProvider, location.mProvider)
- && Objects.equals(mExtras, location.mExtras);
+ && areExtrasEqual(mExtras, location.mExtras);
+ }
+
+ private static boolean areExtrasEqual(@Nullable Bundle extras1, @Nullable Bundle extras2) {
+ if ((extras1 == null || extras1.isEmpty()) && (extras2 == null || extras2.isEmpty())) {
+ return true;
+ } else if (extras1 == null || extras2 == null) {
+ return false;
+ } else {
+ return extras1.kindofEquals(extras2);
+ }
}
@Override
diff --git a/packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java b/packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java
index ed8d524b01326..3c43f4a637ba2 100644
--- a/packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/media/InfoMediaManager.java
@@ -15,7 +15,6 @@
*/
package com.android.settingslib.media;
-import static android.media.MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK;
import static android.media.MediaRoute2Info.TYPE_BLUETOOTH_A2DP;
import static android.media.MediaRoute2Info.TYPE_BUILTIN_SPEAKER;
import static android.media.MediaRoute2Info.TYPE_DOCK;
@@ -388,34 +387,7 @@ public class InfoMediaManager extends MediaManager {
@TargetApi(Build.VERSION_CODES.R)
boolean shouldEnableVolumeSeekBar(RoutingSessionInfo sessionInfo) {
- if (sessionInfo == null) {
- Log.w(TAG, "shouldEnableVolumeSeekBar() package name is null or empty!");
- return false;
- }
- final List