diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 03cfe798..aa76e3eb 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip diff --git a/play-services-api/build.gradle b/play-services-api/build.gradle index 28a98c26..b1477716 100644 --- a/play-services-api/build.gradle +++ b/play-services-api/build.gradle @@ -19,25 +19,23 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.android.tools.build:gradle:2.0.0' } } apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' String getMyVersionName() { def stdout = new ByteArrayOutputStream() - exec { - commandLine 'git', 'describe', '--tags', '--always', '--dirty' - standardOutput = stdout - } - return stdout.toString().trim() + if (rootProject.file("gradlew").exists()) + exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout } + else // automatic build system, don't tag dirty + exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout } + return stdout.toString().trim().substring(1) } group = 'org.microg' -version = getMyVersionName().substring(1) +version = getMyVersionName() android { compileSdkVersion 23 diff --git a/play-services-api/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java b/play-services-api/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java index 9633516d..3a4754fc 100644 --- a/play-services-api/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java +++ b/play-services-api/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java @@ -23,7 +23,7 @@ import android.os.IBinder; import com.google.android.gms.common.api.Scope; import org.microg.gms.common.Constants; -import org.microg.gms.common.Services; +import org.microg.gms.common.GmsService; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; @@ -67,7 +67,7 @@ public class GetServiceRequest extends AutoSafeParcelable { @Override public String toString() { return "GetServiceRequest{" + - "serviceId=" + Services.nameFromServiceId(serviceId) + + "serviceId=" + GmsService.nameFromServiceId(serviceId) + ", gmsVersion=" + gmsVersion + ", packageName='" + packageName + '\'' + (scopes == null || scopes.length == 0 ? "" : (", scopes=" + Arrays.toString(scopes))) + diff --git a/play-services-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java b/play-services-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java index eb707a9a..1b813e40 100644 --- a/play-services-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java +++ b/play-services-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java @@ -65,5 +65,21 @@ public class ConnectionConfiguration extends AutoSafeParcelable { this.nodeId = nodeId; } + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("ConnectionConfiguration{"); + sb.append("name='").append(name).append('\''); + sb.append(", address='").append(address).append('\''); + sb.append(", type=").append(type); + sb.append(", role=").append(role); + sb.append(", enabled=").append(enabled); + sb.append(", connected=").append(connected); + sb.append(", peerNodeId='").append(peerNodeId).append('\''); + sb.append(", btlePriority=").append(btlePriority); + sb.append(", nodeId='").append(nodeId).append('\''); + sb.append('}'); + return sb.toString(); + } + public static final Creator CREATOR = new AutoCreator(ConnectionConfiguration.class); } diff --git a/play-services-api/src/main/java/org/microg/gms/common/GmsService.java b/play-services-api/src/main/java/org/microg/gms/common/GmsService.java new file mode 100644 index 00000000..51f6f90b --- /dev/null +++ b/play-services-api/src/main/java/org/microg/gms/common/GmsService.java @@ -0,0 +1,118 @@ +/* + * Copyright 2013-2015 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 org.microg.gms.common; + +public enum GmsService { + UNKNOWN(-2), + ANY(-1), + GAMES(1, "com.google.android.gms.games.service.START"), + PLUS(2, "com.google.android.gms.plus.service.START", "com.google.android.gms.plus.service.internal.START"), + PANORAMA(3, "com.google.android.gms.panorama.service.START"), + WALLET(4, "com.google.android.gms.wallet.service.BIND"), + PEOPLE(5, "com.google.android.gms.people.service.START"), + LOCATION(6), + APPSTATE(7, "com.google.android.gms.appstate.service.START"), + ADREQUEST(8, "com.google.android.gms.ads.service.START"), + ACCOUNT(9, "com.google.android.gms.accounts.ACCOUNT_SERVICE"), + CAST(10, "com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"), + DRIVE(11, "com.google.android.gms.drive.ApiService.START"), + ADDRESS(12, "com.google.android.gms.identity.service.BIND"), + CAR(13, "com.google.android.gms.car.service.START"), + WEARABLE(14, "com.google.android.gms.wearable.BIND"), + AUTH(16, "com.google.android.gms.auth.service.START"), + FITNESS(17, "com.google.android.gms.fitness.GoogleFitnessService.START"), + REMINDERS(18, "com.google.android.gms.reminders.service.START"), + LIGHTWEIGHT_INDEX(19, "com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"), + DEVICE_CONNECTION(20, "com.google.android.gms.deviceconnection.service.START"), + INDEX(21, "com.google.android.gms.icing.INDEX_SERVICE"), + LOCATION_REPORTING(22, "com.google.android.gms.location.reporting.service.START", "com.google.android.location.reporting.service.START"), + LOCATION_MANAGER(23, "com.google.android.location.internal.GoogleLocationManagerService.START"), + PLAY_LOG(24, "com.google.android.gms.playlog.service.START"), + DROIDGUARD(25, "com.google.android.gms.droidguard.service.START"), + LOCKBOX(26, "com.google.android.gms.lockbox.service.START"), + CAST_MIRRORING(27, "com.google.android.gms.cast_mirroring.service.START"), + NETWORK_QUALITY(28, "com.google.android.gms.mdm.services.START"), + FEEDBACK(29, "com.google.android.gms.feedback.internal.IFeedbackService"), + SEARCH_ADMINISTRATION(30), + PHOTO_AUTO_BACKUP(31, "com.google.android.gms.photos.autobackup.service.START"), + SEARCH_QUERIES(32), + SEARCH_GLOBAL(33), + UDC(35, "com.google.android.gms.udc.service.START"), + SEARCH_CORPORA(36), + DEVICE_MANAGER(37, "com.google.android.gms.mdm.services.DeviceManagerApiService.START"), + PSEUDONYMOUS_ID(38, "com.google.android.gms.pseudonymous.service.START"), + COMMON(39, "com.google.android.gms.common.service.START"), + CLEARCUT_LOGGER(40, "com.google.android.gms.clearcut.service.START"), + USAGE_REPORTING(41, "com.google.android.gms.usagereporting.service.START"), + KIDS(42, "com.google.android.gms.kids.service.START"), + DOWNLOAD(43, "com.google.android.gms.common.download.START"), + SIGN_IN(44, "com.google.android.gms.signin.service.START"), + SAFETY_NET_CLIENT(45, "com.google.android.gms.safetynet.service.START"), + GSERVICES(46, "com.google.android.gms.ads.gservice.START"), + CONTEXT_MANAGER(47, "com.google.android.contextmanager.service.ContextManagerService.START"), + AUDIO_MODEM(48, "com.google.android.gms.audiomodem.service.AudioModemService.START"), + NEARBY_SHARING(49, "com.google.android.gms.nearby.sharing.service.NearbySharingService.START"), + LIGHTWEIGHT_NETWORK_QUALITY(51, "com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START"), + PHENOTYPE(51, "com.google.android.gms.phenotype.service.START"), + VOICE_UNLOCK(52, "com.google.android.gms.speech.service.START"), + NEARBY_CONNECTIONS(54, "com.google.android.gms.nearby.connection.service.START"), + FITNESS_SENSORS(55, "com.google.android.gms.fitness.SensorsApi"), + FITNESS_RECORDING(56, "com.google.android.gms.fitness.RecordingApi"), + FITNESS_HISTORY(57, "com.google.android.gms.fitness.HistoryApi"), + FITNESS_SESSIONS(58, "com.google.android.gms.fitness.SessionsApi"), + FITNESS_BLE(59, "com.google.android.gms.fitness.BleApi"), + FITNESS_CONFIG(60, "com.google.android.gms.fitness.ConfigApi"), + FITNESS_INTERNAL(61, "com.google.android.gms.fitness.InternalApi"), + NEARBY_MESSAGES(62, "com.google.android.gms.nearby.messages.service.NearbyMessagesService.START"), + HELP(63, "com.google.android.gms.googlehelp.service.GoogleHelpService.START"), + CONFIG(64, "com.google.android.gms.config.START"), + GEODATA(65, "com.google.android.gms.location.places.GeoDataApi"), + SEARCH_IME(66), + PLACE_DETECTION(67, "com.google.android.gms.location.places.PlaceDetectionApi"), + CREDENTIALS(68, "com.google.android.gms.auth.api.credentials.service.START"); + + public int SERVICE_ID; + public String ACTION; + public String[] SECONDARY_ACTIONS; + + GmsService(int serviceId, String... actions) { + this.SERVICE_ID = serviceId; + this.ACTION = actions.length > 0 ? actions[0] : null; + this.SECONDARY_ACTIONS = actions; + } + + public interface ADVERTISING_ID { + // Has no service id + String ACTION = "com.google.android.gms.ads.identifier.service.START"; + } + + public static GmsService byServiceId(int serviceId) { + for (GmsService service : values()) { + if (service.SERVICE_ID == serviceId) return service; + } + return UNKNOWN; + } + + public static String nameFromServiceId(int serviceId) { + return byServiceId(serviceId).toString(serviceId); + } + + public String toString(int serviceId) { + if (this != UNKNOWN) return toString(); + return "UNKNOWN(" + serviceId + ")"; + } +} diff --git a/play-services-api/src/main/java/org/microg/gms/common/Services.java b/play-services-api/src/main/java/org/microg/gms/common/Services.java deleted file mode 100644 index e36198ac..00000000 --- a/play-services-api/src/main/java/org/microg/gms/common/Services.java +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright 2013-2015 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 org.microg.gms.common; - -import java.lang.reflect.Field; - -public final class Services { - - private Services() { - } - - public interface GAMES { - int SERVICE_ID = 1; - String ACTION = "com.google.android.gms.games.service.START"; - } - - public interface PLUS { - int SERVICE_ID = 2; - String ACTION = "com.google.android.gms.plus.service.START"; - String ACTION_INTERNAL = "com.google.android.gms.plus.service.internal.START"; - } - - public interface PANORAMA { - int SERVICE_ID = 3; - String ACTION = "com.google.android.gms.panorama.service.START"; - } - - public interface WALLET { - int SERVICE_ID = 4; - String ACTION = "com.google.android.gms.wallet.service.BIND"; - } - - public interface PEOPLE { - int SERVICE_ID = 5; - String ACTION = "com.google.android.gms.people.service.START"; - } - - public interface LOCATION { - int SERVICE_ID = 6; - } - - public interface APPSTATE { - int SERVICE_ID = 7; - String ACTION = "com.google.android.gms.appstate.service.START"; - } - - public interface ADREQUEST { - int SERVICE_ID = 8; - String ACTION = "com.google.android.gms.ads.service.START"; - } - - public interface ACCOUNT { - int SERVICE_ID = 9; - String ACTION = "com.google.android.gms.accounts.ACCOUNT_SERVICE"; - } - - public interface CAST { - int SERVICE_ID = 10; - String ACTION = "com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"; - } - - public interface DRIVE { - int SERVICE_ID = 11; - String ACTION = "com.google.android.gms.drive.ApiService.START"; - } - - public interface ADDRESS { - int SERVICE_ID = 12; - String ACTION = "com.google.android.gms.identity.service.BIND"; - } - - public interface CAR { - int SERVICE_ID = 13; - String ACTION = "com.google.android.gms.car.service.START"; - } - - public interface WEARABLE { - int SERVICE_ID = 14; - String ACTION = "com.google.android.gms.wearable.BIND"; - } - - public interface AUTH { - int SERVICE_ID = 16; - String ACTION = "com.google.android.gms.auth.service.START"; - } - - public interface FITNESS { - int SERVICE_ID = 17; - String ACTION = "com.google.android.gms.fitness.GoogleFitnessService.START"; - } - - public interface REMINDERS { - int SERVICE_ID = 18; - String ACTION = "com.google.android.gms.reminders.service.START"; - } - - public interface LIGHTWEIGHT_INDEX { - int SERVICE_ID = 19; - String ACTION = "com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"; - } - - public interface DEVICE_CONNECTION { - int SERVICE_ID = 20; - String ACTION = "com.google.android.gms.deviceconnection.service.START"; - } - - public interface INDEX { - int SERVICE_ID = 21; - String ACTION = "com.google.android.gms.icing.INDEX_SERVICE"; - } - - public interface LOCATION_REPORTING { - int SERVICE_ID = 22; - String ACTION = "com.google.android.gms.location.reporting.service.START"; - String ACTION_LEGACY = "com.google.android.location.reporting.service.START"; - } - - public interface LOCATION_MANAGER { - int SERVICE_ID = 23; - String ACTION_LEGACY = "com.google.android.location.internal.GoogleLocationManagerService.START"; - } - - public interface PLAY_LOG { - int SERVICE_ID = 24; - String ACTION = "com.google.android.gms.playlog.service.START"; - } - - public interface DROIDGUARD { - int SERVICE_ID = 25; - String ACTION = "com.google.android.gms.droidguard.service.START"; - } - - public interface LOCKBOX { - int SERVICE_ID = 26; - String ACTION = "com.google.android.gms.lockbox.service.START"; - } - - public interface CAST_MIRRORING { - int SERVICE_ID = 27; - String ACTION = "com.google.android.gms.cast_mirroring.service.START"; - } - - public interface NETWORK_QUALITY { - int SERVICE_ID = 28; - String ACTION = "com.google.android.gms.mdm.services.START"; - } - - public interface FEEDBACK { - int SERVICE_ID = 29; - String ACTION = "com.google.android.gms.feedback.internal.IFeedbackService"; - } - - public interface SEARCH_ADMINISTRATION { - int SERVICE_ID = 30; - } - - public interface PHOTO_AUTO_BACKUP { - int SERVICE_ID = 31; - String ACTION = "com.google.android.gms.photos.autobackup.service.START"; - } - - public interface SEARCH_QUERIES { - int SERVICE_ID = 32; - } - - public interface SEARCH_GLOBAL { - int SERVICE_ID = 33; - } - - public interface UDC { - int SERVICE_ID = 35; - String ACTION = "com.google.android.gms.udc.service.START"; - } - - public interface SEARCH_CORPORA { - int SERVICE_ID = 36; - } - - public interface DEVICE_MANAGER { - int SERVICE_ID = 37; - String ACTION = "com.google.android.gms.mdm.services.DeviceManagerApiService.START"; - } - - public interface PSEUDONYMOUS_ID { - int SERVICE_ID = 38; - String ACTION = "com.google.android.gms.pseudonymous.service.START"; - } - - public interface COMMON { - int SERVICE_ID = 39; - String ACTION = "com.google.android.gms.common.service.START"; - } - - public interface CLEARCUT_LOGGER { - int SERVICE_ID = 40; - String ACTION = "com.google.android.gms.clearcut.service.START"; - } - - public interface USAGE_REPORTING { - int SERVICE_ID = 41; - String ACTION = "com.google.android.gms.usagereporting.service.START"; - } - - public interface KIDS { - int SERVICE_ID = 42; - String ACTION = "com.google.android.gms.kids.service.START"; - } - - public interface DOWNLOAD { - int SERVICE_ID = 43; - String ACTION = "com.google.android.gms.common.download.START"; - } - - public interface SIGN_IN { - int SERVICE_ID = 44; - String ACTION = "com.google.android.gms.signin.service.START"; - } - - public interface SAFETY_NET_CLIENT { - int SERVICE_ID = 45; - String ACTION = "com.google.android.gms.safetynet.service.START"; - } - - public interface GSERVICES { - int SERVICE_ID = 46; - String ACTION = "com.google.android.gms.ads.gservice.START"; - } - - public interface CONTEXT_MANAGER { - int SERVICE_ID = 47; - String ACTION = "com.google.android.contextmanager.service.ContextManagerService.START"; - } - - public interface AUDIO_MODEM { - int SERVICE_ID = 48; - String ACTION = "com.google.android.gms.audiomodem.service.AudioModemService.START"; - } - - public interface NEARBY_SHARING { - int SERVICE_ID = 49; - String ACTION = "com.google.android.gms.nearby.sharing.service.NearbySharingService.START"; - } - - public interface LIGHTWEIGHT_NETWORK_QUALITY { - int SERVICE_ID = 51; - String ACTION = "com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START"; - } - - public interface PHENOTYPE { - int SERVICE_ID = 51; - String ACTION = "com.google.android.gms.phenotype.service.START"; - } - - public interface VOICE_UNLOCK { - int SERVICE_ID = 52; - String ACTION = "com.google.android.gms.speech.service.START"; - } - - public interface NEARBY_CONNECTIONS { - int SERVICE_ID = 54; - String ACTION = "com.google.android.gms.nearby.connection.service.START"; - } - - public interface FITNESS_SENSORS { - int SERVICE_ID = 55; - String ACTION = "com.google.android.gms.fitness.SensorsApi"; - } - - public interface FITNESS_RECORDING { - int SERVICE_ID = 56; - String ACTION = "com.google.android.gms.fitness.RecordingApi"; - } - - public interface FITNESS_HISTORY { - int SERVICE_ID = 57; - String ACTION = "com.google.android.gms.fitness.HistoryApi"; - } - - public interface FITNESS_SESSIONS { - int SERVICE_ID = 58; - String ACTION = "com.google.android.gms.fitness.SessionsApi"; - } - - /** - * BLE = Bluetooth Low Energy - */ - public interface FITNESS_BLE { - int SERVICE_ID = 59; - String ACTION = "com.google.android.gms.fitness.BleApi"; - } - - public interface FITNESS_CONFIG { - int SERVICE_ID = 60; - String ACTION = "com.google.android.gms.fitness.ConfigApi"; - } - - public interface FITNESS_INTERNAL { - int SERVICE_ID = 61; - String ACTION = "com.google.android.gms.fitness.InternalApi"; - } - - public interface NEARBY_MESSAGES { - int SERVICE_ID = 62; - String ACTION = "com.google.android.gms.nearby.messages.service.NearbyMessagesService.START"; - } - - public interface HELP { - int SERVICE_ID = 63; - String ACTION = "com.google.android.gms.googlehelp.service.GoogleHelpService.START"; - } - - public interface CONFIG { - int SERVICE_ID = 64; - String ACTION = "com.google.android.gms.config.START"; - } - - public interface GEODATA { - int SERVICE_ID = 65; - String ACTION = "com.google.android.gms.location.places.GeoDataApi"; - } - - public interface SEARCH_IME { - int SERVICE_ID = 66; - } - - public interface PLACE_DETECTION { - int SERVICE_ID = 67; - String ACTION = "com.google.android.gms.location.places.PlaceDetectionApi"; - } - - public interface CREDENTIALS { - int SERVICE_ID = 68; - String ACTION = "com.google.android.gms.auth.api.credentials.service.START"; - } - - public interface ADVERTISING_ID { - // Has no service id - String ACTION = "com.google.android.gms.ads.identifier.service.START"; - } - - public static String nameFromServiceId(int serviceId) { - for (Class cls : Services.class.getDeclaredClasses()) { - try { - Field serviceIdField = cls.getDeclaredField("SERVICE_ID"); - if ((Integer) serviceIdField.get(null) == serviceId) return cls.getSimpleName(); - } catch (Exception e) { - } - } - return "UNKNOWN(" + serviceId + ")"; - } -}