0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-10-31 16:32:39 +00:00

Extend wearable APIs, update Maps API

This commit is contained in:
mar-v-in 2015-08-04 13:02:08 +02:00
parent f77b09dc0c
commit 0890bf4546
55 changed files with 317 additions and 98 deletions

View file

@ -3,6 +3,7 @@ package com.google.android.gms.maps.internal;
import android.os.Bundle;
import com.google.android.gms.maps.internal.IGoogleMapDelegate;
import com.google.android.gms.maps.internal.IOnMapReadyCallback;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IMapViewDelegate {
@ -14,4 +15,5 @@ interface IMapViewDelegate {
void onLowMemory();
void onSaveInstanceState(inout Bundle outState);
IObjectWrapper getView();
void addOnMapReadyCallback(IOnMapReadyCallback callback);
}

View file

@ -0,0 +1,7 @@
package com.google.android.gms.maps.internal;
import com.google.android.gms.maps.internal.IGoogleMapDelegate;
interface IOnMapReadyCallback {
void onMapReady(IGoogleMapDelegate map);
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable AddListenerRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable DeleteDataItemsResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetConfigResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetConfigsResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetConnectedNodesResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetDataItemResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetFdForAssetResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable GetLocalNodeResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable PutDataRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable PutDataResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable RemoveListenerRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable SendMessageResponse;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.wearable;
parcelable StorageInfoResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable AddListenerRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable CapabilityInfoParcelable;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable ChannelEventParcelable;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable DeleteDataItemsResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetConfigResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetConfigsResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetConnectedNodesResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetDataItemResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetFdForAssetResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable GetLocalNodeResponse;

View file

@ -2,16 +2,16 @@ package com.google.android.gms.wearable.internal;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.wearable.DeleteDataItemsResponse;
import com.google.android.gms.wearable.GetConfigResponse;
import com.google.android.gms.wearable.GetConfigsResponse;
import com.google.android.gms.wearable.GetConnectedNodesResponse;
import com.google.android.gms.wearable.GetDataItemResponse;
import com.google.android.gms.wearable.GetFdForAssetResponse;
import com.google.android.gms.wearable.GetLocalNodeResponse;
import com.google.android.gms.wearable.PutDataResponse;
import com.google.android.gms.wearable.SendMessageResponse;
import com.google.android.gms.wearable.StorageInfoResponse;
import com.google.android.gms.wearable.internal.DeleteDataItemsResponse;
import com.google.android.gms.wearable.internal.GetConfigResponse;
import com.google.android.gms.wearable.internal.GetConfigsResponse;
import com.google.android.gms.wearable.internal.GetConnectedNodesResponse;
import com.google.android.gms.wearable.internal.GetDataItemResponse;
import com.google.android.gms.wearable.internal.GetFdForAssetResponse;
import com.google.android.gms.wearable.internal.GetLocalNodeResponse;
import com.google.android.gms.wearable.internal.PutDataResponse;
import com.google.android.gms.wearable.internal.SendMessageResponse;
import com.google.android.gms.wearable.internal.StorageInfoResponse;
interface IWearableCallbacks {
void onGetConfigResponse(in GetConfigResponse response) = 1;

View file

@ -1,5 +1,18 @@
package com.google.android.gms.wearable.internal;
interface IWearableListener {
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.wearable.internal.CapabilityInfoParcelable;
import com.google.android.gms.wearable.internal.ChannelEventParcelable;
import com.google.android.gms.wearable.internal.MessageEventParcelable;
import com.google.android.gms.wearable.internal.NodeParcelable;
interface IWearableListener {
void onDataChanged(in DataHolder data) = 0;
void onMessageReceived(in MessageEventParcelable messageEvent) = 1;
void onPeerConnected(in NodeParcelable node) = 2;
void onPeerDisconnected(in NodeParcelable node) = 3;
void onConnectedNodes(in List<NodeParcelable> nodes) = 4;
void onChannelEvent(in ChannelEventParcelable channelEvent) = 6;
void onConnectedCapabilityChanged(in CapabilityInfoParcelable capabilityInfo) = 7;
}

View file

@ -1,9 +1,9 @@
package com.google.android.gms.wearable.internal;
import com.google.android.gms.wearable.AddListenerRequest;
import com.google.android.gms.wearable.internal.AddListenerRequest;
import com.google.android.gms.wearable.ConnectionConfiguration;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.RemoveListenerRequest;
import com.google.android.gms.wearable.internal.PutDataRequest;
import com.google.android.gms.wearable.internal.RemoveListenerRequest;
import com.google.android.gms.wearable.internal.IWearableCallbacks;
import com.google.android.gms.wearable.internal.IWearableService;
@ -18,6 +18,8 @@ interface IWearableService {
void removeListener(IWearableCallbacks callbacks, in RemoveListenerRequest request) = 16;
void putConfig(IWearableCallbacks callbacks, in ConnectionConfiguration config) = 19;
void getConfigs(IWearableCallbacks callbacks) = 21;
void disableConnection(IWearableCallbacks callbacks, String name) = 23;
void getDataItemsByUri(IWearableCallbacks callbacks, in Uri uri, int i) = 39;
void deleteDataItems(IWearableCallbacks callbacks, in Uri uri) = 40;
void optInCloudSync(IWearableCallbacks callbacks, boolean enable) = 47;
}

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable MessageEventParcelable;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable NodeParcelable;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable PutDataRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable PutDataResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable RemoveListenerRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable SendMessageResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable.internal;
parcelable StorageInfoResponse;

View file

@ -19,8 +19,13 @@ package com.google.android.gms.wearable;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import com.google.android.gms.wearable.internal.PutDataRequest;
import org.microg.gms.common.PublicApi;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
/**
* An asset is a binary blob shared between data items that is replicated across the wearable
@ -33,6 +38,28 @@ import org.microg.safeparcel.AutoSafeParcelable;
@PublicApi
public class Asset extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
@PublicApi(exclude = true)
public byte[] data;
@SafeParceled(3)
private String digest;
@SafeParceled(4)
private ParcelFileDescriptor fd;
@SafeParceled(5)
private Uri uri;
private Asset() {
}
private Asset(byte[] data, String digest, ParcelFileDescriptor fd, Uri uri) {
this.data = data;
this.digest = digest;
this.fd = fd;
this.uri = uri;
}
/**
* Creates an Asset using a byte array.
*/
@ -45,14 +72,20 @@ public class Asset extends AutoSafeParcelable {
* sent in a putDataItem request.
*/
public static Asset createFromFd(ParcelFileDescriptor fd) {
return null;
if (fd == null) {
throw new IllegalArgumentException("Asset fd cannot be null");
}
return new Asset(null, null, fd, null);
}
/**
* Create an Asset using an existing Asset's digest.
*/
public static Asset createFromRef(String digest) {
return null;
if (digest == null) {
throw new IllegalArgumentException("Asset digest cannot be null");
}
return new Asset(null, digest, null, null);
}
/**
@ -68,21 +101,53 @@ public class Asset extends AutoSafeParcelable {
* identify the asset across devices.
*/
public String getDigest() {
return null;
return digest;
}
/**
* @return the file descriptor referencing the asset.
*/
public ParcelFileDescriptor getFd() {
return null;
return fd;
}
/**
* @return the uri referencing the asset data.
*/
public Uri getUri() {
return null;
return uri;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Asset asset = (Asset) o;
if (!Arrays.equals(data, asset.data)) return false;
if (digest != null ? !digest.equals(asset.digest) : asset.digest != null) return false;
if (fd != null ? !fd.equals(asset.fd) : asset.fd != null) return false;
return !(uri != null ? !uri.equals(asset.uri) : asset.uri != null);
}
@Override
public int hashCode() {
return Arrays.hashCode(new Object[]{data, digest, fd, uri});
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Asset[@")
.append(Integer.toHexString(hashCode()))
.append(", ")
.append(digest != null ? digest : "nodigest");
if (this.data != null) sb.append(", size=").append(data.length);
if (this.fd != null) sb.append(", fd=").append(fd);
if (this.uri != null) sb.append(", uri=").append(uri);
return sb.append("]").toString();
}
public static final Creator<Asset> CREATOR = new AutoCreator<Asset>(Asset.class);

View file

@ -14,12 +14,10 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import android.content.IntentFilter;
import com.google.android.gms.wearable.internal.IWearableListener;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-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 org.microg.safeparcel.AutoSafeParcelable;
public class CapabilityInfoParcelable extends AutoSafeParcelable {
public static final Creator<CapabilityInfoParcelable> CREATOR = new AutoCreator<CapabilityInfoParcelable>(CapabilityInfoParcelable.class);
}

View file

@ -14,10 +14,10 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class DeleteDataItemsResponse extends AutoSafeParcelable {
public static final Creator<DeleteDataItemsResponse> CREATOR = new AutoCreator<DeleteDataItemsResponse>(DeleteDataItemsResponse.class);
public class ChannelEventParcelable extends AutoSafeParcelable {
public static final Creator<ChannelEventParcelable> CREATOR = new AutoCreator<ChannelEventParcelable>(ChannelEventParcelable.class);
}

View file

@ -16,8 +16,47 @@
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import com.google.android.gms.wearable.DataItemAsset;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class DataItemAssetParcelable extends AutoSafeParcelable implements DataItemAsset {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private String id;
@SafeParceled(3)
private String key;
private DataItemAssetParcelable() {
}
public DataItemAssetParcelable(String id, String key) {
this.id = id;
this.key = key;
}
@Override
public String getDataItemKey() {
return key;
}
@Override
public String getId() {
return id;
}
@Override
public DataItemAsset freeze() {
return this;
}
@Override
public boolean isDataValid() {
return true;
}
public class DataItemAssetParcelable extends AutoSafeParcelable {
public static final Creator<DataItemAssetParcelable> CREATOR = new AutoCreator<DataItemAssetParcelable>(DataItemAssetParcelable.class);
}

View file

@ -29,16 +29,13 @@ public class DataItemParcelable extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final Uri uri;
private Uri uri;
@SafeParceled(4)
private final Bundle assets;
private Bundle assets = new Bundle();
@SafeParceled(5)
public byte[] data;
private DataItemParcelable() {
uri = null;
assets = new Bundle();
data = null;
}
public DataItemParcelable(Uri uri) {
@ -47,7 +44,6 @@ public class DataItemParcelable extends AutoSafeParcelable {
public DataItemParcelable(Uri uri, Map<String, DataItemAssetParcelable> assets) {
this.uri = uri;
this.assets = new Bundle();
for (String key : assets.keySet()) {
this.assets.putParcelable(key, assets.get(key));
}
@ -63,5 +59,9 @@ public class DataItemParcelable extends AutoSafeParcelable {
return assets;
}
public Uri getUri() {
return uri;
}
public static final Creator<DataItemParcelable> CREATOR = new AutoCreator<DataItemParcelable>(DataItemParcelable.class);
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2013-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 org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class DeleteDataItemsResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private int status;
@SafeParceled(3)
private int count;
private DeleteDataItemsResponse() {
}
public DeleteDataItemsResponse(int status, int count) {
this.status = status;
this.count = count;
}
public static final Creator<DeleteDataItemsResponse> CREATOR = new AutoCreator<DeleteDataItemsResponse>(DeleteDataItemsResponse.class);
}

View file

@ -14,7 +14,9 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import com.google.android.gms.wearable.ConnectionConfiguration;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,7 +14,9 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import com.google.android.gms.wearable.ConnectionConfiguration;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,9 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
import com.google.android.gms.wearable.internal.NodeParcelable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,9 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
import com.google.android.gms.wearable.internal.DataItemParcelable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;

View file

@ -14,9 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
import com.google.android.gms.wearable.internal.NodeParcelable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-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 org.microg.safeparcel.AutoSafeParcelable;
public class MessageEventParcelable extends AutoSafeParcelable {
public static final Creator<MessageEventParcelable> CREATOR = new AutoCreator<MessageEventParcelable>(MessageEventParcelable.class);
}

View file

@ -14,14 +14,15 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import com.google.android.gms.wearable.internal.DataItemAssetParcelable;
import com.google.android.gms.wearable.Asset;
import com.google.android.gms.wearable.DataItem;
import org.microg.gms.common.PublicApi;
import org.microg.safeparcel.AutoSafeParcelable;
@ -129,9 +130,9 @@ public class PutDataRequest extends AutoSafeParcelable {
}
public String toString(boolean verbose) {
return "PutDataRequest[data=" + (data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP)) +
", numAssets=" + getAssets().size() +
", uri=" + uri + "]";
return "PutDataRequest[uri=" + uri +
", data=" + (data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP)) +
", numAssets=" + getAssets().size() + "]";
// TODO: Verbose: dump all assets
}

View file

@ -14,9 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
import com.google.android.gms.wearable.internal.DataItemParcelable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,9 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
import com.google.android.gms.wearable.internal.IWearableListener;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.google.android.gms.wearable;
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;

View file

@ -5,7 +5,7 @@ public class Constants {
* This is the highest version that was looked at during development.
* Does not necessarily mean anything.
*/
public static final int MAX_REFERENCE_VERSION = 7099448;
public static final int MAX_REFERENCE_VERSION = 7887000;
public static final String KEY_MOCK_LOCATION = "mockLocation";
public static final String DEFAULT_ACCOUNT = "<<default account>>";
public static final String GMS_PACKAGE_NAME = "com.google.android.gms";