0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-24 04:05:13 +00:00

Adding some wearable APIs and various smaller changes

This commit is contained in:
mar-v-in 2015-07-24 02:52:23 +02:00
parent 2c847ce6e8
commit f77b09dc0c
64 changed files with 774 additions and 98 deletions

2
extern/SafeParcel vendored

@ -1 +1 @@
Subproject commit cfbcc9db09d98a2d32e996f5ff9fe587aa9f21f4
Subproject commit ef1568e2614f29c3f13a6b6536989aba7f1a1b5d

View file

@ -0,0 +1,3 @@
package com.google.android.gms.common.api;
parcelable Status;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable AddListenerRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable ConnectionConfiguration;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable DeleteDataItemsResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetConfigResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetConfigsResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetConnectedNodesResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetDataItemResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetFdForAssetResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable GetLocalNodeResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable PutDataRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable PutDataResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable RemoveListenerRequest;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable SendMessageResponse;

View file

@ -0,0 +1,3 @@
package com.google.android.gms.wearable;
parcelable StorageInfoResponse;

View file

@ -0,0 +1,29 @@
package com.google.android.gms.wearable.internal;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.wearable.DeleteDataItemsResponse;
import com.google.android.gms.wearable.GetConfigResponse;
import com.google.android.gms.wearable.GetConfigsResponse;
import com.google.android.gms.wearable.GetConnectedNodesResponse;
import com.google.android.gms.wearable.GetDataItemResponse;
import com.google.android.gms.wearable.GetFdForAssetResponse;
import com.google.android.gms.wearable.GetLocalNodeResponse;
import com.google.android.gms.wearable.PutDataResponse;
import com.google.android.gms.wearable.SendMessageResponse;
import com.google.android.gms.wearable.StorageInfoResponse;
interface IWearableCallbacks {
void onGetConfigResponse(in GetConfigResponse response) = 1;
void onPutDataResponse(in PutDataResponse response) = 2;
void onGetDataItemResponse(in GetDataItemResponse response) = 3;
void onDataHolder(in DataHolder dataHolder) = 4;
void onDeleteDataItemsResponse(in DeleteDataItemsResponse response) = 5;
void onSendMessageResponse(in SendMessageResponse response) = 6;
void onGetFdForAssetResponse(in GetFdForAssetResponse response) = 7;
void onGetLocalNodeResponse(in GetLocalNodeResponse response) = 8;
void onGetConnectedNodesResponse(in GetConnectedNodesResponse response) = 9;
void onStatus(in Status status) = 10;
void onStorageInfoResponse(in StorageInfoResponse response) = 11;
void onGetConfigsResponse(in GetConfigsResponse response) = 12;
}

View file

@ -0,0 +1,5 @@
package com.google.android.gms.wearable.internal;
interface IWearableListener {
}

View file

@ -0,0 +1,23 @@
package com.google.android.gms.wearable.internal;
import com.google.android.gms.wearable.AddListenerRequest;
import com.google.android.gms.wearable.ConnectionConfiguration;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.RemoveListenerRequest;
import com.google.android.gms.wearable.internal.IWearableCallbacks;
import com.google.android.gms.wearable.internal.IWearableService;
interface IWearableService {
void getConfig(IWearableCallbacks callbacks) = 2;
void putData(IWearableCallbacks callbacks, in PutDataRequest request) = 5;
void getDataItem(IWearableCallbacks callbacks, in Uri uri) = 6;
void getDataItems(IWearableCallbacks callbacks) = 7;
void getLocalNode(IWearableCallbacks callbacks) = 13;
void getConnectedNodes(IWearableCallbacks callbacks) = 14;
void addListener(IWearableCallbacks callbacks, in AddListenerRequest request) = 15;
void removeListener(IWearableCallbacks callbacks, in RemoveListenerRequest request) = 16;
void putConfig(IWearableCallbacks callbacks, in ConnectionConfiguration config) = 19;
void getConfigs(IWearableCallbacks callbacks) = 21;
void getDataItemsByUri(IWearableCallbacks callbacks, in Uri uri, int i) = 39;
void deleteDataItems(IWearableCallbacks callbacks, in Uri uri) = 40;
}

