Merge "Ignore flow label when comparing RAs in APF"
diff --git a/nfc-extras/Android.mk b/nfc-extras/Android.mk
index cd7a45b..dc45a50 100644
--- a/nfc-extras/Android.mk
+++ b/nfc-extras/Android.mk
@@ -4,10 +4,10 @@
LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit legacy-android-test
+LOCAL_SRC_FILES := $(call all-java-files-under, java)
LOCAL_MODULE:= com.android.nfc_extras
include $(BUILD_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/nfc-extras/tests/Android.mk b/nfc-extras/tests/Android.mk
index 3eca76d..d8fe5a6 100644
--- a/nfc-extras/tests/Android.mk
+++ b/nfc-extras/tests/Android.mk
@@ -22,6 +22,8 @@
android.test.runner \
com.android.nfc_extras
+LOCAL_STATIC_JAVA_LIBRARIES := junit legacy-android-test
+
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
index 44c61f0..6941193 100644
--- a/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
+++ b/services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java
@@ -163,20 +163,31 @@
}
// Fix up upstream interface types for DUN or mobile. NOTE: independent
- // of the value of |requiresDun|, cell data of one form or another is
+ // of the value of |dunCheck|, cell data of one form or another is
// *always* an upstream, regardless of the upstream interface types
// specified by configuration resources.
if (dunCheck == DUN_REQUIRED) {
if (!upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)) {
upstreamIfaceTypes.add(TYPE_MOBILE_DUN);
}
- } else {
+ } else if (dunCheck == DUN_NOT_REQUIRED) {
if (!upstreamIfaceTypes.contains(TYPE_MOBILE)) {
upstreamIfaceTypes.add(TYPE_MOBILE);
}
if (!upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI)) {
upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI);
}
+ } else {
+ // Fix upstream interface types for case DUN_UNSPECIFIED.
+ // Do not modify if a cellular interface type is already present in the
+ // upstream interface types. Add TYPE_MOBILE and TYPE_MOBILE_HIPRI if no
+ // cellular interface types are found in the upstream interface types.
+ if (!(upstreamIfaceTypes.contains(TYPE_MOBILE_DUN)
+ || upstreamIfaceTypes.contains(TYPE_MOBILE)
+ || upstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI))) {
+ upstreamIfaceTypes.add(TYPE_MOBILE);
+ upstreamIfaceTypes.add(TYPE_MOBILE_HIPRI);
+ }
}
return upstreamIfaceTypes;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index df7c660..9949af3 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -847,8 +847,8 @@
public void update(Uri uri) {
ContentResolver resolver = getContext().getContentResolver();
if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
- boolean pulseEnabled = Settings.System.getInt(resolver,
- Settings.System.NOTIFICATION_LIGHT_PULSE, 0) != 0;
+ boolean pulseEnabled = Settings.System.getIntForUser(resolver,
+ Settings.System.NOTIFICATION_LIGHT_PULSE, 0, UserHandle.USER_CURRENT) != 0;
if (mNotificationPulseEnabled != pulseEnabled) {
mNotificationPulseEnabled = pulseEnabled;
updateNotificationPulse();
diff --git a/telecomm/java/android/telecom/Log.java b/telecomm/java/android/telecom/Log.java
index 6107895..640c9e1 100644
--- a/telecomm/java/android/telecom/Log.java
+++ b/telecomm/java/android/telecom/Log.java
@@ -269,6 +269,23 @@
}
/**
+ * Dumps the events in a timeline format.
+ * @param pw The {@link IndentingPrintWriter} to write to.
+ * @hide
+ */
+ public static void dumpEventsTimeline(IndentingPrintWriter pw) {
+ // If the Events logger has not been initialized, then there have been no events logged.
+ // Don't load it now!
+ synchronized (sSingletonSync) {
+ if (sEventManager != null) {
+ getEventManager().dumpEventsTimeline(pw);
+ } else {
+ pw.println("No Historical Events Logged.");
+ }
+ }
+ }
+
+ /**
* Enable or disable extended telecom logging.
*
* @param isExtendedLoggingEnabled {@code true} if extended logging should be enabled,
diff --git a/telecomm/java/android/telecom/Logging/EventManager.java b/telecomm/java/android/telecom/Logging/EventManager.java
index 2cd1b96..fddbfce 100644
--- a/telecomm/java/android/telecom/Logging/EventManager.java
+++ b/telecomm/java/android/telecom/Logging/EventManager.java
@@ -19,6 +19,7 @@
import android.annotation.NonNull;
import android.telecom.Log;
import android.text.TextUtils;
+import android.util.Pair;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
@@ -27,6 +28,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.IllegalFormatException;
@@ -35,6 +37,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.stream.Collectors;
/**
* A utility class that provides the ability to define Events that a subsystem deems important, and
@@ -49,6 +52,7 @@
public static final String TAG = "Logging.Events";
@VisibleForTesting
public static final int DEFAULT_EVENTS_TO_CACHE = 10; // Arbitrarily chosen.
+ private final DateFormat sDateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
public interface Loggable {
/**
@@ -169,7 +173,6 @@
}
}
- private final DateFormat sDateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
private final List<Event> mEvents = new LinkedList<>();
private final Loggable mRecordEntry;
@@ -308,6 +311,41 @@
pw.decreaseIndent();
}
+ /**
+ * Dumps events in a timeline format.
+ * @param pw The {@link IndentingPrintWriter} to output the timeline to.
+ * @hide
+ */
+ public void dumpEventsTimeline(IndentingPrintWriter pw) {
+ pw.println("Historical Events (sorted by time):");
+
+ // Flatten event records out for sorting.
+ List<Pair<Loggable, Event>> events = new ArrayList<>();
+ for (EventRecord er : mEventRecords) {
+ for (Event ev : er.getEvents()) {
+ events.add(new Pair<>(er.getRecordEntry(), ev));
+ }
+ }
+
+ // Sort by event time.
+ Comparator<Pair<Loggable, Event>> byEventTime = (e1, e2) -> {
+ return Long.compare(e1.second.time, e2.second.time);
+ };
+ events.sort(byEventTime);
+
+ pw.increaseIndent();
+ for (Pair<Loggable, Event> event : events) {
+ pw.print(sDateFormat.format(new Date(event.second.time)));
+ pw.print(",");
+ pw.print(event.first.getId());
+ pw.print(",");
+ pw.print(event.second.eventId);
+ pw.print(",");
+ pw.println(event.second.data);
+ }
+ pw.decreaseIndent();
+ }
+
public void changeEventCacheSize(int newSize) {
// Resize the event queue.
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index bc5e4d5..07259cf 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -3093,34 +3093,20 @@
/*
* The config held calling number conversion map, expected to convert to emergency number.
*/
- private static final String[] CONVERT_TO_EMERGENCY_MAP = Resources.getSystem().getStringArray(
- com.android.internal.R.array.config_convert_to_emergency_number_map);
- /**
- * Check whether conversion to emergency number is enabled
- *
- * @return {@code true} when conversion to emergency numbers is enabled,
- * {@code false} otherwise
- *
- * @hide
- */
- public static boolean isConvertToEmergencyNumberEnabled() {
- return CONVERT_TO_EMERGENCY_MAP != null && CONVERT_TO_EMERGENCY_MAP.length > 0;
- }
+ private static String[] sConvertToEmergencyMap = null;
/**
* Converts to emergency number based on the conversion map.
* The conversion map is declared as config_convert_to_emergency_number_map.
*
- * Make sure {@link #isConvertToEmergencyNumberEnabled} is true before calling
- * this function.
- *
+ * @param context a context to use for accessing resources
* @return The converted emergency number if the number matches conversion map,
* otherwise original number.
*
* @hide
*/
- public static String convertToEmergencyNumber(String number) {
- if (TextUtils.isEmpty(number)) {
+ public static String convertToEmergencyNumber(Context context, String number) {
+ if (context == null || TextUtils.isEmpty(number)) {
return number;
}
@@ -3131,7 +3117,17 @@
return number;
}
- for (String convertMap : CONVERT_TO_EMERGENCY_MAP) {
+ if (sConvertToEmergencyMap == null) {
+ sConvertToEmergencyMap = context.getResources().getStringArray(
+ com.android.internal.R.array.config_convert_to_emergency_number_map);
+ }
+
+ // The conversion map is not defined (this is default). Skip conversion.
+ if (sConvertToEmergencyMap == null || sConvertToEmergencyMap.length == 0 ) {
+ return number;
+ }
+
+ for (String convertMap : sConvertToEmergencyMap) {
if (DBG) log("convertToEmergencyNumber: " + convertMap);
String[] entry = null;
String[] filterNumbers = null;
diff --git a/tests/net/java/android/net/nsd/NsdServiceTest.java b/tests/net/java/com/android/server/NsdServiceTest.java
similarity index 100%
rename from tests/net/java/android/net/nsd/NsdServiceTest.java
rename to tests/net/java/com/android/server/NsdServiceTest.java
diff --git a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
index 9fcd1b5..ddceea2 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
+++ b/tests/net/java/com/android/server/connectivity/tethering/TetheringConfigurationTest.java
@@ -128,5 +128,8 @@
assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_DUN));
// Just to prove we haven't clobbered Wi-Fi:
assertTrue(cfg.preferredUpstreamIfaceTypes.contains(TYPE_WIFI));
+ // Check that we have not added new cellular interface types
+ assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE));
+ assertFalse(cfg.preferredUpstreamIfaceTypes.contains(TYPE_MOBILE_HIPRI));
}
}