mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-27 21:53:00 +00:00
Update sublibs, Increase version number, implement basic cast framework module
This commit is contained in:
parent
4893dead0a
commit
8b61ba7e44
14 changed files with 348 additions and 85 deletions
2
extern/GmsApi
vendored
2
extern/GmsApi
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 107d70080ad5f8389db97dc0bb7f36d52af46afe
|
Subproject commit 9ff42ae73a02ea971dc557f657b612113dfa6e24
|
2
extern/GmsLib
vendored
2
extern/GmsLib
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 3a219305d801f79c5385583e8ae8a9e9febc0160
|
Subproject commit 4bffa5799a9ce406a268941e26fbb4a637d42446
|
2
extern/RemoteDroidGuard
vendored
2
extern/RemoteDroidGuard
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 99b7d04824112355ff820adbee1d35624c22f453
|
Subproject commit 0ca6fb22650bb3e0d2fe1440f45e62a4acca2e19
|
2
extern/UnifiedNlp
vendored
2
extern/UnifiedNlp
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 38acecd7b503e4d3777a517b60924d77c7ff5d81
|
Subproject commit d9923a0d10edded17ad96d61e1e247f557bad652
|
|
@ -62,7 +62,7 @@ android {
|
||||||
versionName getMyVersionName()
|
versionName getMyVersionName()
|
||||||
def x = getMyVersionCode()
|
def x = getMyVersionCode()
|
||||||
// We are not allowed to freely choose the hundreds column as it defines the device type
|
// We are not allowed to freely choose the hundreds column as it defines the device type
|
||||||
versionCode(9683000 + x % 100 + ((int) (x / 100)) * 1000)
|
versionCode(10084400 + x % 100 + ((int) (x / 100)) * 1000)
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86"
|
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86"
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*
|
||||||
|
* 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 com.google.android.gms.cast.framework.internal;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.gms.cast.framework.CastOptions;
|
||||||
|
import com.google.android.gms.cast.framework.ICastConnectionController;
|
||||||
|
import com.google.android.gms.cast.framework.ICastContext;
|
||||||
|
import com.google.android.gms.cast.framework.ICastSession;
|
||||||
|
import com.google.android.gms.cast.framework.IReconnectionService;
|
||||||
|
import com.google.android.gms.cast.framework.ISession;
|
||||||
|
import com.google.android.gms.cast.framework.ISessionManager;
|
||||||
|
import com.google.android.gms.cast.framework.ISessionProxy;
|
||||||
|
import com.google.android.gms.cast.framework.media.CastMediaOptions;
|
||||||
|
import com.google.android.gms.cast.framework.media.IMediaNotificationService;
|
||||||
|
import com.google.android.gms.cast.framework.media.internal.IFetchBitmapTask;
|
||||||
|
import com.google.android.gms.cast.framework.media.internal.IFetchBitmapTaskProgressPublisher;
|
||||||
|
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||||
|
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CastDynamiteModuleImpl extends ICastDynamiteModule.Stub {
|
||||||
|
private static final String TAG = CastDynamiteModuleImpl.class.getSimpleName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICastContext newCastContextImpl(IObjectWrapper context, CastOptions options, IMediaRouter router, Map map) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newCastContextImpl");
|
||||||
|
return new ICastContext.Stub() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Bundle getMergedSelectorAsBundle() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: getMergedSelectorAsBundle");
|
||||||
|
return new Bundle();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isApplicationVisible() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: isApplicationVisible");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ISessionManager getSessionManager() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: getSessionManager");
|
||||||
|
return new ISessionManager.Stub(){
|
||||||
|
@Override
|
||||||
|
public IObjectWrapper getWrappedCurrentSession() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: getWrappedCurrentSession");
|
||||||
|
return ObjectWrapper.wrap(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endCurrentSession(boolean b, boolean stopCasting) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: endCurrentSession");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IObjectWrapper getWrappedThis() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: getWrappedThis");
|
||||||
|
return ObjectWrapper.wrap(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: destroy");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResumed(IObjectWrapper activity) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: onActivityResumed");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityPaused(IObjectWrapper activity) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: onActivityPaused");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ISession newSessionImpl(String s1, String s2, ISessionProxy proxy) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newSessionImpl");
|
||||||
|
return new ISession.Stub() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICastSession newCastSessionImpl(CastOptions options, IObjectWrapper session, ICastConnectionController controller) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newCastSessionImpl");
|
||||||
|
return new ICastSession.Stub() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMediaNotificationService newMediaNotificationServiceImpl(IObjectWrapper service, IObjectWrapper castContext, IObjectWrapper resources, CastMediaOptions options) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newMediaNotificationServiceImpl");
|
||||||
|
return new IMediaNotificationService.Stub() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IReconnectionService newReconnectionServiceImpl(IObjectWrapper service, IObjectWrapper sessionManager, IObjectWrapper discoveryManager) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newReconnectionServiceImpl");
|
||||||
|
return new IReconnectionService.Stub() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFetchBitmapTask newFetchBitmapTaskImpl(IObjectWrapper asyncTask, IFetchBitmapTaskProgressPublisher progressPublisher, int i1, int i2, boolean b1, long l1, int i3, int i4, int i5) throws RemoteException {
|
||||||
|
Log.d(TAG, "unimplemented Method: newFetchBitmapTaskImpl");
|
||||||
|
return new IFetchBitmapTask.Stub() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,6 +59,10 @@ public class DynamiteLoaderImpl extends IDynamiteLoader.Stub {
|
||||||
Log.d(TAG, "returning temp fix module version for " + moduleId + ". Firebase Database will not be functional!");
|
Log.d(TAG, "returning temp fix module version for " + moduleId + ". Firebase Database will not be functional!");
|
||||||
return com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor.MODULE_VERSION;
|
return com.google.android.gms.dynamite.descriptors.com.google.android.gms.firebase_database.ModuleDescriptor.MODULE_VERSION;
|
||||||
}
|
}
|
||||||
|
if (moduleId.equals("com.google.android.gms.cast.framework.dynamite")) {
|
||||||
|
Log.d(TAG, "returning temp fix module version for " + moduleId + ". Cast API wil not be functional!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
Log.d(TAG, "unimplemented Method: getModuleVersion for " + moduleId);
|
Log.d(TAG, "unimplemented Method: getModuleVersion for " + moduleId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class DataItemInternal {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder("DataItemInternal{");
|
final StringBuilder sb = new StringBuilder("DataItemInternal{");
|
||||||
sb.append("uri=").append(uri);
|
sb.append("uri=").append(uri);
|
||||||
|
sb.append(", assets=").append(assets.size());
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,11 +95,12 @@ public class DataItemRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataItemParcelable toParcelable() {
|
public DataItemParcelable toParcelable() {
|
||||||
DataItemParcelable parcelable = new DataItemParcelable(dataItem.uri);
|
Map<String, DataItemAssetParcelable> assets = new HashMap<>();
|
||||||
parcelable.data = dataItem.data;
|
|
||||||
for (Map.Entry<String, Asset> entry : dataItem.getAssets().entrySet()) {
|
for (Map.Entry<String, Asset> entry : dataItem.getAssets().entrySet()) {
|
||||||
parcelable.getAssets().put(entry.getKey(), new DataItemAssetParcelable(entry.getValue().getDigest(), entry.getKey()));
|
assets.put(entry.getKey(), new DataItemAssetParcelable(entry.getValue().getDigest(), entry.getKey()));
|
||||||
}
|
}
|
||||||
|
DataItemParcelable parcelable = new DataItemParcelable(dataItem.uri, assets);
|
||||||
|
parcelable.data = dataItem.data;
|
||||||
return parcelable;
|
return parcelable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,9 +150,14 @@ public class MessageHandler extends ServerMessageListener {
|
||||||
|
|
||||||
wearable.sendMessageReceived(rpcRequest.packageName, messageEvent);
|
wearable.sendMessageReceived(rpcRequest.packageName, messageEvent);
|
||||||
} else if (rpcRequest.targetNodeId.equals(peerNodeId)) {
|
} else if (rpcRequest.targetNodeId.equals(peerNodeId)) {
|
||||||
// Drop it, loop detection (yes we really need this in this protocol o.O)
|
// Drop it
|
||||||
} else {
|
} else {
|
||||||
// TODO: find next hop (yes, wtf hops in a network usually consisting of two devices)
|
// TODO: find next hop
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getConnection().writeMessage(new RootMessage.Builder().heartbeat(new Heartbeat()).build());
|
||||||
|
} catch (IOException e) {
|
||||||
|
onDisconnected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,7 @@ public class WearableImpl {
|
||||||
}
|
}
|
||||||
return (state.generation + 527) * 31 + state.lastRequestId;
|
return (state.generation + 527) * 31 + state.lastRequestId;
|
||||||
}
|
}
|
||||||
|
Log.d(TAG, targetNodeId + " seems not reachable");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ package org.microg.gms.wearable;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Messenger;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.microg.gms.wearable;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
@ -54,11 +55,13 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final String packageName;
|
private final String packageName;
|
||||||
private final WearableImpl wearable;
|
private final WearableImpl wearable;
|
||||||
|
private final Handler handler;
|
||||||
|
|
||||||
public WearableServiceImpl(Context context, WearableImpl wearable, String packageName) {
|
public WearableServiceImpl(Context context, WearableImpl wearable, String packageName) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.wearable = wearable;
|
this.wearable = wearable;
|
||||||
this.packageName = packageName;
|
this.packageName = packageName;
|
||||||
|
this.handler = new Handler(context.getMainLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,40 +69,65 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putConfig(IWearableCallbacks callbacks, ConnectionConfiguration config) throws RemoteException {
|
public void putConfig(IWearableCallbacks callbacks, final ConnectionConfiguration config) throws RemoteException {
|
||||||
wearable.createConnection(config);
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onStatus(Status.SUCCESS);
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
wearable.createConnection(config);
|
||||||
|
callbacks.onStatus(Status.SUCCESS);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteConfig(IWearableCallbacks callbacks, String name) throws RemoteException {
|
public void deleteConfig(IWearableCallbacks callbacks, final String name) throws RemoteException {
|
||||||
wearable.deleteConnection(name);
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onStatus(Status.SUCCESS);
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
wearable.deleteConnection(name);
|
||||||
|
callbacks.onStatus(Status.SUCCESS);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getConfigs(IWearableCallbacks callbacks) throws RemoteException {
|
public void getConfigs(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
Log.d(TAG, "getConfigs");
|
Log.d(TAG, "getConfigs");
|
||||||
try {
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, wearable.getConfigurations()));
|
@Override
|
||||||
} catch (Exception e) {
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(8, new ConnectionConfiguration[0]));
|
try {
|
||||||
}
|
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, wearable.getConfigurations()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
callbacks.onGetConfigsResponse(new GetConfigsResponse(8, new ConnectionConfiguration[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enableConfig(IWearableCallbacks callbacks, String name) throws RemoteException {
|
public void enableConfig(IWearableCallbacks callbacks, final String name) throws RemoteException {
|
||||||
Log.d(TAG, "enableConfig: " + name);
|
Log.d(TAG, "enableConfig: " + name);
|
||||||
wearable.enableConnection(name);
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onStatus(Status.SUCCESS);
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
wearable.enableConnection(name);
|
||||||
|
callbacks.onStatus(Status.SUCCESS);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableConfig(IWearableCallbacks callbacks, String name) throws RemoteException {
|
public void disableConfig(IWearableCallbacks callbacks, final String name) throws RemoteException {
|
||||||
Log.d(TAG, "disableConfig: " + name);
|
Log.d(TAG, "disableConfig: " + name);
|
||||||
wearable.disableConnection(name);
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onStatus(Status.SUCCESS);
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
wearable.disableConnection(name);
|
||||||
|
callbacks.onStatus(Status.SUCCESS);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -107,28 +135,42 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putData(IWearableCallbacks callbacks, PutDataRequest request) throws RemoteException {
|
public void putData(IWearableCallbacks callbacks, final PutDataRequest request) throws RemoteException {
|
||||||
Log.d(TAG, "putData: " + request.toString(true));
|
Log.d(TAG, "putData: " + request.toString(true));
|
||||||
DataItemRecord record = wearable.putData(request, packageName);
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onPutDataResponse(new PutDataResponse(0, record.toParcelable()));
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
DataItemRecord record = wearable.putData(request, packageName);
|
||||||
|
callbacks.onPutDataResponse(new PutDataResponse(0, record.toParcelable()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDataItem(IWearableCallbacks callbacks, Uri uri) throws RemoteException {
|
public void getDataItem(IWearableCallbacks callbacks, final Uri uri) throws RemoteException {
|
||||||
Log.d(TAG, "getDataItem: " + uri);
|
Log.d(TAG, "getDataItem: " + uri);
|
||||||
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
DataItemRecord record = wearable.getDataItemByUri(uri, packageName);
|
@Override
|
||||||
if (record != null) {
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, record.toParcelable()));
|
DataItemRecord record = wearable.getDataItemByUri(uri, packageName);
|
||||||
} else {
|
if (record != null) {
|
||||||
// TODO: negative
|
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, record.toParcelable()));
|
||||||
}
|
} else {
|
||||||
|
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDataItems(IWearableCallbacks callbacks) throws RemoteException {
|
public void getDataItems(final IWearableCallbacks callbacks) throws RemoteException {
|
||||||
Log.d(TAG, "getDataItems: " + callbacks);
|
Log.d(TAG, "getDataItems: " + callbacks);
|
||||||
callbacks.onDataItemChanged(wearable.getDataItemsAsHolder(packageName));
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
callbacks.onDataItemChanged(wearable.getDataItemsAsHolder(packageName));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,9 +179,14 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getDataItemsByUriWithFilter(IWearableCallbacks callbacks, Uri uri, int typeFilter) throws RemoteException {
|
public void getDataItemsByUriWithFilter(IWearableCallbacks callbacks, final Uri uri, int typeFilter) throws RemoteException {
|
||||||
Log.d(TAG, "getDataItemsByUri: " + uri);
|
Log.d(TAG, "getDataItemsByUri: " + uri);
|
||||||
callbacks.onDataItemChanged(wearable.getDataItemsByUriAsHolder(uri, packageName));
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
callbacks.onDataItemChanged(wearable.getDataItemsByUriAsHolder(uri, packageName));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,35 +195,50 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteDataItemsWithFilter(IWearableCallbacks callbacks, Uri uri, int typeFilter) throws RemoteException {
|
public void deleteDataItemsWithFilter(IWearableCallbacks callbacks, final Uri uri, int typeFilter) throws RemoteException {
|
||||||
Log.d(TAG, "deleteDataItems: " + uri);
|
Log.d(TAG, "deleteDataItems: " + uri);
|
||||||
callbacks.onDeleteDataItemsResponse(new DeleteDataItemsResponse(0, wearable.deleteDataItems(uri, packageName)));
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
}
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
@Override
|
callbacks.onDeleteDataItemsResponse(new DeleteDataItemsResponse(0, wearable.deleteDataItems(uri, packageName)));
|
||||||
public void sendMessage(IWearableCallbacks callbacks, String targetNodeId, String path, byte[] data) throws RemoteException {
|
|
||||||
Log.d(TAG, "sendMessage: " + targetNodeId + " / " + path + ": " + (data == null ? null : Base64.encodeToString(data, Base64.NO_WRAP)));
|
|
||||||
SendMessageResponse sendMessageResponse = new SendMessageResponse();
|
|
||||||
try {
|
|
||||||
sendMessageResponse.requestId = wearable.sendMessage(packageName, targetNodeId, path, data);
|
|
||||||
if (sendMessageResponse.requestId == -1) {
|
|
||||||
sendMessageResponse.statusCode = 4000;
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
});
|
||||||
sendMessageResponse.statusCode = 8;
|
|
||||||
}
|
|
||||||
callbacks.onSendMessageResponse(sendMessageResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getFdForAsset(IWearableCallbacks callbacks, Asset asset) throws RemoteException {
|
public void sendMessage(IWearableCallbacks callbacks, final String targetNodeId, final String path, final byte[] data) throws RemoteException {
|
||||||
|
Log.d(TAG, "sendMessage: " + targetNodeId + " / " + path + ": " + (data == null ? null : Base64.encodeToString(data, Base64.NO_WRAP)));
|
||||||
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
SendMessageResponse sendMessageResponse = new SendMessageResponse();
|
||||||
|
try {
|
||||||
|
sendMessageResponse.requestId = wearable.sendMessage(packageName, targetNodeId, path, data);
|
||||||
|
if (sendMessageResponse.requestId == -1) {
|
||||||
|
sendMessageResponse.statusCode = 4000;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
sendMessageResponse.statusCode = 8;
|
||||||
|
}
|
||||||
|
callbacks.onSendMessageResponse(sendMessageResponse);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getFdForAsset(IWearableCallbacks callbacks, final Asset asset) throws RemoteException {
|
||||||
Log.d(TAG, "getFdForAsset " + asset);
|
Log.d(TAG, "getFdForAsset " + asset);
|
||||||
// TODO: Access control
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
try {
|
@Override
|
||||||
callbacks.onGetFdForAssetResponse(new GetFdForAssetResponse(0, ParcelFileDescriptor.open(wearable.createAssetFile(asset.getDigest()), ParcelFileDescriptor.MODE_READ_ONLY)));
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
} catch (FileNotFoundException e) {
|
// TODO: Access control
|
||||||
callbacks.onGetFdForAssetResponse(new GetFdForAssetResponse(8, null));
|
try {
|
||||||
}
|
callbacks.onGetFdForAssetResponse(new GetFdForAssetResponse(0, ParcelFileDescriptor.open(wearable.createAssetFile(asset.getDigest()), ParcelFileDescriptor.MODE_READ_ONLY)));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
callbacks.onGetFdForAssetResponse(new GetFdForAssetResponse(8, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,16 +274,26 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getLocalNode(IWearableCallbacks callbacks) throws RemoteException {
|
public void getLocalNode(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
try {
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(0, new NodeParcelable(wearable.getLocalNodeId(), wearable.getLocalNodeId())));
|
@Override
|
||||||
} catch (Exception e) {
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(8, null));
|
try {
|
||||||
}
|
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(0, new NodeParcelable(wearable.getLocalNodeId(), wearable.getLocalNodeId())));
|
||||||
|
} catch (Exception e) {
|
||||||
|
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(8, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getConnectedNodes(IWearableCallbacks callbacks) throws RemoteException {
|
public void getConnectedNodes(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
callbacks.onGetConnectedNodesResponse(new GetConnectedNodesResponse(0, wearable.getConnectedNodesParcelableList()));
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
|
@Override
|
||||||
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
|
callbacks.onGetConnectedNodesResponse(new GetConnectedNodesResponse(0, wearable.getConnectedNodesParcelableList()));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -365,30 +437,45 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void getConnection(IWearableCallbacks callbacks) throws RemoteException {
|
public void getConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
Log.d(TAG, "getConfig");
|
Log.d(TAG, "getConfig");
|
||||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
if (configurations == null || configurations.length == 0) {
|
@Override
|
||||||
callbacks.onGetConfigResponse(new GetConfigResponse(1, new ConnectionConfiguration(null, null, 0, 0, false)));
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
} else {
|
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||||
callbacks.onGetConfigResponse(new GetConfigResponse(0, configurations[0]));
|
if (configurations == null || configurations.length == 0) {
|
||||||
}
|
callbacks.onGetConfigResponse(new GetConfigResponse(1, new ConnectionConfiguration(null, null, 0, 0, false)));
|
||||||
|
} else {
|
||||||
|
callbacks.onGetConfigResponse(new GetConfigResponse(0, configurations[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void enableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
public void enableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
if (configurations.length > 0) {
|
@Override
|
||||||
enableConfig(callbacks, configurations[0].name);
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
}
|
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||||
|
if (configurations.length > 0) {
|
||||||
|
enableConfig(callbacks, configurations[0].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void disableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
public void disableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
handler.post(new CallbackRunnable(callbacks) {
|
||||||
if (configurations.length > 0) {
|
@Override
|
||||||
disableConfig(callbacks, configurations[0].name);
|
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||||
}
|
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||||
|
if (configurations.length > 0) {
|
||||||
|
disableConfig(callbacks, configurations[0].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -397,4 +484,27 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
||||||
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
|
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class CallbackRunnable implements Runnable {
|
||||||
|
private IWearableCallbacks callbacks;
|
||||||
|
|
||||||
|
public CallbackRunnable(IWearableCallbacks callbacks) {
|
||||||
|
this.callbacks = callbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
run(callbacks);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
try {
|
||||||
|
callbacks.onStatus(Status.CANCELED);
|
||||||
|
} catch (RemoteException e1) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void run(IWearableCallbacks callbacks) throws RemoteException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
-keep public class com.google.android.gms.dynamic.IObjectWrapper { public *; }
|
-keep public class com.google.android.gms.dynamic.IObjectWrapper { public *; }
|
||||||
-keep public class com.google.android.gms.chimera.container.DynamiteLoaderImpl { public *; }
|
-keep public class com.google.android.gms.chimera.container.DynamiteLoaderImpl { public *; }
|
||||||
-keep public class com.google.android.gms.dynamite.descriptors.** { public *; }
|
-keep public class com.google.android.gms.dynamite.descriptors.** { public *; }
|
||||||
|
-keep public class com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl { public *; }
|
||||||
|
|
||||||
# Keep AutoSafeParcelables
|
# Keep AutoSafeParcelables
|
||||||
-keep public class * extends org.microg.safeparcel.AutoSafeParcelable {
|
-keep public class * extends org.microg.safeparcel.AutoSafeParcelable {
|
||||||
|
|
Loading…
Reference in a new issue