From ae39009ccd9db363888c292814ce91a12451c16f Mon Sep 17 00:00:00 2001 From: mar-v-in Date: Sun, 25 Jan 2015 17:59:09 +0100 Subject: [PATCH] Add some Wearable classes, mark public apis --- .../gms/common/api/CommonStatusCodes.java | 40 ++++++++++ .../google/android/gms/common/api/Result.java | 3 + .../google/android/gms/common/api/Scope.java | 2 + .../google/android/gms/common/api/Status.java | 3 + .../gms/maps/model/BitmapDescriptor.java | 3 + .../gms/maps/model/CameraPosition.java | 3 + .../android/gms/maps/model/CircleOptions.java | 3 + .../gms/maps/model/GroundOverlayOptions.java | 3 + .../google/android/gms/maps/model/LatLng.java | 2 + .../android/gms/maps/model/LatLngBounds.java | 2 + .../android/gms/maps/model/MarkerOptions.java | 3 + .../gms/maps/model/PolygonOptions.java | 2 + .../gms/maps/model/PolylineOptions.java | 2 + .../maps/model/StreetViewPanoramaCamera.java | 3 + .../maps/model/StreetViewPanoramaLink.java | 3 + .../model/StreetViewPanoramaLocation.java | 3 + .../model/StreetViewPanoramaOrientation.java | 3 + .../google/android/gms/maps/model/Tile.java | 2 + .../gms/maps/model/TileOverlayOptions.java | 3 + .../android/gms/maps/model/VisibleRegion.java | 2 + src/com/google/android/gms/wearable/Node.java | 36 +++++++++ .../gms/wearable/WearableStatusCodes.java | 53 +++++++++++++ .../gms/wearable/internal/NodeParcelable.java | 79 +++++++++++++++++++ src/org/microg/gms/PublicApi.java | 23 ++++++ 24 files changed, 281 insertions(+) create mode 100644 src/com/google/android/gms/common/api/CommonStatusCodes.java create mode 100644 src/com/google/android/gms/wearable/Node.java create mode 100644 src/com/google/android/gms/wearable/WearableStatusCodes.java create mode 100644 src/com/google/android/gms/wearable/internal/NodeParcelable.java create mode 100644 src/org/microg/gms/PublicApi.java diff --git a/src/com/google/android/gms/common/api/CommonStatusCodes.java b/src/com/google/android/gms/common/api/CommonStatusCodes.java new file mode 100644 index 0000000..c0c1beb --- /dev/null +++ b/src/com/google/android/gms/common/api/CommonStatusCodes.java @@ -0,0 +1,40 @@ +/* + * Copyright 2014-2015 µg Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.common.api; + +import org.microg.gms.PublicApi; + +@PublicApi +public class CommonStatusCodes { + public static final int SUCCESS_CACHE = -1; + public static final int SUCCESS = 0; + public static final int SERVICE_MISSING = 1; + public static final int SERVICE_VERSION_UPDATE_REQUIRED = 2; + public static final int SERVICE_DISABLED = 3; + public static final int SIGN_IN_REQUIRED = 4; + public static final int INVALID_ACCOUNT = 5; + public static final int RESOLUTION_REQUIRED = 6; + public static final int NETWORK_ERROR = 7; + public static final int INTERNAL_ERROR = 8; + public static final int SERVICE_INVALID = 9; + public static final int DEVELOPER_ERROR = 10; + public static final int LICENSE_CHECK_FAILED = 11; + public static final int ERROR = 13; + public static final int INTERRUPTED = 14; + public static final int TIMEOUT = 15; + public static final int CANCELED = 16; +} diff --git a/src/com/google/android/gms/common/api/Result.java b/src/com/google/android/gms/common/api/Result.java index d840811..e1bf524 100644 --- a/src/com/google/android/gms/common/api/Result.java +++ b/src/com/google/android/gms/common/api/Result.java @@ -1,8 +1,11 @@ package com.google.android.gms.common.api; +import org.microg.gms.PublicApi; + /** * Represents the final result of invoking an API method in Google Play Services. */ +@PublicApi public interface Result { public Status getStatus(); } diff --git a/src/com/google/android/gms/common/api/Scope.java b/src/com/google/android/gms/common/api/Scope.java index ab9a05a..f1ed8f9 100644 --- a/src/com/google/android/gms/common/api/Scope.java +++ b/src/com/google/android/gms/common/api/Scope.java @@ -1,5 +1,6 @@ package com.google.android.gms.common.api; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -7,6 +8,7 @@ import org.microg.safeparcel.SafeParceled; * Describes an OAuth 2.0 scope to request. This has security implications for the user, and * requesting additional scopes will result in authorization dialogs. */ +@PublicApi public class Scope extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; diff --git a/src/com/google/android/gms/common/api/Status.java b/src/com/google/android/gms/common/api/Status.java index 903563a..eadbefb 100644 --- a/src/com/google/android/gms/common/api/Status.java +++ b/src/com/google/android/gms/common/api/Status.java @@ -1,6 +1,8 @@ package com.google.android.gms.common.api; import android.app.PendingIntent; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; /** @@ -8,6 +10,7 @@ import org.microg.safeparcel.AutoSafeParcelable; *

* TODO: Docs */ +@PublicApi public final class Status extends AutoSafeParcelable implements Result { private static final int STATUS_CODE_INTERRUPTED = 14; private static final int STATUS_CODE_CANCELED = 16; diff --git a/src/com/google/android/gms/maps/model/BitmapDescriptor.java b/src/com/google/android/gms/maps/model/BitmapDescriptor.java index 800c174..5a8b308 100644 --- a/src/com/google/android/gms/maps/model/BitmapDescriptor.java +++ b/src/com/google/android/gms/maps/model/BitmapDescriptor.java @@ -18,10 +18,13 @@ package com.google.android.gms.maps.model; import com.google.android.gms.dynamic.IObjectWrapper; +import org.microg.gms.PublicApi; + /** * Defines an image. For a marker, it can be used to set the image of the marker icon. For a ground * overlay, it can be used to set the image to place on the surface of the earth. */ +@PublicApi public class BitmapDescriptor { private final IObjectWrapper remoteObject; diff --git a/src/com/google/android/gms/maps/model/CameraPosition.java b/src/com/google/android/gms/maps/model/CameraPosition.java index c989ed4..cff1068 100644 --- a/src/com/google/android/gms/maps/model/CameraPosition.java +++ b/src/com/google/android/gms/maps/model/CameraPosition.java @@ -18,6 +18,8 @@ package com.google.android.gms.maps.model; import android.content.Context; import android.util.AttributeSet; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -26,6 +28,7 @@ import java.util.Arrays; /** * An immutable class that aggregates all camera position parameters. */ +@PublicApi public final class CameraPosition extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; diff --git a/src/com/google/android/gms/maps/model/CircleOptions.java b/src/com/google/android/gms/maps/model/CircleOptions.java index 4002c6b..eb3e256 100644 --- a/src/com/google/android/gms/maps/model/CircleOptions.java +++ b/src/com/google/android/gms/maps/model/CircleOptions.java @@ -17,12 +17,15 @@ package com.google.android.gms.maps.model; import android.graphics.Color; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a Circle. */ +@PublicApi public class CircleOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; diff --git a/src/com/google/android/gms/maps/model/GroundOverlayOptions.java b/src/com/google/android/gms/maps/model/GroundOverlayOptions.java index 12ede55..25c024d 100644 --- a/src/com/google/android/gms/maps/model/GroundOverlayOptions.java +++ b/src/com/google/android/gms/maps/model/GroundOverlayOptions.java @@ -18,12 +18,15 @@ package com.google.android.gms.maps.model; import android.os.IBinder; import com.google.android.gms.dynamic.ObjectWrapper; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a ground overlay. */ +@PublicApi public class GroundOverlayOptions extends AutoSafeParcelable { /** * Flag for when no dimension is specified for the height. diff --git a/src/com/google/android/gms/maps/model/LatLng.java b/src/com/google/android/gms/maps/model/LatLng.java index 2606b53..f1eb4b1 100644 --- a/src/com/google/android/gms/maps/model/LatLng.java +++ b/src/com/google/android/gms/maps/model/LatLng.java @@ -16,12 +16,14 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * An immutable class representing a pair of latitude and longitude coordinates, stored as degrees. */ +@PublicApi public final class LatLng extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; diff --git a/src/com/google/android/gms/maps/model/LatLngBounds.java b/src/com/google/android/gms/maps/model/LatLngBounds.java index 5a6653f..1ef2c39 100644 --- a/src/com/google/android/gms/maps/model/LatLngBounds.java +++ b/src/com/google/android/gms/maps/model/LatLngBounds.java @@ -16,6 +16,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -24,6 +25,7 @@ import java.util.Arrays; /** * An immutable class representing a latitude/longitude aligned rectangle. */ +@PublicApi public final class LatLngBounds extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; diff --git a/src/com/google/android/gms/maps/model/MarkerOptions.java b/src/com/google/android/gms/maps/model/MarkerOptions.java index 4a076ac..34ddaaf 100644 --- a/src/com/google/android/gms/maps/model/MarkerOptions.java +++ b/src/com/google/android/gms/maps/model/MarkerOptions.java @@ -18,9 +18,12 @@ package com.google.android.gms.maps.model; import android.os.IBinder; import com.google.android.gms.dynamic.ObjectWrapper; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; +@PublicApi public class MarkerOptions extends AutoSafeParcelable { @SafeParceled(1) diff --git a/src/com/google/android/gms/maps/model/PolygonOptions.java b/src/com/google/android/gms/maps/model/PolygonOptions.java index b74d2ea..162ae2f 100644 --- a/src/com/google/android/gms/maps/model/PolygonOptions.java +++ b/src/com/google/android/gms/maps/model/PolygonOptions.java @@ -16,12 +16,14 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; /** * Defines options for a polygon. * TODO */ +@PublicApi public class PolygonOptions extends AutoSafeParcelable { public PolygonOptions() { } diff --git a/src/com/google/android/gms/maps/model/PolylineOptions.java b/src/com/google/android/gms/maps/model/PolylineOptions.java index 2a06e96..6a0b809 100644 --- a/src/com/google/android/gms/maps/model/PolylineOptions.java +++ b/src/com/google/android/gms/maps/model/PolylineOptions.java @@ -16,6 +16,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -25,6 +26,7 @@ import java.util.List; * Defines options for a polyline. * TODO */ +@PublicApi public class PolylineOptions extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; diff --git a/src/com/google/android/gms/maps/model/StreetViewPanoramaCamera.java b/src/com/google/android/gms/maps/model/StreetViewPanoramaCamera.java index 534d814..1281fcb 100644 --- a/src/com/google/android/gms/maps/model/StreetViewPanoramaCamera.java +++ b/src/com/google/android/gms/maps/model/StreetViewPanoramaCamera.java @@ -1,4 +1,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; + +@PublicApi public class StreetViewPanoramaCamera { } diff --git a/src/com/google/android/gms/maps/model/StreetViewPanoramaLink.java b/src/com/google/android/gms/maps/model/StreetViewPanoramaLink.java index 66859e0..0b85a6e 100644 --- a/src/com/google/android/gms/maps/model/StreetViewPanoramaLink.java +++ b/src/com/google/android/gms/maps/model/StreetViewPanoramaLink.java @@ -1,4 +1,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; + +@PublicApi public class StreetViewPanoramaLink { } diff --git a/src/com/google/android/gms/maps/model/StreetViewPanoramaLocation.java b/src/com/google/android/gms/maps/model/StreetViewPanoramaLocation.java index 8ef5fda..cfd3a29 100644 --- a/src/com/google/android/gms/maps/model/StreetViewPanoramaLocation.java +++ b/src/com/google/android/gms/maps/model/StreetViewPanoramaLocation.java @@ -1,4 +1,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; + +@PublicApi public class StreetViewPanoramaLocation { } diff --git a/src/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.java b/src/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.java index 285c061..32eec06 100644 --- a/src/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.java +++ b/src/com/google/android/gms/maps/model/StreetViewPanoramaOrientation.java @@ -1,4 +1,7 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; + +@PublicApi public class StreetViewPanoramaOrientation { } diff --git a/src/com/google/android/gms/maps/model/Tile.java b/src/com/google/android/gms/maps/model/Tile.java index a3062e5..3e5031c 100644 --- a/src/com/google/android/gms/maps/model/Tile.java +++ b/src/com/google/android/gms/maps/model/Tile.java @@ -1,5 +1,6 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -7,6 +8,7 @@ import org.microg.safeparcel.SafeParceled; * Contains information about a Tile that is returned by a {@link TileProvider}. * TODO SafeParceled */ +@PublicApi public class Tile extends AutoSafeParcelable { @SafeParceled(1) private final int versionCode; diff --git a/src/com/google/android/gms/maps/model/TileOverlayOptions.java b/src/com/google/android/gms/maps/model/TileOverlayOptions.java index 1552383..5582561 100644 --- a/src/com/google/android/gms/maps/model/TileOverlayOptions.java +++ b/src/com/google/android/gms/maps/model/TileOverlayOptions.java @@ -19,12 +19,15 @@ package com.google.android.gms.maps.model; import android.os.IBinder; import android.os.RemoteException; import com.google.android.gms.maps.model.internal.ITileProviderDelegate; + +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; /** * Defines options for a TileOverlay. */ +@PublicApi public class TileOverlayOptions extends AutoSafeParcelable { @SafeParceled(1) diff --git a/src/com/google/android/gms/maps/model/VisibleRegion.java b/src/com/google/android/gms/maps/model/VisibleRegion.java index 43f161d..601f150 100644 --- a/src/com/google/android/gms/maps/model/VisibleRegion.java +++ b/src/com/google/android/gms/maps/model/VisibleRegion.java @@ -16,9 +16,11 @@ package com.google.android.gms.maps.model; +import org.microg.gms.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; +@PublicApi public class VisibleRegion extends AutoSafeParcelable { @SafeParceled(1) private int versionCode; diff --git a/src/com/google/android/gms/wearable/Node.java b/src/com/google/android/gms/wearable/Node.java new file mode 100644 index 0000000..9c7d579 --- /dev/null +++ b/src/com/google/android/gms/wearable/Node.java @@ -0,0 +1,36 @@ +/* + * Copyright 2014-2015 µg Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.wearable; + +import org.microg.gms.PublicApi; + +/** + * Information about a particular node in the Android Wear network. + */ +@PublicApi +public interface Node { + /** + * Returns a human readable description of the node. Sometimes generated from the Bluetooth + * device name + */ + public abstract String getDisplayName(); + + /** + * Returns an opaque string that represents a node in the Android Wear network. + */ + public abstract String getId(); +} diff --git a/src/com/google/android/gms/wearable/WearableStatusCodes.java b/src/com/google/android/gms/wearable/WearableStatusCodes.java new file mode 100644 index 0000000..46e4dbd --- /dev/null +++ b/src/com/google/android/gms/wearable/WearableStatusCodes.java @@ -0,0 +1,53 @@ +/* + * Copyright 2014-2015 µg Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.wearable; + +import com.google.android.gms.common.api.CommonStatusCodes; + +import org.microg.gms.PublicApi; + +/** + * Error codes for wearable API failures. These values may be returned by APIs to indicate the + * success or failure of a request. + */ +@PublicApi +public class WearableStatusCodes extends CommonStatusCodes { + /** + * Indicates that the targeted node is not accessible in the wearable network. + */ + public static final int TARGET_NODE_NOT_CONNECTED = 4000; + /** + * Indicates that the specified listener is already registered. + */ + public static final int DUPLICATE_LISTENER = 4001; + /** + * Indicates that the specified listener is not recognized. + */ + public static final int UNKNOWN_LISTENER = 4002; + /** + * Indicates that the data item was too large to set. + */ + public static final int DATA_ITEM_TOO_LARGE = 4003; + /** + * Indicates that the targeted node is not a valid node in the wearable network. + */ + public static final int INVALID_TARGET_NODE = 4004; + /** + * Indicates that the requested asset is unavailable. + */ + public static final int ASSET_UNAVAILABLE = 4005; +} diff --git a/src/com/google/android/gms/wearable/internal/NodeParcelable.java b/src/com/google/android/gms/wearable/internal/NodeParcelable.java new file mode 100644 index 0000000..9c96a10 --- /dev/null +++ b/src/com/google/android/gms/wearable/internal/NodeParcelable.java @@ -0,0 +1,79 @@ +/* + * Copyright 2014-2015 µg Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.gms.wearable.internal; + +import com.google.android.gms.wearable.Node; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +/** + * Parcelable implementation of the {@link com.google.android.gms.wearable.Node} interface. + */ +public class NodeParcelable extends AutoSafeParcelable implements Node { + @SafeParceled(1) + private final int versionCode; + @SafeParceled(2) + private final String id; + @SafeParceled(3) + private final String displayName; + + private NodeParcelable() { + versionCode = 1; + id = displayName = null; + } + + public NodeParcelable(String id, String displayName) { + versionCode = 1; + this.id = id; + this.displayName = displayName; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + NodeParcelable that = (NodeParcelable) o; + + if (!id.equals(that.id)) return false; + if (!displayName.equals(that.displayName)) return false; + + return true; + } + + @Override + public String getDisplayName() { + return displayName; + } + + @Override + public String getId() { + return id; + } + + @Override + public int hashCode() { + int result = 37 * 17 + id.hashCode(); + return 37 * result + displayName.hashCode(); + } + + @Override + public String toString() { + return "NodeParcelable{" + id + "," + displayName + "}"; + } +} diff --git a/src/org/microg/gms/PublicApi.java b/src/org/microg/gms/PublicApi.java new file mode 100644 index 0000000..00092ba --- /dev/null +++ b/src/org/microg/gms/PublicApi.java @@ -0,0 +1,23 @@ +/* + * Copyright 2014-2015 µg Project Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.microg.gms; + +public @interface PublicApi { + String since() default "-1"; + + String until() default "-1"; +}