mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-24 04:05:13 +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()
|
||||
def x = getMyVersionCode()
|
||||
// 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 {
|
||||
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!");
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public class DataItemInternal {
|
|||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("DataItemInternal{");
|
||||
sb.append("uri=").append(uri);
|
||||
sb.append(", assets=").append(assets.size());
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -95,11 +95,12 @@ public class DataItemRecord {
|
|||
}
|
||||
|
||||
public DataItemParcelable toParcelable() {
|
||||
DataItemParcelable parcelable = new DataItemParcelable(dataItem.uri);
|
||||
parcelable.data = dataItem.data;
|
||||
Map<String, DataItemAssetParcelable> assets = new HashMap<>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,9 +150,14 @@ public class MessageHandler extends ServerMessageListener {
|
|||
|
||||
wearable.sendMessageReceived(rpcRequest.packageName, messageEvent);
|
||||
} else if (rpcRequest.targetNodeId.equals(peerNodeId)) {
|
||||
// Drop it, loop detection (yes we really need this in this protocol o.O)
|
||||
// Drop it
|
||||
} 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;
|
||||
}
|
||||
Log.d(TAG, targetNodeId + " seems not reachable");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.microg.gms.wearable;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.microg.gms.wearable;
|
|||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcel;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
|
@ -54,11 +55,13 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
private final Context context;
|
||||
private final String packageName;
|
||||
private final WearableImpl wearable;
|
||||
private final Handler handler;
|
||||
|
||||
public WearableServiceImpl(Context context, WearableImpl wearable, String packageName) {
|
||||
this.context = context;
|
||||
this.wearable = wearable;
|
||||
this.packageName = packageName;
|
||||
this.handler = new Handler(context.getMainLooper());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -66,40 +69,65 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
*/
|
||||
|
||||
@Override
|
||||
public void putConfig(IWearableCallbacks callbacks, ConnectionConfiguration config) throws RemoteException {
|
||||
wearable.createConnection(config);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
public void putConfig(IWearableCallbacks callbacks, final ConnectionConfiguration config) throws RemoteException {
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
wearable.createConnection(config);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(IWearableCallbacks callbacks, String name) throws RemoteException {
|
||||
wearable.deleteConnection(name);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
public void deleteConfig(IWearableCallbacks callbacks, final String name) throws RemoteException {
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
wearable.deleteConnection(name);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getConfigs(IWearableCallbacks callbacks) throws RemoteException {
|
||||
Log.d(TAG, "getConfigs");
|
||||
try {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, wearable.getConfigurations()));
|
||||
} catch (Exception e) {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(8, new ConnectionConfiguration[0]));
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
try {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(0, wearable.getConfigurations()));
|
||||
} catch (Exception e) {
|
||||
callbacks.onGetConfigsResponse(new GetConfigsResponse(8, new ConnectionConfiguration[0]));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
wearable.enableConnection(name);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
wearable.enableConnection(name);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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);
|
||||
wearable.disableConnection(name);
|
||||
callbacks.onStatus(Status.SUCCESS);
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@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
|
||||
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));
|
||||
DataItemRecord record = wearable.putData(request, packageName);
|
||||
callbacks.onPutDataResponse(new PutDataResponse(0, record.toParcelable()));
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
DataItemRecord record = wearable.putData(request, packageName);
|
||||
callbacks.onPutDataResponse(new PutDataResponse(0, record.toParcelable()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
DataItemRecord record = wearable.getDataItemByUri(uri, packageName);
|
||||
if (record != null) {
|
||||
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, record.toParcelable()));
|
||||
} else {
|
||||
// TODO: negative
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
DataItemRecord record = wearable.getDataItemByUri(uri, packageName);
|
||||
if (record != null) {
|
||||
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, record.toParcelable()));
|
||||
} else {
|
||||
callbacks.onGetDataItemResponse(new GetDataItemResponse(0, null));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDataItems(IWearableCallbacks callbacks) throws RemoteException {
|
||||
public void getDataItems(final IWearableCallbacks callbacks) throws RemoteException {
|
||||
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
|
||||
|
@ -137,9 +179,14 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
}
|
||||
|
||||
@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);
|
||||
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
|
||||
|
@ -148,35 +195,50 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
}
|
||||
|
||||
@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);
|
||||
callbacks.onDeleteDataItemsResponse(new DeleteDataItemsResponse(0, wearable.deleteDataItems(uri, packageName)));
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
callbacks.onDeleteDataItemsResponse(new DeleteDataItemsResponse(0, wearable.deleteDataItems(uri, packageName)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sendMessageResponse.statusCode = 8;
|
||||
}
|
||||
callbacks.onSendMessageResponse(sendMessageResponse);
|
||||
});
|
||||
}
|
||||
|
||||
@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);
|
||||
// TODO: Access control
|
||||
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));
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
// TODO: Access control
|
||||
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
|
||||
|
@ -212,16 +274,26 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
|
||||
@Override
|
||||
public void getLocalNode(IWearableCallbacks callbacks) throws RemoteException {
|
||||
try {
|
||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(0, new NodeParcelable(wearable.getLocalNodeId(), wearable.getLocalNodeId())));
|
||||
} catch (Exception e) {
|
||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(8, null));
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
try {
|
||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(0, new NodeParcelable(wearable.getLocalNodeId(), wearable.getLocalNodeId())));
|
||||
} catch (Exception e) {
|
||||
callbacks.onGetLocalNodeResponse(new GetLocalNodeResponse(8, null));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
public void getConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||
Log.d(TAG, "getConfig");
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
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]));
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
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
|
||||
@Deprecated
|
||||
public void enableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
if (configurations.length > 0) {
|
||||
enableConfig(callbacks, configurations[0].name);
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
if (configurations.length > 0) {
|
||||
enableConfig(callbacks, configurations[0].name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void disableConnection(IWearableCallbacks callbacks) throws RemoteException {
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
if (configurations.length > 0) {
|
||||
disableConfig(callbacks, configurations[0].name);
|
||||
}
|
||||
handler.post(new CallbackRunnable(callbacks) {
|
||||
@Override
|
||||
public void run(IWearableCallbacks callbacks) throws RemoteException {
|
||||
ConnectionConfiguration[] configurations = wearable.getConfigurations();
|
||||
if (configurations.length > 0) {
|
||||
disableConfig(callbacks, configurations[0].name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -397,4 +484,27 @@ public class WearableServiceImpl extends IWearableService.Stub {
|
|||
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
|
||||
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.chimera.container.DynamiteLoaderImpl { 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 public class * extends org.microg.safeparcel.AutoSafeParcelable {
|
||||
|
|
Loading…
Reference in a new issue