View file

@ -24,7 +24,7 @@ import org.microg.safeparcel.SafeParceled;
public class CorpusStatus extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 2;
private int versionCode;
@SafeParceled(1)
public boolean found;
@SafeParceled(2)
@ -38,5 +38,9 @@ public class CorpusStatus extends AutoSafeParcelable {
@SafeParceled(6)
public String g;
public CorpusStatus() {
versionCode = 2;
}
public static final Creator<CorpusStatus> CREATOR = new AutoCreator<CorpusStatus>(CorpusStatus.class);
}

View file

@ -21,7 +21,7 @@ import org.microg.safeparcel.SafeParceled;
public class PIMEUpdateResponse extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 1;
private int versionCode;
@SafeParceled(1)
private String b;
@ -33,6 +33,7 @@ public class PIMEUpdateResponse extends AutoSafeParcelable {
public final PIMEUpdate[] updates;
public PIMEUpdateResponse() {
versionCode = 1;
this.bytes = null;
this.updates = new PIMEUpdate[0];
}

View file

@ -24,7 +24,7 @@ import java.util.List;
public class QuerySpecification extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode = 2;
@SafeParceled(1)
public final boolean b;
//@SafeParceled(value = 2, subType = "TODO")
@ -43,7 +43,6 @@ public class QuerySpecification extends AutoSafeParcelable {
public final int i;
private QuerySpecification() {
versionCode = 2;
b = false;
c = null;
d = null;

View file

@ -21,7 +21,7 @@ import org.microg.safeparcel.SafeParceled;
public class SearchResults extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode = 2;
private int versionCode = 2;
public static Creator<SearchResults> CREATOR = new AutoCreator<SearchResults>(SearchResults.class);
}

View file

@ -21,7 +21,11 @@ import org.microg.safeparcel.SafeParceled;
public class SuggestSpecification extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 2;
private int versionCode;
public SuggestSpecification() {
versionCode = 2;
}
public static final Creator<SuggestSpecification> CREATOR = new AutoCreator<SuggestSpecification>(SuggestSpecification.class);
}

View file

@ -21,7 +21,7 @@ import org.microg.safeparcel.SafeParceled;
public class SuggestionResults extends AutoSafeParcelable {
@SafeParceled(1000)
private int versionCode = 2;
private int versionCode;
@SafeParceled(1)
public final String errorMessage;
@ -31,17 +31,20 @@ public class SuggestionResults extends AutoSafeParcelable {
public final String[] s2;
private SuggestionResults() {
versionCode = 2;
errorMessage = null;
s1 = s2 = null;
}
public SuggestionResults(String errorMessage) {
versionCode = 2;
this.errorMessage = errorMessage;
this.s1 = null;
this.s2 = null;
}
public SuggestionResults(String[] s1, String[] s2) {
versionCode = 2;
this.errorMessage = null;
this.s1 = s1;
this.s2 = s2;

View file

@ -21,17 +21,12 @@ import org.microg.safeparcel.SafeParceled;
public class AccountChangeEventsRequest extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(2)
private int i;
@SafeParceled(3)
private String s;
private AccountChangeEventsRequest() {
versionCode = 1;
}
public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<AccountChangeEventsRequest>(AccountChangeEventsRequest.class);
}

View file

@ -24,12 +24,11 @@ import java.util.List;
public class AccountChangeEventsResponse extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(value = 2, subType = "com.google.android.gms.auth.AccountChangeEvent")
private List<AccountChangeEvent> events;
public AccountChangeEventsResponse() {
versionCode = 1;
events = new ArrayList<AccountChangeEvent>();
}

View file

@ -11,12 +11,11 @@ import org.microg.safeparcel.SafeParceled;
@PublicApi
public class Scope extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(2)
private final String scopeUri;
private Scope() {
versionCode = -1;
scopeUri = null;
}
@ -24,7 +23,6 @@ public class Scope extends AutoSafeParcelable {
* Creates a new scope with the given URI.
*/
public Scope(String scopeUri) {
versionCode = 1;
this.scopeUri = scopeUri;
}

View file

@ -19,13 +19,12 @@ public final class Status extends AutoSafeParcelable implements Result {
public static final Status CANCELED = new Status(STATUS_CODE_CANCELED);
public static final Status SUCCESS = new Status(0);
private final int versionCode;
private int versionCode = 1;
private final int statusCode;
private final String statusMessage;
private final PendingIntent resolution;
private Status() {
versionCode = 1;
statusCode = 0;
statusMessage = null;
resolution = null;
@ -40,7 +39,6 @@ public final class Status extends AutoSafeParcelable implements Result {
}
public Status(int statusCode, String statusMessage, PendingIntent resolution) {
this.versionCode = 1;
this.statusCode = statusCode;
this.statusMessage = statusMessage;
this.resolution = resolution;

View file

@ -31,7 +31,7 @@ import java.util.Arrays;
public class GetServiceRequest extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 2;
@SafeParceled(2)
public final int serviceId;
@ -55,13 +55,11 @@ public class GetServiceRequest extends AutoSafeParcelable {
public Account account;
private GetServiceRequest() {
versionCode = 2;
serviceId = -1;
gmsVersion = Constants.MAX_REFERENCE_VERSION;
}
public GetServiceRequest(int serviceId) {
this.versionCode = 2;
this.serviceId = serviceId;
this.gmsVersion = Constants.MAX_REFERENCE_VERSION;
}

View file

@ -86,7 +86,7 @@ public class LocationRequest extends AutoSafeParcelable {
public static final int PRIORITY_NO_POWER = 105;
@SafeParceled(1000)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
private int priority;
@SafeParceled(2)
@ -105,7 +105,6 @@ public class LocationRequest extends AutoSafeParcelable {
private long maxWaitTime;
public LocationRequest() {
this.versionCode = 1;
this.priority = PRIORITY_BALANCED_POWER_ACCURACY;
this.interval = 3600000;
this.fastestInterval = 600000;

View file

@ -16,7 +16,7 @@ public class LocationStatus extends AutoSafeParcelable {
public static final int STATUS_LOCATION_DISABLED_IN_SETTINGS = 7;
public static final int STATUS_IN_PROGRESS = 8;
@SafeParceled(1000)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
int cellStatus;
@SafeParceled(2)
@ -24,10 +24,6 @@ public class LocationStatus extends AutoSafeParcelable {
@SafeParceled(3)
long elapsedRealtimeNanos;
private LocationStatus() {
versionCode = 1;
}
@Override
public boolean equals(Object o) {
if (this == o)

View file

@ -9,11 +9,7 @@ import org.microg.safeparcel.SafeParceled;
public class AutocompleteFilter extends AutoSafeParcelable {
@SafeParceled(1000)
private final int versionCode;
private AutocompleteFilter() {
this.versionCode = 1;
}
private int versionCode = 1;
public static final Creator<AutocompleteFilter> CREATOR = new AutoCreator<AutocompleteFilter>(AutocompleteFilter.class);
}

View file

@ -9,11 +9,7 @@ import org.microg.safeparcel.SafeParceled;
public class UserAddedPlace extends AutoSafeParcelable {
@SafeParceled(1000)
private final int versionCode;
private UserAddedPlace() {
versionCode = 1;
}
private int versionCode = 1;
public static final Creator<UserAddedPlace> CREATOR = new AutoCreator<UserAddedPlace>(UserAddedPlace.class);
}

View file

@ -6,7 +6,7 @@ import org.microg.safeparcel.SafeParceled;
public class PlacesParams extends AutoSafeParcelable {
@SafeParceled(1000)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
public final String clientPackageName;
@SafeParceled(2)
@ -17,7 +17,6 @@ public class PlacesParams extends AutoSafeParcelable {
public final String gCoreClientName;
private PlacesParams() {
versionCode = 1;
clientPackageName = locale = accountName = gCoreClientName = null;
}

View file

@ -31,7 +31,7 @@ import java.util.Arrays;
@PublicApi
public final class CameraPosition extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
/**
* The location that the camera is pointing at.
*/
@ -61,7 +61,6 @@ public final class CameraPosition extends AutoSafeParcelable {
*/
private CameraPosition() {
target = null;
versionCode = 1;
zoom = tilt = bearing = 0;
}
@ -81,7 +80,6 @@ public final class CameraPosition extends AutoSafeParcelable {
*/
public CameraPosition(LatLng target, float zoom, float tilt, float bearing)
throws NullPointerException, IllegalArgumentException {
versionCode = 1;
if (target == null) {
throw new NullPointerException("null camera target");
}

View file

@ -26,7 +26,7 @@ import org.microg.safeparcel.SafeParceled;
@PublicApi
public final class LatLng extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
/**
* Latitude, in degrees. This value is in the range [-90, 90].
*/
@ -43,7 +43,6 @@ public final class LatLng extends AutoSafeParcelable {
* In fact, those are replaced by their real values later using SafeParcelUtil.
*/
private LatLng() {
versionCode = 1;
latitude = longitude = 0;
}
@ -56,7 +55,6 @@ public final class LatLng extends AutoSafeParcelable {
* inclusive and +180 degrees exclusive.
*/
public LatLng(double latitude, double longitude) {
this.versionCode = 1;
this.latitude = Math.max(-90, Math.min(90, latitude));
if ((-180 <= longitude) && (longitude < 180)) {
this.longitude = longitude;

View file

@ -28,7 +28,7 @@ import java.util.Arrays;
@PublicApi
public final class LatLngBounds extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
/**
* Southwest corner of the bound.
*/
@ -45,7 +45,6 @@ public final class LatLngBounds extends AutoSafeParcelable {
* In fact, those are replaced by their real values later using SafeParcelUtil.
*/
private LatLngBounds() {
this.versionCode = 1;
southwest = northeast = null;
}
@ -70,7 +69,6 @@ public final class LatLngBounds extends AutoSafeParcelable {
if (northeast.latitude < southwest.latitude)
throw new IllegalArgumentException("latitude of northeast corner must not be" +
" lower than latitude of southwest corner");
this.versionCode = 1;
this.southwest = southwest;
this.northeast = northeast;
}

View file

@ -11,7 +11,7 @@ import org.microg.safeparcel.SafeParceled;
@PublicApi
public class Tile extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
/**
* The width of the image encoded by {@link #data} in pixels.
*/
@ -30,7 +30,6 @@ public class Tile extends AutoSafeParcelable {
public final byte[] data;
private Tile() {
versionCode = 1;
width = height = 0;
data = null;
}
@ -45,7 +44,6 @@ public class Tile extends AutoSafeParcelable {
* {@link android.graphics.BitmapFactory#decodeByteArray(byte[], int, int)}.
*/
public Tile(int width, int height, byte[] data) {
this.versionCode = 1;
this.width = width;
this.height = height;
this.data = data;

View file

@ -18,6 +18,7 @@ package com.google.android.gms.maps.model;
import android.os.IBinder;
import android.os.RemoteException;
import com.google.android.gms.maps.model.internal.ITileProviderDelegate;
import org.microg.gms.common.PublicApi;
@ -31,7 +32,7 @@ import org.microg.safeparcel.SafeParceled;
public class TileOverlayOptions extends AutoSafeParcelable {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
/**
* This is a IBinder to the {@link #tileProvider}, built using {@link ITileProviderDelegate}.
*/
@ -49,7 +50,6 @@ public class TileOverlayOptions extends AutoSafeParcelable {
* Creates a new set of tile overlay options.
*/
public TileOverlayOptions() {
versionCode = 1;
}
/**

View file

@ -24,7 +24,7 @@ import java.util.Date;
public class LogEvent extends AutoSafeParcelable {
@SafeParceled(1)
public final int versionCode;
private int versionCode = 1;
@SafeParceled(2)
public final long eventTime;
@ -36,7 +36,6 @@ public class LogEvent extends AutoSafeParcelable {
public final byte[] data;
private LogEvent() {
versionCode = 1;
eventTime = -1;
tag = null;
data = null;

View file

@ -22,7 +22,7 @@ import org.microg.safeparcel.SafeParceled;
public class PlayLoggerContext extends AutoSafeParcelable {
@SafeParceled(1)
public final int versionCode;
private int versionCode = 1;
@SafeParceled(2)
public final String packageName;
@ -43,14 +43,12 @@ public class PlayLoggerContext extends AutoSafeParcelable {
public final String logSourceName;
private PlayLoggerContext() {
this.versionCode = 1;
packageName = uploadAccount = logSourceName = null;
logSource = loggingId = -1;
logAndroidId = false;
}
public PlayLoggerContext(String packageName, int logSource, String uploadAccount, int loggingId, String logSourceName) {
this.versionCode = 1;
this.packageName = packageName;
this.logSource = logSource;
this.uploadAccount = uploadAccount;

View file

@ -22,7 +22,7 @@ import org.microg.safeparcel.SafeParceled;
public class GetCorpusStatusRequest extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
public final String packageName;
@ -31,7 +31,6 @@ public class GetCorpusStatusRequest extends AutoSafeParcelable {
public final String corpus;
private GetCorpusStatusRequest() {
versionCode = 1;
packageName = null;
corpus = null;
}

View file

@ -25,7 +25,7 @@ import org.microg.safeparcel.SafeParceled;
public class GetCorpusStatusResponse extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode;
@SafeParceled(1)
public final Status status;
@ -34,13 +34,11 @@ public class GetCorpusStatusResponse extends AutoSafeParcelable {
public final CorpusStatus corpusStatus;
private GetCorpusStatusResponse() {
versionCode = 1;
status = null;
corpusStatus = null;
}
public GetCorpusStatusResponse(Status status, CorpusStatus corpusStatus) {
this.versionCode = 1;
this.status = status;
this.corpusStatus = corpusStatus;
}

View file

@ -22,7 +22,7 @@ import org.microg.safeparcel.SafeParceled;
public class RequestIndexingRequest extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
public final String packageName;
@ -34,7 +34,6 @@ public class RequestIndexingRequest extends AutoSafeParcelable {
public final long sequenceNumber;
private RequestIndexingRequest() {
versionCode = 1;
packageName = null;
corpus = null;
sequenceNumber = 0;

View file

@ -24,7 +24,7 @@ import org.microg.safeparcel.SafeParceled;
public class RequestIndexingResponse extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode;
@SafeParceled(1)
public final Status status;
@ -33,13 +33,11 @@ public class RequestIndexingResponse extends AutoSafeParcelable {
public final boolean scheduledIndexing;
private RequestIndexingResponse() {
versionCode = 1;
status = null;
scheduledIndexing = false;
}
public RequestIndexingResponse(Status status, boolean scheduledIndexing) {
this.versionCode = 1;
this.status = status;
this.scheduledIndexing = scheduledIndexing;
}

View file

@ -25,7 +25,7 @@ import org.microg.safeparcel.SafeParceled;
public class QueryResponse extends AutoSafeParcelable {
@SafeParceled(1000)
public final int versionCode;
private int versionCode = 1;
@SafeParceled(1)
public final Status status;
@ -34,13 +34,11 @@ public class QueryResponse extends AutoSafeParcelable {
public final SearchResults results;
private QueryResponse() {
versionCode = 1;
status = null;
results = null;
}
public QueryResponse(Status status, SearchResults results) {
this.versionCode = 1;
this.status = status;
this.results = results;
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import android.content.IntentFilter;
import com.google.android.gms.wearable.internal.IWearableListener;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class AddListenerRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final IWearableListener listener;
@SafeParceled(3)
public final IntentFilter[] intentFilters;
private AddListenerRequest() {
listener = null;
intentFilters = null;
}
public AddListenerRequest(IWearableListener listener, IntentFilter[] intentFilters) {
this.listener = listener;
this.intentFilters = intentFilters;
}
public static final Creator<AddListenerRequest> CREATOR = new AutoCreator<AddListenerRequest>(AddListenerRequest.class);
}

View file

@ -1,4 +1,53 @@
package com.google.android.gms.wearable;
public class ConnectionConfiguration {
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class ConnectionConfiguration extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final String name;
@SafeParceled(3)
public final String address;
@SafeParceled(4)
public final int type;
@SafeParceled(5)
public final int role;
@SafeParceled(6)
public final boolean enabled;
@SafeParceled(7)
public boolean connected = false;
@SafeParceled(8)
public String peerNodeId;
@SafeParceled(9)
public boolean btlePriority = true;
@SafeParceled(10)
public String nodeId;
private ConnectionConfiguration() {
name = address = null;
type = role = 0;
enabled = false;
}
public ConnectionConfiguration(String name, String address, int type, int role, boolean enabled) {
this.name = name;
this.address = address;
this.type = type;
this.role = role;
this.enabled = enabled;
}
public ConnectionConfiguration(String name, String address, int type, int role, boolean enabled, String nodeId) {
this.name = name;
this.address = address;
this.type = type;
this.role = role;
this.enabled = enabled;
this.nodeId = nodeId;
}
public static final Creator<ConnectionConfiguration> CREATOR = new AutoCreator<ConnectionConfiguration>(ConnectionConfiguration.class);
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
public class DeleteDataItemsResponse extends AutoSafeParcelable {
public static final Creator<DeleteDataItemsResponse> CREATOR = new AutoCreator<DeleteDataItemsResponse>(DeleteDataItemsResponse.class);
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetConfigResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final ConnectionConfiguration connectionConfiguration;
private GetConfigResponse() {
statusCode = 0;
connectionConfiguration = null;
}
public GetConfigResponse(int statusCode, ConnectionConfiguration connectionConfiguration) {
this.statusCode = statusCode;
this.connectionConfiguration = connectionConfiguration;
}
public static final Creator<GetConfigResponse> CREATOR = new AutoCreator<GetConfigResponse>(GetConfigResponse.class);
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetConfigsResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final ConnectionConfiguration[] configurations;
private GetConfigsResponse() {
statusCode = 0;
configurations = null;
}
public GetConfigsResponse(int statusCode, ConnectionConfiguration[] configurations) {
this.statusCode = statusCode;
this.configurations = configurations;
}
public static final Creator<GetConfigsResponse> CREATOR = new AutoCreator<GetConfigsResponse>(GetConfigsResponse.class);
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import com.google.android.gms.wearable.internal.NodeParcelable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.List;
public class GetConnectedNodesResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final List<NodeParcelable> nodes;
private GetConnectedNodesResponse() {
statusCode = 0;
nodes = null;
}
public GetConnectedNodesResponse(int statusCode, List<NodeParcelable> nodes) {
this.statusCode = statusCode;
this.nodes = nodes;
}
public static final Creator<GetConnectedNodesResponse> CREATOR = new AutoCreator<GetConnectedNodesResponse>(GetConnectedNodesResponse.class);
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import com.google.android.gms.wearable.internal.DataItemParcelable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetDataItemResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final DataItemParcelable dataItem;
private GetDataItemResponse() {
statusCode = 0;
dataItem = null;
}
public GetDataItemResponse(int statusCode, DataItemParcelable dataItem) {
this.statusCode = statusCode;
this.dataItem = dataItem;
}
public static final Creator<GetDataItemResponse> CREATOR = new AutoCreator<GetDataItemResponse>(GetDataItemResponse.class);
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
public class GetFdForAssetResponse extends AutoSafeParcelable {
public static final Creator<GetFdForAssetResponse> CREATOR = new AutoCreator<GetFdForAssetResponse>(GetFdForAssetResponse.class);
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import com.google.android.gms.wearable.internal.NodeParcelable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class GetLocalNodeResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final NodeParcelable node;
private GetLocalNodeResponse() {
statusCode = 0;
node = null;
}
public GetLocalNodeResponse(int statusCode, NodeParcelable node) {
this.statusCode = statusCode;
this.node = node;
}
public static final Creator<GetLocalNodeResponse> CREATOR = new AutoCreator<GetLocalNodeResponse>(GetLocalNodeResponse.class);
}

View file

@ -17,11 +17,17 @@
package com.google.android.gms.wearable;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import com.google.android.gms.wearable.internal.DataItemAssetParcelable;
import org.microg.gms.common.PublicApi;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
@ -31,19 +37,46 @@ import java.util.Map;
public class PutDataRequest extends AutoSafeParcelable {
public static final String WEAR_URI_SCHEME = "wear";
private DataItem dataItem;
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
final Uri uri;
@SafeParceled(4)
private final Bundle assets;
@SafeParceled(5)
byte[] data;
private PutDataRequest(DataItem dataItem) {
this.dataItem = dataItem;
private PutDataRequest() {
uri = null;
assets = new Bundle();
}
private PutDataRequest(Uri uri) {
this.uri = uri;
assets = new Bundle();
}
public static PutDataRequest create(Uri uri) {
return new PutDataRequest(uri);
}
public static PutDataRequest create(String path) {
// TODO
return new PutDataRequest(null);
if (TextUtils.isEmpty(path)) {
throw new IllegalArgumentException("An empty path was supplied.");
} else if (!path.startsWith("/")) {
throw new IllegalArgumentException("A path must start with a single / .");
} else if (path.startsWith("//")) {
throw new IllegalArgumentException("A path must start with a single / .");
} else {
return create((new Uri.Builder()).scheme(WEAR_URI_SCHEME).path(path).build());
}
}
public static PutDataRequest createFromDataItem(DataItem source) {
return new PutDataRequest(source);
PutDataRequest dataRequest = new PutDataRequest(source.getUri());
dataRequest.data = source.getData();
// TODO: assets
return dataRequest;
}
public static PutDataRequest createWithAutoAppendedId(String pathPrefix) {
@ -51,39 +84,42 @@ public class PutDataRequest extends AutoSafeParcelable {
}
public Asset getAsset(String key) {
// TODO
return null;
return assets.getParcelable(key);
}
public Map<String, Asset> getAssets() {
// TODO
return Collections.emptyMap();
Map<String, Asset> map = new HashMap<String, Asset>();
assets.setClassLoader(DataItemAssetParcelable.class.getClassLoader());
for (String key : assets.keySet()) {
map.put(key, (Asset) assets.getParcelable(key));
}
return map;
}
public byte[] getData() {
return dataItem.getData();
return data;
}
public Uri getUri() {
return dataItem.getUri();
return uri;
}
public boolean hasAsset(String key) {
return dataItem.getAssets().containsKey(key);
return assets.containsKey(key);
}
public PutDataRequest putAsset(String key, Asset value) {
// TODO
assets.putParcelable(key, value);
return this;
}
public PutDataRequest removeAsset(String key) {
// TODO
assets.remove(key);
return this;
}
public PutDataRequest setData(byte[] data) {
// TODO
this.data = data;
return this;
}
@ -93,7 +129,10 @@ public class PutDataRequest extends AutoSafeParcelable {
}
public String toString(boolean verbose) {
return "PutDataRequest{data=" + dataItem + "}";
return "PutDataRequest[data=" + (data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP)) +
", numAssets=" + getAssets().size() +
", uri=" + uri + "]";
// TODO: Verbose: dump all assets
}
public static final Creator<PutDataRequest> CREATOR = new AutoCreator<PutDataRequest>(PutDataRequest.class);

View file

@ -0,0 +1,43 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import com.google.android.gms.wearable.internal.DataItemParcelable;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class PutDataResponse extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final int statusCode;
@SafeParceled(3)
public final DataItemParcelable dataItem;
private PutDataResponse() {
statusCode = 0;
dataItem = null;
}
public PutDataResponse(int statusCode, DataItemParcelable dataItem) {
this.statusCode = statusCode;
this.dataItem = dataItem;
}
public static final Creator<PutDataResponse> CREATOR = new AutoCreator<PutDataResponse>(PutDataResponse.class);
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import com.google.android.gms.wearable.internal.IWearableListener;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class RemoveListenerRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final IWearableListener listener;
private RemoveListenerRequest() {
listener = null;
}
public RemoveListenerRequest(IWearableListener listener) {
this.listener = listener;
}
public static final Creator<RemoveListenerRequest> CREATOR = new AutoCreator<RemoveListenerRequest>(RemoveListenerRequest.class);
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
public class SendMessageResponse extends AutoSafeParcelable {
public static final Creator<SendMessageResponse> CREATOR = new AutoCreator<SendMessageResponse>(SendMessageResponse.class);
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-2015 µg 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.wearable;
import org.microg.safeparcel.AutoSafeParcelable;
public class StorageInfoResponse extends AutoSafeParcelable {
public static final Creator<StorageInfoResponse> CREATOR = new AutoCreator<StorageInfoResponse>(StorageInfoResponse.class);
}

View file

@ -0,0 +1,23 @@
/*
* Copyright 2013-2015 µg 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.wearable.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class DataItemAssetParcelable extends AutoSafeParcelable {
public static final Creator<DataItemAssetParcelable> CREATOR = new AutoCreator<DataItemAssetParcelable>(DataItemAssetParcelable.class);
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2013-2015 µg 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.wearable.internal;
import android.net.Uri;
import android.os.Bundle;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.HashMap;
import java.util.Map;
public class DataItemParcelable extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final Uri uri;
@SafeParceled(4)
private final Bundle assets;
@SafeParceled(5)
public byte[] data;
private DataItemParcelable() {
uri = null;
assets = new Bundle();
data = null;
}
public DataItemParcelable(Uri uri) {
this(uri, new HashMap<String, DataItemAssetParcelable>());
}
public DataItemParcelable(Uri uri, Map<String, DataItemAssetParcelable> assets) {
this.uri = uri;
this.assets = new Bundle();
for (String key : assets.keySet()) {
this.assets.putParcelable(key, assets.get(key));
}
data = null;
}
public Map<String, DataItemAssetParcelable> getAssets() {
Map<String, DataItemAssetParcelable> assets = new HashMap<String, DataItemAssetParcelable>();
this.assets.setClassLoader(DataItemAssetParcelable.class.getClassLoader());
for (String key : this.assets.keySet()) {
assets.put(key, (DataItemAssetParcelable) this.assets.getParcelable(key));
}
return assets;
}
public static final Creator<DataItemParcelable> CREATOR = new AutoCreator<DataItemParcelable>(DataItemParcelable.class);
}

View file

@ -26,19 +26,17 @@ import org.microg.safeparcel.SafeParceled;
*/
public class NodeParcelable extends AutoSafeParcelable implements Node {
@SafeParceled(1)
private final int versionCode;
private int versionCode = 1;
@SafeParceled(2)
private final String id;
@SafeParceled(3)
private final String displayName;
private NodeParcelable() {
versionCode = 1;
id = displayName = null;
}
public NodeParcelable(String id, String displayName) {
versionCode = 1;
this.id = id;
this.displayName = displayName;
}