Merge "Expose the LTZP in the location provider API"

This commit is contained in:
Neil Fuller
2020-10-06 08:49:40 +00:00
committed by Android (Google) Code Review
4 changed files with 38 additions and 12 deletions

View File

@@ -59,3 +59,35 @@ package com.android.location.provider {
}
package com.android.location.timezone.provider {
public final class LocationTimeZoneEventUnbundled {
method public int getEventType();
method @NonNull public java.util.List<java.lang.String> getTimeZoneIds();
field public static final int EVENT_TYPE_PERMANENT_FAILURE = 1; // 0x1
field public static final int EVENT_TYPE_SUCCESS = 2; // 0x2
field public static final int EVENT_TYPE_UNCERTAIN = 3; // 0x3
}
public static final class LocationTimeZoneEventUnbundled.Builder {
ctor public LocationTimeZoneEventUnbundled.Builder();
method @NonNull public com.android.location.timezone.provider.LocationTimeZoneEventUnbundled build();
method @NonNull public com.android.location.timezone.provider.LocationTimeZoneEventUnbundled.Builder setEventType(int);
method @NonNull public com.android.location.timezone.provider.LocationTimeZoneEventUnbundled.Builder setTimeZoneIds(@NonNull java.util.List<java.lang.String>);
}
public abstract class LocationTimeZoneProviderBase {
ctor public LocationTimeZoneProviderBase(android.content.Context, String);
method public final android.os.IBinder getBinder();
method protected final android.content.Context getContext();
method protected abstract void onSetRequest(@NonNull com.android.location.timezone.provider.LocationTimeZoneProviderRequestUnbundled);
method protected final void reportLocationTimeZoneEvent(@NonNull com.android.location.timezone.provider.LocationTimeZoneEventUnbundled);
}
public final class LocationTimeZoneProviderRequestUnbundled {
method @IntRange(from=0) public long getInitializationTimeoutMillis();
method public boolean getReportLocationTimeZone();
}
}

View File

@@ -18,7 +18,6 @@ package com.android.location.timezone.provider;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.location.timezone.LocationTimeZoneEvent;
import android.os.SystemClock;
@@ -31,8 +30,6 @@ import java.util.Objects;
/**
* An event from a {@link LocationTimeZoneProviderBase} sent while determining a device's time zone
* using its location.
*
* @hide
*/
public final class LocationTimeZoneEventUnbundled {
@@ -69,7 +66,6 @@ public final class LocationTimeZoneEventUnbundled {
/**
* Returns the event type.
*/
@Nullable
public @EventType int getEventType() {
return mDelegate.getEventType();
}
@@ -118,8 +114,6 @@ public final class LocationTimeZoneEventUnbundled {
/**
* A builder of {@link LocationTimeZoneEventUnbundled} instances.
*
* @hide
*/
public static final class Builder {

View File

@@ -16,6 +16,7 @@
package com.android.location.timezone.provider;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.os.IBinder;
@@ -55,8 +56,6 @@ import java.util.Objects;
*
* <p>IMPORTANT: This class is effectively a public API for unbundled applications, and must remain
* API stable.
*
* @hide
*/
public abstract class LocationTimeZoneProviderBase {
@@ -85,7 +84,8 @@ public abstract class LocationTimeZoneProviderBase {
/**
* Reports a new location time zone event from this provider.
*/
protected void reportLocationTimeZoneEvent(LocationTimeZoneEventUnbundled event) {
protected final void reportLocationTimeZoneEvent(
@NonNull LocationTimeZoneEventUnbundled event) {
ILocationTimeZoneProviderManager manager = mManager;
if (manager != null) {
try {
@@ -102,7 +102,7 @@ public abstract class LocationTimeZoneProviderBase {
* to start returning location time zones, or to stop returning location time zones, depending
* on the parameters in the request.
*/
protected abstract void onSetRequest(LocationTimeZoneProviderRequestUnbundled request);
protected abstract void onSetRequest(@NonNull LocationTimeZoneProviderRequestUnbundled request);
private final class Service extends ILocationTimeZoneProvider.Stub {

View File

@@ -16,6 +16,7 @@
package com.android.location.timezone.provider;
import android.annotation.IntRange;
import android.annotation.NonNull;
import com.android.internal.location.timezone.LocationTimeZoneProviderRequest;
@@ -27,8 +28,6 @@ import java.util.Objects;
*
* <p>IMPORTANT: This class is effectively a public API for unbundled code, and must remain API
* stable.
*
* @hide
*/
public final class LocationTimeZoneProviderRequestUnbundled {
@@ -54,6 +53,7 @@ public final class LocationTimeZoneProviderRequestUnbundled {
* true}. Failure to send an event in this time (with some fuzz) may be interpreted as if the
* provider is uncertain of the time zone, and/or it could lead to the provider being disabled.
*/
@IntRange(from = 0)
public long getInitializationTimeoutMillis() {
return mRequest.getInitializationTimeoutMillis();
}