Continue work on Wearable
(+ small fix in maps)
This commit is contained in:
parent
c618221a38
commit
28c11da033
35 changed files with 462 additions and 2458 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -4,3 +4,6 @@
|
|||
[submodule "extern/GmsApi"]
|
||||
path = extern/GmsApi
|
||||
url = https://github.com/microg/android_external_GmsApi.git
|
||||
[submodule "extern/Wearable"]
|
||||
path = extern/Wearable
|
||||
url = https://github.com/microg/android_external_Wearable.git
|
||||
|
|
|
|||
2
extern/GmsApi
vendored
2
extern/GmsApi
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 4f6a84de9d95fef255579c5ce06a89363dc05aa8
|
||||
Subproject commit f0ec7e606f3e6e3a219eb87266c4dae1828b5083
|
||||
1
extern/Wearable
vendored
Submodule
1
extern/Wearable
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e6d59dc062def314cdebf64699b15bb8b6a5eede
|
||||
|
|
@ -39,6 +39,7 @@ dependencies {
|
|||
compile 'com.squareup.wire:wire-runtime:1.6.1'
|
||||
compile project(':play-services-api')
|
||||
compile project(':unifiednlp-base')
|
||||
compile project(':wearable-lib')
|
||||
// vtm from ./libs
|
||||
compile 'org.oscim:vtm-android:0.6.0-SNAPSHOT@aar'
|
||||
compile 'org.oscim:vtm-themes:0.6.0-SNAPSHOT'
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@ package org.microg.gms.maps.camera;
|
|||
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate;
|
||||
import com.google.android.gms.maps.model.CameraPosition;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLngBounds;
|
||||
|
||||
import org.microg.gms.maps.GmsMapsTypeHelper;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.map.Map;
|
||||
|
|
@ -159,7 +161,7 @@ public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int i) throws RemoteException {
|
||||
public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int padding) throws RemoteException {
|
||||
Log.d(TAG, "newLatLngBounds");
|
||||
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
|
||||
@Override
|
||||
|
|
@ -173,9 +175,17 @@ public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IObjectWrapper newLatLngBoundsWithSize(LatLngBounds bounds, int i1, int i2, int i3)
|
||||
public IObjectWrapper newLatLngBoundsWithSize(final LatLngBounds bounds, final int width, final int height, int padding)
|
||||
throws RemoteException {
|
||||
Log.d(TAG, "newLatLngBoundsWithSize");
|
||||
return new ObjectWrapper<CameraUpdate>(new NoCameraUpdate());
|
||||
return new ObjectWrapper<CameraUpdate>(new MapPositionCameraUpdate() {
|
||||
@Override
|
||||
MapPosition getMapPosition(Map map) {
|
||||
MapPosition mapPosition = map.getMapPosition();
|
||||
mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds),
|
||||
width, height);
|
||||
return mapPosition;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ public class DataItemInternal {
|
|||
this.uri = new Uri.Builder().scheme("wear").authority(host).path(path).build();
|
||||
}
|
||||
|
||||
public DataItemInternal(Uri uri) {
|
||||
this.uri = uri;
|
||||
this.host = uri.getAuthority();
|
||||
this.path = uri.getPath();
|
||||
}
|
||||
|
||||
public DataItemInternal addAsset(String key, Asset asset) {
|
||||
this.assets.put(key, asset);
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,15 @@ package org.microg.gms.wearable;
|
|||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.google.android.gms.wearable.Asset;
|
||||
import com.google.android.gms.wearable.internal.DataItemAssetParcelable;
|
||||
import com.google.android.gms.wearable.internal.DataItemParcelable;
|
||||
|
||||
import org.microg.wearable.proto.AssetEntry;
|
||||
import org.microg.wearable.proto.SetDataItem;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DataItemRecord {
|
||||
|
|
@ -76,4 +80,23 @@ public class DataItemRecord {
|
|||
record.assetsAreReady = cursor.getLong(10) > 0;
|
||||
return record;
|
||||
}
|
||||
|
||||
public static DataItemRecord fromSetDataItem(SetDataItem setDataItem) {
|
||||
DataItemRecord record = new DataItemRecord();
|
||||
record.dataItem = new DataItemInternal(Uri.parse(setDataItem.uri));
|
||||
if (setDataItem.data != null) record.dataItem.data = setDataItem.data.toByteArray();
|
||||
if (setDataItem.assets != null) {
|
||||
for (AssetEntry asset : setDataItem.assets) {
|
||||
// TODO record.dataItem.addAsset(asset.key, asset.value)
|
||||
}
|
||||
}
|
||||
record.source = setDataItem.source;
|
||||
record.seqId = setDataItem.seqId;
|
||||
record.v1SeqId = -1;
|
||||
record.lastModified = setDataItem.lastModified;
|
||||
record.deleted = setDataItem.deleted == null ? false : setDataItem.deleted;
|
||||
record.packageName = setDataItem.packageName;
|
||||
record.signatureDigest = setDataItem.signatureDigest;
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* 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 org.microg.gms.wearable;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.wearable.ConnectionConfiguration;
|
||||
import com.google.android.gms.wearable.internal.MessageEventParcelable;
|
||||
import com.google.android.gms.wearable.internal.NodeParcelable;
|
||||
|
||||
import org.microg.gms.checkin.LastCheckinInfo;
|
||||
import org.microg.gms.common.Build;
|
||||
import org.microg.wearable.ServerMessageListener;
|
||||
import org.microg.wearable.proto.AckAsset;
|
||||
import org.microg.wearable.proto.Connect;
|
||||
import org.microg.wearable.proto.FetchAsset;
|
||||
import org.microg.wearable.proto.FilePiece;
|
||||
import org.microg.wearable.proto.Heartbeat;
|
||||
import org.microg.wearable.proto.Request;
|
||||
import org.microg.wearable.proto.RootMessage;
|
||||
import org.microg.wearable.proto.SetAsset;
|
||||
import org.microg.wearable.proto.SetDataItem;
|
||||
import org.microg.wearable.proto.SyncStart;
|
||||
import org.microg.wearable.proto.SyncTableEntry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MessageHandler extends ServerMessageListener {
|
||||
private static final String TAG = "GmsWearMsgHandler";
|
||||
private final WearableServiceImpl service;
|
||||
private final ConnectionConfiguration config;
|
||||
|
||||
public MessageHandler(WearableServiceImpl service, ConnectionConfiguration config) {
|
||||
this(service, config, new Build().model, config.nodeId, LastCheckinInfo.read(service.getContext()).androidId);
|
||||
}
|
||||
|
||||
private MessageHandler(WearableServiceImpl service, ConnectionConfiguration config, String name, String networkId, long androidId) {
|
||||
super(new Connect.Builder()
|
||||
.name(name)
|
||||
.id(config.nodeId)
|
||||
.networkId(networkId)
|
||||
.peerAndroidId(androidId)
|
||||
.unknown4(3)
|
||||
.unknown5(1)
|
||||
.build());
|
||||
this.service = service;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnect(Connect connect) {
|
||||
super.onConnect(connect);
|
||||
config.peerNodeId = connect.id;
|
||||
config.connected = true;
|
||||
service.onPeerConnected(new NodeParcelable(connect.id, connect.name));
|
||||
try {
|
||||
getConnection().writeMessage(new RootMessage.Builder().syncStart(new SyncStart.Builder()
|
||||
.receivedSeqId(-1L)
|
||||
.version(2)
|
||||
.syncTable(Arrays.asList(
|
||||
new SyncTableEntry.Builder().key("cloud").value(1L).build(),
|
||||
new SyncTableEntry.Builder().key(config.nodeId).value(service.getCurrentSeqId(config.nodeId)).build(), // TODO
|
||||
new SyncTableEntry.Builder().key(config.peerNodeId).value(service.getCurrentSeqId(config.peerNodeId)).build() // TODO
|
||||
)).build()).build());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetAsset(SetAsset setAsset) {
|
||||
Log.d(TAG, "onSetAsset: " + setAsset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAckAsset(AckAsset ackAsset) {
|
||||
Log.d(TAG, "onAckAsset: " + ackAsset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFetchAsset(FetchAsset fetchAsset) {
|
||||
Log.d(TAG, "onFetchAsset: " + fetchAsset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncStart(SyncStart syncStart) {
|
||||
Log.d(TAG, "onSyncStart: " + syncStart);
|
||||
if (syncStart.version < 2) {
|
||||
Log.d(TAG, "Sync uses version " + syncStart.version + " which is not supported (yet)");
|
||||
}
|
||||
if (syncStart.syncTable != null) {
|
||||
for (SyncTableEntry entry : syncStart.syncTable) {
|
||||
service.syncToPeer(getConnection(), entry.key, entry.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetDataItem(SetDataItem setDataItem) {
|
||||
Log.d(TAG, "onSetDataItem: " + setDataItem);
|
||||
service.putDataItem(DataItemRecord.fromSetDataItem(setDataItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRcpRequest(Request rcpRequest) {
|
||||
Log.d(TAG, "onRcpRequest: " + rcpRequest);
|
||||
if (TextUtils.isEmpty(rcpRequest.targetNodeId)) {
|
||||
// TODO: That's probably not how it should go!
|
||||
MessageEventParcelable messageEvent = new MessageEventParcelable();
|
||||
messageEvent.data = rcpRequest.rawData != null ? rcpRequest.rawData.toByteArray() : null;
|
||||
messageEvent.path = rcpRequest.path;
|
||||
messageEvent.requestId = rcpRequest.requestId + 31 * (rcpRequest.generation + 527);
|
||||
messageEvent.sourceNodeId = TextUtils.isEmpty(rcpRequest.sourceNodeId) ? config.peerNodeId : rcpRequest.sourceNodeId;
|
||||
|
||||
service.onMessageReceived(messageEvent);
|
||||
} else if (rcpRequest.targetNodeId.equals(config.peerNodeId)) {
|
||||
// Drop it, loop detection (yes we really need this in this protocol o.O)
|
||||
} else {
|
||||
// TODO: find next hop (yes, wtf hops in a network usually consisting of two devices)
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHearbeat(Heartbeat heartbeat) {
|
||||
Log.d(TAG, "onHearbeat: " + heartbeat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFilePiece(FilePiece filePiece) {
|
||||
Log.d(TAG, "onFilePiece: " + filePiece);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelRequest(Request channelRequest) {
|
||||
Log.d(TAG, "onChannelRequest:" + channelRequest);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* 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 org.microg.gms.wearable;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.wearable.ConnectionConfiguration;
|
||||
|
||||
import org.microg.wearable.SocketWearableConnection;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
class NetworkConnectionThread extends Thread {
|
||||
private static final String TAG = "GmsWearNetConnThr";
|
||||
private static final int WEAR_TCP_PORT = 5601;
|
||||
|
||||
private ConnectionConfiguration config;
|
||||
private ServerSocket socket;
|
||||
private MessageHandler handler;
|
||||
|
||||
public NetworkConnectionThread(WearableServiceImpl service, ConnectionConfiguration config) {
|
||||
this.config = config;
|
||||
this.handler = new MessageHandler(service, config);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
socket = new ServerSocket(WEAR_TCP_PORT);
|
||||
Log.d(TAG, "Listening for connections on TCP :" + WEAR_TCP_PORT);
|
||||
Socket accepted = socket.accept();
|
||||
new SocketWearableConnection(accepted, handler).run();
|
||||
Log.d(TAG, "Connection terminated, me too");
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -187,6 +187,11 @@ public class NodeDatabaseHelper extends SQLiteOpenHelper {
|
|||
return db.query("dataItemsAndAssets", GDIBHAP_FIELDS, selection, params, null, null, "packageName, signatureDigest, host, path");
|
||||
}
|
||||
|
||||
public Cursor getModifiedDataItems(final String nodeId, final long seqId, final boolean excludeDeleted) {
|
||||
String selection = "sourceNode =? AND seqId >?" + (excludeDeleted ? "AND deleted =0" : "");
|
||||
return getReadableDatabase().query("dataItemsAndAssets", GDIBHAP_FIELDS, selection, new String[]{nodeId, Long.toString(seqId)}, null, null, "seqId", null);
|
||||
}
|
||||
|
||||
public synchronized int deleteDataItems(String packageName, String signatureDigest, String host, String path) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
db.beginTransaction();
|
||||
|
|
@ -204,4 +209,17 @@ public class NodeDatabaseHelper extends SQLiteOpenHelper {
|
|||
db.endTransaction();
|
||||
return n;
|
||||
}
|
||||
|
||||
public long getCurrentSeqId(String sourceNode) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
Cursor cursor = db.query("dataItemsAndAssets", new String[]{"seqId"}, "sourceNode=?", new String[]{sourceNode}, null, null, "seqId DESC", "1");
|
||||
long res = 1;
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
res = cursor.getLong(0);
|
||||
}
|
||||
cursor.close();;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,28 +28,35 @@ import android.util.Log;
|
|||
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.data.DataHolder;
|
||||
import com.google.android.gms.wearable.internal.AddListenerRequest;
|
||||
import com.google.android.gms.wearable.Asset;
|
||||
import com.google.android.gms.wearable.ConnectionConfiguration;
|
||||
import com.google.android.gms.wearable.Node;
|
||||
import com.google.android.gms.wearable.internal.AddListenerRequest;
|
||||
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.DataItemParcelable;
|
||||
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.GetLocalNodeResponse;
|
||||
import com.google.android.gms.wearable.internal.IWearableCallbacks;
|
||||
import com.google.android.gms.wearable.internal.IWearableListener;
|
||||
import com.google.android.gms.wearable.internal.IWearableService;
|
||||
import com.google.android.gms.wearable.internal.MessageEventParcelable;
|
||||
import com.google.android.gms.wearable.internal.NodeParcelable;
|
||||
import com.google.android.gms.wearable.internal.PutDataRequest;
|
||||
import com.google.android.gms.wearable.internal.PutDataResponse;
|
||||
import com.google.android.gms.wearable.internal.RemoveListenerRequest;
|
||||
import com.google.android.gms.wearable.internal.DataItemParcelable;
|
||||
import com.google.android.gms.wearable.internal.IWearableCallbacks;
|
||||
import com.google.android.gms.wearable.internal.IWearableService;
|
||||
import com.google.android.gms.wearable.internal.NodeParcelable;
|
||||
|
||||
import org.microg.gms.common.PackageUtils;
|
||||
import org.microg.wearable.WearableConnection;
|
||||
import org.microg.wearable.proto.AssetEntry;
|
||||
import org.microg.wearable.proto.RootMessage;
|
||||
import org.microg.wearable.proto.SetDataItem;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -63,6 +70,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import okio.ByteString;
|
||||
|
||||
public class WearableServiceImpl extends IWearableService.Stub implements IWearableListener {
|
||||
private static final String TAG = "GmsWearSvcImpl";
|
||||
|
||||
|
|
@ -75,6 +84,10 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
private final NodeDatabaseHelper nodeDatabase;
|
||||
private final ConfigurationDatabaseHelper configDatabase;
|
||||
private Set<IWearableListener> listeners = new HashSet<IWearableListener>();
|
||||
private Set<Node> connectedNodes = new HashSet<Node>();
|
||||
private ConnectionConfiguration[] configurations;
|
||||
private boolean configurationsUpdated = false;
|
||||
private NetworkConnectionThread nct;
|
||||
|
||||
private long seqIdBlock;
|
||||
private long seqIdInBlock = -1;
|
||||
|
|
@ -125,7 +138,7 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
callbacks.onPutDataResponse(new PutDataResponse(0, parcelable));
|
||||
}
|
||||
|
||||
private DataItemRecord putDataItem(String packageName, String signatureDigest, String source, DataItemInternal dataItem) {
|
||||
public DataItemRecord putDataItem(String packageName, String signatureDigest, String source, DataItemInternal dataItem) {
|
||||
DataItemRecord record = new DataItemRecord();
|
||||
record.packageName = packageName;
|
||||
record.signatureDigest = signatureDigest;
|
||||
|
|
@ -134,6 +147,10 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
record.dataItem = dataItem;
|
||||
record.v1SeqId = getNextSeqId();
|
||||
if (record.source.equals(getLocalNodeId())) record.seqId = record.v1SeqId;
|
||||
return putDataItem(record);
|
||||
}
|
||||
|
||||
public DataItemRecord putDataItem(DataItemRecord record) {
|
||||
nodeDatabase.putRecord(record);
|
||||
return record;
|
||||
}
|
||||
|
|
@ -231,8 +248,16 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
|
||||
@Override
|
||||
public void getConnectedNodes(IWearableCallbacks callbacks) throws RemoteException {
|
||||
Log.d(TAG, "getConnectedNodes[fak]");
|
||||
callbacks.onGetConnectedNodesResponse(new GetConnectedNodesResponse(0, new ArrayList<NodeParcelable>()));
|
||||
Log.d(TAG, "getConnectedNodes");
|
||||
callbacks.onGetConnectedNodesResponse(new GetConnectedNodesResponse(0, getConnectedNodesParcelableList()));
|
||||
}
|
||||
|
||||
private List<NodeParcelable> getConnectedNodesParcelableList() {
|
||||
List<NodeParcelable> nodes = new ArrayList<NodeParcelable>();
|
||||
for (Node connectedNode : connectedNodes) {
|
||||
nodes.add(new NodeParcelable(connectedNode));
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -253,13 +278,14 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
public void putConfig(IWearableCallbacks callbacks, ConnectionConfiguration config) throws RemoteException {
|
||||
Log.d(TAG, "putConfig[nyp]: " + config);
|
||||
configDatabase.putConfiguration(config);
|
||||
configurationsUpdated = true;
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getConfig(IWearableCallbacks callbacks) throws RemoteException {
|
||||
Log.d(TAG, "getConfig");
|
||||
ConnectionConfiguration[] configurations = configDatabase.getAllConfigurations();
|
||||
ConnectionConfiguration[] configurations = getConfigurations();
|
||||
if (configurations == null || configurations.length == 0) {
|
||||
callbacks.onGetConfigResponse(new GetConfigResponse(1, new ConnectionConfiguration(null, null, 0, 0, false)));
|
||||
} else {
|
||||
|
|
@ -271,16 +297,59 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
public void getConfigs(IWearableCallbacks callbacks) throws RemoteException {
|
||||
Log.d(TAG, "getConfigs");
|
||||
try {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, configDatabase.getAllConfigurations()));
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, getConfigurations()));
|
||||
} catch (Exception e) {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(8, new ConnectionConfiguration[0]));
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized ConnectionConfiguration[] getConfigurations() {
|
||||
if (configurations == null) {
|
||||
configurations = configDatabase.getAllConfigurations();
|
||||
}
|
||||
if (configurationsUpdated) {
|
||||
configurationsUpdated = false;
|
||||
ConnectionConfiguration[] newConfigurations = configDatabase.getAllConfigurations();
|
||||
for (ConnectionConfiguration configuration : configurations) {
|
||||
for (ConnectionConfiguration newConfiguration : newConfigurations) {
|
||||
if (newConfiguration.name.equals(configuration.name)) {
|
||||
newConfiguration.connected = configuration.connected;
|
||||
newConfiguration.peerNodeId = configuration.peerNodeId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
configurations = newConfigurations;
|
||||
}
|
||||
return configurations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableConnection(IWearableCallbacks callbacks, String name) throws RemoteException {
|
||||
Log.d(TAG, "enableConnection: " + name);
|
||||
configDatabase.setEnabledState(name, true);
|
||||
configurationsUpdated = true;
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
if (name.equals("server")) {
|
||||
// TODO: hackady hack
|
||||
(nct = new NetworkConnectionThread(this, configDatabase.getConfiguration(name))).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableConnection(IWearableCallbacks callbacks, String name) throws RemoteException {
|
||||
Log.d(TAG, "disableConnection: " + name);
|
||||
configDatabase.setEnabledState(name, false);
|
||||
configurationsUpdated = true;
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
if (name.equals("server")) {
|
||||
// TODO: hacady hack
|
||||
if (nct != null) {
|
||||
nct.close();
|
||||
nct.interrupt();
|
||||
nct = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -298,17 +367,45 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(MessageEventParcelable messageEvent) throws RemoteException {
|
||||
for (IWearableListener listener : listeners) {
|
||||
listener.onMessageReceived(messageEvent);
|
||||
public void onMessageReceived(MessageEventParcelable messageEvent) {
|
||||
Log.d(TAG, "onMessageReceived: " + messageEvent);
|
||||
for (IWearableListener listener : new ArrayList<IWearableListener>(listeners)) {
|
||||
try {
|
||||
listener.onMessageReceived(messageEvent);
|
||||
} catch (RemoteException e) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPeerConnected(NodeParcelable node) throws RemoteException {
|
||||
for (IWearableListener listener : listeners) {
|
||||
listener.onPeerConnected(node);
|
||||
public void onPeerConnected(NodeParcelable node) {
|
||||
Log.d(TAG, "onPeerConnected: " + node);
|
||||
for (IWearableListener listener : new ArrayList<IWearableListener>(listeners)) {
|
||||
try {
|
||||
listener.onPeerConnected(node);
|
||||
} catch (RemoteException e) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
addConnectedNode(node);
|
||||
}
|
||||
|
||||
private void addConnectedNode(Node node) {
|
||||
connectedNodes.add(node);
|
||||
onConnectedNodes(getConnectedNodesParcelableList());
|
||||
}
|
||||
|
||||
private void removeConnectedNode(String nodeId) {
|
||||
Node toRemove = null;
|
||||
for (Node node : connectedNodes) {
|
||||
if (node.getId().equals(nodeId)) {
|
||||
toRemove = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
connectedNodes.remove(toRemove);
|
||||
onConnectedNodes(getConnectedNodesParcelableList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -319,9 +416,21 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onConnectedNodes(List<NodeParcelable> nodes) throws RemoteException {
|
||||
public void onConnectedNodes(List<NodeParcelable> nodes) {
|
||||
Log.d(TAG, "onConnectedNodes: " + nodes);
|
||||
for (IWearableListener listener : listeners) {
|
||||
listener.onConnectedNodes(nodes);
|
||||
try {
|
||||
listener.onConnectedNodes(nodes);
|
||||
} catch (RemoteException e) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationReceived(AncsNotificationParcelable notification) throws RemoteException {
|
||||
for (IWearableListener listener : listeners) {
|
||||
listener.onNotificationReceived(notification);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,4 +447,55 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara
|
|||
listener.onConnectedCapabilityChanged(capabilityInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityUpdate(AmsEntityUpdateParcelable update) throws RemoteException {
|
||||
for (IWearableListener listener : listeners) {
|
||||
listener.onEntityUpdate(update);
|
||||
}
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void syncToPeer(WearableConnection connection, String nodeId, long seqId) {
|
||||
Cursor cursor = nodeDatabase.getModifiedDataItems(nodeId, seqId, true);
|
||||
if (cursor != null) {
|
||||
while (cursor.moveToNext()) {
|
||||
DataItemRecord record = DataItemRecord.fromCursor(cursor);
|
||||
SetDataItem.Builder builder = new SetDataItem.Builder()
|
||||
.packageName(record.packageName)
|
||||
.signatureDigest(record.signatureDigest)
|
||||
.uri(record.dataItem.uri.toString())
|
||||
.seqId(record.seqId)
|
||||
.deleted(record.deleted)
|
||||
.lastModified(record.lastModified);
|
||||
if (record.source != null) builder.source(record.source);
|
||||
if (record.dataItem.data != null) builder.data(ByteString.of(record.dataItem.data));
|
||||
List<AssetEntry> protoAssets = new ArrayList<AssetEntry>();
|
||||
Map<String, Asset> assets = record.dataItem.getAssets();
|
||||
for (String key : assets.keySet()) {
|
||||
protoAssets.add(new AssetEntry.Builder()
|
||||
.key(key)
|
||||
.unknown3(4)
|
||||
.value(new org.microg.wearable.proto.Asset.Builder()
|
||||
.digest(assets.get(key).getDigest())
|
||||
.build()).build());
|
||||
}
|
||||
builder.assets(protoAssets);
|
||||
try {
|
||||
connection.writeMessage(new RootMessage.Builder().setDataItem(builder.build()).build());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public long getCurrentSeqId(String nodeId) {
|
||||
return nodeDatabase.getCurrentSeqId(nodeId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.STRING;
|
||||
|
||||
public final class AckAsset extends Message {
|
||||
|
||||
public static final String DEFAULT_DIGEST = "";
|
||||
|
||||
@ProtoField(tag = 1, type = STRING)
|
||||
public final String digest;
|
||||
|
||||
public AckAsset(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
private AckAsset(Builder builder) {
|
||||
this(builder.digest);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof AckAsset)) return false;
|
||||
return equals(digest, ((AckAsset) other).digest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
return result != 0 ? result : (hashCode = digest != null ? digest.hashCode() : 0);
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<AckAsset> {
|
||||
|
||||
public String digest;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(AckAsset message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.digest = message.digest;
|
||||
}
|
||||
|
||||
public Builder digest(String digest) {
|
||||
this.digest = digest;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AckAsset build() {
|
||||
return new AckAsset(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.STRING;
|
||||
|
||||
public final class AppKey extends Message {
|
||||
|
||||
public static final String DEFAULT_PACKAGENAME = "";
|
||||
public static final String DEFAULT_SIGNATUREDIGEST = "";
|
||||
|
||||
@ProtoField(tag = 1, type = STRING)
|
||||
public final String packageName;
|
||||
|
||||
@ProtoField(tag = 2, type = STRING)
|
||||
public final String signatureDigest;
|
||||
|
||||
public AppKey(String packageName, String signatureDigest) {
|
||||
this.packageName = packageName;
|
||||
this.signatureDigest = signatureDigest;
|
||||
}
|
||||
|
||||
private AppKey(Builder builder) {
|
||||
this(builder.packageName, builder.signatureDigest);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof AppKey)) return false;
|
||||
AppKey o = (AppKey) other;
|
||||
return equals(packageName, o.packageName)
|
||||
&& equals(signatureDigest, o.signatureDigest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = packageName != null ? packageName.hashCode() : 0;
|
||||
result = result * 37 + (signatureDigest != null ? signatureDigest.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<AppKey> {
|
||||
|
||||
public String packageName;
|
||||
public String signatureDigest;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(AppKey message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.packageName = message.packageName;
|
||||
this.signatureDigest = message.signatureDigest;
|
||||
}
|
||||
|
||||
public Builder packageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signatureDigest(String signatureDigest) {
|
||||
this.signatureDigest = signatureDigest;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppKey build() {
|
||||
return new AppKey(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.squareup.wire.Message.Label.REPEATED;
|
||||
|
||||
public final class AppKeys extends Message {
|
||||
|
||||
public static final List<AppKey> DEFAULT_APPKEYS = Collections.emptyList();
|
||||
|
||||
@ProtoField(tag = 1, label = REPEATED, messageType = AppKey.class)
|
||||
public final List<AppKey> appKeys;
|
||||
|
||||
public AppKeys(List<AppKey> appKeys) {
|
||||
this.appKeys = immutableCopyOf(appKeys);
|
||||
}
|
||||
|
||||
private AppKeys(Builder builder) {
|
||||
this(builder.appKeys);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof AppKeys)) return false;
|
||||
return equals(appKeys, ((AppKeys) other).appKeys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
return result != 0 ? result : (hashCode = appKeys != null ? appKeys.hashCode() : 1);
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<AppKeys> {
|
||||
|
||||
public List<AppKey> appKeys;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(AppKeys message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.appKeys = copyOf(message.appKeys);
|
||||
}
|
||||
|
||||
public Builder appKeys(List<AppKey> appKeys) {
|
||||
this.appKeys = checkForNulls(appKeys);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppKeys build() {
|
||||
return new AppKeys(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
|
||||
public final class Asset extends Message {
|
||||
|
||||
public Asset() {
|
||||
}
|
||||
|
||||
private Asset(Builder builder) {
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return other instanceof Asset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<Asset> {
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(Asset message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Asset build() {
|
||||
return new Asset(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.INT32;
|
||||
import static com.squareup.wire.Message.Datatype.STRING;
|
||||
|
||||
public final class AssetEntry extends Message {
|
||||
|
||||
public static final String DEFAULT_KEY = "";
|
||||
public static final Integer DEFAULT_UNKNOWN3 = 0;
|
||||
|
||||
@ProtoField(tag = 1, type = STRING)
|
||||
public final String key;
|
||||
|
||||
@ProtoField(tag = 2)
|
||||
public final Asset value;
|
||||
|
||||
@ProtoField(tag = 3, type = INT32)
|
||||
public final Integer unknown3;
|
||||
|
||||
public AssetEntry(String key, Asset value, Integer unknown3) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.unknown3 = unknown3;
|
||||
}
|
||||
|
||||
private AssetEntry(Builder builder) {
|
||||
this(builder.key, builder.value, builder.unknown3);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof AssetEntry)) return false;
|
||||
AssetEntry o = (AssetEntry) other;
|
||||
return equals(key, o.key)
|
||||
&& equals(value, o.value)
|
||||
&& equals(unknown3, o.unknown3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = key != null ? key.hashCode() : 0;
|
||||
result = result * 37 + (value != null ? value.hashCode() : 0);
|
||||
result = result * 37 + (unknown3 != null ? unknown3.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<AssetEntry> {
|
||||
|
||||
public String key;
|
||||
public Asset value;
|
||||
public Integer unknown3;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(AssetEntry message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.key = message.key;
|
||||
this.value = message.value;
|
||||
this.unknown3 = message.unknown3;
|
||||
}
|
||||
|
||||
public Builder key(String key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder value(Asset value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder unknown3(Integer unknown3) {
|
||||
this.unknown3 = unknown3;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetEntry build() {
|
||||
return new AssetEntry(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.BOOL;
|
||||
import static com.squareup.wire.Message.Datatype.INT32;
|
||||
import static com.squareup.wire.Message.Datatype.INT64;
|
||||
import static com.squareup.wire.Message.Datatype.STRING;
|
||||
|
||||
public final class ChannelControlRequest extends Message {
|
||||
|
||||
public static final Integer DEFAULT_TYPE = 0;
|
||||
public static final Long DEFAULT_CHANNELID = 0L;
|
||||
public static final Boolean DEFAULT_FROMCHANNELOPERATOR = false;
|
||||
public static final String DEFAULT_PACKAGENAME = "";
|
||||
public static final String DEFAULT_SIGNATUREDIGEST = "";
|
||||
public static final String DEFAULT_PATH = "";
|
||||
public static final Integer DEFAULT_CLOSEERRORCODE = 0;
|
||||
|
||||
@ProtoField(tag = 1, type = INT32)
|
||||
public final Integer type;
|
||||
|
||||
@ProtoField(tag = 2, type = INT64)
|
||||
public final Long channelId;
|
||||
|
||||
@ProtoField(tag = 3, type = BOOL)
|
||||
public final Boolean fromChannelOperator;
|
||||
|
||||
@ProtoField(tag = 4, type = STRING)
|
||||
public final String packageName;
|
||||
|
||||
@ProtoField(tag = 5, type = STRING)
|
||||
public final String signatureDigest;
|
||||
|
||||
@ProtoField(tag = 6, type = STRING)
|
||||
public final String path;
|
||||
|
||||
@ProtoField(tag = 7, type = INT32)
|
||||
public final Integer closeErrorCode;
|
||||
|
||||
public ChannelControlRequest(Integer type, Long channelId, Boolean fromChannelOperator, String packageName, String signatureDigest, String path, Integer closeErrorCode) {
|
||||
this.type = type;
|
||||
this.channelId = channelId;
|
||||
this.fromChannelOperator = fromChannelOperator;
|
||||
this.packageName = packageName;
|
||||
this.signatureDigest = signatureDigest;
|
||||
this.path = path;
|
||||
this.closeErrorCode = closeErrorCode;
|
||||
}
|
||||
|
||||
private ChannelControlRequest(Builder builder) {
|
||||
this(builder.type, builder.channelId, builder.fromChannelOperator, builder.packageName, builder.signatureDigest, builder.path, builder.closeErrorCode);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof ChannelControlRequest)) return false;
|
||||
ChannelControlRequest o = (ChannelControlRequest) other;
|
||||
return equals(type, o.type)
|
||||
&& equals(channelId, o.channelId)
|
||||
&& equals(fromChannelOperator, o.fromChannelOperator)
|
||||
&& equals(packageName, o.packageName)
|
||||
&& equals(signatureDigest, o.signatureDigest)
|
||||
&& equals(path, o.path)
|
||||
&& equals(closeErrorCode, o.closeErrorCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = type != null ? type.hashCode() : 0;
|
||||
result = result * 37 + (channelId != null ? channelId.hashCode() : 0);
|
||||
result = result * 37 + (fromChannelOperator != null ? fromChannelOperator.hashCode() : 0);
|
||||
result = result * 37 + (packageName != null ? packageName.hashCode() : 0);
|
||||
result = result * 37 + (signatureDigest != null ? signatureDigest.hashCode() : 0);
|
||||
result = result * 37 + (path != null ? path.hashCode() : 0);
|
||||
result = result * 37 + (closeErrorCode != null ? closeErrorCode.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<ChannelControlRequest> {
|
||||
|
||||
public Integer type;
|
||||
public Long channelId;
|
||||
public Boolean fromChannelOperator;
|
||||
public String packageName;
|
||||
public String signatureDigest;
|
||||
public String path;
|
||||
public Integer closeErrorCode;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(ChannelControlRequest message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.type = message.type;
|
||||
this.channelId = message.channelId;
|
||||
this.fromChannelOperator = message.fromChannelOperator;
|
||||
this.packageName = message.packageName;
|
||||
this.signatureDigest = message.signatureDigest;
|
||||
this.path = message.path;
|
||||
this.closeErrorCode = message.closeErrorCode;
|
||||
}
|
||||
|
||||
public Builder type(Integer type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder channelId(Long channelId) {
|
||||
this.channelId = channelId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fromChannelOperator(Boolean fromChannelOperator) {
|
||||
this.fromChannelOperator = fromChannelOperator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder packageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signatureDigest(String signatureDigest) {
|
||||
this.signatureDigest = signatureDigest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder path(String path) {
|
||||
this.path = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder closeErrorCode(Integer closeErrorCode) {
|
||||
this.closeErrorCode = closeErrorCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelControlRequest build() {
|
||||
return new ChannelControlRequest(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.BOOL;
|
||||
|
||||
public final class ChannelDataAckRequest extends Message {
|
||||
|
||||
public static final Boolean DEFAULT_FINALMESSAGE = false;
|
||||
|
||||
@ProtoField(tag = 1)
|
||||
public final ChannelDataHeader header;
|
||||
|
||||
@ProtoField(tag = 2, type = BOOL)
|
||||
public final Boolean finalMessage;
|
||||
|
||||
public ChannelDataAckRequest(ChannelDataHeader header, Boolean finalMessage) {
|
||||
this.header = header;
|
||||
this.finalMessage = finalMessage;
|
||||
}
|
||||
|
||||
private ChannelDataAckRequest(Builder builder) {
|
||||
this(builder.header, builder.finalMessage);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof ChannelDataAckRequest)) return false;
|
||||
ChannelDataAckRequest o = (ChannelDataAckRequest) other;
|
||||
return equals(header, o.header)
|
||||
&& equals(finalMessage, o.finalMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = header != null ? header.hashCode() : 0;
|
||||
result = result * 37 + (finalMessage != null ? finalMessage.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<ChannelDataAckRequest> {
|
||||
|
||||
public ChannelDataHeader header;
|
||||
public Boolean finalMessage;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(ChannelDataAckRequest message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.header = message.header;
|
||||
this.finalMessage = message.finalMessage;
|
||||
}
|
||||
|
||||
public Builder header(ChannelDataHeader header) {
|
||||
this.header = header;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder finalMessage(Boolean finalMessage) {
|
||||
this.finalMessage = finalMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelDataAckRequest build() {
|
||||
return new ChannelDataAckRequest(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.BOOL;
|
||||
import static com.squareup.wire.Message.Datatype.INT64;
|
||||
|
||||
public final class ChannelDataHeader extends Message {
|
||||
|
||||
public static final Long DEFAULT_CHANNELID = 0L;
|
||||
public static final Boolean DEFAULT_FROMCHANNELOPERATOR = false;
|
||||
public static final Long DEFAULT_UNKNOWN3 = 0L;
|
||||
|
||||
@ProtoField(tag = 1, type = INT64)
|
||||
public final Long channelId;
|
||||
|
||||
@ProtoField(tag = 2, type = BOOL)
|
||||
public final Boolean fromChannelOperator;
|
||||
|
||||
@ProtoField(tag = 3, type = INT64)
|
||||
public final Long unknown3;
|
||||
|
||||
public ChannelDataHeader(Long channelId, Boolean fromChannelOperator, Long unknown3) {
|
||||
this.channelId = channelId;
|
||||
this.fromChannelOperator = fromChannelOperator;
|
||||
this.unknown3 = unknown3;
|
||||
}
|
||||
|
||||
private ChannelDataHeader(Builder builder) {
|
||||
this(builder.channelId, builder.fromChannelOperator, builder.unknown3);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof ChannelDataHeader)) return false;
|
||||
ChannelDataHeader o = (ChannelDataHeader) other;
|
||||
return equals(channelId, o.channelId)
|
||||
&& equals(fromChannelOperator, o.fromChannelOperator)
|
||||
&& equals(unknown3, o.unknown3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = channelId != null ? channelId.hashCode() : 0;
|
||||
result = result * 37 + (fromChannelOperator != null ? fromChannelOperator.hashCode() : 0);
|
||||
result = result * 37 + (unknown3 != null ? unknown3.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<ChannelDataHeader> {
|
||||
|
||||
public Long channelId;
|
||||
public Boolean fromChannelOperator;
|
||||
public Long unknown3;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(ChannelDataHeader message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.channelId = message.channelId;
|
||||
this.fromChannelOperator = message.fromChannelOperator;
|
||||
this.unknown3 = message.unknown3;
|
||||
}
|
||||
|
||||
public Builder channelId(Long channelId) {
|
||||
this.channelId = channelId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fromChannelOperator(Boolean fromChannelOperator) {
|
||||
this.fromChannelOperator = fromChannelOperator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder unknown3(Long unknown3) {
|
||||
this.unknown3 = unknown3;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelDataHeader build() {
|
||||
return new ChannelDataHeader(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||
// Source file: protos-repo/wearable.proto
|
||||
package org.microg.gms.wearable;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.ProtoField;
|
||||
import okio.ByteString;
|
||||
|
||||
import static com.squareup.wire.Message.Datatype.BOOL;
|
||||
import static com.squareup.wire.Message.Datatype.BYTES;
|
||||
|
||||
public final class ChannelDataRequest extends Message {
|
||||
|
||||
public static final ByteString DEFAULT_PAYLOAD = ByteString.EMPTY;
|
||||
public static final Boolean DEFAULT_FINALMESSAGE = false;
|
||||
|
||||
@ProtoField(tag = 1)
|
||||
public final ChannelDataHeader header;
|
||||
|
||||
@ProtoField(tag = 2, type = BYTES)
|
||||
public final ByteString payload;
|
||||
|
||||
@ProtoField(tag = 3, type = BOOL)
|
||||
public final Boolean finalMessage;
|
||||
|
||||
public ChannelDataRequest(ChannelDataHeader header, ByteString payload, Boolean finalMessage) {
|
||||
this.header = header;
|
||||
this.payload = payload;
|
||||
this.finalMessage = finalMessage;
|
||||
}
|
||||
|
||||
private ChannelDataRequest(Builder builder) {
|
||||
this(builder.header, builder.payload, builder.finalMessage);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == this) return true;
|
||||
if (!(other instanceof ChannelDataRequest)) return false;
|
||||
ChannelDataRequest o = (ChannelDataRequest) other;
|
||||
return equals(header, o.header)
|
||||
&& equals(payload, o.payload)
|
||||
&& equals(finalMessage, o.finalMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = hashCode;
|
||||
if (result == 0) {
|
||||
result = header != null ? header.hashCode() : 0;
|
||||
result = result * 37 + (payload != null ? payload.hashCode() : 0);
|
||||
result = result * 37 + (finalMessage != null ? finalMessage.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final class Builder extends Message.Builder<ChannelDataRequest> {
|
||||
|
||||
public ChannelDataHeader header;
|
||||
public ByteString payload;
|
||||
public Boolean finalMessage;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder(ChannelDataRequest message) {
|
||||
super(message);
|
||||
if (message == null) return;
|
||||
this.header = message.header;
|
||||
this.payload = message.payload;
|
||||
this.finalMessage = message.finalMessage;
|
||||
}
|
||||
|
||||
public Builder header(ChannelDataHeader header) {
|
||||
this.header = header;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder payload(ByteString payload) {
|
||||
this.payload = payload;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder finalMessage(Boolean finalMessage) {
|
||||
this.finalMessage = finalMessage;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelDataRequest build() {
|
||||
return new ChannelDataRequest(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue