From 8a239f5e316d8fb4c4644e1177900329bd216544 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 5 Mar 2016 21:49:32 +0100 Subject: [PATCH] Small fixes to Wearable --- extern/GmsApi | 2 +- .../org/microg/gms/wearable/NodeDatabaseHelper.java | 2 +- .../microg/gms/wearable/WearableServiceImpl.java | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/extern/GmsApi b/extern/GmsApi index c959e728..96540b11 160000 --- a/extern/GmsApi +++ b/extern/GmsApi @@ -1 +1 @@ -Subproject commit c959e72839430ee32d6c9bebee1d2531b4e8e31c +Subproject commit 96540b11c64f6e5821e86014a9b32647307a89d6 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 8cd55d78..ec6fbf67 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 @@ -143,7 +143,7 @@ public class NodeDatabaseHelper extends SQLiteOpenHelper { } private static void updateRecord(SQLiteDatabase db, String key, DataItemRecord record) { - Log.d(TAG, "updateRecord: " + record); + Log.d(TAG, "updateRecord not implemented: " + record); } private String insertRecord(SQLiteDatabase db, DataItemRecord record) { 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 40c002e5..d6b54ab0 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 @@ -122,7 +122,7 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara @Override public void putData(IWearableCallbacks callbacks, PutDataRequest request) throws RemoteException { - Log.d(TAG, "putData: " + request); + Log.d(TAG, "putData: " + request.toString(true)); String host = request.getUri().getHost(); if (TextUtils.isEmpty(host)) host = getLocalNodeId(); DataItemInternal dataItem = new DataItemInternal(host, request.getUri().getPath()); @@ -169,15 +169,21 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara stream.close(); success = tmpFile.renameTo(assetFile); } catch (IOException e) { + Log.w(TAG, e); } } - return Asset.createFromRef(digest); + if (success) { + Log.d(TAG, "Successfully created asset file " + assetFile); + return Asset.createFromRef(digest); + } else { + Log.w(TAG, "Failed creating asset file " + assetFile); + } } return null; } private File createAssetFile(String digest) { - File dir = new File(new File(context.getFilesDir(), "assets"), digest.substring(digest.length() - 2, digest.length())); + File dir = new File(new File(context.getFilesDir(), "assets"), digest.substring(digest.length() - 2)); dir.mkdirs(); return new File(dir, digest + ".asset"); } @@ -198,6 +204,7 @@ public class WearableServiceImpl extends IWearableService.Stub implements IWeara if (cursor.moveToNext()) { DataItemParcelable dataItem = new DataItemParcelable(new Uri.Builder().scheme("wear").authority(cursor.getString(0)).path(cursor.getString(1)).build()); dataItem.data = cursor.getBlob(2); + Log.d(TAG, "getDataItem.asset " + cursor.getString(5)); // TODO: assets callbacks.onGetDataItemResponse(new GetDataItemResponse(0, dataItem)); }