From 72ee3bcd3865225b86db8d4db86b5f7883c6b538 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 14 Aug 2016 10:41:56 +0200 Subject: [PATCH] Combined changes: - Adapt to GmsApi changes - Add GmsLib for play-services-wearable library - Increase version code (fixes #167) - Update wearable --- .gitmodules | 3 + build.gradle | 7 + extern/GmsApi | 2 +- extern/GmsLib | 1 + play-services-base | 1 + play-services-basement | 1 + play-services-common-api | 1 - play-services-core/build.gradle | 4 +- .../src/main/AndroidManifest.xml | 4 +- .../gms/common/RemoteListenerProxy.java | 3 + .../gms/wearable/NodeDatabaseHelper.java | 7 +- .../org/microg/gms/wearable/WearableImpl.java | 40 +-- .../gms/wearable/WearableLocationService.java | 55 ---- .../gms/wearable/WearableServiceImpl.java | 11 +- .../WearableLocationService.java} | 105 ++++--- .../gms/wearable/databundle/DataBundle.java | 64 ----- .../wearable/databundle/DataBundleEntry.java | 80 ------ .../databundle/DataBundleTypedValue.java | 80 ------ .../wearable/databundle/DataBundleValue.java | 259 ------------------ .../src/main/protos-repo/databundle.proto | 33 --- play-services-iid-api | 1 + play-services-tasks | 1 + play-services-wearable | 1 + settings.gradle | 8 +- 24 files changed, 115 insertions(+), 657 deletions(-) create mode 100644 build.gradle create mode 160000 extern/GmsLib create mode 120000 play-services-base create mode 120000 play-services-basement delete mode 120000 play-services-common-api delete mode 100644 play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationService.java rename play-services-core/src/main/java/org/microg/gms/wearable/{WearableLocationListener.java => location/WearableLocationService.java} (54%) delete mode 100644 play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java delete mode 100644 play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java delete mode 100644 play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java delete mode 100644 play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java delete mode 100644 play-services-core/src/main/protos-repo/databundle.proto create mode 120000 play-services-iid-api create mode 120000 play-services-tasks create mode 120000 play-services-wearable diff --git a/.gitmodules b/.gitmodules index 36e22e46..2c5c997d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "extern/Wearable"] path = extern/Wearable url = https://github.com/microg/android_external_Wearable.git +[submodule "extern/GmsLib"] + path = extern/GmsLib + url = https://github.com/microg/android_external_GmsLib.git diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..47c3b920 --- /dev/null +++ b/build.gradle @@ -0,0 +1,7 @@ +subprojects { + group = 'org.microg' + repositories { + jcenter() + } +} + diff --git a/extern/GmsApi b/extern/GmsApi index 3d8fee7f..b9cb95d3 160000 --- a/extern/GmsApi +++ b/extern/GmsApi @@ -1 +1 @@ -Subproject commit 3d8fee7fabcd9e7c5c46f3f1f44da6cf4db89a70 +Subproject commit b9cb95d39bdb4bbac6dd0d2b0405e4d5a23717c2 diff --git a/extern/GmsLib b/extern/GmsLib new file mode 160000 index 00000000..310127db --- /dev/null +++ b/extern/GmsLib @@ -0,0 +1 @@ +Subproject commit 310127db7905a15af2589a161169292275ead064 diff --git a/play-services-base b/play-services-base new file mode 120000 index 00000000..972776e9 --- /dev/null +++ b/play-services-base @@ -0,0 +1 @@ +extern/GmsLib/play-services-base \ No newline at end of file diff --git a/play-services-basement b/play-services-basement new file mode 120000 index 00000000..aac14e46 --- /dev/null +++ b/play-services-basement @@ -0,0 +1 @@ +extern/GmsApi/play-services-basement \ No newline at end of file diff --git a/play-services-common-api b/play-services-common-api deleted file mode 120000 index c85558d0..00000000 --- a/play-services-common-api +++ /dev/null @@ -1 +0,0 @@ -extern/GmsApi/play-services-common-api/ \ No newline at end of file diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index b40aa8f4..16220fbf 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -38,6 +38,7 @@ dependencies { compile project(":microg-ui-tools") compile project(':play-services-api') + compile project(':play-services-wearable') compile project(':unifiednlp-base') compile project(':wearable-lib') @@ -80,8 +81,7 @@ android { versionName getMyVersionName() def x = getMyVersionCode() // We are not allowed to freely choose the hundreds column as it defines the device type - // Update commit id to current when increasing gms version code - versionCode(9256200 + x % 100 + ((int) (x / 100)) * 1000) + versionCode(9450200 + x % 100 + ((int) (x / 100)) * 1000) ndk { abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86" diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 87a1909a..e270a7bc 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -130,10 +130,10 @@ + android:name="org.microg.gms.wearable.location.WearableLocationService"> + diff --git a/play-services-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java b/play-services-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java index 36bd99f4..0bfbee6b 100644 --- a/play-services-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java +++ b/play-services-core/src/main/java/org/microg/gms/common/RemoteListenerProxy.java @@ -66,6 +66,7 @@ public class RemoteListenerProxy implements ServiceConnect if (!connecting) Log.d(TAG, "Could not connect to: " + intent); return connecting; } + Log.d(TAG, "Unable to resolve: " + searchIntent); return false; } catch (Exception e) { Log.w(TAG, e); @@ -95,6 +96,8 @@ public class RemoteListenerProxy implements ServiceConnect } waiting.clear(); context.unbindService(RemoteListenerProxy.this); + connecting = false; + remote = null; } } } diff --git a/play-services-core/src/main/java/org/microg/gms/wearable/NodeDatabaseHelper.java b/play-services-core/src/main/java/org/microg/gms/wearable/NodeDatabaseHelper.java index dfef5bfc..9876afac 100644 --- a/play-services-core/src/main/java/org/microg/gms/wearable/NodeDatabaseHelper.java +++ b/play-services-core/src/main/java/org/microg/gms/wearable/NodeDatabaseHelper.java @@ -75,17 +75,20 @@ public class NodeDatabaseHelper extends SQLiteOpenHelper { if (path == null) { params = new String[]{packageName, signatureDigest}; selection = "packageName = ? AND signatureDigest = ?"; - } else if (host == null) { + } else if (TextUtils.isEmpty(host)) { if (path.endsWith("/")) path = path + "%"; + path = path.replace("*", "%"); params = new String[]{packageName, signatureDigest, path}; selection = "packageName = ? AND signatureDigest = ? AND path LIKE ?"; } else { if (path.endsWith("/")) path = path + "%"; + path = path.replace("*", "%"); + host = host.replace("*", "%"); params = new String[]{packageName, signatureDigest, host, path}; selection = "packageName = ? AND signatureDigest = ? AND host = ? AND path LIKE ?"; } selection += " AND deleted=0 AND assetsPresent !=0"; - return getReadableDatabase().rawQuery("SELECT host AS host,path AS path,data AS data,\'\' AS tags,assetname AS asset_key,assets_digest AS asset_id FROM dataItemsAndAssets WHERE " + selection, params); + return getReadableDatabase().rawQuery("SELECT null AS host,printf(\"wear://%s%s\",host,path) AS path,data AS data,\'\' AS tags,assetname AS asset_key,assets_digest AS asset_id FROM dataItemsAndAssets WHERE " + selection, params); } public synchronized Cursor getDataItemsByHostAndPath(String packageName, String signatureDigest, String host, String path) { diff --git a/play-services-core/src/main/java/org/microg/gms/wearable/WearableImpl.java b/play-services-core/src/main/java/org/microg/gms/wearable/WearableImpl.java index d50539f5..527c1ba7 100644 --- a/play-services-core/src/main/java/org/microg/gms/wearable/WearableImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/wearable/WearableImpl.java @@ -417,9 +417,7 @@ public class WearableImpl { } public DataItemRecord putData(PutDataRequest request, String packageName) { - String host = request.getUri().getHost(); - if (TextUtils.isEmpty(host)) host = getLocalNodeId(); - DataItemInternal dataItem = new DataItemInternal(host, request.getUri().getPath()); + DataItemInternal dataItem = new DataItemInternal(fixHost(request.getUri().getHost(), true), request.getUri().getPath()); for (Map.Entry assetEntry : request.getAssets().entrySet()) { Asset asset = prepareAsset(packageName, assetEntry.getValue()); if (asset != null) { @@ -443,6 +441,13 @@ public class WearableImpl { return DataHolder.fromCursor(dataHolderItems, 0, null); } + private String fixHost(String host, boolean nothingToLocal) { + if (TextUtils.isEmpty(host) && nothingToLocal) return getLocalNodeId(); + if (TextUtils.isEmpty(host)) return null; + if (host.equals("local")) return getLocalNodeId(); + return host; + } + public DataHolder getDataItemsByUriAsHolder(Uri uri, String packageName) { String firstSignature; try { @@ -450,23 +455,22 @@ public class WearableImpl { } catch (Exception e) { return null; } - Cursor dataHolderItems = nodeDatabase.getDataItemsForDataHolderByHostAndPath(packageName, firstSignature, uri.getHost(), uri.getPath()); + Cursor dataHolderItems = nodeDatabase.getDataItemsForDataHolderByHostAndPath(packageName, firstSignature, fixHost(uri.getHost(), false), uri.getPath()); + int j = 0; while (dataHolderItems.moveToNext()) { - Log.d(TAG, "getDataItems[]: path=" + Uri.parse(dataHolderItems.getString(1)).getPath()); + for (int i = 0; i < dataHolderItems.getColumnCount(); i++) { + if (dataHolderItems.getType(i) == Cursor.FIELD_TYPE_STRING) { + Log.d(TAG, "getDataItems[" + j + "]: " + dataHolderItems.getColumnName(i) + "=" + dataHolderItems.getString(i)); + } + if (dataHolderItems.getType(i) == Cursor.FIELD_TYPE_INTEGER) + Log.d(TAG, "getDataItems[" + j + "]: " + dataHolderItems.getColumnName(i) + "=" + dataHolderItems.getLong(i)); + } } dataHolderItems.moveToFirst(); dataHolderItems.moveToPrevious(); - return new DataHolder(dataHolderItems, 0, null); - } - - public DataHolder getDataItemForRecordAsHolder(DataItemRecord record) { - Cursor dataHolderItems = nodeDatabase.getDataItemsForDataHolderByHostAndPath(record.packageName, record.signatureDigest, record.dataItem.uri.getHost(), record.dataItem.uri.getPath()); - while (dataHolderItems.moveToNext()) { - Log.d(TAG, "getDataItems[]: path=" + Uri.parse(dataHolderItems.getString(1)).getPath()); - } - dataHolderItems.moveToFirst(); - dataHolderItems.moveToPrevious(); - return new DataHolder(dataHolderItems, 0, null); + DataHolder dataHolder = new DataHolder(dataHolderItems, 0, null); + Log.d(TAG, "Returning data holder of size " + dataHolder.getCount() + " for query " + uri); + return dataHolder; } public synchronized void addListener(String packageName, IWearableListener listener) { @@ -515,7 +519,7 @@ public class WearableImpl { } public int deleteDataItems(Uri uri, String packageName) { - List records = nodeDatabase.deleteDataItems(packageName, PackageUtils.firstSignatureDigest(context, packageName), uri.getHost(), uri.getPath()); + List records = nodeDatabase.deleteDataItems(packageName, PackageUtils.firstSignatureDigest(context, packageName), fixHost(uri.getHost(), false), uri.getPath()); for (DataItemRecord record : records) { syncRecordToAll(record); } @@ -533,7 +537,7 @@ public class WearableImpl { } public DataItemRecord getDataItemByUri(Uri uri, String packageName) { - Cursor cursor = nodeDatabase.getDataItemsByHostAndPath(packageName, PackageUtils.firstSignatureDigest(context, packageName), uri.getHost(), uri.getPath()); + Cursor cursor = nodeDatabase.getDataItemsByHostAndPath(packageName, PackageUtils.firstSignatureDigest(context, packageName), fixHost(uri.getHost(), true), uri.getPath()); DataItemRecord record = null; if (cursor != null) { if (cursor.moveToNext()) { diff --git a/play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationService.java b/play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationService.java deleted file mode 100644 index 0b194425..00000000 --- a/play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationService.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2013-2016 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.app.Service; -import android.content.Intent; -import android.os.IBinder; -import android.support.annotation.Nullable; - -import com.google.android.gms.location.internal.LocationRequestInternal; - -import java.util.Collection; - -public class WearableLocationService extends Service { - // TODO: Implement and use WearableListenerService - private static final String TAG = "GmsWearLocSvc"; - - private WearableLocationListener listener; - - @Override - public void onCreate() { - listener = new WearableLocationListener(this); - } - - @Nullable - @Override - public IBinder onBind(Intent intent) { - if (intent.getAction().equals("com.google.android.gms.wearable.BIND_LISTENER")) { - return listener.asBinder(); - } - return null; - } - - public void onLocationRequests(String nodeId, Collection requests, boolean triggerUpdate) { - - } - - public void onCapabilityQuery(String nodeId) { - - } -} diff --git a/play-services-core/src/main/java/org/microg/gms/wearable/WearableServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/wearable/WearableServiceImpl.java index 14df7e53..9785e836 100644 --- a/play-services-core/src/main/java/org/microg/gms/wearable/WearableServiceImpl.java +++ b/play-services-core/src/main/java/org/microg/gms/wearable/WearableServiceImpl.java @@ -21,6 +21,7 @@ import android.net.Uri; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.RemoteException; +import android.util.Base64; import android.util.Log; import com.google.android.gms.common.api.Status; @@ -154,11 +155,11 @@ public class WearableServiceImpl extends IWearableService.Stub { @Override public void sendMessage(IWearableCallbacks callbacks, String targetNodeId, String path, byte[] data) throws RemoteException { - Log.d(TAG, "sendMessage: " + targetNodeId + " / " + path); + Log.d(TAG, "sendMessage: " + targetNodeId + " / " + path + ": " + (data == null ? null : Base64.encodeToString(data, Base64.NO_WRAP))); SendMessageResponse sendMessageResponse = new SendMessageResponse(); try { - sendMessageResponse.resultId = wearable.sendMessage(packageName, targetNodeId, path, data); - if (sendMessageResponse.resultId == -1) { + sendMessageResponse.requestId = wearable.sendMessage(packageName, targetNodeId, path, data); + if (sendMessageResponse.requestId == -1) { sendMessageResponse.statusCode = 4000; } } catch (Exception e) { @@ -262,8 +263,8 @@ public class WearableServiceImpl extends IWearableService.Stub { } @Override - public void getStrorageInformation(IWearableCallbacks callbacks) throws RemoteException { - Log.d(TAG, "unimplemented Method: getStrorageInformation"); + public void getStorageInformation(IWearableCallbacks callbacks) throws RemoteException { + Log.d(TAG, "unimplemented Method: getStorageInformation"); } @Override diff --git a/play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationListener.java b/play-services-core/src/main/java/org/microg/gms/wearable/location/WearableLocationService.java similarity index 54% rename from play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationListener.java rename to play-services-core/src/main/java/org/microg/gms/wearable/location/WearableLocationService.java index 6510b3b9..a4e2a0d1 100644 --- a/play-services-core/src/main/java/org/microg/gms/wearable/WearableLocationListener.java +++ b/play-services-core/src/main/java/org/microg/gms/wearable/location/WearableLocationService.java @@ -14,86 +14,83 @@ * limitations under the License. */ -package org.microg.gms.wearable; +package org.microg.gms.wearable.location; import android.content.Context; -import android.content.pm.PackageManager; -import android.os.RemoteException; import android.util.Log; -import com.google.android.gms.common.data.DataHolder; +import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.internal.ClientIdentity; import com.google.android.gms.location.internal.LocationRequestInternal; -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.IWearableListener; -import com.google.android.gms.wearable.internal.MessageEventParcelable; -import com.google.android.gms.wearable.internal.NodeParcelable; +import com.google.android.gms.wearable.DataMap; +import com.google.android.gms.wearable.MessageEvent; +import com.google.android.gms.wearable.Node; +import com.google.android.gms.wearable.Wearable; +import com.google.android.gms.wearable.WearableListenerService; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; -public class WearableLocationListener extends IWearableListener.Stub { - public static final String LOCATION_REQUESTS = "com/google/android/location/fused/wearable/LOCATION_REQUESTS"; - public static final String CAPABILITY_QUERY = "com/google/android/location/fused/wearable/CAPABILITY_QUERY"; +public class WearableLocationService extends WearableListenerService { + private static final String TAG = "GmsWearLocSvc"; - private static final String TAG = "GmsWearLocListener"; + public static final String PATH_LOCATION_REQUESTS = "com/google/android/location/fused/wearable/LOCATION_REQUESTS"; + public static final String PATH_CAPABILITY_QUERY = "com/google/android/location/fused/wearable/CAPABILITY_QUERY"; + public static final String PATH_CAPABILITY = "com/google/android/location/fused/wearable/CAPABILITY"; - private WearableLocationService locationService; - - public WearableLocationListener(WearableLocationService locationService) { - this.locationService = locationService; - } + private GoogleApiClient apiClient; + private Map> requestMap = new HashMap>(); @Override - public void onDataChanged(DataHolder data) throws RemoteException { - } - - @Override - public void onMessageReceived(MessageEventParcelable messageEvent) throws RemoteException { - if (messageEvent.getPath().equals(LOCATION_REQUESTS)) { - //DataMap dataMap = DataMap.fromByteArray(messageEvent.getData()); - //locationService.onLocationRequests(messageEvent.getSourceNodeId(), parseLocationRequestList(dataMap, locationService), dataMap.getBoolean("TRIGGER_UPDATE", false)); - } else if (messageEvent.getPath().equals(CAPABILITY_QUERY)) { - locationService.onCapabilityQuery(messageEvent.getSourceNodeId()); + public void onMessageReceived(MessageEvent messageEvent) { + if (messageEvent.getPath().equals(PATH_LOCATION_REQUESTS)) { + DataMap dataMap = DataMap.fromByteArray(messageEvent.getData()); + onLocationRequests(messageEvent.getSourceNodeId(), readLocationRequestList(dataMap, this), dataMap.getBoolean("TRIGGER_UPDATE", false)); + } else if (messageEvent.getPath().equals(PATH_CAPABILITY_QUERY)) { + onCapabilityQuery(messageEvent.getSourceNodeId()); } } @Override - public void onPeerConnected(NodeParcelable node) throws RemoteException { + public void onPeerDisconnected(Node peer) { + onLocationRequests(peer.getId(), null, false); } - @Override - public void onPeerDisconnected(NodeParcelable node) throws RemoteException { - locationService.onLocationRequests(node.getId(), Collections.emptyList(), false); + public void onLocationRequests(String nodeId, Collection requests, boolean triggerUpdate) { + if (requests == null || requests.isEmpty()) { + requestMap.remove(nodeId); + } else { + requestMap.put(nodeId, requests); + } + Log.d(TAG, "Requests: "+requestMap.entrySet()); + // TODO actually request } - @Override - public void onConnectedNodes(List nodes) throws RemoteException { + public void onCapabilityQuery(String nodeId) { + Wearable.MessageApi.sendMessage(getApiClient(), nodeId, PATH_CAPABILITY, writeLocationCapability(new DataMap(), true).toByteArray()); } - @Override - public void onNotificationReceived(AncsNotificationParcelable notification) throws RemoteException { + private GoogleApiClient getApiClient() { + if (apiClient == null) { + apiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).build(); + } + if (!apiClient.isConnected()) { + apiClient.connect(); + } + return apiClient; } - @Override - public void onChannelEvent(ChannelEventParcelable channelEvent) throws RemoteException { + public static DataMap writeLocationCapability(DataMap dataMap, boolean locationCapable) { + dataMap.putBoolean("CAPABILITY_LOCATION", locationCapable); + return dataMap; } - @Override - public void onConnectedCapabilityChanged(CapabilityInfoParcelable capabilityInfo) throws RemoteException { - } - - @Override - public void onEntityUpdate(AmsEntityUpdateParcelable update) throws RemoteException { - } - - /*public static Collection parseLocationRequestList(DataMap dataMap, Context context) { + public static Collection readLocationRequestList(DataMap dataMap, Context context) { if (!dataMap.containsKey("REQUEST_LIST")) { Log.w(TAG, "malformed DataMap: missing key REQUEST_LIST"); return Collections.emptyList(); @@ -101,12 +98,12 @@ public class WearableLocationListener extends IWearableListener.Stub { List requestMapList = dataMap.getDataMapArrayList("REQUEST_LIST"); List locationRequests = new ArrayList(); for (DataMap map : requestMapList) { - locationRequests.add(parseLocationRequest(map, context)); + locationRequests.add(readLocationRequest(map, context)); } return locationRequests; } - private static LocationRequestInternal parseLocationRequest(DataMap dataMap, Context context) { + private static LocationRequestInternal readLocationRequest(DataMap dataMap, Context context) { LocationRequestInternal request = new LocationRequestInternal(); request.triggerUpdate = true; request.request = new LocationRequest(); @@ -142,11 +139,11 @@ public class WearableLocationListener extends IWearableListener.Stub { private static ClientIdentity generateClientIdentity(String packageName, Context context) { return null; - try { + /*try { return new ClientIdentity(context.getPackageManager().getApplicationInfo(packageName, 0).uid, packageName); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Unknown client identity: " + packageName, e); return new ClientIdentity(context.getApplicationInfo().uid, context.getPackageName()); - } - }*/ + }*/ + } } diff --git a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java b/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java deleted file mode 100644 index ba388652..00000000 --- a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -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 DataBundle extends Message { - - public static final List DEFAULT_ENTRIES = Collections.emptyList(); - - @ProtoField(tag = 1, label = REPEATED, messageType = DataBundleEntry.class) - public final List entries; - - public DataBundle(List entries) { - this.entries = immutableCopyOf(entries); - } - - private DataBundle(Builder builder) { - this(builder.entries); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundle)) return false; - return equals(entries, ((DataBundle) other).entries); - } - - @Override - public int hashCode() { - int result = hashCode; - return result != 0 ? result : (hashCode = entries != null ? entries.hashCode() : 1); - } - - public static final class Builder extends Message.Builder { - - public List entries; - - public Builder() { - } - - public Builder(DataBundle message) { - super(message); - if (message == null) return; - this.entries = copyOf(message.entries); - } - - public Builder entries(List entries) { - this.entries = checkForNulls(entries); - return this; - } - - @Override - public DataBundle build() { - return new DataBundle(this); - } - } -} diff --git a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java b/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java deleted file mode 100644 index a5f52d38..00000000 --- a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; - -import static com.squareup.wire.Message.Datatype.STRING; - -public final class DataBundleEntry extends Message { - - public static final String DEFAULT_KEY = ""; - - @ProtoField(tag = 1, type = STRING) - public final String key; - - @ProtoField(tag = 2) - public final DataBundleTypedValue typedValue; - - public DataBundleEntry(String key, DataBundleTypedValue typedValue) { - this.key = key; - this.typedValue = typedValue; - } - - private DataBundleEntry(Builder builder) { - this(builder.key, builder.typedValue); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleEntry)) return false; - DataBundleEntry o = (DataBundleEntry) other; - return equals(key, o.key) - && equals(typedValue, o.typedValue); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = key != null ? key.hashCode() : 0; - result = result * 37 + (typedValue != null ? typedValue.hashCode() : 0); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public String key; - public DataBundleTypedValue typedValue; - - public Builder() { - } - - public Builder(DataBundleEntry message) { - super(message); - if (message == null) return; - this.key = message.key; - this.typedValue = message.typedValue; - } - - public Builder key(String key) { - this.key = key; - return this; - } - - public Builder typedValue(DataBundleTypedValue typedValue) { - this.typedValue = typedValue; - return this; - } - - @Override - public DataBundleEntry build() { - return new DataBundleEntry(this); - } - } -} diff --git a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java b/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java deleted file mode 100644 index 9a7d08f6..00000000 --- a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; - -import static com.squareup.wire.Message.Datatype.INT32; - -public final class DataBundleTypedValue extends Message { - - public static final Integer DEFAULT_TYPE = 0; - - @ProtoField(tag = 1, type = INT32) - public final Integer type; - - @ProtoField(tag = 2) - public final DataBundleValue value; - - public DataBundleTypedValue(Integer type, DataBundleValue value) { - this.type = type; - this.value = value; - } - - private DataBundleTypedValue(Builder builder) { - this(builder.type, builder.value); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleTypedValue)) return false; - DataBundleTypedValue o = (DataBundleTypedValue) other; - return equals(type, o.type) - && equals(value, o.value); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = type != null ? type.hashCode() : 0; - result = result * 37 + (value != null ? value.hashCode() : 0); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public Integer type; - public DataBundleValue value; - - public Builder() { - } - - public Builder(DataBundleTypedValue message) { - super(message); - if (message == null) return; - this.type = message.type; - this.value = message.value; - } - - public Builder type(Integer type) { - this.type = type; - return this; - } - - public Builder value(DataBundleValue value) { - this.value = value; - return this; - } - - @Override - public DataBundleTypedValue build() { - return new DataBundleTypedValue(this); - } - } -} diff --git a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java b/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java deleted file mode 100644 index 81d97338..00000000 --- a/play-services-core/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; -import java.util.Collections; -import java.util.List; -import okio.ByteString; - -import static com.squareup.wire.Message.Datatype.BOOL; -import static com.squareup.wire.Message.Datatype.BYTES; -import static com.squareup.wire.Message.Datatype.DOUBLE; -import static com.squareup.wire.Message.Datatype.FLOAT; -import static com.squareup.wire.Message.Datatype.INT32; -import static com.squareup.wire.Message.Datatype.INT64; -import static com.squareup.wire.Message.Datatype.STRING; -import static com.squareup.wire.Message.Label.REPEATED; - -public final class DataBundleValue extends Message { - - public static final ByteString DEFAULT_BYTEARRAY = ByteString.EMPTY; - public static final String DEFAULT_STRINGVAL = ""; - public static final Double DEFAULT_DOUBLEVAL = 0D; - public static final Float DEFAULT_FLOATVAL = 0F; - public static final Long DEFAULT_LONGVAL = 0L; - public static final Integer DEFAULT_INTVAL = 0; - public static final Integer DEFAULT_BYTEVAL = 0; - public static final Boolean DEFAULT_BOOLEANVAL = false; - public static final List DEFAULT_MAP = Collections.emptyList(); - public static final List DEFAULT_LIST = Collections.emptyList(); - public static final List DEFAULT_STRINGARRAY = Collections.emptyList(); - public static final List DEFAULT_LONGARRAY = Collections.emptyList(); - public static final Integer DEFAULT_LENGTH = 0; - public static final List DEFAULT_FLOATARRAY = Collections.emptyList(); - - @ProtoField(tag = 1, type = BYTES) - public final ByteString byteArray; - - @ProtoField(tag = 2, type = STRING) - public final String stringVal; - - @ProtoField(tag = 3, type = DOUBLE) - public final Double doubleVal; - - @ProtoField(tag = 4, type = FLOAT) - public final Float floatVal; - - @ProtoField(tag = 5, type = INT64) - public final Long longVal; - - @ProtoField(tag = 6, type = INT32) - public final Integer intVal; - - @ProtoField(tag = 7, type = INT32) - public final Integer byteVal; - - @ProtoField(tag = 8, type = BOOL) - public final Boolean booleanVal; - - @ProtoField(tag = 9, label = REPEATED, messageType = DataBundleEntry.class) - public final List map; - - @ProtoField(tag = 10, label = REPEATED, messageType = DataBundleTypedValue.class) - public final List list; - - @ProtoField(tag = 11, type = STRING, label = REPEATED) - public final List stringArray; - - @ProtoField(tag = 12, type = INT64, label = REPEATED) - public final List longArray; - - @ProtoField(tag = 13, type = INT32) - public final Integer length; - - @ProtoField(tag = 14, type = FLOAT, label = REPEATED) - public final List floatArray; - - public DataBundleValue(ByteString byteArray, String stringVal, Double doubleVal, Float floatVal, Long longVal, Integer intVal, Integer byteVal, Boolean booleanVal, List map, List list, List stringArray, List longArray, Integer length, List floatArray) { - this.byteArray = byteArray; - this.stringVal = stringVal; - this.doubleVal = doubleVal; - this.floatVal = floatVal; - this.longVal = longVal; - this.intVal = intVal; - this.byteVal = byteVal; - this.booleanVal = booleanVal; - this.map = immutableCopyOf(map); - this.list = immutableCopyOf(list); - this.stringArray = immutableCopyOf(stringArray); - this.longArray = immutableCopyOf(longArray); - this.length = length; - this.floatArray = immutableCopyOf(floatArray); - } - - private DataBundleValue(Builder builder) { - this(builder.byteArray, builder.stringVal, builder.doubleVal, builder.floatVal, builder.longVal, builder.intVal, builder.byteVal, builder.booleanVal, builder.map, builder.list, builder.stringArray, builder.longArray, builder.length, builder.floatArray); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleValue)) return false; - DataBundleValue o = (DataBundleValue) other; - return equals(byteArray, o.byteArray) - && equals(stringVal, o.stringVal) - && equals(doubleVal, o.doubleVal) - && equals(floatVal, o.floatVal) - && equals(longVal, o.longVal) - && equals(intVal, o.intVal) - && equals(byteVal, o.byteVal) - && equals(booleanVal, o.booleanVal) - && equals(map, o.map) - && equals(list, o.list) - && equals(stringArray, o.stringArray) - && equals(longArray, o.longArray) - && equals(length, o.length) - && equals(floatArray, o.floatArray); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = byteArray != null ? byteArray.hashCode() : 0; - result = result * 37 + (stringVal != null ? stringVal.hashCode() : 0); - result = result * 37 + (doubleVal != null ? doubleVal.hashCode() : 0); - result = result * 37 + (floatVal != null ? floatVal.hashCode() : 0); - result = result * 37 + (longVal != null ? longVal.hashCode() : 0); - result = result * 37 + (intVal != null ? intVal.hashCode() : 0); - result = result * 37 + (byteVal != null ? byteVal.hashCode() : 0); - result = result * 37 + (booleanVal != null ? booleanVal.hashCode() : 0); - result = result * 37 + (map != null ? map.hashCode() : 1); - result = result * 37 + (list != null ? list.hashCode() : 1); - result = result * 37 + (stringArray != null ? stringArray.hashCode() : 1); - result = result * 37 + (longArray != null ? longArray.hashCode() : 1); - result = result * 37 + (length != null ? length.hashCode() : 0); - result = result * 37 + (floatArray != null ? floatArray.hashCode() : 1); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public ByteString byteArray; - public String stringVal; - public Double doubleVal; - public Float floatVal; - public Long longVal; - public Integer intVal; - public Integer byteVal; - public Boolean booleanVal; - public List map; - public List list; - public List stringArray; - public List longArray; - public Integer length; - public List floatArray; - - public Builder() { - } - - public Builder(DataBundleValue message) { - super(message); - if (message == null) return; - this.byteArray = message.byteArray; - this.stringVal = message.stringVal; - this.doubleVal = message.doubleVal; - this.floatVal = message.floatVal; - this.longVal = message.longVal; - this.intVal = message.intVal; - this.byteVal = message.byteVal; - this.booleanVal = message.booleanVal; - this.map = copyOf(message.map); - this.list = copyOf(message.list); - this.stringArray = copyOf(message.stringArray); - this.longArray = copyOf(message.longArray); - this.length = message.length; - this.floatArray = copyOf(message.floatArray); - } - - public Builder byteArray(ByteString byteArray) { - this.byteArray = byteArray; - return this; - } - - public Builder stringVal(String stringVal) { - this.stringVal = stringVal; - return this; - } - - public Builder doubleVal(Double doubleVal) { - this.doubleVal = doubleVal; - return this; - } - - public Builder floatVal(Float floatVal) { - this.floatVal = floatVal; - return this; - } - - public Builder longVal(Long longVal) { - this.longVal = longVal; - return this; - } - - public Builder intVal(Integer intVal) { - this.intVal = intVal; - return this; - } - - public Builder byteVal(Integer byteVal) { - this.byteVal = byteVal; - return this; - } - - public Builder booleanVal(Boolean booleanVal) { - this.booleanVal = booleanVal; - return this; - } - - public Builder map(List map) { - this.map = checkForNulls(map); - return this; - } - - public Builder list(List list) { - this.list = checkForNulls(list); - return this; - } - - public Builder stringArray(List stringArray) { - this.stringArray = checkForNulls(stringArray); - return this; - } - - public Builder longArray(List longArray) { - this.longArray = checkForNulls(longArray); - return this; - } - - public Builder length(Integer length) { - this.length = length; - return this; - } - - public Builder floatArray(List floatArray) { - this.floatArray = checkForNulls(floatArray); - return this; - } - - @Override - public DataBundleValue build() { - return new DataBundleValue(this); - } - } -} diff --git a/play-services-core/src/main/protos-repo/databundle.proto b/play-services-core/src/main/protos-repo/databundle.proto deleted file mode 100644 index 031d4abc..00000000 --- a/play-services-core/src/main/protos-repo/databundle.proto +++ /dev/null @@ -1,33 +0,0 @@ -option java_package = "org.microg.gms.wearable.databundle"; -option java_outer_classname = "DataBundleProto"; - -message DataBundle { - repeated DataBundleEntry entries = 1; -} - -message DataBundleEntry { - optional string key = 1; - optional DataBundleTypedValue typedValue = 2; -} - -message DataBundleTypedValue { - optional int32 type = 1; - optional DataBundleValue value = 2; -} - -message DataBundleValue { - optional bytes byteArray = 1; - optional string stringVal = 2; - optional double doubleVal = 3; - optional float floatVal = 4; - optional int64 longVal = 5; - optional int32 intVal = 6; - optional int32 byteVal = 7; - optional bool booleanVal = 8; - repeated DataBundleEntry map = 9; - repeated DataBundleTypedValue list = 10; - repeated string stringArray = 11; - repeated int64 longArray = 12; - optional int32 length = 13; - repeated float floatArray = 14; -} diff --git a/play-services-iid-api b/play-services-iid-api new file mode 120000 index 00000000..304442a6 --- /dev/null +++ b/play-services-iid-api @@ -0,0 +1 @@ +extern/GmsApi/play-services-iid-api \ No newline at end of file diff --git a/play-services-tasks b/play-services-tasks new file mode 120000 index 00000000..f9f43574 --- /dev/null +++ b/play-services-tasks @@ -0,0 +1 @@ +extern/GmsLib/play-services-tasks \ No newline at end of file diff --git a/play-services-wearable b/play-services-wearable new file mode 120000 index 00000000..73b88bdb --- /dev/null +++ b/play-services-wearable @@ -0,0 +1 @@ +extern/GmsLib/play-services-wearable \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index dd16f87f..fb6ecb86 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,12 +6,18 @@ include ':unifiednlp-api' include ':unifiednlp-base' include ':unifiednlp-compat' +include ':play-services-basement' + include ':play-services-api' include ':play-services-cast-api' -include ':play-services-common-api' +include ':play-services-iid-api' include ':play-services-location-api' include ':play-services-wearable-api' +include ':play-services-base' +include ':play-services-tasks' +include ':play-services-wearable' + include ':play-services-core' include ':microg-ui-tools'