diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-21 01:10:11 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-05-21 01:10:11 +0000 |
commit | 226227637923881beded429166619870a38c075c (patch) | |
tree | e1a18520138375dccd5da9f20312283e00370b3e | |
parent | 093c7e4111183c16906945164da20e0885a7e2b6 (diff) | |
parent | 794cdc4facb7b1540947303cdc7a665a62091c11 (diff) | |
download | GeoTZ-226227637923881beded429166619870a38c075c.tar.gz |
Snap for 7384269 from 794cdc4facb7b1540947303cdc7a665a62091c11 to sc-release
Change-Id: I4c903f52058aef8a897681a54a718ee3896260d7
-rw-r--r-- | apex/com.android.geotz/Android.bp | 17 | ||||
-rw-r--r-- | locationtzprovider/src/main/java/com/android/timezone/location/provider/core/OfflineLocationTimeZoneDelegate.java | 15 |
2 files changed, 21 insertions, 11 deletions
diff --git a/apex/com.android.geotz/Android.bp b/apex/com.android.geotz/Android.bp index 2c063d3..f0e977b 100644 --- a/apex/com.android.geotz/Android.bp +++ b/apex/com.android.geotz/Android.bp @@ -28,10 +28,7 @@ apex_defaults { // module. file_contexts: ":com.android.geotz-file_contexts", - // This name is hardcoded on Android S with associated AndroidManifest.xml - // entries in the system server. Do not remove until all releases use an - // APK. - java_libs: ["geotz"], + systemserverclasspath_fragments: ["com.android.geotz-systemserverclasspath-fragment"], // Shared signing information. key: "com.android.geotz.key", @@ -49,6 +46,16 @@ android_app_certificate { certificate: "com.android.geotz", } +// Encapsulate the contributions made by the com.android.geotz to the systemserverclasspath. +systemserverclasspath_fragment { + name: "com.android.geotz-systemserverclasspath-fragment", + // This name is hardcoded on Android S with associated AndroidManifest.xml + // entries in the system server. Do not remove until all releases use an + // APK. + contents: ["geotz"], + apex_available: ["com.android.geotz"], +} + // The definition for the real (not test) geotz APEX. apex { name: "com.android.geotz", @@ -70,6 +77,8 @@ java_library { "offlinelocationtimezoneprovider", ], sdk_version: "system_current", + // TODO(b/188773212): force dex compilation for inclusion in bootclasspath_fragment. + compile_dex: true, apex_available: [ "com.android.geotz", ], diff --git a/locationtzprovider/src/main/java/com/android/timezone/location/provider/core/OfflineLocationTimeZoneDelegate.java b/locationtzprovider/src/main/java/com/android/timezone/location/provider/core/OfflineLocationTimeZoneDelegate.java index 56d6c39..1bfb202 100644 --- a/locationtzprovider/src/main/java/com/android/timezone/location/provider/core/OfflineLocationTimeZoneDelegate.java +++ b/locationtzprovider/src/main/java/com/android/timezone/location/provider/core/OfflineLocationTimeZoneDelegate.java @@ -301,7 +301,7 @@ public final class OfflineLocationTimeZoneDelegate { String unexpectedStateDebugInfo = "Unexpected call to onActiveListeningResult()," + " activeListeningResult=" + activeListeningResult + ", currentMode=" + currentMode; - handleUnexpectedCallback(unexpectedStateDebugInfo); + handleUnexpectedLocationCallback(unexpectedStateDebugInfo); return; } @@ -343,7 +343,7 @@ public final class OfflineLocationTimeZoneDelegate { String unexpectedStateDebugInfo = "Unexpected call to onPassiveListeningResult()," + " passiveListeningResult=" + passiveListeningResult + ", currentMode=" + currentMode; - handleUnexpectedCallback(unexpectedStateDebugInfo); + handleUnexpectedLocationCallback(unexpectedStateDebugInfo); return; } logDebug("onPassiveListeningResult()" @@ -416,7 +416,7 @@ public final class OfflineLocationTimeZoneDelegate { Mode currentMode = mCurrentMode.get(); if (currentMode.mModeEnum != MODE_STARTED || currentMode.mListenMode != LOCATION_LISTEN_MODE_PASSIVE) { - handleUnexpectedCallback("Unexpected call to onPassiveListeningEnded()" + handleUnexpectedLocationCallback("Unexpected call to onPassiveListeningEnded()" + ", currentMode=" + currentMode); return; } @@ -555,10 +555,11 @@ public final class OfflineLocationTimeZoneDelegate { } @GuardedBy("mLock") - private void handleUnexpectedCallback(@NonNull String debugInfo) { - // To help track down unexpected behavior, this fails hard. - logWarn(debugInfo); - throw new IllegalStateException(debugInfo); + private void handleUnexpectedLocationCallback(@NonNull String debugInfo) { + // Unexpected location callbacks can occur when location listening is cancelled, but a + // location is already available (e.g. the callback is already invoked but blocked or + // sitting in a handler queue). This is logged but generally ignored. + logDebug(debugInfo); } @GuardedBy("mLock") |