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

Extend Wearable APIs

This commit is contained in:
mar-v-in 2015-11-17 17:16:22 +01:00
parent 4f6a84de9d
commit f0ec7e606f
12 changed files with 159 additions and 7 deletions

View file

@ -15,6 +15,6 @@ interface ICameraUpdateFactoryDelegate {
IObjectWrapper newCameraPosition(in CameraPosition cameraPosition);
IObjectWrapper newLatLng(in LatLng latLng);
IObjectWrapper newLatLngZoom(in LatLng latLng, float zoom);
IObjectWrapper newLatLngBounds(in LatLngBounds bounds, int i);
IObjectWrapper newLatLngBoundsWithSize(in LatLngBounds bounds, int i1, int i2, int i3);
IObjectWrapper newLatLngBounds(in LatLngBounds bounds, int padding);
IObjectWrapper newLatLngBoundsWithSize(in LatLngBounds bounds, int width, int height, int size);
}

View file

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

View file

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

View file

@ -1,6 +1,8 @@
package com.google.android.gms.wearable.internal;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.wearable.internal.AmsEntityUpdateParcelable;
import com.google.android.gms.wearable.internal.AncsNotificationParcelable;
import com.google.android.gms.wearable.internal.CapabilityInfoParcelable;
import com.google.android.gms.wearable.internal.ChannelEventParcelable;
import com.google.android.gms.wearable.internal.MessageEventParcelable;
@ -12,7 +14,8 @@ interface IWearableListener {
void onPeerConnected(in NodeParcelable node) = 2;
void onPeerDisconnected(in NodeParcelable node) = 3;
void onConnectedNodes(in List<NodeParcelable> nodes) = 4;
void onNotificationReceived(in AncsNotificationParcelable notification) = 5;
void onChannelEvent(in ChannelEventParcelable channelEvent) = 6;
void onConnectedCapabilityChanged(in CapabilityInfoParcelable capabilityInfo) = 7;
void onEntityUpdate(in AmsEntityUpdateParcelable update) = 8;
}

View file

@ -18,6 +18,7 @@ interface IWearableService {
void removeListener(IWearableCallbacks callbacks, in RemoveListenerRequest request) = 16;
void putConfig(IWearableCallbacks callbacks, in ConnectionConfiguration config) = 19;
void getConfigs(IWearableCallbacks callbacks) = 21;
void enableConnection(IWearableCallbacks callbacks, String name) = 22;
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;

View file

@ -0,0 +1,42 @@
/*
* Copyright 2013-2015 microG 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.common.PublicApi;
@PublicApi
public interface MessageEvent {
/**
* @return the data passed by the message.
*/
byte[] getData();
/**
* @return the path the message is being delivered to
*/
String getPath();
/**
* @return the request id of the message, generated by the sender
*/
int getRequestId();
/**
* @return the node ID of the sender.
*/
String getSourceNodeId();
}

View file

@ -28,15 +28,19 @@ public class AddListenerRequest extends AutoSafeParcelable {
public final IWearableListener listener;
@SafeParceled(3)
public final IntentFilter[] intentFilters;
@SafeParceled(4)
public final String channelTokenString;
private AddListenerRequest() {
listener = null;
intentFilters = null;
channelTokenString = null;
}
public AddListenerRequest(IWearableListener listener, IntentFilter[] intentFilters) {
public AddListenerRequest(IWearableListener listener, IntentFilter[] intentFilters, String channelTokenString) {
this.listener = listener;
this.intentFilters = intentFilters;
this.channelTokenString = channelTokenString;
}
public static final Creator<AddListenerRequest> CREATOR = new AutoCreator<AddListenerRequest>(AddListenerRequest.class);

View file

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

View file

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

View file

@ -26,7 +26,7 @@ public class GetConnectedNodesResponse extends AutoSafeParcelable {
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
@SafeParceled(value = 3, subClass = NodeParcelable.class)
public final List<NodeParcelable> nodes;
private GetConnectedNodesResponse() {

View file

@ -16,8 +16,53 @@
package com.google.android.gms.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import com.google.android.gms.wearable.MessageEvent;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class MessageEventParcelable extends AutoSafeParcelable implements MessageEvent {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public int requestId;
@SafeParceled(3)
public String path;
@SafeParceled(4)
public byte[] data;
@SafeParceled(5)
public String sourceNodeId;
@Override
public byte[] getData() {
return data;
}
@Override
public String getPath() {
return path;
}
@Override
public int getRequestId() {
return requestId;
}
@Override
public String getSourceNodeId() {
return sourceNodeId;
}
@Override
public String toString() {
return "MessageEventParcelable{" +
"requestId=" + requestId +
", path='" + path + '\'' +
", dataSize=" + (data != null ? data.length : -1) +
", sourceNodeId='" + sourceNodeId + '\'' +
'}';
}
public class MessageEventParcelable extends AutoSafeParcelable {
public static final Creator<MessageEventParcelable> CREATOR = new AutoCreator<MessageEventParcelable>(MessageEventParcelable.class);
}

View file

@ -41,6 +41,11 @@ public class NodeParcelable extends AutoSafeParcelable implements Node {
this.displayName = displayName;
}
public NodeParcelable(Node node) {
this.id = node.getId();
this.displayName = node.getDisplayName();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;