Small fixes to Wearable

This commit is contained in:
Marvin W 2016-03-05 21:49:32 +01:00
parent 2cd12cced6
commit 8a239f5e31
3 changed files with 12 additions and 5 deletions

2
extern/GmsApi vendored

@ -1 +1 @@
Subproject commit c959e72839430ee32d6c9bebee1d2531b4e8e31c
Subproject commit 96540b11c64f6e5821e86014a9b32647307a89d6

View File

@ -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) {

View File

@ -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);
}
}
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));
}