Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c59c9c1 authored by Neil Fuller's avatar Neil Fuller
Browse files

Expose the LTZP in the location provider API

Expose the LocationTimeZoneProvider and associated classes in the
location lib API.

Bug: 152744911
Test: build only
Change-Id: Ib577bbdee10d7778e28fc1c6003cc97fdb15acb3
parent d75f5c49
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
@@ -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();
  }

}
+0 −6
Original line number Original line Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.location.timezone.provider;


import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.location.timezone.LocationTimeZoneEvent;
import android.location.timezone.LocationTimeZoneEvent;
import android.os.SystemClock;
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
 * An event from a {@link LocationTimeZoneProviderBase} sent while determining a device's time zone
 * using its location.
 * using its location.
 *
 * @hide
 */
 */
public final class LocationTimeZoneEventUnbundled {
public final class LocationTimeZoneEventUnbundled {


@@ -69,7 +66,6 @@ public final class LocationTimeZoneEventUnbundled {
    /**
    /**
     * Returns the event type.
     * Returns the event type.
     */
     */
    @Nullable
    public @EventType int getEventType() {
    public @EventType int getEventType() {
        return mDelegate.getEventType();
        return mDelegate.getEventType();
    }
    }
@@ -118,8 +114,6 @@ public final class LocationTimeZoneEventUnbundled {


    /**
    /**
     * A builder of {@link LocationTimeZoneEventUnbundled} instances.
     * A builder of {@link LocationTimeZoneEventUnbundled} instances.
     *
     * @hide
     */
     */
    public static final class Builder {
    public static final class Builder {


+4 −4
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.location.timezone.provider;
package com.android.location.timezone.provider;


import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.os.IBinder;
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
 * <p>IMPORTANT: This class is effectively a public API for unbundled applications, and must remain
 * API stable.
 * API stable.
 *
 * @hide
 */
 */
public abstract class LocationTimeZoneProviderBase {
public abstract class LocationTimeZoneProviderBase {


@@ -85,7 +84,8 @@ public abstract class LocationTimeZoneProviderBase {
    /**
    /**
     * Reports a new location time zone event from this provider.
     * 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;
        ILocationTimeZoneProviderManager manager = mManager;
        if (manager != null) {
        if (manager != null) {
            try {
            try {
@@ -102,7 +102,7 @@ public abstract class LocationTimeZoneProviderBase {
     * to start returning location time zones, or to stop returning location time zones, depending
     * to start returning location time zones, or to stop returning location time zones, depending
     * on the parameters in the request.
     * 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 {
    private final class Service extends ILocationTimeZoneProvider.Stub {


+2 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.location.timezone.provider;
package com.android.location.timezone.provider;


import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.NonNull;


import com.android.internal.location.timezone.LocationTimeZoneProviderRequest;
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
 * <p>IMPORTANT: This class is effectively a public API for unbundled code, and must remain API
 * stable.
 * stable.
 *
 * @hide
 */
 */
public final class LocationTimeZoneProviderRequestUnbundled {
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
     * 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.
     * provider is uncertain of the time zone, and/or it could lead to the provider being disabled.
     */
     */
    @IntRange(from = 0)
    public long getInitializationTimeoutMillis() {
    public long getInitializationTimeoutMillis() {
        return mRequest.getInitializationTimeoutMillis();
        return mRequest.getInitializationTimeoutMillis();
    }
    }