mirror of
https://github.com/moparisthebest/android_external_GmsLib
synced 2024-11-14 04:55:10 -05:00
Start adding support for wearable API
This commit is contained in:
parent
2f2745d6e9
commit
ad1d47e1cf
2
GmsApi
2
GmsApi
@ -1 +1 @@
|
||||
Subproject commit c4db81d1fcf5c301f34e12d5675b9b50c507bd42
|
||||
Subproject commit 3c19d84eaa9842a2526166a38ad445125dbd2300
|
@ -10,6 +10,7 @@ import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.microg.gms.Constants;
|
||||
import org.microg.gms.PublicApi;
|
||||
|
||||
/**
|
||||
* Utility class for verifying that the Google Play services APK is available and up-to-date on
|
||||
@ -19,6 +20,7 @@ import org.microg.gms.Constants;
|
||||
* TODO: methods :)
|
||||
*/
|
||||
public class GooglePlayServicesUtil {
|
||||
@PublicApi(exclude = true)
|
||||
private static final String TAG = "GooglePlayServicesUtil";
|
||||
|
||||
public static final String GMS_ERROR_DIALOG = "GooglePlayServicesErrorDialog";
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.google.android.gms.common.api;
|
||||
|
||||
import org.microg.gms.PublicApi;
|
||||
import org.microg.gms.common.api.ApiBuilder;
|
||||
|
||||
/**
|
||||
@ -14,14 +15,17 @@ import org.microg.gms.common.api.ApiBuilder;
|
||||
* <p/>
|
||||
* See {@link GoogleApiClient.Builder} for usage examples.
|
||||
*/
|
||||
@PublicApi
|
||||
public final class Api<O extends Api.ApiOptions> {
|
||||
|
||||
private final ApiBuilder<O> builder;
|
||||
|
||||
@PublicApi(exclude = true)
|
||||
public Api(ApiBuilder<O> builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@PublicApi(exclude = true)
|
||||
public ApiBuilder<O> getBuilder() {
|
||||
return builder;
|
||||
}
|
||||
@ -30,28 +34,33 @@ public final class Api<O extends Api.ApiOptions> {
|
||||
* Base interface for API options. These are used to configure specific parameters for
|
||||
* individual API surfaces. The default implementation has no parameters.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface ApiOptions {
|
||||
/**
|
||||
* Base interface for {@link ApiOptions} in {@link Api}s that have options.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface HasOptions extends ApiOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Base interface for {@link ApiOptions} that are not required, don't exist.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface NotRequiredOptions extends ApiOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ApiOptions} implementation for {@link Api}s that do not take any options.
|
||||
*/
|
||||
@PublicApi
|
||||
public final class NoOptions implements NotRequiredOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Base interface for {@link ApiOptions} that are optional.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface Optional extends HasOptions, NotRequiredOptions {
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import android.view.View;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
|
||||
import org.microg.gms.Constants;
|
||||
import org.microg.gms.PublicApi;
|
||||
import org.microg.gms.common.api.GoogleApiClientImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -37,6 +38,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* method and then call {@link #connect()} in {@link Activity#onStart()} and {@link #disconnect()}
|
||||
* in {@link Activity#onStop()}, regardless of the state.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface GoogleApiClient {
|
||||
/**
|
||||
* Connects the client to Google Play services. Blocks until the connection either succeeds or
|
||||
@ -217,6 +219,7 @@ public interface GoogleApiClient {
|
||||
/**
|
||||
* Builder to configure a {@link GoogleApiClient}.
|
||||
*/
|
||||
@PublicApi
|
||||
public class Builder {
|
||||
private final Context context;
|
||||
private final Map<Api, Api.ApiOptions> apis = new HashMap<>();
|
||||
@ -412,6 +415,7 @@ public interface GoogleApiClient {
|
||||
* Provides callbacks that are called when the client is connected or disconnected from the
|
||||
* service. Most applications implement {@link #onConnected(Bundle)} to start making requests.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface ConnectionCallbacks {
|
||||
/**
|
||||
* A suspension cause informing that the service has been killed.
|
||||
@ -456,6 +460,7 @@ public interface GoogleApiClient {
|
||||
* the service. See {@link ConnectionResult} for a list of error codes and suggestions for
|
||||
* resolution.
|
||||
*/
|
||||
@PublicApi
|
||||
public interface OnConnectionFailedListener {
|
||||
/**
|
||||
* Called when there was an error connecting the client to the service.
|
||||
|
@ -12,6 +12,10 @@ import org.microg.gms.common.ForwardConnectionCallbacks;
|
||||
import org.microg.gms.common.ForwardConnectionFailedListener;
|
||||
import org.microg.gms.common.api.AbstractPlayServicesClient;
|
||||
|
||||
/**
|
||||
* This class is deprecated as of play services 6.5, do not use it in production systems,
|
||||
* it's just a forwarder for the {@link FusedLocationProviderApi}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class LocationClient extends AbstractPlayServicesClient {
|
||||
public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
|
||||
|
@ -1,32 +1,17 @@
|
||||
package com.google.android.gms.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.google.android.gms.common.api.AccountInfo;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
|
||||
import org.microg.gms.common.api.ApiBuilder;
|
||||
import org.microg.gms.common.api.ApiConnection;
|
||||
import org.microg.gms.location.FusedLocationProviderApiImpl;
|
||||
import org.microg.gms.location.GeofencingApiImpl;
|
||||
import org.microg.gms.location.LocationClientImpl;
|
||||
import org.microg.gms.location.LocationServicesApiBuilder;
|
||||
|
||||
/**
|
||||
* The main entry point for location services integration.
|
||||
*/
|
||||
public class LocationServices {
|
||||
public static final Api<Api.ApiOptions.NoOptions> API = new Api<>(
|
||||
new ApiBuilder<Api.ApiOptions.NoOptions>() {
|
||||
@Override
|
||||
public ApiConnection build(Context context, Looper looper,
|
||||
Api.ApiOptions.NoOptions options,
|
||||
AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
|
||||
return new LocationClientImpl(context, callbacks, connectionFailedListener);
|
||||
}
|
||||
});
|
||||
public static final Api<Api.ApiOptions.NoOptions> API = new Api<>(new
|
||||
LocationServicesApiBuilder());
|
||||
public static final FusedLocationProviderApi FusedLocationApi = new
|
||||
FusedLocationProviderApiImpl();
|
||||
public static final GeofencingApi GeofencingApi = new GeofencingApiImpl();
|
||||
|
20
src/com/google/android/gms/wearable/DataApi.java
Normal file
20
src/com/google/android/gms/wearable/DataApi.java
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2014-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;
|
||||
|
||||
public interface DataApi {
|
||||
}
|
20
src/com/google/android/gms/wearable/MessageApi.java
Normal file
20
src/com/google/android/gms/wearable/MessageApi.java
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2014-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;
|
||||
|
||||
public interface MessageApi {
|
||||
}
|
20
src/com/google/android/gms/wearable/NodeApi.java
Normal file
20
src/com/google/android/gms/wearable/NodeApi.java
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2014-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;
|
||||
|
||||
public interface NodeApi {
|
||||
}
|
47
src/com/google/android/gms/wearable/Wearable.java
Normal file
47
src/com/google/android/gms/wearable/Wearable.java
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2014-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.common.api.Api;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
|
||||
import org.microg.gms.wearable.DataApiImpl;
|
||||
import org.microg.gms.wearable.MessageApiImpl;
|
||||
import org.microg.gms.wearable.NodeApiImpl;
|
||||
import org.microg.gms.wearable.WearableApiBuilder;
|
||||
|
||||
/**
|
||||
* An API for the Android Wear platform.
|
||||
*/
|
||||
public class Wearable {
|
||||
/**
|
||||
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Wearable features.
|
||||
*/
|
||||
public static final Api<WearableOptions> API = new Api<>(new WearableApiBuilder());
|
||||
|
||||
public static final DataApi DataApi = new DataApiImpl();
|
||||
public static final MessageApi MessageApi = new MessageApiImpl();
|
||||
public static final NodeApi NodeApi = new NodeApiImpl();
|
||||
|
||||
public static class WearableOptions implements Api.ApiOptions.Optional {
|
||||
public static class Builder {
|
||||
public WearableOptions build() {
|
||||
return new WearableOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
src/org/microg/gms/location/LocationServicesApiBuilder.java
Normal file
37
src/org/microg/gms/location/LocationServicesApiBuilder.java
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2014-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 org.microg.gms.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.google.android.gms.common.api.AccountInfo;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
|
||||
import org.microg.gms.common.api.ApiBuilder;
|
||||
import org.microg.gms.common.api.ApiConnection;
|
||||
|
||||
public class LocationServicesApiBuilder implements ApiBuilder<Api.ApiOptions.NoOptions> {
|
||||
@Override
|
||||
public ApiConnection build(Context context, Looper looper,
|
||||
Api.ApiOptions.NoOptions options,
|
||||
AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
|
||||
return new LocationClientImpl(context, callbacks, connectionFailedListener);
|
||||
}
|
||||
}
|
22
src/org/microg/gms/wearable/DataApiImpl.java
Normal file
22
src/org/microg/gms/wearable/DataApiImpl.java
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014-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 org.microg.gms.wearable;
|
||||
|
||||
import com.google.android.gms.wearable.DataApi;
|
||||
|
||||
public class DataApiImpl implements DataApi {
|
||||
}
|
22
src/org/microg/gms/wearable/MessageApiImpl.java
Normal file
22
src/org/microg/gms/wearable/MessageApiImpl.java
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014-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 org.microg.gms.wearable;
|
||||
|
||||
import com.google.android.gms.wearable.MessageApi;
|
||||
|
||||
public class MessageApiImpl implements MessageApi {
|
||||
}
|
22
src/org/microg/gms/wearable/NodeApiImpl.java
Normal file
22
src/org/microg/gms/wearable/NodeApiImpl.java
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2014-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 org.microg.gms.wearable;
|
||||
|
||||
import com.google.android.gms.wearable.NodeApi;
|
||||
|
||||
public class NodeApiImpl implements NodeApi {
|
||||
}
|
40
src/org/microg/gms/wearable/WearableApiBuilder.java
Normal file
40
src/org/microg/gms/wearable/WearableApiBuilder.java
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2014-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 org.microg.gms.wearable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.api.AccountInfo;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.wearable.Wearable;
|
||||
|
||||
import org.microg.gms.common.api.ApiBuilder;
|
||||
import org.microg.gms.common.api.ApiConnection;
|
||||
|
||||
public class WearableApiBuilder implements ApiBuilder<Wearable.WearableOptions> {
|
||||
private static final String TAG = "GmsWearableApi";
|
||||
|
||||
@Override
|
||||
public ApiConnection build(Context context, Looper looper, Wearable.WearableOptions options,
|
||||
AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
|
||||
GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
|
||||
Log.d(TAG, "Wearables not supported");
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user